mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
Add a test of the signal ABI for INT instructions in both 32-bit and 64-bit processes. Check the signal number, trap number, error code, si_code, si_addr, instruction pointer and RF/TF state against legacy IDT behavior. Include a 15-byte prefixed INT to check that IP uses the hardware instruction length. Exercise both INT3 encodings, INT4, UD2 and HLT to cover the unchanged trap and fault paths. Run each instruction with TF clear and set. Resume at a known NOP after handling the signal and check that single-stepping traps after the NOP. Also drive INT 0x2d under ptrace, which resumes through the fault frame rather than sigreturn and so exposes a stale FRED software event flag. Start from an INT3 stop, whose FRED frame has no software event flag, instead of the syscall frame of raise(SIGSTOP). Single-step into the INT and check that the fault reports its address. Then suppress SIGSEGV and resume at the NOP, once with PTRACE_SINGLESTEP and once with PTRACE_CONT and TF set. Section 6.2.3 of the Intel FRED specification [1] specifies the immediate single-step trap caused by returning with both that flag and TF set. Check that each trap occurs after the NOP, rather than at its address. Report whether the CPU supports FRED, since a pass looks the same on either entry path. INT 0x80 with IA32 emulation disabled and a 64-bit tracer of a 32-bit tracee are not covered. Both variants pass all 29 checks on a non-FRED AMD host and on Panther Lake with FRED enabled and the fix applied. With the same binaries on unpatched Panther Lake, 16 signal-context checks fail and the first ptrace check reports the IP after the INT. The two dependent ptrace resume checks are not reached. [1] Intel Flexible Return and Event Delivery (FRED) Specification, revision 9.0 (346446-009US), section 6.2.3. Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://cdrdv2.intel.com/v1/dl/getContent/678938 # [1] Link: https://patch.msgid.link/20260917230907.2080792-3-matthew.schwartz@linux.dev |
||
|---|---|---|
| .. | ||
| bugs | ||
| .gitignore | ||
| amx.c | ||
| apx.c | ||
| avx.c | ||
| check_cc.sh | ||
| check_initial_reg_state.c | ||
| clang_helpers_32.S | ||
| clang_helpers_64.S | ||
| corrupt_xstate_header.c | ||
| entry_from_vm86.c | ||
| fsgsbase_restore.c | ||
| fsgsbase.c | ||
| helpers.h | ||
| int_signal.c | ||
| ioperm.c | ||
| iopl.c | ||
| lam.c | ||
| ldt_gdt.c | ||
| Makefile | ||
| mov_ss_trap.c | ||
| nx_stack.c | ||
| ptrace_syscall.c | ||
| raw_syscall_helper_32.S | ||
| sigaltstack.c | ||
| sigreturn.c | ||
| sigtrap_loop.c | ||
| single_step_syscall.c | ||
| srso.c | ||
| syscall_arg_fault.c | ||
| syscall_nt.c | ||
| syscall_numbering.c | ||
| sysret_rip.c | ||
| sysret_ss_attrs.c | ||
| test_FCMOV.c | ||
| test_FCOMI.c | ||
| test_FISTTP.c | ||
| test_mremap_vdso.c | ||
| test_shadow_stack.c | ||
| test_syscall_vdso.c | ||
| test_vsyscall.c | ||
| thunks_32.S | ||
| thunks.S | ||
| trivial_32bit_program.c | ||
| trivial_64bit_program.c | ||
| trivial_program.c | ||
| unwind_vdso.c | ||
| vdso_restorer.c | ||
| xstate.c | ||
| xstate.h | ||