Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp308398lqb; Tue, 16 Apr 2024 17:15:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAllTeGaB92OWFvIVFeUYKCckRsj0EKWyHaqZzlLEAOP2lLe73ICN7RnVsnmUAaXpON57gbS41bTNrlmQSHsZsVu/C5IEXN770A//m9A== X-Google-Smtp-Source: AGHT+IHy0K1nHtdeEk0jLDCfkLNaZVL28jcgRVL+9Dxs070NmWVLdn6ePFSm47hUubHc0+4RSduQ X-Received: by 2002:a05:6a20:9496:b0:1a3:bfce:ec9e with SMTP id hs22-20020a056a20949600b001a3bfceec9emr15725964pzb.18.1713312928260; Tue, 16 Apr 2024 17:15:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713312928; cv=pass; d=google.com; s=arc-20160816; b=PDFO/Tq3EqUscmdGrXf5lH+46h0sJHY7z+CXgAUI/+6L7sEOL+wu6nBZN4+IrXrMfj 2koGeQhJvyOpJW89FsVOWH4cSLqrrkR9aJdhGFx9VMtlGRPDjK1R1Seh8SqIE20tlo7j FSmUKciRDVqlwXG8IXg02ja3TaGO5E7ZN2AKVTjOWDKT/s5oez/J2e5plJ256CNsQ5cy AayOauwU+fHFHrVm90KjB1XRU36IDkTri0gUjD17QPNy2qEqgm0nYa+HKPf0LKhPZlJZ CzldN/QDQl1bD7vmoFeeAoCkmZH6Jw+UkiVZdWV6ggWksJUvzVJWOY9pfOgKJtr5Q7Wq hMQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=m9VfputrxLnVngbwQFKyRzwQMY5dHXwAcsvKFnPKLMI=; fh=renssG/kh5qId/srkD1+s338T+MvUpn4TDt6Wi42XGU=; b=EI5W/9cITA6SLkA614PbrfOuWV0Nxk25ApYpqIriEQMAsp7/hQVqL9HAUaF5YvZ0Bu li6iVNnkzlSNrZUaUnMMaevcA0z9RRtqlJMPFKebKIWeEP7Uzd/15Y9dMeEHK9rjU78j PmtmeklBqjl19eXL94xcaISM2T/QfwNAOrUs6hHNlIa5CVWTMlLi8QXiNsGn76r92WWG LHxjc8rXVVWebz/S8IFzTXHU9UhqreylbCUID1Wl3DaFSPS6i3kQo0Gn1DcElqTjE10C mnhZnkLG0rq9NQctIgKLDfsItCTvAmaQbnMMKDbupo740RPiQT1fUFGy8rMnO87s9w/f tK2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RNyrZRwk; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-147791-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147791-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b6-20020a17090a550600b0029969ee2a08si260485pji.52.2024.04.16.17.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 17:15:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147791-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RNyrZRwk; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-147791-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147791-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C8941286840 for ; Wed, 17 Apr 2024 00:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E5181860; Wed, 17 Apr 2024 00:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RNyrZRwk" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19AE7364 for ; Wed, 17 Apr 2024 00:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713312914; cv=none; b=gf5ma6O9dRXaT809uWRcKzsj1XIDxBoWA7sidXANZoCsK1d8lgNWX2yvqPg+0lERtQ4ZL/RQV6e+lLw8B4YFzvTnB0ZsEOmq6Bl+45aESWiVNVQgJ904gBmuCATvT3yGtnbTYl9XSdC58SjInHu/Mp+E0kiNUjbqG1jjSCw/vvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713312914; c=relaxed/simple; bh=AacvfWgUXUIENBNEnwfPiB1vP9BLM+sOUlSbsxnKkKE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IAujqP4xPm9p7hww4SYCNkkoYCPqEh8rRHmpfmufBtRPuLsg0cEGbMI+N6A/QT+M4tA+pafu29Ld81LEaIQQnc2OTBxQDweI+buzSpEunQlHruDEwyOvvhfJTqzR/TV1k6BSEwoCzEDkRG3goO8z3DPmSBKomq/9eDFuD3e2lgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RNyrZRwk; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-ddaf2f115f2so7219211276.3 for ; Tue, 16 Apr 2024 17:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713312912; x=1713917712; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=m9VfputrxLnVngbwQFKyRzwQMY5dHXwAcsvKFnPKLMI=; b=RNyrZRwkUL+bfRFbIaog45oNyBmvXY3r9tAP82PtSnGv1o7cu6uOm1rnyRxlYgCvEw r8mxybDZ+LAEnL2cMMy36DsjgfVCDgZQhihVTamO764/oj3XTHWddAkDNQ4w64h63e2n 4CHjF5NeA3P1t+vfUNY8gTBBlxUxf9MBmgv6n1rYzrfDF74tEw9V/Mz5fIuPLx8Qeyop J4oWITpf1Sr3a2vWqgjvUgu0HVURLPje0W8dQf9I49N0pPExSSPItdF7H2XgmBvjzyg7 5OCahzws77hAgo5IQMOo6Xxdcnm8S+Xaz4XZl9G51ATHhZuuGf4cc6pm8eDMvu+MrvZb T6bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713312912; x=1713917712; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m9VfputrxLnVngbwQFKyRzwQMY5dHXwAcsvKFnPKLMI=; b=EhlSVdL5tl4GSkpdDfFiHNA8JXIcKnvwNA7N6Nywa9SOoXHr3zZfgkOg3ShI4GSq7g fC6rDMUZQ8P8ilxAW8IGhi9hPHSoQ+N751L0BsCP2tRy2NBydaM/fpzboFdsR7rARyj5 G+1MD3dN6eMBdQ88uzLVIOdFxFstLRfuByV0XAscoLXk/cSDHXjeAoumxXUkATA8vxjU VHQJPxlQDr80I/Cl0aXy8LQLBF+Oe6Iq6BVLMoF0em/NhlYzbF17/eP27OGOmv3DeNAR 9WoVO9JEckFVPwBk6L2L0o0AuzuuTzyO2zxyvrWx4t5CTrKR72Rl2NkYj3DLHzGY8Kgl asGQ== X-Forwarded-Encrypted: i=1; AJvYcCXPQAEtgSbGT0Ntlzjz85QbT63AgI+92v4LuiSxuhOzfjlX+20TLuI85MSB99KVwfvqT5kv0znP7yIOogSCWRZH7SjAYr4Ly5T6go02 X-Gm-Message-State: AOJu0YysTBoKgxVC2rw3kvpZD4HMBW9m9d7mvpopn9TQOnMs+wiP+mQM dymZOD0PH6rqSmBTpE09Q5t2uEvsp/8QDAcO+PisRs+AnjTicpLnUh/Zl4HjmrB/1IMsLpxonf9 6mA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:c0c:b0:de1:d49:7ff6 with SMTP id fs12-20020a0569020c0c00b00de10d497ff6mr1198221ybb.7.1713312912168; Tue, 16 Apr 2024 17:15:12 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 16 Apr 2024 17:15:06 -0700 In-Reply-To: <20240417001507.2264512-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240417001507.2264512-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240417001507.2264512-2-seanjc@google.com> Subject: [PATCH 1/2] cpu: Re-enable CPU mitigations by default for !X86 architectures From: Sean Christopherson To: Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Greg Kroah-Hartman , Peter Zijlstra Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Rothwell , Michael Ellerman , Geert Uytterhoeven , Sean Christopherson Content-Type: text/plain; charset="UTF-8" Add a generic Kconfig, CPU_MITIGATIONS, to control whether or not CPU mitigations are enabled by default, and force it on for all architectures except x86. A recent commit to turn mitigations off by default if SPECULATION_MITIGATIONS=n kinda sorta missed that "cpu_mitigations" is completely generic, where as SPECULATION_MITIGATIONS is x86 specific. Alternatively, SPECULATION_MITIGATIONS could simply be defined in common code, but that creates weirdness for x86 because SPECULATION_MITIGATIONS ends up being defined twice, and the default behavior would likely depend on the arbitrary include order (if the two definitions diverged). Ideally, CPU_MITIGATIONS would be unconditionally on by default for all architectures, and manually turned off, but there is no way to unselect a Kconfig. Reported-by: Stephen Rothwell Reported-by: Michael Ellerman Reported-by: Geert Uytterhoeven Closes: https://lkml.kernel.org/r/20240413115324.53303a68%40canb.auug.org.au Fixes: f337a6a21e2f ("x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/x86/Kconfig | 1 + drivers/base/Kconfig | 3 +++ kernel/cpu.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4474bf32d0a4..a0eca6313276 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2490,6 +2490,7 @@ config PREFIX_SYMBOLS menuconfig SPECULATION_MITIGATIONS bool "Mitigations for speculative execution vulnerabilities" + select CPU_MITIGATIONS default y help Say Y here to enable options which enable mitigations for diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 2b8fd6bb7da0..dab19f15fa57 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE config GENERIC_CPU_VULNERABILITIES bool +config CPU_MITIGATIONS + def_bool !X86 + config SOC_BUS bool select GLOB diff --git a/kernel/cpu.c b/kernel/cpu.c index 07ad53b7f119..bb0ff275fb46 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -3207,8 +3207,8 @@ enum cpu_mitigations { }; static enum cpu_mitigations cpu_mitigations __ro_after_init = - IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO : - CPU_MITIGATIONS_OFF; + IS_ENABLED(CONFIG_CPU_MITIGATIONS) ? CPU_MITIGATIONS_AUTO : + CPU_MITIGATIONS_OFF; static int __init mitigations_parse_cmdline(char *arg) { -- 2.44.0.683.g7961c838ac-goog