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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251217135932.3153847-2-srosek@google.com>
Date: Wed, 17 Dec 2025 13:59:31 +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 1/2] selftests/x86/ldt_gdt: 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/ldt_gdt 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/ldt_gdt.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
index bb99a71380a5..b178392e50c0 100644
--- a/tools/testing/selftests/x86/ldt_gdt.c
+++ b/tools/testing/selftests/x86/ldt_gdt.c
@@ -62,6 +62,18 @@ static struct user_desc *low_user_desc;
 static struct user_desc *low_user_desc_clear;  /* Use to delete GDT entry */
 static int gdt_entry_num;
 
+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
+}
+
 static void check_invalid_segment(uint16_t index, int ldt)
 {
 	uint32_t has_limit = 0, has_ar = 0, limit, ar;
@@ -147,6 +159,7 @@ static bool install_valid_mode(const struct user_desc *d, uint32_t ar,
 	if (!ldt) {
 #ifndef __i386__
 		/* No point testing set_thread_area in a 64-bit build */
+		printf("[SKIP]\tNo point testing set_thread_area in a 64-bit build\n");
 		return false;
 #endif
 		if (!gdt_entry_num)
@@ -676,6 +689,10 @@ static void setup_counter_page(void)
 static int invoke_set_thread_area(void)
 {
 	int ret;
+	if (!is_32bit_syscall_supported()) {
+		printf("[SKIP]\tNo 32bit syscall support in a 64-bit build\n");
+		return -1;
+	}
 	asm volatile ("int $0x80"
 		      : "=a" (ret), "+m" (low_user_desc) :
 			"a" (243), "b" (low_user_desc)
@@ -716,8 +733,10 @@ static void setup_low_user_desc(void)
 
 static void test_gdt_invalidation(void)
 {
-	if (!gdt_entry_num)
+	if (!gdt_entry_num) {
+		printf("[SKIP]\tNo set_thread_area support in a 64-bit only system\n");
 		return;	/* 64-bit only system -- we can't use set_thread_area */
+	}
 
 	unsigned short prev_sel;
 	unsigned short sel;
-- 
2.52.0.305.g3fc767764a-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ