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: <ZnGUVcEUUF_1Vqmi@google.com>
Date: Tue, 18 Jun 2024 07:06:13 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Borislav Petkov <bp@...nel.org>
Cc: "H. Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>, 
	"Borislav Petkov (AMD)" <bp@...en8.de>
Subject: Re: [RFC PATCH] x86/cpufeatures: Flip the /proc/cpuinfo appearance logic

On Tue, Jun 18, 2024, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@...en8.de>
> 
> I'm getting tired of telling people to put a magic "" in the
> 
>   #define X86_FEATURE		/* "" ... */
> 
> comment to hide the new feature flag from the user-visible
> /proc/cpuinfo.
> 
> Flip the logic to make it explicit: an explicit "<name>" in the comment
> adds the flag to /proc/cpuinfo and otherwise not, by default.
> 
> Add the "<name>" of all the existing flags to keep backwards
> compatibility with userspace.

If we're going to churn the whole file, why not take the opportunity make it more
structured?  E.g. use a variadic macro so the name doesn't need to be buried in a
string inside a comment, and so that each feature doesn't have to open code the
math.  Lack of third input omits the flag from /proc/cpuinfo, and a magic keyword,
e.g. AUTO, uses the feature name.

There are quite a few games that could be played with macros, and IMO pretty much
all of them would be better than comment+string shenanigans.

#define X86F(word, bit, abi_name...) ((word) * 32 + bit)

#define X86_FEATURE_FPU           X86F(0,  0, AUTO)

#define X86_FEATURE_XMM		  X86F(0, 25, SSE2)

#define X86_FEATURE_K8		  X86F(3,  4)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ