Re: [PATCH v3] x86: Clear feature bits disabled at compile-time

From: Borislav Petkov
Date: Thu Jul 24 2025 - 06:13:23 EST


On July 24, 2025 12:45:51 PM GMT+03:00, Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx> wrote:
>If some config options are disabled during compile time, they still are
>enumerated in macros that use the x86_capability bitmask - cpu_has() or
>this_cpu_has().
>
>The features are also visible in /proc/cpuinfo even though they are not
>enabled - which is contrary to what the documentation states about the
>file. Examples of such feature flags are lam, fred, sgx, ibrs_enhanced,
>split_lock_detect, user_shstk, avx_vnni and enqcmd.
>
>Add a DISABLED_MASK_INITIALIZER() macro that creates an initializer list

Where?

>filled with DISABLED_MASKx bitmasks.
>
>Initialize the cpu_caps_cleared array with the autogenerated disabled
>bitmask.
>
>Fixes: ea4e3bef4c94 ("Documentation/x86: Add documentation for /proc/cpuinfo feature flags")
>Reported-by: Farrah Chen <farrah.chen@xxxxxxxxx>
>Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>Cc: <stable@xxxxxxxxxxxxxxx>
>---
>Changelog v3:
>- Remove Fixes: tags, keep only one at the point where the documentation
> changed and promised feature bits wouldn't show up if they're not
> enabled.

The behavior was there before. Why do you keep pointing at the patch which documents it?

--
Sent from a small device: formatting sucks and brevity is inevitable.