Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp321609lqp; Fri, 12 Apr 2024 21:21:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1KZz4w+lQJdWE8GleR7O0/jf49fC70l0tN75jzTZZbfSfRxfC+kJkQfqaoYaI6G2glz2QiWXl+8DbCAzKyiiOKews+xrV3I/Wm9sKLg== X-Google-Smtp-Source: AGHT+IENpqBy0tNTFJw3JLxv+CLU1qa52sDLKK7VdiIEvhQ1MuZAqMp2qidRAdbbeTDjqFCmyLrc X-Received: by 2002:a17:907:9725:b0:a51:d1f6:3943 with SMTP id jg37-20020a170907972500b00a51d1f63943mr3392173ejc.56.1712982118930; Fri, 12 Apr 2024 21:21:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712982118; cv=pass; d=google.com; s=arc-20160816; b=sQGHgtdXh2m7NBALrMlhktUUKlkT7/FrQpXcQ4NA5g2A3GFLEZUhb8euV7BINqunsP Uoxr4f9MBT5TwMzWrXk7dmajgHpMx5gjkx9Ugs4CxICwaUuqTLjPmDJ8q920R+y6rAUI HGgxT2wL5i7AM8VgsCfFiuCbJpyKIN7pUWrUXwN5AqhyDqJz9EfLoUYnQWftWrflsAK1 y1ezCwDDnkSOWoLZLpwlUbBbzflniD5JXjmSHW0Asrq3zuWhy4VgtK/UI5L3aQUozu65 SP+iKjz2PMhLR7IsRgOPN6p4RAjyaJTWITTMpLyRHOtccG1aaAMP6IFzgEeE0QbCODwR 7pzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LUHHQXutT1teVrhW/Gjtpp/x1IDVeAKY+vt99HUrIss=; fh=D1drUkjhd6cQ461FGcgjExl1O+jZ7EhaGJAtOyxVAPQ=; b=qA+6BbCH5wI2/UyuLR2VNyx1nWa4xxsKffWZiWQ+apDGJF/L9CyUeJTFNVzpupTjDp yqgzrqqE6oAWwgOMBnfS4dcHG48eR3efwfNNuDtep/y7Se4HzNGIUy0P4dpSA4FVSCUX LUAoSQ2cAe6X0Z02cvyPaq8LtoxkiScZJ5aQU2EkinVYs7REovn/0IICVwoCYDtPkgOG zI4JxTYe9y41yJGsuAh8had/MwpVwHzjdm/nZJpIh75VsuqfhZNrlztSyaerZrEvLpNV +KRjGMbx8vnLyftB3NejCAQlGfMfZyQbTK+6DBZXXmbIhNrE/ZfuGLsfBMJlD+k7RZAj NOEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p1YTh15+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143574-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143574-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 b17-20020a170906d11100b00a5246fee810si417508ejz.320.2024.04.12.21.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 21:21:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143574-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=p1YTh15+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143574-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143574-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 7AB2A1F23B4A for ; Sat, 13 Apr 2024 04:21:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 620EB1C2BE; Sat, 13 Apr 2024 04:21:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p1YTh15+" 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 75DCD1BF37 for ; Sat, 13 Apr 2024 04:21:38 +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=1712982098; cv=none; b=Uq0PUmCzSK94RQTQ9qF1P6DLbUCWBrik+IEbIrfjyqaF+y0kuXVDXcODPRANY86KxYAZDWO/HN6znvNjGrfMjNciIdXxMOJRtIROB7ladaHLhBQu7kbGA3bjrsyeSmtR2C87NHgHObVaGjlUSTuyRF/Edw+wPcl1TSpzNDVUgEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712982098; c=relaxed/simple; bh=CCB9vHLqRR69IsVfqOm+w0j+qxCe4Y2M4F8ATCYzNNo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LeGk7qMzQkK5I5Y2rvUh0rm2EacsU1lvMlrC1L8vArixsmyhkEFDJ45iTB3I5ayHocAcqdh6tUiUs5+0lyRVIagJ5R+0rD7IyVNqq9++d6z86OtKsHpfz/8U8Tt86NeAvWcvfb+Ypv/I4WxLZPg3EzcyIHE85mFeO9aHg4cttyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p1YTh15+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D17FC113CD; Sat, 13 Apr 2024 04:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712982097; bh=CCB9vHLqRR69IsVfqOm+w0j+qxCe4Y2M4F8ATCYzNNo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p1YTh15+eGg5LcpadJEMrQT52iB53KIgbccvUQTglxB52vMCV/L7T90ZDpJCvh//L X1vdiYc45ERAMhcP5VtAoS4wPQOg1BEtHeyzUmhBLuTHON4rP3YVGPrTHZHOoJ09nx wilqxER0gaMhRTIAxlYWyV9dwcvClfvDTCwv9Pn4RZA1sEK9VR0mkssvsNm2vXJZlL MyWSdhdGYvyIEFv78x6MTn8aTz9hGPWTEJSPe+VrOOP+meayPrhpg+R1y6IVzRa2oN QtbGPakljkAxRfdbp5A/jIpH9F2DZoVEArODFDBtT5jSOq6GI+j3sPjjsmTnu4qTRe 3tWVXwVbJFJ7w== Date: Fri, 12 Apr 2024 21:21:35 -0700 From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Daniel Sneddon , Pawan Gupta , Thomas Gleixner , Alexandre Chartre , Konrad Rzeszutek Wilk , Peter Zijlstra , Greg Kroah-Hartman , Sean Christopherson , Andrew Cooper , Dave Hansen , Nikolay Borisov , KP Singh , Waiman Long , Borislav Petkov , Ingo Molnar Subject: Re: [PATCH 3/3] x86/bugs: Remove support for Spectre v2 LFENCE "retpolines" Message-ID: <20240413042135.z2vglouqfl763m77@treble> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Apr 12, 2024 at 11:10:34AM -0700, Josh Poimboeuf wrote: > I found several bugs where code assumes that X86_FEATURE_RETPOLINE > actually means retpolines (imagine that!). In fact that feature also > includes the original AMD LFENCE "retpolines", which aren't in fact > retpolines. > > Really, those "retpolines" should just be removed. They're already > considered vulnerable due to the fact that the speculative window after > the indirect branch can still be long enough to do multiple dependent > loads. And recent tooling makes such gadgets easier to find. > > Also, EIBRS_LFENCE tests worse in real-world benchmarks than the actual > BHI mitigations, so it's both slower and less secure. > > Specifically this removes support for the following cmdline options: > > - spectre_v2=retpoline,amd > - spectre_v2=retpoline,lfence > - spectre_v2=eibrs,lfence > > Now when any of those options are used, it will print an error and fall > back to the defaults (spectre_v2=auto spectre_bhi=on). > > Signed-off-by: Josh Poimboeuf Compile fix: diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index e1c421282a78..3a1349c0f225 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -53,7 +53,7 @@ #ifdef CONFIG_MITIGATION_RETPOLINE # define DISABLE_RETPOLINE 0 #else -# define DISABLE_RETPOLINE (1 << (X86_FEATURE_RETPOLINE & 31) +# define DISABLE_RETPOLINE (1 << (X86_FEATURE_RETPOLINE & 31)) #endif #ifdef CONFIG_MITIGATION_RETHUNK