bf6465d046
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. |
||
---|---|---|
.. | ||
32 | ||
64 | ||
avx_resms64.S | ||
avx_resms64f.S | ||
avx_resms64fx.S | ||
avx_resms64x.S | ||
avx_savms64.S | ||
avx_savms64f.S | ||
cpuinfo.c | ||
cpuinfo.h | ||
crtfastmath.c | ||
crti.S | ||
crtn.S | ||
crtprec.c | ||
cygming-crtbegin.c | ||
cygming-crtend.c | ||
cygwin.S | ||
darwin-lib.h | ||
dragonfly-unwind.h | ||
elf-lib.h | ||
enable-execute-stack-mingw32.c | ||
freebsd-unwind.h | ||
gthr-win32.c | ||
gthr-win32.h | ||
i386-asm.h | ||
libgcc-bsd.ver | ||
libgcc-cygming.ver | ||
libgcc-darwin.10.4.ver | ||
libgcc-darwin.10.5.ver | ||
libgcc-glibc.ver | ||
libgcc-sol2.ver | ||
linux-unwind.h | ||
morestack.S | ||
resms64.h | ||
resms64f.h | ||
resms64fx.h | ||
resms64x.h | ||
savms64.h | ||
savms64f.h | ||
sfp-exceptions.c | ||
sfp-machine.h | ||
shadow-stack-unwind.h | ||
sol2-c1.S | ||
sol2-unwind.h | ||
sse_resms64.S | ||
sse_resms64f.S | ||
sse_resms64fx.S | ||
sse_resms64x.S | ||
sse_savms64.S | ||
sse_savms64f.S | ||
t-chkstk | ||
t-cpuinfo | ||
t-cpuinfo-static | ||
t-crtpc | ||
t-crtstuff | ||
t-cygming | ||
t-cygwin | ||
t-darwin | ||
t-dlldir | ||
t-dlldir-x | ||
t-dragonfly | ||
t-dw2-eh | ||
t-freebsd | ||
t-gthr-win32 | ||
t-linux | ||
t-mingw32 | ||
t-mingw-pthread | ||
t-msabi | ||
t-nto | ||
t-seh-eh | ||
t-sjlj-eh | ||
t-slibgcc-cygming | ||
t-softfp | ||
t-sol2 | ||
t-stack-i386 | ||
value-unwind.h | ||
w32-unwind.h |