glibc/sysdeps/x86_64
H.J. Lu 35694d3416 x86-64/cet: Check the restore token in longjmp
setcontext and swapcontext put a restore token on the old shadow stack
which is used to restore the target shadow stack when switching user
contexts.  When longjmp from a user context, the target shadow stack
can be different from the current shadow stack and INCSSP can't be
used to restore the shadow stack pointer to the target shadow stack.

Update longjmp to search for a restore token.  If found, use the token
to restore the shadow stack pointer before using INCSSP to pop the
shadow stack.  Stop the token search and use INCSSP if the shadow stack
entry value is the same as the current shadow stack pointer.

It is a user error if there is a shadow stack switch without leaving a
restore token on the old shadow stack.

The only difference between __longjmp.S and __longjmp_chk.S is that
__longjmp_chk.S has a check for invalid longjmp usages.  Merge
__longjmp.S and __longjmp_chk.S by adding the CHECK_INVALID_LONGJMP
macro.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2024-01-04 13:38:26 -08:00
..
64 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fpu Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
htl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
multiarch Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nptl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sys Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
x32 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Implies
Makefile
Versions
____longjmp_chk.S
__longjmp.S x86-64/cet: Check the restore token in longjmp 2024-01-04 13:38:26 -08:00
_mcount.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
abort-instr.h
add_n.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
addmul_1.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
bsd-_setjmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
bsd-setjmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
configure i386: Ignore --enable-cet 2024-01-04 06:08:55 -08:00
configure.ac i386: Ignore --enable-cet 2024-01-04 06:08:55 -08:00
crti.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
crtn.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-cache.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-hwcaps-subdirs.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-irel.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-machine.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-runtime.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-tls.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-tls.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-tlsdesc.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-tlsdesc.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-trampoline.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-trampoline.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ffs.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ffsll.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ifuncmain8.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ifuncmod8.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
isa-default-impl.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
isa.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
l10nflist.c
link-defines.sym
locale-defines.sym
localplt.data
lshift.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
machine-gmon.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memcmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memcmpeq.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memcpy.S
memcpy_chk.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memmove.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memmove_chk.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
mempcpy.S
mempcpy_chk.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memrchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memset.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
memset_chk.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
mp_clz_tab.c
mul_1.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
preconfigure
preconfigure.ac
rawmemchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rshift.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rtld-offsets.sym
setjmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stackguard-macros.h
stackinfo.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
start.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stpcpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stpncpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcasecmp.S
strcasecmp_l-nonascii.c
strcasecmp_l.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcat.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strchr-isa-default-impl.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strchrnul.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcspn-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strcspn.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strlen.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strncase.S
strncase_l-nonascii.c
strncase_l.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strncat.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strncmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strncpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strnlen.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strpbrk-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strpbrk.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strrchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strspn-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
strspn.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sub_n.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
submul_1.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sysdep.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tls_get_addr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tlsdesc.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tlsdesc.sym
tst-audit.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-audit3.c
tst-audit4-aux.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-audit4.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-audit5.c
tst-audit6.c
tst-audit7.c
tst-audit10-aux.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-audit10.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-auditmod3a.c
tst-auditmod3b.c
tst-auditmod4a.c
tst-auditmod4b.c
tst-auditmod5a.c
tst-auditmod5b.c
tst-auditmod6a.c
tst-auditmod6b.c
tst-auditmod6c.c
tst-auditmod7a.c
tst-auditmod7b.c
tst-auditmod10a.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-auditmod10b.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-avx-aux.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-avx.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-avx512-aux.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-avx512.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-avx512mod.c
tst-avxmod.c
tst-glibc-hwcaps.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-platform-1.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-platformmod-1.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-platformmod-2.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-quad1.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-quad1pie.c
tst-quad2.c
tst-quad2pie.c
tst-quadmod1.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-quadmod1pie.S
tst-quadmod2.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-quadmod2pie.S
tst-rsi-strlen.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-rsi-wcslen.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-split-dynreloc.c
tst-split-dynreloc.lds
tst-sse.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tst-ssemod.c
varshift.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcpcpy-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcpcpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcpncpy-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcpncpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcscat-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcscat.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcschr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcscmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcscpy-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcscpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcslen.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncat-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncat.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncmp-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncpy-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsncpy.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsnlen-generic.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsnlen.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsrchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wmemchr.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wmemcmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wmemset.S
wmemset_chk.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wordcopy.c
x86-lp_size.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00