mirror-linux/arch/x86/kernel/cpu/mce
William Roche 201bc182ad x86/mce/amd: Check SMCA feature bit before accessing SMCA MSRs
People do effort to inject MCEs into guests in order to simulate/test
handling of hardware errors. The real use case behind it is testing the
handling of SIGBUS which the memory failure code sends to the process.

If that process is QEMU, instead of killing the whole guest, the MCE can
be injected into the guest kernel so that latter can attempt proper
handling and kill the user *process*  in the guest, instead, which
caused the MCE. The assumption being here that the whole injection flow
can supply enough information that the guest kernel can pinpoint the
right process. But that's a different topic...

Regardless of virtualization or not, access to SMCA-specific registers
like MCA_DESTAT should only be done after having checked the smca
feature bit. And there are AMD machines like Bulldozer (the one before
Zen1) which do support deferred errors but are not SMCA machines.

Therefore, properly check the feature bit before accessing related MSRs.

  [ bp: Rewrite commit message. ]

Fixes: 7cb735d7c0 ("x86/mce: Unify AMD DFR handler with MCA Polling")
Signed-off-by: William Roche <william.roche@oracle.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20260218163025.1316501-1-william.roche@oracle.com
2026-03-18 23:02:16 +01:00
..
Makefile thermal: Move therm_throt there from x86/mce 2021-02-08 11:43:20 +01:00
amd.c x86/mce/amd: Check SMCA feature bit before accessing SMCA MSRs 2026-03-18 23:02:16 +01:00
apei.c x86/mce/apei: Handle variable SMCA BERT record size 2024-10-31 10:45:59 +01:00
core.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dev-mcelog.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
genpool.c x86/mce: Make four functions return bool 2024-12-30 22:06:36 +01:00
inject.c Merge branch 'x86/msr' into x86/core, to resolve conflicts 2025-05-13 10:42:06 +02:00
intel.c x86/mce: Separate global and per-CPU quirks 2025-09-11 12:23:14 +02:00
internal.h x86/mce: Handle AMD threshold interrupt storms 2025-11-21 20:41:10 +01:00
p5.c x86/mce: Get rid of machine_check_vector 2021-09-23 11:15:49 +02:00
severity.c x86/mce: use is_copy_from_user() to determine copy-from-user context 2025-03-17 22:07:05 -07:00
threshold.c x86/mce: Handle AMD threshold interrupt storms 2025-11-21 20:41:10 +01:00
winchip.c x86/mce: Get rid of machine_check_vector 2021-09-23 11:15:49 +02:00