Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2150415lqe; Tue, 9 Apr 2024 10:51:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSvqsNHDu0XGV7bs0BoqGy8l5TryT830JxYRf3KEkEP8espP7f7Poujq/nbVu2myj1YSgdo5E+eDUK78JG32nOdoXqjIfLwgAjlglNEA== X-Google-Smtp-Source: AGHT+IE6KevVKXeWKQ44wEXGp7O23l/jZR+qVubBoI0SdG68hH5S8uDHf11vaeorVWgLsRIS4qU5 X-Received: by 2002:a17:906:d7a5:b0:a51:a425:44c3 with SMTP id pk5-20020a170906d7a500b00a51a42544c3mr130664ejb.26.1712685104083; Tue, 09 Apr 2024 10:51:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712685104; cv=pass; d=google.com; s=arc-20160816; b=lfidsudxmgvROpbGDbJBpFzK+6Msbw8KDlfQT0W7WxPlgZDEI9p1wF1STDEDP3QDzy nozfHod2xJjqa8g3vY0l1bnPO7HN88l+3QydLIz+EA/+sxOa8D01b7yq6vXcQIGtdM4T Xc2nfotn/SZrYvGoyRppzfCgKCxw6ZnwW9KVJWS7SI5me42h9cRYWVSdoGRaTkr0SLbo DeDWraybz/P1pat6tmTDV25uWA0GRskwAWDGKtQjmOzK2Rn7g5yE5vjHU/n6DHWK7Rxd 1lLsfLnAcN8xnF3tafJu8/9ho0bNq0KMFQDPoF7wec0sYLqOg5RdQj8i1p2/vIsjkQm+ n3nw== 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=A7D9RJgwpQ1W8M/aA/vuUOPVBx7m9VVMSR4azYK+r2U=; fh=pnrvd4BMN4k74EHQGF4v9AZapK96lRc/GjrSaNVguhU=; b=YEn81/Es3/+SRJ0O1LNjsJMYfllHvGLsHDERcxl5G2yEfUVsZoRMqvVeUBfhpBnmYe 1FIuWWJSEtdWO8Uyi1EquMuoO/UwsIFbAVyVlwsBHKVwzZjfTA7Xe1b5eY0KoiLPVI4b 1okuoj8YiJ2QTo8UbjfPlfHQqMGbw0aBmzFGxpVUQEqMOsAh0N/ScoFWq2w27EmfBIlp eDX+11vSM8d86RD2wWz/ntE4BnEbF4SsFRek7hqd/wJN2bcVhfU9+QW4yVZDfRVlT4Cb alvoY6bO4E13LWedGhJcp1kmJCUU5UcH49ZUkEJNQHJO1sghs3sobKBzP0kScLbSMr5F zXbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=itkF8bUI; 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-137425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137425-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cr13-20020a170906d54d00b00a51dccf86b3si1918982ejc.737.2024.04.09.10.51.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 10:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137425-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=@google.com header.s=20230601 header.b=itkF8bUI; 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-137425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137425-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9CF9B1F23B63 for ; Tue, 9 Apr 2024 17:51:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5C8E156C63; Tue, 9 Apr 2024 17:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="itkF8bUI" Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 6BF30156998 for ; Tue, 9 Apr 2024 17:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712685076; cv=none; b=TuLVeJ667QuYet91pAyHaeZYUxJb0ufSEVV9UL++dPWXODRdRyqZ4HUSU5KlUnv7oj3RUQLpjULkp0ApqyJnrBo/kA3VTo99aJZix9Y4rNzPw3X38CTH53L/NBquHKtUSf+fartv2Aq2rtYSwfVJ7rkFNuOpxamjXcjM+Snqsbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712685076; c=relaxed/simple; bh=QVtEQp4/Pcfuor0ucORpy+mLoe+0G9NQLRsGApm4biU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=B+/KbfDB+6GsOfhO3f4oKJ2+BMm30cu/ezjM4Wg0zmf5xuRw+PcyYbER+81XV+Y+69YyJM2Q/r+9kUWMENwM0J5sSXhycMOY6dtS0SlvcECuwBBkPAE499TTN67mOXXnMQrxo75KsUwK4cFyqAHK4c2BwhY/a9yPMLrpq/SkHwo= 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=itkF8bUI; arc=none smtp.client-ip=209.85.215.202 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-pg1-f202.google.com with SMTP id 41be03b00d2f7-5c6245bc7caso4156337a12.3 for ; Tue, 09 Apr 2024 10:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712685075; x=1713289875; 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=A7D9RJgwpQ1W8M/aA/vuUOPVBx7m9VVMSR4azYK+r2U=; b=itkF8bUIabXOiKwdBCbeeKobhWElxIjYrJNzz526HLsXUB4YJyUFvtlf9irtdKrGJN sU4lz+itK40DWd6VluXd3Cqk3StVNb+rbnGQ02l2F381EX0kQcW1yjQQ5yAwnjYC5Zff YSLS/OuWJCQ/WQ5xi916NnQD8d4P75LlyqekEzVMvKf70TJ4n8zBXloWAtMAmCd9hapM Nh+Vdp+TrPSk2r+W80MGduWh+HCHuEZj0IM4U9IvdXnWW53jtsLTG1u+SPOO76eyab7C VS0Y2kZPPVs4oN4mdFKSNQDR9u0BooXAYn7L29wdLetkqur41XLZRH3Dl9P2vM7snd2h DoBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712685075; x=1713289875; 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=A7D9RJgwpQ1W8M/aA/vuUOPVBx7m9VVMSR4azYK+r2U=; b=Yp7cD+3/rokL3scKUb+Z3Q9NiGJFTM5E2PqkzRcRhGZQRjIr0739/pm2wfY7CrnZr4 2Dgft9SgbOv/z7dSJUUi2j1umsZnUfAAKDuG6ZvsdIcC3Nr3uCek/rA2u2W+GNTYS03t JsjFtvVMODbG8PEAt4EJb4fZLKF/3KIxHCNklgoqkS3fAodUCLrxLWblRKEvXIbiPqwU iyyIc0gLlcE/bbEkC7kNR5pyVY9FwqZVg3JwSpQikMeboktm5YJDgXM8BAV8FoGZ96kM s44WgY6DW80JIU0EXmgh1ChtwisYZWpUqtUwqI7JEE4eylbXkfGHv3yDUdtRsH++n+Wf sN9Q== X-Forwarded-Encrypted: i=1; AJvYcCXCBO8BZEXf3tPqxJytwZTYlmLzw7U2FHhauv362IB8wUzcV2iywKa+f/LNXqgYX9+EH/YHOwOOpk1Mz/UgVV+TzBL+GHG92ibNHHJN X-Gm-Message-State: AOJu0YyV3Fg5eFcaPCaEW7Q9nu6jxEOQegM+K0sn5dP3AVrm2/tq+ZNz EC/zkKnreuZB2qq6P5kp8Ivxt99pGdY3AC/FYf0cqaFrRjC/W3nIdgxcYnd8sOef65j2+VabPE+ XlA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:682:b0:5cd:8454:38b2 with SMTP id ca2-20020a056a02068200b005cd845438b2mr10850pgb.11.1712685073964; Tue, 09 Apr 2024 10:51:13 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 9 Apr 2024 10:51:06 -0700 In-Reply-To: <20240409175108.1512861-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: <20240409175108.1512861-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240409175108.1512861-3-seanjc@google.com> Subject: [PATCH 2/3] x86/cpu: Disable BHI mitigation by default when SPECULATION_MITIGATIONS=n From: Sean Christopherson To: Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Peter Zijlstra , Josh Poimboeuf Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Pawan Gupta , Daniel Sneddon Content-Type: text/plain; charset="UTF-8" Rework the initialization of bhi_mitigation to use positive CONFIG tests for the ON/AUTO cases so that lack of *any* CONFIG_SPECTRE_BHI_* #define, i.e. when the kernel is built with CONFIG_SPECULATION_MITIGATIONS=n, results in the mitigation being OFF by default, not AUTO. Per the help text for SPECULATION_MITIGATIONS, the intent is that 'N' disables all mitigations. Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob") Cc: stable@vger.kernel.org Cc: Pawan Gupta Cc: Daniel Sneddon Signed-off-by: Sean Christopherson --- arch/x86/kernel/cpu/bugs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 295463707e68..e1775debeafe 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1630,9 +1630,9 @@ enum bhi_mitigations { }; static enum bhi_mitigations bhi_mitigation __ro_after_init = - IS_ENABLED(CONFIG_SPECTRE_BHI_ON) ? BHI_MITIGATION_ON : - IS_ENABLED(CONFIG_SPECTRE_BHI_OFF) ? BHI_MITIGATION_OFF : - BHI_MITIGATION_AUTO; + IS_ENABLED(CONFIG_SPECTRE_BHI_ON) ? BHI_MITIGATION_ON : + IS_ENABLED(CONFIG_SPECTRE_BHI_AUTO) ? BHI_MITIGATION_AUTO : + BHI_MITIGATION_OFF; static int __init spectre_bhi_parse_cmdline(char *str) { -- 2.44.0.478.gd926399ef9-goog