about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/x86_64/getcontext.S
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* x86-64/CET: Extend ucontext_t to save shadow stackH.J. Lu2018-07-251-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a field to ucontext_t to save shadow stack: 1. getcontext and swapcontext are updated to save the caller's shadow stack pointer and return addresses. 2. setcontext and swapcontext are updated to restore shadow stack and jump to new context directly. 3. makecontext is updated to allocate a new shadow stack and set the caller's return address to __start_context. Since makecontext allocates a new shadow stack when making a new context and kernel allocates a new shadow stack for clone/fork/vfork syscalls, we track the current shadow stack base. In setcontext and swapcontext, if the target shadow stack base is the same as the current shadow stack base, we unwind the shadow stack. Otherwise it is a stack switch and we look for a restore token. We enable shadow stack at run-time only if program and all used shared objects, including dlopened ones, are shadow stack enabled, which means that they must be compiled with GCC 8 or above and glibc 2.28 or above. We need to save and restore shadow stack only if shadow stack is enabled. When caller of getcontext, setcontext, swapcontext and makecontext is compiled with smaller ucontext_t, shadow stack won't be enabled at run-time. We check if shadow stack is enabled before accessing the extended field in ucontext_t. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/unix/sysv/linux/x86/sys/ucontext.h (ucontext_t): Add __ssp. * sysdeps/unix/sysv/linux/x86_64/__start_context.S: Include <asm/prctl.h> and "ucontext_i.h" when shadow stack is enabled. (__push___start_context): New. * sysdeps/unix/sysv/linux/x86_64/getcontext.S: Include <asm/prctl.h>. (__getcontext): Record the current shadow stack base. Save the caller's shadow stack pointer and base. * sysdeps/unix/sysv/linux/x86_64/makecontext.c: Include <pthread.h>, <libc-pointer-arith.h> and <sys/prctl.h>. (__push___start_context): New prototype. (__makecontext): Call __push___start_context to allocate a new shadow stack, push __start_context onto the new stack as well as the new shadow stack. * sysdeps/unix/sysv/linux/x86_64/setcontext.S: Include <asm/prctl.h>. (__setcontext): Restore the target shadow stack. * sysdeps/unix/sysv/linux/x86_64/swapcontext.S: Include <asm/prctl.h>. (__swapcontext): Record the current shadow stack base. Save the caller's shadow stack pointer and base. Restore the target shadow stack. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (STACK_SIZE_TO_SHADOW_STACK_SIZE_SHIFT): New. * sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym (oSSP): New.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Remove unused pseudo_end labelAndreas Schwab2012-07-251-2/+1
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Fix FPU context handling in getcontext on x86-64.Ulrich Drepper2011-04-171-1/+2
| | | | fnstenv on x86-64 seems to clear the state. Work around.
* Add space inf weak_alias use.Ulrich Drepper2005-05-261-1/+1
|
* * sysdeps/unix/sysv/linux/x86_64/getcontext.S: Use functionallyUlrich Drepper2005-03-311-6/+10
| | | | | | | | | | | | | | | | | | | equivalent, but shorter instructions. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/setcontext.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/swapcontext.S: Likewise. * sysdeps/unix/x86_64/sysdep.S: Likewise. * sysdeps/x86_64/strchr.S: Likewise. * sysdeps/x86_64/memset.S: Likewise. * sysdeps/x86_64/strcspn.S: Likewise. * sysdeps/x86_64/strcmp.S: Likewise. * sysdeps/x86_64/elf/start.S: Likewise. * sysdeps/x86_64/strspn.S: Likewise. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/x86_64/bsd-_setjmp.S: Likewise. * sysdeps/x86_64/bsd-setjmp.S: Likewise. * sysdeps/x86_64/strtok.S: Likewise.
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-221-11/+7
|
* 2.5-18.1Jakub Jelinek2007-07-121-7/+11
|
* Update.Andreas Jaeger2002-08-311-1/+9
| | | | | | | | | | | | | | | | | | | | | | | 2002-08-31 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/x86_64/Makefile (sysdep_routines): Add __start_context. * sysdeps/unix/sysv/linux/x86_64/__start_context.S: New file. * sysdeps/unix/sysv/linux/x86_64/makecontext.c: New file. * sysdeps/unix/sysv/linux/x86_64/ucontext_i.h: Add defines for registers used for passing args. * sysdeps/unix/sysv/linux/x86_64/swapcontext.S: Save and restore all needed registers. * sysdeps/unix/sysv/linux/x86_64/setcontext.S: Restore all registers. * sysdeps/unix/sysv/linux/x86_64/getcontext.S: Save all needed registers.
* Update.Andreas Jaeger2002-03-281-0/+76
2002-03-28 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/x86_64/swapcontext.S: New. * sysdeps/unix/sysv/linux/x86_64/getcontext.S: New. * sysdeps/unix/sysv/linux/x86_64/setcontext.S: New. * sysdeps/unix/sysv/linux/x86_64/ucontext_i.h: New.