* Mark Brown:
+4. Signal handling +--------------------
+* A new signal frame record gcs_context encodes the current GCS mode and
- pointer for the interrupted context on signal delivery. This will always
- be present on systems that support GCS.
+* The record contains a flag field which reports the current GCS configuration
- for the interrupted context as PR_GET_SHADOW_STACK_STATUS would.
+* The signal handler is run with the same GCS configuration as the interrupted
- context.
+* When GCS is enabled for the interrupted thread a signal handling specific
- GCS cap token will be written to the GCS, this is an architectural GCS cap
- token with bit 63 set and the token type (bits 0..11) all clear. The
- GCSPR_EL0 reported in the signal frame will point to this cap token.
How does this marker interfere with Top Byte Ignore (TBI; I hope I got the name right)? The specification currently does not say that only addresses pushed to the shadow stack with the top byte cleared, which potentially makes the markup ambiguous. On x86-64, the same issue may exist with LAM. I have not tested yet what happens there. On AArch64 and RISC-V, it may be more natural to use the LSB instead of the LSB for the mark bit because of its instruction alignment.
We also have a gap on x86-64 for backtrace generation because the interrupted instruction address does not end up on the shadow stack. This address is potentially quite interesting for backtrace generation. I assume it's currently missing because the kernel does not resume execution using a regular return instruction. It would be really useful if it could be pushed to the shadow stack, or recoverable from the shadow stack in some other way (e.g., the address of the signal context could be pushed instead). That would need some form of marker as well.
Thanks, Florian