From nobody Fri Dec 19 19:04:29 2025 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2078.outbound.protection.outlook.com [40.107.220.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41801204F6B for ; Wed, 8 Jan 2025 20:25:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736367954; cv=fail; b=bZzAfpGBi7pxXT7TG8b3IDj5LjGYD2BfZsAa65/rqCfA9uxKyoSQUmJUv3c1tb7xQkUz0HSRQ5zPo/iLXCr5nT/eKpY3RyyVCTSpMjA+BKeBrsfhJI5GsAdnPu3uWt3ZtV74Wq6kD9XQde8e6pnhv8bNYHQTzWN4g2zSSSCPm4g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736367954; c=relaxed/simple; bh=YP9jjJw5PBdvIfVo8lT2qbxiRM69sqN7Gxy/Km3Hd4E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WwY6wR0WqPEx1g7j5b6pGZl1KIZ0Bs9YtO2seT0k+FfrWhKp0lbxEQ5McCspnPqBwMG6+IO+8CzQiXeq9y3pOfBU06+YtBVpgt9/dpAsLEE2fKEElstT+NQjRFr0XiZ0KVN4MJH6zH+BAd6N2u5eX+70lfSa3Z7Cxy5SoNGXZcA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Wj0sBW7a; arc=fail smtp.client-ip=40.107.220.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Wj0sBW7a" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zHNMnKaExMr6ZkjuOc8wT15Pmss/2RV/7FkMPPa3DTvo9hTEET0I/FeqyWE2YGX1M8EWjy89+ipIDQbpxY/N2lkvc5KBTi/VnlTgYluCjddswQeX09sIATgyH2JVkqoXbzeoKuWiIh6WqQ4JCpMOHwq8vTkD5WEYymGouocVbAFRKFqoW+hpP+krhL56QmpWm31GOqxVZ4rRGVKECbiU0RSGTu+jUsD5etT3BBZNBZTRuQYTsKVMHQwtPOHdYX/kG/ONlUN3R0HWHWTLBwv+mwznP90mw/XIgDpbSgAgE6yS+ahbNS1cYVKMXlQawhgX9xUdczVZ4ftlwV9UfbDiDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SaiPzL1UmZAkYF75Ftc5tCFEQt241nm9W13d1h08QEI=; b=tHzq6Lx8kO40RZs85XSwhKuaBFV6uRewxodE+y55CTGUvwYuyaMZUkP2Fg81PkBHA0kdOzL5LMIPXyo1DUG5nAg8GbMa4bH3Yj8PJhGtdhnCTzBoYk79DJqXeOFZYXss0+GgUyey81aaHundeeEzApEG+UkcxyTynxM6m9bx8Dzlj4UeyZkifvJI6rEjc0bLUtyRVvgX4/Nke8QeXdpe8/pbAbdnji2160Qv+Q9uwxIA1GoJNyEpF/EfqF0jqDtpQNyPGq9g2ZkMiDJpcscAlxLY/aoeVoT2isK1HRRixdTAC1/XeYEN9L30aiy4iXujKfE+Iy4jCVR/L4SXnKjVkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SaiPzL1UmZAkYF75Ftc5tCFEQt241nm9W13d1h08QEI=; b=Wj0sBW7asAcILT9ElTZ0Dy4Ub7EoC/iCQ69Ew2t+mcVJgxoAtUB6Su5u8qXC3Rg0Jd5RDDYrwhF0/j+p7JCgaHgQXWvDYs9vmtzd+2V0q1Iq0jl2BMorJkO3c+BfGX3/kheQ5IO9Opno4x1cE8WUm0Go6/F/6svMPxXE/3/TJ28= Received: from SA9PR11CA0029.namprd11.prod.outlook.com (2603:10b6:806:6e::34) by MW4PR12MB6778.namprd12.prod.outlook.com (2603:10b6:303:1e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.10; Wed, 8 Jan 2025 20:25:49 +0000 Received: from DS3PEPF000099E2.namprd04.prod.outlook.com (2603:10b6:806:6e:cafe::45) by SA9PR11CA0029.outlook.office365.com (2603:10b6:806:6e::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.11 via Frontend Transport; Wed, 8 Jan 2025 20:25:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099E2.mail.protection.outlook.com (10.167.17.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8335.7 via Frontend Transport; Wed, 8 Jan 2025 20:25:49 +0000 Received: from tiny.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 8 Jan 2025 14:25:47 -0600 From: David Kaplan To: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Pawan Gupta , Ingo Molnar , Dave Hansen , , "H . Peter Anvin" CC: Subject: [PATCH v3 22/35] x86/bugs: Add attack vector controls for mds Date: Wed, 8 Jan 2025 14:25:02 -0600 Message-ID: <20250108202515.385902-23-david.kaplan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108202515.385902-1-david.kaplan@amd.com> References: <20250108202515.385902-1-david.kaplan@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E2:EE_|MW4PR12MB6778:EE_ X-MS-Office365-Filtering-Correlation-Id: 41830522-848e-43e8-ebd5-08dd3022a3dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FsfBPAOFABGYNMThzDhShTa1OXaec9RylhW00/uCjVTqEb8ZxD5wqorDTuV7?= =?us-ascii?Q?k/dVOrTPE5PGonNgn2gsBwWWYMT6Dzoa+vrUbERCO4JQ6EhxaT2M0RgQszXp?= =?us-ascii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GIfzLFw2QUWltQlOxr4LNqalQAqSW5?= =?us-ascii?Q?Htv4sCRRxIGGn9ZdxEkWd7eATUC6ABNnW/bOArRjEQwLEQfzu0AFrmgaJJ/+?= =?us-ascii?Q?68xwyh/ZxAqM7+zEhEKz9mv9YHjDFWJt1fJvRM/9FryaWUdWYoAly3OXJJyB?= =?us-ascii?Q?4YiSvqPlifOmHt5GerztlVpYKSuEVTlXLfOo59mc5Dd1cXb0FrYXiUOYTvtf?= =?us-ascii?Q?CQmr0Ka4+sC9My5F551Sh+AX0aj/1AimxJa8r8UBeVZyZjmwLYM6x5l7QqrI?= =?us-ascii?Q?T+2NTJWSQLmV790rhysUeQUl8fYPY+nNhZIykbdxwdyUU8l5FDnmqDr8x9DX?= =?us-ascii?Q?jX+94b4JHqVOWhCbxmwEZBgPYvtXfLprJ0u7X7MnLv1fXuhIytDMz2jf1LUK?= =?us-ascii?Q?syrZWkYZtSVG884Xa7hxiK8r68YLx6iwynD37/YVbF1xZYuMK+7jbGK/iEhb?= =?us-ascii?Q?65kN75ccqh+vWlgCmLXjWPGNgs0yU7ISCf/Ej6soEo4kuGgsej5/k/wlPlV3?= =?us-ascii?Q?4PNsMIwfJhBWsc8=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2025 20:25:49.1570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41830522-848e-43e8-ebd5-08dd3022a3dc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6778 Content-Type: text/plain; charset="utf-8" Use attack vector controls to determine if mds mitigation is required. If cross-thread attack mitigations are required, disable SMT. Signed-off-by: David Kaplan --- arch/x86/kernel/cpu/bugs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 175dbbf9b06e..298acb80d126 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -476,8 +476,12 @@ static void __init mds_select_mitigation(void) if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) mds_mitigation =3D MDS_MITIGATION_OFF; =20 - if (mds_mitigation =3D=3D MDS_MITIGATION_AUTO) - mds_mitigation =3D MDS_MITIGATION_FULL; + if (mds_mitigation =3D=3D MDS_MITIGATION_AUTO) { + if (should_mitigate_vuln(X86_BUG_MDS)) + mds_mitigation =3D MDS_MITIGATION_FULL; + else + mds_mitigation =3D MDS_MITIGATION_OFF; + } =20 if (mds_mitigation =3D=3D MDS_MITIGATION_FULL) { if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) @@ -506,7 +510,8 @@ static void __init mds_apply_mitigation(void) if (mds_mitigation =3D=3D MDS_MITIGATION_FULL) { setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF); if (!boot_cpu_has(X86_BUG_MSBDS_ONLY) && - (mds_nosmt || cpu_mitigations_auto_nosmt())) + (mds_nosmt || cpu_mitigations_auto_nosmt() || + cpu_mitigate_attack_vector(CPU_MITIGATE_CROSS_THREAD))) cpu_smt_disable(false); } } --=20 2.34.1