]> xenbits.xensource.com Git - xen.git/commit
x86/cpuid: Calculate FEATURESET_NR_ENTRIES more helpfully
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 10 May 2023 18:58:43 +0000 (19:58 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 15 May 2023 10:03:11 +0000 (11:03 +0100)
commit56e2c8e5860090a35d5f0cafe168223a2a7c0e62
treedf366b671fd0875826215c51e981361668ad7792
parentb8be19ce432a2edd69c0673768a0beeec77f795a
x86/cpuid: Calculate FEATURESET_NR_ENTRIES more helpfully

When adding new featureset words, it is convenient to split the work into
several patches.  However, GCC 12 spotted that the way we prefer to split the
work results in a real (transient) breakage whereby the policy <-> featureset
helpers perform out-of-bounds accesses on the featureset array.

Fix this by having gen-cpuid.py calculate FEATURESET_NR_ENTRIES from the
comments describing the word blocks, rather than from the XEN_CPUFEATURE()
with the greatest value.

For simplicty, require that the word blocks appear in order.  This can be
revisted if we find a good reason to have blocks out of order.

No functional change.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/tools/gen-cpuid.py