• Yazen Ghannam's avatar
    x86/MCE: Always save CS register on AMD Zen IF Poison errors · 4240e2eb
    Yazen Ghannam authored
    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: default avatarYazen Ghannam <yazen.ghannam@amd.com>
    Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230814200853.29258-1-yazen.ghannam@amd.com
    4240e2eb
internal.h 7.13 KB