You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb][Linux] Mark memory regions used for shadow stacks
This is intended for use with Arm's Guarded Control Stack extension
(GCS). Which reuses some existing shadow stack support in Linux.
It should also work with the x86 equivalent.
A "ss" flag is added to the "VmFlags" line of shadow stack memory
regions in /proc/<pid>/smaps. To keep the naming generic I've called
it shadow stack instead of guarded control stack.
Also the wording is "shadow stack: yes" because the shadow stack
region is just where it's stored. It's enabled for the whole process
or it isn't. As opposed to memory tagging which can be enabled per
region, so "memory tagging: enabled" fits better for that.
I've added a test case that is also intended to be the start of
a set of tests for GCS. This should help me avoid duplicating the
inline assembly needed.
Note that no special compiler support is needed for the test.
However, for the intial enabling of GCS (assuming the libc isn't
doing it) we do need to use an inline assembly version of prctl.
This is because as soon as you enable GCS, all returns are checked
against the GCS. If the GCS is empty, the program will fault.
In other words, you can never return from the function that enabled
GCS, unless you push values onto it (which is possible but not needed
here).
So you cannot use the libc's prctl wrapper for this reason. You can
use that wrapper for anything else, as we do to check if GCS is
enabled.
0 commit comments