[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230531212907.GHZHe8I/DZUyzIXI2Q@fat_crate.local>
Date: Wed, 31 May 2023 23:29:07 +0200
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Jon Kohler <jon@...anix.com>, Dave Hansen <dave.hansen@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"Chang S. Bae" <chang.seok.bae@...el.com>,
Kyle Huey <me@...ehuey.com>,
"neelnatu@...gle.com" <neelnatu@...gle.com>,
Andrew Cooper <andrew.cooper3@...rix.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH] x86/fpu/xstate: clear XSAVE features if DISABLED_MASK set
On Wed, May 31, 2023 at 08:18:34PM +0000, Sean Christopherson wrote:
> Assert that the to-be-checked bit passed to cpu_feature_enabled() is a
> compile-time constant instead of applying the DISABLED_MASK_BIT_SET()
> logic if and only if the bit is a constant. Conditioning the check on
> the bit being constant instead of requiring the bit to be constant could
> result in compiler specific kernel behavior, e.g. running on hardware that
> supports a disabled feature would return %false if the compiler resolved
> the bit to a constant, but %true if not.
Uff, more mirroring CPUID inconsistencies.
So *actually*, we should clear all those build-time disabled bits from
x86_capability so that this doesn't happen.
> All current usage of cpu_feature_enabled() specifies a hardcoded
> X86_FEATURE_* flag, so this *should* be a glorified nop.
Also, pls add here the exact example which prompted this as I'm sure we
will forget why this was done.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists