From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p1YTh15+" 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