Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp848705lqp; Sun, 14 Apr 2024 02:19:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvky6uRexlwddo9Xm3IiWucSPJR0JTABn5A8g8eZJ83KzybQnJ80P0N7d8c7y1NWQqFtEnUUc1QyLPDmhRpL73vamv/dnyfVyylCBItg== X-Google-Smtp-Source: AGHT+IHSqWi/OqAdayF7ZEej/KWZk8pwyoCfxW//WRaKMQ1Ifn/y/c5JNzWv5ED6imZkwbvbLtWu X-Received: by 2002:a05:6871:520b:b0:22e:d541:7eb5 with SMTP id ht11-20020a056871520b00b0022ed5417eb5mr9346057oac.38.1713086383041; Sun, 14 Apr 2024 02:19:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713086383; cv=pass; d=google.com; s=arc-20160816; b=sE/sc/WYxI+80IlxKUIBWvLOXZvkVPJ+9kEHScU3OOuTDufmP1CWm4AASsAj75utQ/ DpuWIaj7ArAiu4rXlNhJ7t4OEUi28bAZES7PkJVPREKMrBAln6PN90KvTDsarlywDXnf mJySy8dBZ0SsE+3uqSORk3iEl/H3kMeoC8wSWE3Fd9fpK+i0/I25j6MEP22t8eA/+6ht fzteMv71/udtZRhZbfhiGNPCLZASfSh/VoGXvJRcvY4AXYY8ujazs6A8Pymj06CZcwqz UCR3HZgsz+ohwXWiOdKQD10LZdlWjEimDu025kCD8CoEoHrdFMdJxP+iBS8uHmPJ6jWO dg/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=NZFwphc8SHYVbPnkWi5EsmyxN8HbgaWmtnfTFBlfG2c=; fh=R1QmE2OeO7JK6I+xtg1+hJuAk3WGsJr1U3xA2JZqleM=; b=uqvnhmxRTP+oi598WMbTGhGa+hKruUF0zWnRYaZrjg3NgNoboZl2a5CPGNsozjwBnP FDisQw2MTrhC0KCLsB4hrwZePXxC7GLnYhV1ztNKwMFc39Vl/mM9xkH2oangTXaJtxqs TJxysLfYnVLXFUOwFIassxeBC1VtHoJodheiWu43khP8gwCxTWdWwl7KUr/WCMDBnthN qSProFhBBC6+X7HPDctRjJhd092St3TucHY0YghqXrbAjJJoEvCn47T/CravielDNEoY qjPm2fnKxJmMTww+pQiIEAwh0QzJ4yS9F7DNKUreFBLQTdCgjoOoPJkQADtIx8bls4w9 CuFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=v+zPO3NB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-144071-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id dw27-20020a056a00369b00b006eab6f3d8a8si6320938pfb.243.2024.04.14.02.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 02:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144071-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=@linutronix.de header.s=2020 header.b=v+zPO3NB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-144071-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 8FA542821E9 for ; Sun, 14 Apr 2024 09:19:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD45622F00; Sun, 14 Apr 2024 09:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v+zPO3NB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/R9VLDvu" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 A406C1AACB; Sun, 14 Apr 2024 09:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713086377; cv=none; b=sbMrlRe4zvfRxGev/q/MegIUidwD8+l4Zv/bfjkXWpQYsM8FsZ5I6r9EuGoeiE15g+GncUvRtzzq5YoDBuR31WVlte/zxKL/LcP8VyfT9oD68FWd5TRlQZZp/I7W6Ll8EWF7HVV+8/cgnQ5GLzmFMpFqvhUuRS0oOQIUlAn5hDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713086377; c=relaxed/simple; bh=lnii2kZ8IUvaZdbR0jQA4QKCoeVDNlBUw1Zj8Jm+CSI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ZWN/JsneHkCj1Sb5OJPIe3skNktr8T0x0f097Aqm++ucqeC+069bdbEuSdAOLv2/r9mrvQkmxa14RCqwuejPAXvsumB/FfRdpuzNWbOTTE27G/qb3RNZXaFiT9tV/tfRrCSjc8kHw/FKjQ3KDLPqVjijvgRFlTnmgIb1zlGPrFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v+zPO3NB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/R9VLDvu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Sun, 14 Apr 2024 09:19:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713086373; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NZFwphc8SHYVbPnkWi5EsmyxN8HbgaWmtnfTFBlfG2c=; b=v+zPO3NBl+tOpY3Gaa72M2N78iAfXLIyevqEEBWTNi9nQ4GyWdAa3inddo0OiaWI0uEynB I2hpVDIKTJk4xJ7sbM0MdcfFEgPw5MuSd5pqmfp0Pe3STGPH5IV4oNcN7iyCLoMR7jRHkO aVyZrUbXJtmtu26sXxssgfyAzQc3SpQK5nFfUwfqm9TuM9RfFVLHTOxRU3FTo0nWQ4VwFn usbll9gf3oIuRQLIIZKRTD02EDSVesO/OkPj1pycqjC8MVlKknRfIxiSWBnzW7reuis9Rv y/95iDuuGC+JNX0Qez3hk4ScGNQAw7Mo2EQzVmg69Lqxa3GvjF+sH+qTBRitVA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713086373; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NZFwphc8SHYVbPnkWi5EsmyxN8HbgaWmtnfTFBlfG2c=; b=/R9VLDvuW1MdHw2em5hXToeU3yOsOLRAWusGogzGe914o418BIQ236z4Hx6Dvh9OEYplKZ T8EklU8FDWr2fJCQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/bugs: Fix BHI retpoline check Cc: Josh Poimboeuf , Ingo Molnar , Pawan Gupta , Borislav Petkov , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171308637277.10875.5583955178829069240.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 69129794d94c544810e68b2b4eaa7e44063f9bf2 Gitweb: https://git.kernel.org/tip/69129794d94c544810e68b2b4eaa7e44063f9bf2 Author: Josh Poimboeuf AuthorDate: Fri, 12 Apr 2024 11:10:33 -07:00 Committer: Ingo Molnar CommitterDate: Sun, 14 Apr 2024 11:10:05 +02:00 x86/bugs: Fix BHI retpoline check Confusingly, X86_FEATURE_RETPOLINE doesn't mean retpolines are enabled, as it also includes the original "AMD retpoline" which isn't a retpoline at all. Also replace cpu_feature_enabled() with boot_cpu_has() because this is before alternatives are patched and cpu_feature_enabled()'s fallback path is slower than plain old boot_cpu_has(). Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Reviewed-by: Pawan Gupta Cc: Borislav Petkov Cc: Linus Torvalds Link: https://lore.kernel.org/r/ad3807424a3953f0323c011a643405619f2a4927.1712944776.git.jpoimboe@kernel.org --- arch/x86/kernel/cpu/bugs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index ca295b0..ab18185 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1652,7 +1652,8 @@ static void __init bhi_select_mitigation(void) return; /* Retpoline mitigates against BHI unless the CPU has RRSBA behavior */ - if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { + if (boot_cpu_has(X86_FEATURE_RETPOLINE) && + !boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE)) { spec_ctrl_disable_kernel_rrsba(); if (rrsba_disabled) return; @@ -2804,11 +2805,13 @@ static const char *spectre_bhi_state(void) { if (!boot_cpu_has_bug(X86_BUG_BHI)) return "; BHI: Not affected"; - else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW)) + else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW)) return "; BHI: BHI_DIS_S"; - else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP)) + else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP)) return "; BHI: SW loop, KVM: SW loop"; - else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && rrsba_disabled) + else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && + !boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE) && + rrsba_disabled) return "; BHI: Retpoline"; else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT)) return "; BHI: Vulnerable, KVM: SW loop";