Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2717826lqt; Mon, 22 Apr 2024 21:56:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKZSxwNqBZUjlMsmp9Fwk5VbqOVd6ux2zzsVP5RegxeRwKQ6jPpiikr/HXEKOQeVyJbGYlyKHRK0k9Ha6LeKChc4j/fI1eQ1gd4elEXA== X-Google-Smtp-Source: AGHT+IGaa2nx4Pj7BvZQvCH3uHA7+9LjBB4vogLGduWRaZ0d8RdtEn212cJGMbB7kMkcOXyG8w8w X-Received: by 2002:a5d:620b:0:b0:343:9a57:7d1f with SMTP id y11-20020a5d620b000000b003439a577d1fmr6216670wru.69.1713848167130; Mon, 22 Apr 2024 21:56:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713848167; cv=pass; d=google.com; s=arc-20160816; b=XpZnkmTVcIPnElC2vVAyMWU2yeVzPv4lj0FiQFGNvNZveURoEEJUCXLA/Ka7Tg5LzO hgyCLVC4j2i2LK6Uo70BR2lBvxFLCwZ/AolZwbCnYFzNeRbko4eXhEVKniiZzel/O1Tz CJGi3Pb7M90UjmeV2mapcaxreyWjoIZPyUQnGbFKJeehsd5wmTOl/W9MGp1/aF5GRu7t fd5RHdl8Gm4qdl6q6l/kMuebvVQYv+6b0JiQnSxo/bRGaFn4NpNZ+wn8tGduk0FF1tq9 fthxaujQnZxApbfe1Z5HY7JBilNnJ65Gkwdg//9VN9+ltS7oQ0+HM+RCIZWAKDwUE0Em NMzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QHxzblYHiT0gLBDIW6uMmTNp3W0xip3qt3hEII3tQTs=; fh=fOa0FmsOuLLsqHThXSNkD5h1t3yKmudsc1nYJP5ZyOA=; b=OWyCvbHyMutATV1WfGF3qdX6HKI2OgobM3LjWQWC5wJdteDCKbGSe7ddJ95NiEx/zG uxdIxx+fCfrXtGbREr7ZAWNPqtqDsqvv/82e5+VdPVEVWOMk4zVU+oUhrXCHD9Jm7HKM ugftK5ukRSgprFAF0gtupeh1e5NfNdb35Gu4CMKQtJW3k4cCwUjSKD3AGstUiEzFe6xc 3mCRK+C9plndGM+OjWpydW9OG74pSEy3S0NY4M+JOutjqysAQYV+4+jjYNjHO2vkpvdw uFriY1k3nh+ZdaCk+8D0bOoYeRiWTdcHGN0Jy5cC97btuvZBtBWLPfpjp2YzZU8k4+Me rzuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="le/Pv/qX"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-154513-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l12-20020a170906794c00b00a55bfb25d76si1617209ejo.494.2024.04.22.21.56.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 21:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154513-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="le/Pv/qX"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-154513-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id AB3E91F22BDE for ; Tue, 23 Apr 2024 04:56:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4852720DE7; Tue, 23 Apr 2024 04:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="le/Pv/qX" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 584EB1CAB3; Tue, 23 Apr 2024 04:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713848154; cv=none; b=YAI7VeOIskTlQoJr0dkE4SIkHRzT/gq/nosGvkjBBR0V8etm3he1i1R2LVs9QQOUbiDsZ+mgCNWqJD50NkP42lOvPKwTv9vFeyKKTT4Bu83qhpmtzysxEGqTI8xx9jMZ6vuZiYMI4yVJ1CeEb0VlUT1UnlFrRjKIaCCb6MZVINA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713848154; c=relaxed/simple; bh=puryQ1J6mzWbCrUfIOEYUOuYeQHliVuNmWN99eIePwQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b109HJHGIDbifzIPlkC5K8UgwXKspwDf2Rw0SNNNALaGHu8JVcP6dtsHuw9n03HOMYxAtBkFP1oMbxdMpVq2FoU0ukZaGsdmZSBCoz8dKhh2mcRM7/2DlOgnNgwgqdkU5KHnLKrpP54tUV6UqWE5tCMElC0tieIpzifTGQMK3dI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=le/Pv/qX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F34BC116B1; Tue, 23 Apr 2024 04:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713848153; bh=puryQ1J6mzWbCrUfIOEYUOuYeQHliVuNmWN99eIePwQ=; h=From:To:Cc:Subject:Date:From; b=le/Pv/qXNH6cmU/bEapqQld8Xy6qptw1W4yy3w76kNBPQoyRaCQ0eDU8aW4OhYWvQ 5Mw11o+v7XwagPHZlhU0O3PzlDxaSNWLya2r6tfJ2eLh6f061eRrKx2Aax9CCNIi40 9btXUZVsTznHsEP/H1yEccKQOxUkoFa5bdqrxukAQowOZhhLU7AzfKPatKfViNJz8F YlPKOkmW98paCxbsin3DxJ2//NPjoEEvFPmVbXH0uiYwYiMJb0X4DKvMA+EqLHRt7z uXd8GQaU2PNSFL2wkl7+gq+reYJfXzAQ0Hi/4hMHQK4jllydhVPYg3fUcJ0p+39rmQ BWvJQ5CtWZjFA== From: Song Liu To: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-team@meta.com, Song Liu , stable@vger.kernel.org, Sean Christopherson , Ingo Molnar , Daniel Sneddon , Jakub Kicinski Subject: [PATCH] arch/Kconfig: Move SPECULATION_MITIGATIONS to arch/Kconfig Date: Mon, 22 Apr 2024 21:55:48 -0700 Message-ID: <20240423045548.1324969-1-song@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit SPECULATION_MITIGATIONS is currently defined only for x86. As a result, IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) is always false for other archs. f337a6a21e2f effectively set "mitigations=off" by default on non-x86 archs, which is not desired behavior. Jakub observed this change when running bpf selftests on s390 and arm64. Fix this by moving SPECULATION_MITIGATIONS to arch/Kconfig so that it is available in all archs and thus can be used safely in kernel/cpu.c Fixes: f337a6a21e2f ("x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n") Cc: stable@vger.kernel.org Cc: Sean Christopherson Cc: Ingo Molnar Cc: Daniel Sneddon Cc: Jakub Kicinski Signed-off-by: Song Liu --- arch/Kconfig | 10 ++++++++++ arch/x86/Kconfig | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 9f066785bb71..8f4af75005f8 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -1609,4 +1609,14 @@ config CC_HAS_SANE_FUNCTION_ALIGNMENT # strict alignment always, even with -falign-functions. def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG +menuconfig SPECULATION_MITIGATIONS + bool "Mitigations for speculative execution vulnerabilities" + default y + help + Say Y here to enable options which enable mitigations for + speculative execution hardware vulnerabilities. + + If you say N, all mitigations will be disabled. You really + should know what you are doing to say so. + endmenu diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 39886bab943a..50c890fce5e0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2486,16 +2486,6 @@ config PREFIX_SYMBOLS def_bool y depends on CALL_PADDING && !CFI_CLANG -menuconfig SPECULATION_MITIGATIONS - bool "Mitigations for speculative execution vulnerabilities" - default y - help - Say Y here to enable options which enable mitigations for - speculative execution hardware vulnerabilities. - - If you say N, all mitigations will be disabled. You really - should know what you are doing to say so. - if SPECULATION_MITIGATIONS config MITIGATION_PAGE_TABLE_ISOLATION -- 2.43.0