Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp177547rdh; Tue, 22 Aug 2023 17:09:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz946LcyGVyQxV2LJNNSXSYOpLIt6iJcb8o+CNBUxKXSACFkV0hr6+Gr0LUuPpePwsssId X-Received: by 2002:a05:6a20:542:b0:140:253b:b658 with SMTP id 2-20020a056a20054200b00140253bb658mr6794337pzq.57.1692749390762; Tue, 22 Aug 2023 17:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692749390; cv=none; d=google.com; s=arc-20160816; b=KQxO92+lqJIpdmVfuo0IRKvkLrs143X1V4cc2Y+bY5g+jTQNyyUP+rU9xYt21srfEl nLzBP5I5PNLoc54OkUtI7jB7fBMh76ukgjra+scUK45QeWEji4f0WomFyKfE5Vi84L1A d3ffssIaHzcT2+d/JF9a5PyJQMPx9YyPJHAXkv5lBrD2puw+TWVFr96JEcAnGZjfzaGd 5lVzRgMTNyBFYYOii10c+my9fMVxLHyW6lMGNfpmDWHUc1YUVkz16nBT5FTP+6D1brBt whC5rL1ST115aDZBtJ/vRq8B45NsHLp/7r/mHRlD842fGVqBqaKOE2vufG7/wYLs2zzK GU2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oMA0kKO6Uoi50Xas5wdtdSr9QIRjkbBAWf3h6/4u6pg=; fh=DKddrj6Ti8DgEe4gf6lqntVcxVBY22NPjCYHw/c+0Tk=; b=eeRX/C3oLSGGebWK+FypPu06X/n7USwfEEqZh6TItwJj1mhm+Yetj0MueSlD8bOTHY awTZaW2HUGtLI8LxeCrn4QCID1UEinRdGOZ9PUTzWM1F44kcj6T4/ykG9H3aFCJXfC9n NZTDFSe0UYOF85FZ335D+gqy0OOMXIlCuYUwRECmK5Bowf8G/41j7htVWtUbcuXihJKI LYiTO5OB8N//Qz4nMHxFzZzDQz8/plQWhaiRvgu2QLPALzc9Qmp3rGsmTWi7kijX0vxy 0Pi9QIWXq/WqK9AmzKyq4bYc1MTABJfID4+T67Uk+HshPupOchkjudWV3mJORqtaLIPv sBiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bTL/cfik"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020aa780d5000000b006880a2ca0fasi9409734pfn.312.2023.08.22.17.09.13; Tue, 22 Aug 2023 17:09:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bTL/cfik"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjHVV7I (ORCPT + 99 others); Tue, 22 Aug 2023 17:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbjHVV7H (ORCPT ); Tue, 22 Aug 2023 17:59:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 661A5CE8 for ; Tue, 22 Aug 2023 14:59:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 037FF60EA0 for ; Tue, 22 Aug 2023 21:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D606BC433C7; Tue, 22 Aug 2023 21:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692741544; bh=sfm1SPxcuzXHDiKsq8vWr9D2Z8Po/kb2b91YeVVlxEs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bTL/cfik2EBAetBY5d9zs3VVGPWGM2570QAHibQ8QhiMUaWqfnDqTwZrj9Zrf+M5M /fZjqo4q1iDSvYX0/T5X1OxAsYLhNnCYb9PVqADTSRpJ4oJx6zGTOGuO7GfqrUriSo BdEPcIvQqH1ganyJLo61lNqDU8q4Ts2mZOYCwraHEUdmSgC1jo/eVxb2HkmWHIjU04 V4RPOLk4E6EtI4c4Tqemz69PnC5AXtKkGGFOeWRNFvzzNwQzKPQcFTs+zg033/uQeu mxOSb77L0WAZiVw5iKJEyHxvrAEZTxRxaY9WZTqcnNMWAabQYcPPTbTPyBhiwumj+9 t2S0q1v5t19Cw== Date: Tue, 22 Aug 2023 14:59:01 -0700 From: Josh Poimboeuf To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Babu Moger , Paolo Bonzini , Sean Christopherson , David.Kaplan@amd.com, Andrew Cooper , Nikolay Borisov , gregkh@linuxfoundation.org, Thomas Gleixner Subject: Re: [PATCH 04/22] x86/srso: Fix SBPB enablement for spec_rstack_overflow=off Message-ID: <20230822215901.nkikxpcmlrssi42l@treble> References: <23a121e309d5e880eb35c441d9bdfa642d6d59f4.1692580085.git.jpoimboe@kernel.org> <20230821141619.GCZONxs5OdbbXFYSq2@fat_crate.local> <20230821163649.dyhxdeewlf6eerda@treble> <20230822055452.GDZORNrNdYc3OmGygU@fat_crate.local> <20230822060706.GEZORQiq136ZR5Tnc0@fat_crate.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230822060706.GEZORQiq136ZR5Tnc0@fat_crate.local> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 22, 2023 at 08:07:06AM +0200, Borislav Petkov wrote: > On Tue, Aug 22, 2023 at 07:54:52AM +0200, Borislav Petkov wrote: > > If you goto pred_cmd, you will overwrite it with PRED_CMD_SBPB here. > > Looking at this more: > > "If SRSO mitigation is not required or is disabled, software may use > SBPB on context/virtual machine switch to help protect against > vulnerabilities like Spectre v2." > > I think we actually want this overwrite to happen. Yeah, I had seen that. The combination of spectre_v2_user=on with srso=off doesn't make a whole lot of sense, but... give the user what they want and all. Which would presumably be IBPB *without* the SRSO mitigation (aka SBPB). > But then if retbleed=ibpb, entry_ibpb() will do bit 0 unconditionally... > > Hmm, lemme talk to people. I don't think we need to worry about that, SBPB is >= fam19 but retbleed is <= fam17. So either way (0x17 or 0x19) entry_ibpb() should do IBPB. -- Josh