[all-commits] [llvm/llvm-project] 02c600: [lldb][AArch64] Add Guarded Control Stack register...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Jan 24 05:42:28 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 02c6002d1cd2dabe4b98368f91e7b4395e5ab11d
      https://github.com/llvm/llvm-project/commit/02c6002d1cd2dabe4b98368f91e7b4395e5ab11d
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2025-01-24 (Fri, 24 Jan 2025)

  Changed paths:
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
    M lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
    M lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
    M lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
    M lldb/test/API/linux/aarch64/gcs/TestAArch64LinuxGCS.py
    M lldb/test/API/linux/aarch64/gcs/main.c

  Log Message:
  -----------
  [lldb][AArch64] Add Guarded Control Stack registers (#123720)

The Guarded Control Stack extension implements a shadow stack and the
Linux kernel provides access to 3 registers for it via ptrace.

struct user_gcs {
	__u64 features_enabled;
	__u64 features_locked;
	__u64 gcspr_el0;
};

This commit adds support for reading those from a live process.

The first 2 are pseudo registers based on the real control register and
the 3rd is a real register. This is the stack pointer for the guarded
stack.

I have added a "gcs_" prefix to the "features" registers so that they
have a clear name when shown individually. Also this means they will tab
complete from "gcs", and be next to gcspr_el0 in any sorted lists of
registers.

Guarded Control Stack Registers:
  gcs_features_enabled = 0x0000000000000000
  gcs_features_locked = 0x0000000000000000
  gcspr_el0 = 0x0000000000000000

Testing is more of the usual, where possible I'm writing a register then
doing something in the program to confirm the value was actually sent to
ptrace.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list