selftests/x86: Add a test for ia32_emulation=
PATCH 1/1 selftests/x86: Add a test for ia32_emulation=
Nothing in tools/testing/selftests mentions ia32_emulation=. Add a 64-bit test that tries INT $0x80 and execve() of a trivial 32-bit helper. Both must work or both must be refused. If ia32_emulation= is on the kernel command line, the result must also match it; without it only the agreement is checked and the other two checks are skipped.
Tested: under QEMU TCG (x86_64 defconfig, next-20261113): with no parameter 1 check passes and 2 are skipped, with ia32_emulation=0 and ia32_emulation=1 all 3 pass. On a kernel where the early_param was renamed so that ia32_emulation=0 is ignored, 2 of 3 fail. The test and the helper build with the selftests Makefile.
Not tested: CONFIG_IA32_EMULATION=n, CONFIG_IA32_EMULATION_DEFAULT_DISABLED, FRED, 32-bit kernels, running through run_kselftest.sh.
--- tools/testing/selftests/x86/Makefile | 6 +- .../selftests/x86/ia32_emulation_child.c | 11 + .../selftests/x86/ia32_emulation_param.c | 192 ++++++++++++++++++ 3 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/x86/ia32_emulation_child.c create mode 100644 tools/testing/selftests/x86/ia32_emulation_param.c
tools/testing/selftests/x86/Makefile +4 -2
@@ -17,10 +17,12 @@ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap TARGETS_C_BOTHBITS += nx_stack TARGETS_C_32BIT_ONLY := entry_from_vm86 test_syscall_vdso unwind_vdso \ test_FCMOV test_FCOMI test_FISTTP \ - vdso_restorer + vdso_restorer \ + ia32_emulation_child TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip syscall_numbering \ corrupt_xstate_header amx lam test_shadow_stack avx apx \ - sigframe_fpu_portability + sigframe_fpu_portability \ + ia32_emulation_param # Some selftests require 32bit support enabled also on 64bit systems TARGETS_C_32BIT_NEEDED := ldt_gdt ptrace_syscall
tools/testing/selftests/x86/ia32_emulation_child.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* ia32_emulation_child.c - 32-bit helper for ia32_emulation_param +* +* Does nothing, successfully. ia32_emulation_param execs it to see if +* the kernel accepts 32-bit executables. +*/ +int main (void ) +{ +return 0 ; +}
tools/testing/selftests/x86/ia32_emulation_param.c new file +192 -0
192 lines not on this page · raw message
Signature · 1 line
2.56.1