/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1#ifndef _ASM_X86_UCONTEXT_H2#define _ASM_X86_UCONTEXT_H34/*5* Indicates the presence of extended state information in the memory6* layout pointed by the fpstate pointer in the ucontext's sigcontext7* struct (uc_mcontext).8*/9#define UC_FP_XSTATE 0x11011#ifdef __x86_64__12/*13* UC_SIGCONTEXT_SS will be set when delivering 64-bit or x32 signals on14* kernels that save SS in the sigcontext. All kernels that set15* UC_SIGCONTEXT_SS will correctly restore at least the low 32 bits of esp16* regardless of SS (i.e. they implement espfix).17*18* Kernels that set UC_SIGCONTEXT_SS will also set UC_STRICT_RESTORE_SS19* 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* else27* new SS = a flat 32-bit data segment28*29* This behavior serves three purposes:30*31* - Legacy programs that construct a 64-bit sigcontext from scratch32* with zero or garbage in the SS slot (e.g. old CRIU) and call33* sigreturn will still work.34*35* - Old DOSEMU versions sometimes catch a signal from a segmented36* context, delete the old SS segment (with modify_ldt), and change37* the saved CS to a 64-bit segment. These DOSEMU versions expect38* 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 is40* no longer valid. UC_STRICT_RESTORE_SS will be clear, so the kernel41* will fix up SS for these DOSEMU versions.42*43* - Old and new programs that catch a signal and return without44* modifying the saved context will end up in exactly the state they45* started in, even if they were running in a segmented context when46* the signal was raised.. Old kernels would lose track of the47* previous SS value.48*/49#define UC_SIGCONTEXT_SS 0x250#define UC_STRICT_RESTORE_SS 0x451#endif5253#include <asm-generic/ucontext.h>5455#endif /* _ASM_X86_UCONTEXT_H */565758