Re: [PATCH v11 4/4] x86/cpu: Clear feature bits whose dependencies were cleared
From: Maciej Wieczor-Retman
Date: Mon Mar 23 2026 - 14:12:47 EST
On 2026-03-23 at 17:35:57 +0100, Borislav Petkov wrote:
>On Fri, Mar 20, 2026 at 12:50:29PM +0000, Maciej Wieczor-Retman wrote:
>> From: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>>
>> After cpu_caps_cleared[] is initialized with DISABLED_MASK_INIT,
>> features present in disabled bitmasks are cleared from x86_capability[].
>> However features that depend on them and are not part of any disabled
>> mask are not cleared by anything. They can trigger the warning in
>> check_cpufeature_deps(), as before both features would show up as
>> enabled even though they weren't. The uncleared features can also still
>> falsely show up in /proc/cpuinfo.
>
>Well, why aren't we clearing those apply_forced_caps() too instead of clearing
>them at check time?
At the moment only the SGX + SGX_LC pair can cause this problem (case of SGX is
not compiled and it has X86_DISABLED_FEATURE_SGX while SGX_LC depends on SGX but
doesn't have X86_DISABLED_FEATURE_SGX_LC defined therefore it is not
automatically cleared).
Clearing the compile time disabled bits is fairly low effort since it's just
initializing the cpu_caps_cleared[]. To validate the whole cpuid_deps[] array
and add relevant bits to cpu_caps_cleared[] would probably require adding
another loop that would check all of the entries. Since now only SGX has this
problem I didn't think it warranted adding more than this check in
check_cpufeature_deps().
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette
--
Kind regards
Maciej Wieczór-Retman