Re: [PATCH] x86/CPU/AMD: Clear RDRAND CPUID if Built-In-Self-Test failed on boot
From: Borislav Petkov
Date: Tue Apr 28 2026 - 22:08:42 EST
On April 28, 2026 10:11:50 PM UTC, Dmitry Safonov <dima@xxxxxxxxxx> wrote:
>On Tue, Apr 28, 2026 at 7:21 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>>
>> On Tue, Apr 28, 2026 at 06:35:31PM +0100, Dmitry Safonov via B4 Relay wrote:
>> > Yet, CPUID gets cleared only for previously known broken
>> > implementations, see i.e., commit c49a0a80137c ("x86/CPU/AMD: Clear
>> > RDRAND CPUID bit on AMD family 15h/16h"), that disabled RDRAND on
>> > the same CPU family, where it was broken only after suspend-resume.
>> >
>> > As RDRAND is not masked in CPUID, some userspace may attempt using it,
>>
>> So why aren't you clearing the MSR bit even if our internal X86_FEATURE
>> representation is cleared?
>
>That's exactly what this is about?
I don't know what you mean here...?
You're doing a bunch of code to fix the case of what I understand is some ordering issue of init code which misses to clear the CPUID bit for RDRAND on those machines but then looking at the code again, x86_init_rdrand() runs *after* clear_rdrand_cpuid_bit()!
So the CPUID bit should have been cleared already by the time userspace is up.
So I guess I still don't know what exactly you're fixing here.
Maybe try to explain again...?
Thx.
--
Small device. Typos and formatting crap