]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/MCE: Always save CS register on AMD Zen IF Poison errors
authorYazen Ghannam <yazen.ghannam@amd.com>
Mon, 14 Aug 2023 20:08:53 +0000 (15:08 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 18 Aug 2023 11:05:52 +0000 (13:05 +0200)
commit4240e2ebe67941ce2c4f5c866c3af4b5ac7a0c67
tree1ef3c5ad4e37235fb7da8b1ead8418e6f773227f
parentc3629dd7e67d6ec5705d33b0de0d142c972fe573
x86/MCE: Always save CS register on AMD Zen IF Poison errors

The Instruction Fetch (IF) units on current AMD Zen-based systems do not
guarantee a synchronous #MC is delivered for poison consumption errors.
Therefore, MCG_STATUS[EIPV|RIPV] will not be set. However, the
microarchitecture does guarantee that the exception is delivered within
the same context. In other words, the exact rIP is not known, but the
context is known to not have changed.

There is no architecturally-defined method to determine this behavior.

The Code Segment (CS) register is always valid on such IF unit poison
errors regardless of the value of MCG_STATUS[EIPV|RIPV].

Add a quirk to save the CS register for poison consumption from the IF
unit banks.

This is needed to properly determine the context of the error.
Otherwise, the severity grading function will assume the context is
IN_KERNEL due to the m->cs value being 0 (the initialized value). This
leads to unnecessary kernel panics on data poison errors due to the
kernel believing the poison consumption occurred in kernel context.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230814200853.29258-1-yazen.ghannam@amd.com
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/internal.h