[PATCH 01/15] x86/cpufeatures: Add new word for scattered features

Chris Chiu chris.chiu at canonical.com
Wed May 22 04:35:20 UTC 2024


On Fri, May 17, 2024 at 3:59 PM Yuxuan Luo <yuxuan.luo at canonical.com> wrote:
>
> From: Sandipan Das <sandipan.das at amd.com>
>
> Add a new word for scattered features because all free bits among the
> existing Linux-defined auxiliary flags have been exhausted.
>
> Signed-off-by: Sandipan Das <sandipan.das at amd.com>
> Signed-off-by: Ingo Molnar <mingo at kernel.org>
> Link: https://lore.kernel.org/r/8380d2a0da469a1f0ad75b8954a79fb689599ff6.1711091584.git.sandipan.das@amd.com
> (cherry picked from commit 7f274e609f3d5f45c22b1dd59053f6764458b492)
> CVE-2024-2201
> Signed-off-by: Yuxuan Luo <yuxuan.luo at canonical.com>
> ---
>  arch/x86/include/asm/cpufeature.h        | 6 ++++--
>  arch/x86/include/asm/cpufeatures.h       | 2 +-
>  arch/x86/include/asm/disabled-features.h | 3 ++-
>  arch/x86/include/asm/required-features.h | 3 ++-
>  4 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
> index 4466a47b76080..41cb0cbbfdebf 100644
> --- a/arch/x86/include/asm/cpufeature.h
> +++ b/arch/x86/include/asm/cpufeature.h
> @@ -92,8 +92,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
>            CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) ||    \
>            CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 19, feature_bit) ||    \
>            CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 20, feature_bit) ||    \
> +          CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 21, feature_bit) ||    \
>            REQUIRED_MASK_CHECK                                    ||    \
> -          BUILD_BUG_ON_ZERO(NCAPINTS != 21))
> +          BUILD_BUG_ON_ZERO(NCAPINTS != 22))
>
>  #define DISABLED_MASK_BIT_SET(feature_bit)                             \
>          ( CHECK_BIT_IN_MASK_WORD(DISABLED_MASK,  0, feature_bit) ||    \
> @@ -117,8 +118,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
>            CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 18, feature_bit) ||    \
>            CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 19, feature_bit) ||    \
>            CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 20, feature_bit) ||    \
> +          CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 21, feature_bit) ||    \
>            DISABLED_MASK_CHECK                                    ||    \
> -          BUILD_BUG_ON_ZERO(NCAPINTS != 21))
> +          BUILD_BUG_ON_ZERO(NCAPINTS != 22))
>
>  #define cpu_has(c, bit)                                                        \
>         (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 :  \
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 1ccdc67151453..68fd012e9df6e 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -13,7 +13,7 @@
>  /*
>   * Defines x86 CPU feature bits
>   */
> -#define NCAPINTS                       21         /* N 32-bit words worth of info */
> +#define NCAPINTS                       22         /* N 32-bit words worth of info */
>  #define NBUGINTS                       2          /* N 32-bit bug flags */
>
>  /*
> diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h
> index 8453260f6d9f9..b51b937beea37 100644
> --- a/arch/x86/include/asm/disabled-features.h
> +++ b/arch/x86/include/asm/disabled-features.h
> @@ -86,6 +86,7 @@
>  #define DISABLED_MASK18        0
>  #define DISABLED_MASK19        0
>  #define DISABLED_MASK20        0
> -#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21)
> +#define DISABLED_MASK21        0
> +#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22)
>
>  #endif /* _ASM_X86_DISABLED_FEATURES_H */
> diff --git a/arch/x86/include/asm/required-features.h b/arch/x86/include/asm/required-features.h
> index fb3d81347e333..06fb6b66a093b 100644
> --- a/arch/x86/include/asm/required-features.h
> +++ b/arch/x86/include/asm/required-features.h
> @@ -103,6 +103,7 @@
>  #define REQUIRED_MASK18        0
>  #define REQUIRED_MASK19        0
>  #define REQUIRED_MASK20        0
> -#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 21)
> +#define REQUIRED_MASK21        0
> +#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22)
>
>  #endif /* _ASM_X86_REQUIRED_FEATURES_H */
> --
> 2.34.1
>

Please also append the [SRU] and which kernel you'd like to apply to
the patchset.
I assume it's the same [Focal] as the cover letter.
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list