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] [day] [month] [year] [list]
Message-ID: <Y8nhtjFcsB63UsmQ@google.com>
Date:   Fri, 20 Jan 2023 00:35:02 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Dave Hansen <dave.hansen@...el.com>, X86 ML <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/cpu: Start documenting what the X86_FEATURE_ flag
 testing macros do

On Thu, Jan 19, 2023, Borislav Petkov wrote:
> Another belated reply... ;-\
> 
> On Thu, Nov 10, 2022 at 11:27:08PM +0000, Sean Christopherson wrote:
> > What about doing the opposite and folding cpu_feature_enabled()'s build-time
> > functionality into static_cpu_has() _and_ boot_cpu_has(), and then dropping
> > cpu_feature_enabled()?  That way the tradeoffs of using the static variant are
> > still captured in code (cpu_feature_enabled() sounds too innocuous to my ears),
> > and as an added bonus even slow paths benefit from build-time disabling of features.
> > 
> > Hiding the use of alternatives in cpu_feature_enabled() seems like it will lead to
> > unnecessary code patching.
> 
> Actually, tglx and I have a sekrit plan - a small preview below. I don't have
> answers to replacing all functionality we have yet but it is a good start and
> the goal is to eventually get rid of all the gunk that has grown over the years.
> +struct func_1 {
> +	/* EDX */
> +	union {
> +		struct {
> +		u32	fpu	  : 1, vme	 : 1, de	  : 1, pse	: 1,
> +			tsc	  : 1, msr	 : 1, pae	  : 1, mce	: 1,
> +
> +			cx8	  : 1, apic	 : 1, __rsv2	  : 1, sep	: 1,
> +			mtrr	  : 1, pge	 : 1, mca	  : 1, cmov	: 1,
> +
> +			pat	  : 1, pse36	 : 1, psn	  : 1, clfsh	: 1,
> +			__rsv3	  : 1, ds	 : 1, acpi	  : 1, mmx	: 1,
> +
> +			fxsr	  : 1, sse	 : 1, sse2	  : 1, ss	: 1,
> +			htt	  : 1, tm	 : 1, __rsv4	  : 1, pbe	: 1;
> +		};
> +		u32 edx;
> +	} __packed;
> +};

IMO, switching to bitfields would be a big step backwards.  Visually auditing the
code is difficult, e.g. when reviewing brand new leafs, and using cpufeatures.h as
a quick reference is essentially impossible.

E.g. I often look at cpufeatures.h when I want to know the leaf+bit of a feature,
because trying to find the same info in the SDM or APM is often painful.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ