Commit 0cdd2c4f authored by David Kaplan's avatar David Kaplan Committed by Borislav Petkov (AMD)
Browse files

x86/bugs: Add attack vector controls for ITS



Use attack vector controls to determine if ITS mitigation is required.

Signed-off-by: default avatarDavid Kaplan <david.kaplan@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/20250707183316.1349127-19-david.kaplan@amd.com
parent eda718fd
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -1518,13 +1518,17 @@ early_param("indirect_target_selection", its_parse_cmdline);

static void __init its_select_mitigation(void)
{
	if (!boot_cpu_has_bug(X86_BUG_ITS) || cpu_mitigations_off()) {
	if (!boot_cpu_has_bug(X86_BUG_ITS)) {
		its_mitigation = ITS_MITIGATION_OFF;
		return;
	}

	if (its_mitigation == ITS_MITIGATION_AUTO)
	if (its_mitigation == ITS_MITIGATION_AUTO) {
		if (should_mitigate_vuln(X86_BUG_ITS))
			its_mitigation = ITS_MITIGATION_ALIGNED_THUNKS;
		else
			its_mitigation = ITS_MITIGATION_OFF;
	}

	if (its_mitigation == ITS_MITIGATION_OFF)
		return;
@@ -1555,11 +1559,12 @@ static void __init its_select_mitigation(void)

static void __init its_update_mitigation(void)
{
	if (!boot_cpu_has_bug(X86_BUG_ITS) || cpu_mitigations_off())
	if (!boot_cpu_has_bug(X86_BUG_ITS))
		return;

	switch (spectre_v2_enabled) {
	case SPECTRE_V2_NONE:
		if (its_mitigation != ITS_MITIGATION_OFF)
			pr_err("WARNING: Spectre-v2 mitigation is off, disabling ITS\n");
		its_mitigation = ITS_MITIGATION_OFF;
		break;