Skip to content

x86/fred: Reconstruct fault state for rejected INT instructions

Matthew Schwartz linux-kselftest lkml stable 1 version Applied

Status from this message: The following commit has been merged into the x86/urgent branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2x86/fred: Reconstruct the #GP context for rejected INT instructionsarch/x86/entry/entry_fred.c+10 -12 replies
2/2selftests/x86: Check signal state for rejected software interruptstools/testing/selftests/x86/Makefile tools/testing/selftests/x86/int_signal.c+312 -10 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchH. Peter Anvin
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] x86/fred: Reconstruct fault state for rejected INT instructions

This series reconstructs the #GP signal context for rejected INT instructions with FRED enabled. The incorrect error code and saved IP break Wine's handling of INT 0x2d, causing Elden Ring to fail with a spurious access violation on Panther Lake.

The software event flag handling follows the same reasoning as the existing sigreturn fix in prevent_single_step_upon_eretu(). The second patch adds 32-bit and 64-bit signal-context and ptrace resume coverage.

Both selftest variants pass all 29 checks on patched FRED-enabled Panther Lake and on a non-FRED AMD host. With the same binaries on unpatched Panther Lake, 16 signal-context checks and the first ptrace IP check fail. The two dependent ptrace resume checks are not reached.

Separate continuation testing with the fix matched an IDT baseline on another system in both bitnesses: unchanged IP retries the INT whether RF is set or clear, and advancing IP resumes at the next instruction.

One observed ptrace divergence remains separate: after rewriting IP at the stop from raise(SIGSTOP), PTRACE_SINGLESTEP traps before the target instruction on FRED, whereas IDT executes it. The selftest starts from an INT3 stop to isolate rejected-INT behavior. The syscall-stop case is a follow-up investigation outside this series.

Matthew Schwartz (2):
x86/fred: Reconstruct the #GP context for rejected INT instructions selftests/x86: Check signal state for rejected software interrupts

 arch/x86/entry/entry_fred.c              |  11 +-
 tools/testing/selftests/x86/Makefile     |   2 +-
 tools/testing/selftests/x86/int_signal.c | 311 +++++++++++++++++++++++
 3 files changed, 322 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/x86/int_signal.c

base-commit: b5a051f6b840d48f159166ef073d3021989bfb50

Signature · 1 line
2.55.0