lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251217135932.3153847-3-srosek@google.com>
Date: Wed, 17 Dec 2025 13:59:32 +0000
From: Slawomir Rosek <srosek@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, 
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, 
	"H . Peter Anvin" <hpa@...or.com>, Shuah Khan <shuah@...nel.org>
Cc: Betty Zhou <bettyzhou@...gle.com>, Wake Liu <wakel@...gle.com>, 
	Kazuhiro Inaba <kinaba@...gle.com>, Jeff Xu <jeffxu@...gle.com>, 
	Alistair Delva <adelva@...gle.com>, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, Slawomir Rosek <srosek@...gle.com>
Subject: [PATCH v1 2/2] selftests/x86/ptrace_syscall: Skip int80 if not supported

The IA32 Emulation support can be either removed from the kernel,
disabled by default or disabled at runtime. The x86/ptrace_syscall
selftest crashes for all of above thus is_32bit_syscall_supported()
helper is added to skip int80 syscalls if they are not supported.

Signed-off-by: Slawomir Rosek <srosek@...gle.com>
---
 tools/testing/selftests/x86/ptrace_syscall.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c
index 360ec88d5432..6c19bea485c6 100644
--- a/tools/testing/selftests/x86/ptrace_syscall.c
+++ b/tools/testing/selftests/x86/ptrace_syscall.c
@@ -51,6 +51,18 @@ extern void sys32_helper(struct syscall_args32 *, void *);
 extern void int80_and_ret(void);
 #endif
 
+static bool is_32bit_syscall_supported(void)
+{
+#ifdef __x86_64__
+	return system("((zcat /proc/config.gz | grep CONFIG_IA32_EMULATION=y) &&"
+		"((test -z $(zcat /proc/config.gz | grep CONFIG_IA32_EMULATION_DEFAULT_DISABLED=y)) || (grep ia32_emulation=true /proc/cmdline)) &&"
+		"(test -z $(grep ia32_emulation=false /proc/cmdline))) >/dev/null 2>&1"
+	) == 0;
+#else
+	return true;
+#endif
+}
+
 /*
  * Helper to invoke int80 with controlled regs and capture the final regs.
  */
@@ -389,8 +401,12 @@ static void test_restart_under_ptrace(void)
 
 int main()
 {
-	printf("[RUN]\tCheck int80 return regs\n");
-	test_sys32_regs(do_full_int80);
+	if (is_32bit_syscall_supported()) {
+		printf("[RUN]\tCheck int80 return regs\n");
+		test_sys32_regs(do_full_int80);
+	} else {
+		printf("[SKIP]\t32bit syscall support is not available\n");
+	}
 
 #if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16)
 	vsyscall32 = (void *)getauxval(AT_SYSINFO);
-- 
2.52.0.305.g3fc767764a-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ