For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v2: - Rework patch per feedback - Add Cc: stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index efd42ee9d1cc..289ff197b1b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -378,6 +378,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (cpu_has(c, X86_FEATURE_ZEN3) || cpu_has(c, X86_FEATURE_ZEN4)) {
On Tue, Jul 22, 2025 at 08:28:44AM -0400, Michael Zhivich wrote:
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
"This is a stable-only fix." so that the AI is happy. :-P
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com
Acked-by: Borislav Petkov (AMD) bp@alien8.de
Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
That commit in Fixes: is the 6.12 stable one.
The 6.6 one is:
Fixes: 90293047df18 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
The 6.1 is:
Fixes: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
The 5.15 one:
Fixes: f2b75f1368af ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
and the 5.10 one is
Fixes: 78192f511f40 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
and since all stable kernels above have INIT_STACK_NONE, that same one-liner should be applied to all of them.
Greg, I'm thinking this one-liner should apply to all of the above with some fuzz. Can you simply add it to each stable version with a different Fixes: tag each?
Or do you prefer separate submissions?
Thx.
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index efd42ee9d1cc..289ff197b1b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -378,6 +378,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping;
- /* reserved bits are expected to be 0 in test below */
- p.__reserved = 0;
if (cpu_has(c, X86_FEATURE_ZEN3) || cpu_has(c, X86_FEATURE_ZEN4)) { --
On Tue, Jul 22, 2025 at 04:22:54PM +0200, Borislav Petkov wrote:
On Tue, Jul 22, 2025 at 08:28:44AM -0400, Michael Zhivich wrote:
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
"This is a stable-only fix." so that the AI is happy. :-P
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com
Acked-by: Borislav Petkov (AMD) bp@alien8.de
Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
That commit in Fixes: is the 6.12 stable one.
The 6.6 one is:
Fixes: 90293047df18 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
The 6.1 is:
Fixes: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
The 5.15 one:
Fixes: f2b75f1368af ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
and the 5.10 one is
Fixes: 78192f511f40 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
and since all stable kernels above have INIT_STACK_NONE, that same one-liner should be applied to all of them.
Greg, I'm thinking this one-liner should apply to all of the above with some fuzz. Can you simply add it to each stable version with a different Fixes: tag each?
Or do you prefer separate submissions?
Ideally, separate submissions, otherwise I have to do this all by hand :(
thanks
greg k-h
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index efd42ee9d1cc..289ff197b1b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -378,6 +378,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (cpu_has(c, X86_FEATURE_ZEN3) || cpu_has(c, X86_FEATURE_ZEN4)) {
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#opti...
Rule: The upstream commit ID must be specified with a separate line above the commit text. Subject: [PATCH v3 6.12] x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() Link: https://lore.kernel.org/stable/20250723134019.2370983-1-mzhivich%40akamai.co...
Please ignore this mail if the patch is not relevant for upstream.
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: 90293047df18 ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 5fcdfbb792bd..b5a234eef471 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -549,6 +549,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (cpu_has(c, X86_FEATURE_ZEN3) || cpu_has(c, X86_FEATURE_ZEN4)) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 4785d41558d6..2d71c329b347 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -563,6 +563,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: f2b75f1368af ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 04ac18ff022f..3c7d64c454b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -592,6 +592,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: 78192f511f40 ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index e67d7603449b..bf07b2c5418a 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -599,6 +599,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: 78192f511f40 ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index e67d7603449b..bf07b2c5418a 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -599,6 +599,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: f2b75f1368af ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 04ac18ff022f..3c7d64c454b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -592,6 +592,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection.
This is a stable-only fix.
Cc: stable@vger.kernel.org Signed-off-by: Michael Zhivich mzhivich@akamai.com Fixes: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each stable
arch/x86/kernel/cpu/amd.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 4785d41558d6..2d71c329b347 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -563,6 +563,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0;
if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {
linux-stable-mirror@lists.linaro.org