Go to file
H.J. Lu bf6465d046 i386: Properly pop restore token in signal frame
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.
2020-02-10 07:59:10 -08:00
config Fixes after recent configure changes relating to static libraries 2020-02-01 00:34:28 +00:00
contrib contrib: Change 'remote' for personal branches and add branch creation script 2020-01-24 14:38:16 +00:00
fixincludes Fix missing SCNuMAX defines in inttypes.h on hpux11.[01]* 2020-01-25 12:20:24 -05:00
gcc i386: Properly pop restore token in signal frame 2020-02-10 07:59:10 -08:00
gnattools
gotools
include libiberty/hashtab: More const parameters 2020-02-05 13:01:06 +00:00
INSTALL
intl Fixes after recent configure changes relating to static libraries 2020-02-01 00:34:28 +00:00
libada Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libatomic Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libbacktrace libbacktrace: always pass -g when compiling test code 2020-02-03 18:13:28 -08:00
libcc1
libcpp Regenerate .pot files. 2020-02-07 22:35:59 +00:00
libdecnumber
libffi Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libgcc i386: Properly pop restore token in signal frame 2020-02-10 07:59:10 -08:00
libgfortran Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libgo syscall: fix riscv64 GNU/Linux build 2020-02-03 18:14:19 -08:00
libgomp Add xfails to libgomp tests target-{33,34}.c, target-link-1.c 2020-02-10 09:16:46 +01:00
libhsail-rt Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libiberty libiberty/hashtab: More const parameters 2020-02-05 13:01:06 +00:00
libitm Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libobjc Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
liboffloadmic Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libphobos Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libquadmath Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libsanitizer Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libssp Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
libstdc++-v3 libstdc++: Fix names of types in comment 2020-02-09 14:00:23 +00:00
libvtv Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
lto-plugin
maintainer-scripts
zlib Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog rs6000: Update constraint documentation 2020-02-03 18:23:51 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.