gcc/libgcc
H.J. Lu 5707be3c7d libgcc/CET: Skip signal frames when unwinding shadow stack
When -fcf-protection -mcet is used, I got

FAIL: g++.dg/eh/sighandle.C

(gdb) bt
 #0  _Unwind_RaiseException (exc=exc@entry=0x416ed0)
    at /export/gnu/import/git/sources/gcc/libgcc/unwind.inc:140
 #1  0x00007ffff7d9936b in __cxxabiv1::__cxa_throw (obj=<optimized out>,
    tinfo=0x403dd0 <typeinfo for int@@CXXABI_1.3>, dest=0x0)
    at /export/gnu/import/git/sources/gcc/libstdc++-v3/libsupc++/eh_throw.cc:90
 #2  0x0000000000401255 in sighandler (signo=11, si=0x7fffffffd6f8,
    uc=0x7fffffffd5c0)
    at /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/eh/sighandle.C:9
 #3  <signal handler called> <<<< Signal frame which isn't on shadow stack
 #4  dosegv ()
    at /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/eh/sighandle.C:14
 #5  0x00000000004012e3 in main ()
    at /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/eh/sighandle.C:30
(gdb) p frames
$6 = 5
(gdb)

frame count should be 4, not 5.  This patch skips signal frames when
unwinding shadow stack.

gcc/testsuite/

	PR libgcc/85334
	* g++.dg/torture/pr85334.C: New test.

libgcc/

	PR libgcc/85334
	* unwind-generic.h (_Unwind_Frames_Increment): New.
	* config/i386/shadow-stack-unwind.h (_Unwind_Frames_Increment):
	Likewise.
	* unwind.inc (_Unwind_RaiseException_Phase2): Increment frame
	count with _Unwind_Frames_Increment.
	(_Unwind_ForcedUnwind_Phase2): Likewise.

From-SVN: r259502
2018-04-19 10:05:39 -07:00
..
config libgcc/CET: Skip signal frames when unwinding shadow stack 2018-04-19 10:05:39 -07:00
soft-fp op-common.h (_FP_MUL, [...]): Add /* FALLTHRU */ comments. 2017-01-24 23:32:30 +01:00
ChangeLog libgcc/CET: Skip signal frames when unwinding shadow stack 2018-04-19 10:05:39 -07:00
Makefile.in Update copyright years. 2018-01-03 11:03:58 +01:00
config.host RISC-V: Support for FreeBSD. 2018-04-06 13:04:17 -07:00
config.in re PR debug/83917 (with -mcall-ms2sysv-xlogues, stepping into x86 tail-call restore stub gives bad backtrace) 2018-02-28 09:59:15 +01:00
configure cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace --enable-cet=default with --enable-cet=auto. 2018-04-19 09:45:51 +02:00
configure.ac re PR debug/83917 (with -mcall-ms2sysv-xlogues, stepping into x86 tail-call restore stub gives bad backtrace) 2018-02-28 09:59:15 +01:00
crtstuff.c Update copyright years. 2018-01-03 11:03:58 +01:00
dfp-bit.c Update copyright years. 2018-01-03 11:03:58 +01:00
dfp-bit.h Update copyright years. 2018-01-03 11:03:58 +01:00
divmod.c Update copyright years. 2018-01-03 11:03:58 +01:00
empty.mk
emutls.c Update copyright years. 2018-01-03 11:03:58 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2018-01-03 11:03:58 +01:00
find-symver.awk Update copyright years. 2018-01-03 11:03:58 +01:00
fixed-bit.c Update copyright years. 2018-01-03 11:03:58 +01:00
fixed-bit.h Update copyright years. 2018-01-03 11:03:58 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2018-01-03 11:03:58 +01:00
fp-bit.h Update copyright years. 2018-01-03 11:03:58 +01:00
gbl-ctors.h Update copyright years. 2018-01-03 11:03:58 +01:00
gcov.h Update copyright years. 2018-01-03 11:03:58 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2018-01-03 11:03:58 +01:00
generic-morestack.c Update copyright years. 2018-01-03 11:03:58 +01:00
generic-morestack.h Update copyright years. 2018-01-03 11:03:58 +01:00
gstdint.h
gthr-posix.h Update copyright years. 2018-01-03 11:03:58 +01:00
gthr-single.h Update copyright years. 2018-01-03 11:03:58 +01:00
gthr.h Update copyright years. 2018-01-03 11:03:58 +01:00
libgcc-std.ver.in Update copyright years. 2018-01-03 11:03:58 +01:00
libgcc2.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcc2.h Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-driver-system.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-driver.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-interface.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-merge.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-profiler.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov-util.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcov.h Update copyright years. 2018-01-03 11:03:58 +01:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2018-01-03 11:03:58 +01:00
mkmap-flat.awk Update copyright years. 2018-01-03 11:03:58 +01:00
mkmap-symver.awk Update copyright years. 2018-01-03 11:03:58 +01:00
offloadstuff.c Update copyright years. 2018-01-03 11:03:58 +01:00
shared-object.mk Add the nvptx port. 2014-11-10 16:12:42 +00:00
siditi-object.mk
static-object.mk Add the nvptx port. 2014-11-10 16:12:42 +00:00
sync.c Update copyright years. 2018-01-03 11:03:58 +01:00
udivmod.c Update copyright years. 2018-01-03 11:03:58 +01:00
udivmodsi4.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-arm-common.inc Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-c.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-compat.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-compat.h Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-dw2-fde-compat.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-dw2-fde-dip.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-dw2-fde.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-dw2-fde.h Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-dw2.c SVE unwinding 2018-01-13 17:56:52 +00:00
unwind-dw2.h Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-generic.h libgcc/CET: Skip signal frames when unwinding shadow stack 2018-04-19 10:05:39 -07:00
unwind-pe.h Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-seh.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-sjlj.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind.inc libgcc/CET: Skip signal frames when unwinding shadow stack 2018-04-19 10:05:39 -07:00
vtv_end.c Update copyright years. 2018-01-03 11:03:58 +01:00
vtv_end_preinit.c Update copyright years. 2018-01-03 11:03:58 +01:00
vtv_start.c Update copyright years. 2018-01-03 11:03:58 +01:00
vtv_start_preinit.c Update copyright years. 2018-01-03 11:03:58 +01:00