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: <f142e9c4-4829-4ace-8757-485246ad3572@intel.com>
Date: Tue, 16 Apr 2024 08:23:58 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Borislav Petkov <bp@...en8.de>, Dave Hansen
 <dave.hansen@...ux.intel.com>, Robert Richter <rric@...nel.org>
Cc: linux-kernel@...r.kernel.org, jgross@...e.com, tglx@...utronix.de,
 x86@...nel.org
Subject: Re: [PATCH 2/4] perf/x86/ibs: Use CPUID region helper

On 4/16/24 08:12, Borislav Petkov wrote:
>>  	if (!boot_cpu_has(X86_FEATURE_IBS))
>>  		return 0;
>>  
>> -	/* check IBS cpuid feature flags */
>> -	max_level = cpuid_eax(0x80000000);
>> -	if (max_level < IBS_CPUID_FEATURES)
>> -		return IBS_CAPS_DEFAULT;
>> +	get_cpuid_region_leaf(IBS_CPUID_FEATURES, CPUID_EAX, &caps);
> I wanna say all this checking of max level is worthless because if you
> have X86_FEATURE_IBS, then it is a given that you also have that
> 0x8000001b CPUID leaf.
> 
> Right, Bob?
> 
> Unless there was some weird thing back then with the CPUID leafs...

When I was looking at it, I (maybe wrongly) assumed that 0x8000001b and
X86_FEATURE_IBS were independent for a reason.  Because, oddly enough:

	#define IBS_CAPS_DEFAULT         (IBS_CAPS_AVAIL         \
                                         | IBS_CAPS_FETCHSAM    \
                                         | IBS_CAPS_OPSAM)

So, if the CPU enumerates X86_FEATURE_IBS but has a
max_level<IBS_CPUID_FEATURES then it assumes there's a working IBS
because the software-inserted IBS_CAPS_DEFAULT has IBS_CAPS_AVAIL set.

Actually, that even means that the new code should probably be:

	u32 caps = IBS_CAPS_DEFAULT;
	
 	if (!boot_cpu_has(X86_FEATURE_IBS))
 		return 0;	

	get_cpuid_region_leaf(IBS_CPUID_FEATURES, CPUID_EAX, &caps);

to match the old.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ