1 #ifndef _ASM_X86_UCONTEXT_H 2 #define _ASM_X86_UCONTEXT_H 3 4 /* 5 * Indicates the presence of extended state information in the memory 6 * layout pointed by the fpstate pointer in the ucontext's sigcontext 7 * struct (uc_mcontext). 8 */ 9 #define UC_FP_XSTATE 0x1 10 11 #ifdef __x86_64__ 12 /* 13 * UC_SIGCONTEXT_SS will be set when delivering 64-bit or x32 signals on 14 * kernels that save SS in the sigcontext. All kernels that set 15 * UC_SIGCONTEXT_SS will correctly restore at least the low 32 bits of esp 16 * regardless of SS (i.e. they implement espfix). 17 * 18 * Kernels that set UC_SIGCONTEXT_SS will also set UC_STRICT_RESTORE_SS 19 * when delivering a signal that came from 64-bit code. 20 * 21 * Sigreturn restores SS as follows: 22 * 23 * if (saved SS is valid || UC_STRICT_RESTORE_SS is set || 24 * saved CS is not 64-bit) 25 * new SS = saved SS (will fail IRET and signal if invalid) 26 * else 27 * new SS = a flat 32-bit data segment 28 * 29 * This behavior serves three purposes: 30 * 31 * - Legacy programs that construct a 64-bit sigcontext from scratch 32 * with zero or garbage in the SS slot (e.g. old CRIU) and call 33 * sigreturn will still work. 34 * 35 * - Old DOSEMU versions sometimes catch a signal from a segmented 36 * context, delete the old SS segment (with modify_ldt), and change 37 * the saved CS to a 64-bit segment. These DOSEMU versions expect 38 * sigreturn to send them back to 64-bit mode without killing them, 39 * despite the fact that the SS selector when the signal was raised is 40 * no longer valid. UC_STRICT_RESTORE_SS will be clear, so the kernel 41 * will fix up SS for these DOSEMU versions. 42 * 43 * - Old and new programs that catch a signal and return without 44 * modifying the saved context will end up in exactly the state they 45 * started in, even if they were running in a segmented context when 46 * the signal was raised.. Old kernels would lose track of the 47 * previous SS value. 48 */ 49 #define UC_SIGCONTEXT_SS 0x2 50 #define UC_STRICT_RESTORE_SS 0x4 51 #endif 52 53 #include <asm-generic/ucontext.h> 54 55 #endif /* _ASM_X86_UCONTEXT_H */ 56