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: <20260123165411.GBaXOns6lupfE0pxX-@fat_crate.local>
Date: Fri, 23 Jan 2026 17:54:11 +0100
From: Borislav Petkov <bp@...en8.de>
To: Slawomir Rosek <srosek@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	"H . Peter Anvin" <hpa@...or.com>, Shuah Khan <shuah@...nel.org>,
	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
Subject: Re: [PATCH v1 1/2] selftests/x86/ldt_gdt: Skip int80 if not supported

On Wed, Dec 17, 2025 at 01:59:31PM +0000, Slawomir Rosek wrote:
> 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
> +}

Hmmm, so, my gut feeling tells me that we need a proper ia32 emu support
detection in the running kernel. I can't find one after a short grep, maybe it
should be in /proc/cpuinfo, maybe it should be a syscall which fails when
IA32_EMULATION is off or maybe ptrace(2) says somewhere in the depths of its
countless ops that it does support IA32 emulation.

And then you could put that in that helper and then put that helper in
a header and not copy it in every test...

I'd say.

Thx.


-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ