linux/arch/x86/entry
Kirill A. Shutemov 1b2d4eea3f x86/vsyscall: Do not require X86_PF_INSTR to emulate vsyscall
[ Upstream commit 8ba38a7a9a ]

emulate_vsyscall() expects to see X86_PF_INSTR in PFEC on a vsyscall
page fault, but the CPU does not report X86_PF_INSTR if neither
X86_FEATURE_NX nor X86_FEATURE_SMEP are enabled.

X86_FEATURE_NX should be enabled on nearly all 64-bit CPUs, except for
early P4 processors that did not support this feature.

Instead of explicitly checking for X86_PF_INSTR, compare the fault
address to RIP.

On machines with X86_FEATURE_NX enabled, issue a warning if RIP is equal
to fault address but X86_PF_INSTR is absent.

[ dhansen: flesh out code comments ]

Originally-by: Dave Hansen <dave.hansen@intel.com>
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Link: https://lore.kernel.org/all/bd81a98b-f8d4-4304-ac55-d4151a1a77ab@intel.com
Link: https://lore.kernel.org/all/20250624145918.2720487-1-kirill.shutemov%40linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-11-13 15:34:11 -05:00
..
syscalls uretprobe: change syscall number, again 2024-08-02 15:18:49 +02:00
vdso random: vDSO: add a __vdso_getrandom prototype for all architectures 2024-09-13 17:28:35 +02:00
vsyscall x86/vsyscall: Do not require X86_PF_INSTR to emulate vsyscall 2025-11-13 15:34:11 -05:00
calling.h x86/entry: Fix ORC unwinder for PUSH_REGS with save_ret=1 2025-04-10 14:39:20 +02:00
common.c x86/entry: Add __init to ia32_emulation_override_cmdline() 2025-04-10 14:39:12 +02:00
entry.S x86/bugs: Rename MDS machinery to something more generic 2025-07-10 16:05:14 +02:00
entry_32.S x86/entry_32: Clear CPU buffers after register restore in NMI return 2024-10-08 15:16:28 -07:00
entry_64.S x86/its: Align RETs in BHB clear sequence to avoid thunking 2025-05-18 08:24:59 +02:00
entry_64_compat.S x86/bhi: Avoid warning in #DB handler due to BHI mitigation 2024-07-03 13:26:30 +02:00
entry_64_fred.S x86/fred: Remove ENDBR64 from FRED entry points 2025-10-19 16:33:56 +02:00
entry_fred.c x86/irq: Install posted MSI notification handler 2024-04-30 00:54:42 +02:00
Makefile x86/entry: Merge thunk_64.S and thunk_32.S into thunk.S 2024-04-09 09:57:56 +02:00
syscall_32.c x86/syscall: Mark exit[_group] syscall handlers __noreturn 2024-06-28 15:23:38 +02:00
syscall_64.c x86/syscall: Mark exit[_group] syscall handlers __noreturn 2024-06-28 15:23:38 +02:00
syscall_x32.c x86/syscall: Mark exit[_group] syscall handlers __noreturn 2024-06-28 15:23:38 +02:00
thunk.S x86/entry: Merge thunk_64.S and thunk_32.S into thunk.S 2024-04-09 09:57:56 +02:00