Re: [PATCH v11 3/4] x86/cpu: Do a sanity check on required feature bits

From: Maciej Wieczor-Retman

Date: Mon Mar 30 2026 - 05:55:19 EST


On 2026-03-27 at 19:01:01 -0700, H. Peter Anvin wrote:
>On 2026-03-27 18:52, H. Peter Anvin wrote:
>>
>> One thing that matters here is that these bitmaps are *already* accessed using
>> bitop operations. Therefore, if this is a problem *here*, then it is a problem
>> *everywhere*. The simplest way to deal with it is probably to require NCAPINTS
>> and NBUGINTS to be even, even (pun intended) if that means a temporarily
>> unused word at the end of the array. That doesn't even require any code
>> changes, just a statement at the top of cpufeatures.h (see attached patch for
>> an untested example.)
>>
>
>Untested indeed. I just realized this breaks cpufeaturemasks.awk:
>
># Note: this blithely assumes that each word has at least one
># feature defined in it; if not, something else is wrong!
>
> -hpa
>

I think you'd also need to modify enum cpuid_leafs. There is a check at some
point that verifies if there is enough of these enums to match NCAPINTS.

--
Kind regards
Maciej Wieczór-Retman