Linux CET kernel places a restore token on shadow stack for signal handler to enhance security. The restore token is 8 byte and aligned to 8 bytes. It is usually transparent to user programs since kernel will pop the restore token when signal handler returns. But when an exception is thrown from a signal handler, now we need to pop the restore token from shadow stack. For x86-64, we just need to treat the signal frame as normal frame. For i386, we need to search for the restore token to check if the original shadow stack is 8 byte aligned. If the original shadow stack is 8 byte aligned, we just need to pop 2 slots, one restore token, from shadow stack. Otherwise, we need to pop 3 slots, one restore token + 4 byte padding, from shadow stack. This patch also includes 2 tests, one has a restore token with 4 byte padding and one without. Tested on Linux/x86-64 CET machine with and without -m32. libgcc/ PR libgcc/85334 * config/i386/shadow-stack-unwind.h (_Unwind_Frames_Increment): New. gcc/testsuite/ PR libgcc/85334 * g++.target/i386/pr85334-1.C: New test. * g++.target/i386/pr85334-2.C: Likewise.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
32 | Loading commit data... | |
64 | Loading commit data... | |
avx_resms64.S | Loading commit data... | |
avx_resms64f.S | Loading commit data... | |
avx_resms64fx.S | Loading commit data... | |
avx_resms64x.S | Loading commit data... | |
avx_savms64.S | Loading commit data... | |
avx_savms64f.S | Loading commit data... | |
cpuinfo.c | Loading commit data... | |
cpuinfo.h | Loading commit data... | |
crtfastmath.c | Loading commit data... | |
crti.S | Loading commit data... | |
crtn.S | Loading commit data... | |
crtprec.c | Loading commit data... | |
cygming-crtbegin.c | Loading commit data... | |
cygming-crtend.c | Loading commit data... | |
cygwin.S | Loading commit data... | |
darwin-lib.h | Loading commit data... | |
dragonfly-unwind.h | Loading commit data... | |
elf-lib.h | Loading commit data... | |
enable-execute-stack-mingw32.c | Loading commit data... | |
freebsd-unwind.h | Loading commit data... | |
gthr-win32.c | Loading commit data... | |
gthr-win32.h | Loading commit data... | |
i386-asm.h | Loading commit data... | |
libgcc-bsd.ver | Loading commit data... | |
libgcc-cygming.ver | Loading commit data... | |
libgcc-darwin.10.4.ver | Loading commit data... | |
libgcc-darwin.10.5.ver | Loading commit data... | |
libgcc-glibc.ver | Loading commit data... | |
libgcc-sol2.ver | Loading commit data... | |
linux-unwind.h | Loading commit data... | |
morestack.S | Loading commit data... | |
resms64.h | Loading commit data... | |
resms64f.h | Loading commit data... | |
resms64fx.h | Loading commit data... | |
resms64x.h | Loading commit data... | |
savms64.h | Loading commit data... | |
savms64f.h | Loading commit data... | |
sfp-exceptions.c | Loading commit data... | |
sfp-machine.h | Loading commit data... | |
shadow-stack-unwind.h | Loading commit data... | |
sol2-c1.S | Loading commit data... | |
sol2-unwind.h | Loading commit data... | |
sse_resms64.S | Loading commit data... | |
sse_resms64f.S | Loading commit data... | |
sse_resms64fx.S | Loading commit data... | |
sse_resms64x.S | Loading commit data... | |
sse_savms64.S | Loading commit data... | |
sse_savms64f.S | Loading commit data... | |
t-chkstk | Loading commit data... | |
t-cpuinfo | Loading commit data... | |
t-cpuinfo-static | Loading commit data... | |
t-crtpc | Loading commit data... | |
t-crtstuff | Loading commit data... | |
t-cygming | Loading commit data... | |
t-cygwin | Loading commit data... | |
t-darwin | Loading commit data... | |
t-dlldir | Loading commit data... | |
t-dlldir-x | Loading commit data... | |
t-dragonfly | Loading commit data... | |
t-dw2-eh | Loading commit data... | |
t-freebsd | Loading commit data... | |
t-gthr-win32 | Loading commit data... | |
t-linux | Loading commit data... | |
t-mingw-pthread | Loading commit data... | |
t-mingw32 | Loading commit data... | |
t-msabi | Loading commit data... | |
t-nto | Loading commit data... | |
t-seh-eh | Loading commit data... | |
t-sjlj-eh | Loading commit data... | |
t-slibgcc-cygming | Loading commit data... | |
t-softfp | Loading commit data... | |
t-sol2 | Loading commit data... | |
t-stack-i386 | Loading commit data... | |
value-unwind.h | Loading commit data... | |
w32-unwind.h | Loading commit data... |