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: <yu3pbemophlzqgd67xongzdflsj2yp722x5brj5ikaiyprxckm@b4vmk4kajxlc>
Date: Fri, 24 Jan 2025 21:17:22 +0100
From: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
To: Dave Hansen <dave.hansen@...el.com>
CC: <shuah@...nel.org>, <hpa@...or.com>, <x86@...nel.org>,
	<dave.hansen@...ux.intel.com>, <bp@...en8.de>, <mingo@...hat.com>,
	<tglx@...utronix.de>, <linux-kernel@...r.kernel.org>,
	<linux-kselftest@...r.kernel.org>, <kirill@...temov.name>, "Kirill A.
 Shutemov" <kirill.shutemov@...ux.intel.com>, Shuah Khan
	<skhan@...uxfoundation.org>
Subject: Re: [PATCH v5 1/3] selftests/lam: Move cpu_has_la57() to use cpuinfo
 flag

On 2025-01-24 at 08:14:41 -0800, Dave Hansen wrote:
>On 11/27/24 09:35, Maciej Wieczor-Retman wrote:
>> -/* Check 5-level page table feature in CPUID.(EAX=07H, ECX=00H):ECX.[bit 16] */
>>  static inline int cpu_has_la57(void)
>>  {
>> -	unsigned int cpuinfo[4];
>> -
>> -	__cpuid_count(0x7, 0, cpuinfo[0], cpuinfo[1], cpuinfo[2], cpuinfo[3]);
>> -
>> -	return (cpuinfo[2] & (1 << 16));
>> +	return !system("grep -wq la57 /proc/cpuinfo");
>>  }
>
>I would rather we find another way.
>
>First, we've documented the behavior a bit in here:
>
>	https://docs.kernel.org/arch/x86/cpuinfo.html
>
>The important part is:
>
>	"The absence of a flag in /proc/cpuinfo by itself means almost
>	nothing to an end user."
>
>Even worse, let's say there's a CPU bug and we say define a bug bit:
>
>	bugs		: spectre_v1 spectre_v2 ... la57_is_broken
>
>How is that grep going to work out? ;)
>
>Could you poke around and see if there is any existing ABI that we can
>use to query LA57 support? Maybe one of the things KVM exports, or some
>TASK_SIZE_MAX comparisons?

Sure, I'll try to find some other way.

My previous tactic was to munmap() a high address and see if it works. Does that
sound okay in case there isn't anything else would indicate la57 to userspace
reliably?

>

-- 
Kind regards
Maciej Wieczór-Retman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ