mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] x86/vsyscall: Tighten vsyscall emulation checks for a #PF fixup
@ 2026-03-13 19:23 Sohil Mehta
  2026-03-13 19:23 ` [RFC PATCH 1/2] x86/vsyscall: Avoid vsyscall emulation when X86_PF_INSTR is not set Sohil Mehta
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sohil Mehta @ 2026-03-13 19:23 UTC (permalink / raw)
  To: Dave Hansen, x86, Andy Lutomirski, Borislav Petkov, H . Peter Anvin
  Cc: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Sohil Mehta,
	Nam Cao, Cedric Xing, Rick Edgecombe, Andrew Cooper,
	Michael Roth, Brijesh Singh, Jarkko Sakkinen, Tony Luck,
	linux-kernel

This series is a result of the suggestions made by Peter Anvin at
https://lore.kernel.org/lkml/2074c00d-2e73-4bd9-89d2-7b0a015b134e@zytor.com/.

The vsyscall emulation code already has a bunch of checks to make sure
only valid page faults get emulated. This series improves those checks
mainly from the defensive point of view.

The patches are based on the LASS-vsyscall series under review at
https://lore.kernel.org/lkml/20260309181029.398498-1-sohil.mehta@intel.com/

Patch 1 seems like a straightforward change that is unlikely to cause
any issues.

Patch 2 adds a few more PF error codes to the emulation reject-list.
But, it is debatable whether they are absolutely necessary.

  X86_PF_RSVD: Reserved bits being set in do_user_addr_fault() already
  generates an OOPS before vsyscall emulation attempted. No need to
  check for it again.

  X86_PF_PK: PKRU never rejects instruction fetches so it is highly
  unlikely the vsyscall emulation code will be reached with this bit
  set.

  X86_PF_SHSTK: I am not sure if we can have a vsyscall page access that
  results in X86_PF_SHSTK set but doesn't have X86_PF_WRITE with it. If
  we cannot, the current checks in emulate_vsyscall_pf() will already
  reject emulation.

I have included X86_PF_PK and X86_PF_SHSTK in patch 2 because I am not a
100% sure about the reasoning. Additionally, I don't see any harm in
including them. Also, should we also add X86_PF_SGX and X86_PF_RMP by
the same logic? Any insight here would be appreciated.

The patches pass the vsyscall selftest. But, they should be considered
untested as I don't know how to generate these PF error codes in the
vsyscall context.

Sohil Mehta (2):
  x86/vsyscall: Avoid vsyscall emulation when X86_PF_INSTR is not set
  x86/vsyscall: Avoid vsyscall emulation for some unexpected fault types

 arch/x86/entry/vsyscall/vsyscall_64.c | 10 ++++++----
 arch/x86/mm/fault.c                   |  3 ---
 2 files changed, 6 insertions(+), 7 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-19 18:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-13 19:23 [RFC PATCH 0/2] x86/vsyscall: Tighten vsyscall emulation checks for a #PF fixup Sohil Mehta
2026-03-13 19:23 ` [RFC PATCH 1/2] x86/vsyscall: Avoid vsyscall emulation when X86_PF_INSTR is not set Sohil Mehta
2026-03-13 19:23 ` [RFC PATCH 2/2] x86/vsyscall: Avoid vsyscall emulation for some unexpected fault types Sohil Mehta
2026-03-18 18:47 ` [RFC PATCH 0/2] x86/vsyscall: Tighten vsyscall emulation checks for a #PF fixup Edgecombe, Rick P
2026-03-18 18:47 ` Edgecombe, Rick P
2026-03-19 18:30   ` Sohil Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®