Commit b52a0f85 authored by Mario Limonciello's avatar Mario Limonciello Committed by Heyuan Wang
Browse files

x86/CPU/AMD: Clear virtualized VMLOAD/VMSAVE on Zen4 client

mainline inclusion
from mainline-v6.12
commit a5ca1dc46a6b610dd4627d8b633d6c84f9724ef0
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB8IUH
CVE: CVE-2024-53114

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5ca1dc46a6b610dd4627d8b633d6c84f9724ef0



--------------------------------

A number of Zen4 client SoCs advertise the ability to use virtualized
VMLOAD/VMSAVE, but using these instructions is reported to be a cause
of a random host reboot.

These instructions aren't intended to be advertised on Zen4 client
so clear the capability.

Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219009


Signed-off-by: default avatarHeyuan Wang <wangheyuan2@h-partners.com>
parent c0c5f5fd
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1048,6 +1048,17 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)
{
	if (!cpu_has(c, X86_FEATURE_HYPERVISOR))
		msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);

	/*
	 * These Zen4 SoCs advertise support for virtualized VMLOAD/VMSAVE
	 * in some BIOS versions but they can lead to random host reboots.
	 */
	switch (c->x86_model) {
	case 0x18 ... 0x1f:
	case 0x60 ... 0x7f:
		clear_cpu_cap(c, X86_FEATURE_V_VMSAVE_VMLOAD);
		break;
	}
}

static void init_amd_zen5(struct cpuinfo_x86 *c)