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 E19EC1F4FD1; Mon, 21 Oct 2024 10:42:25 +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=1729507346; cv=none; b=gfG8Qm3jhxRz10kWpoPZqFgmwiQeuoRzQHuqpSMirTtAe/5a1nKQgXYiWsUX2Qyf5I9EteJTm/2BPfxz7LOduUwOjZaRF/37cQz6sSp+VirEzimEQ1trnErKn6FuaSbhc4K+blIBPAr6GAMsIyUq1MbW2hUien3QEFKPeJBSnh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507346; c=relaxed/simple; bh=ShJy1xWRkGs0P7i//ZxDtDtmWWem3r2yZqzsL9wqags=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C6IZ04AS+NuLClt7DYgGhXEB7ahhdwGrZqFc5U7B7StXGX/HbzBVle/eVCnB/nzUuIRG+Mh1MvMIJ9VX5xAAMTF2kD49zq3hplAgRvD17QJg5K7XLxFBBurOlExQSYe4j41M/Oj+acDHfRq8LfYf0sBi3TE5wYlQUNO9Yv5QZWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ges1i7Zc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ges1i7Zc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33246C4CEC3; Mon, 21 Oct 2024 10:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729507345; bh=ShJy1xWRkGs0P7i//ZxDtDtmWWem3r2yZqzsL9wqags=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ges1i7ZcFP3ckvjzgQ4im77bSkmVp61Tdl/D7p1Dxazu+GD0YXpy7d0BL2rZPup+n jVIYO1w/aR9bsFP6Gybgi5ygpJXJFDIt7BlGbM1MRBM0qtkD0qBgne+6wMeA12Zoxp G0DtqTvb5/gePVYyGsz78x2UdvbVva4LkYdEDgfc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Borislav Petkov , Johannes Wikner , stable@kernel.org Subject: [PATCH 6.1 46/91] x86/bugs: Skip RSB fill at VMEXIT Date: Mon, 21 Oct 2024 12:25:00 +0200 Message-ID: <20241021102251.618382903@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021102249.791942892@linuxfoundation.org> References: <20241021102249.791942892@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Wikner commit 0fad2878642ec46225af2054564932745ac5c765 upstream. entry_ibpb() is designed to follow Intel's IBPB specification regardless of CPU. This includes invalidating RSB entries. Hence, if IBPB on VMEXIT has been selected, entry_ibpb() as part of the RET untraining in the VMEXIT path will take care of all BTB and RSB clearing so there's no need to explicitly fill the RSB anymore. [ bp: Massage commit message. ] Suggested-by: Borislav Petkov Signed-off-by: Johannes Wikner Cc: Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1093,6 +1093,14 @@ do_cmd_auto: case RETBLEED_MITIGATION_IBPB: setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB); mitigate_smt = true; + + /* + * There is no need for RSB filling: entry_ibpb() ensures + * all predictions, including the RSB, are invalidated, + * regardless of IBPB implementation. + */ + setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT); + break; default: @@ -2603,6 +2611,13 @@ static void __init srso_select_mitigatio if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) { setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT); srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT; + + /* + * There is no need for RSB filling: entry_ibpb() ensures + * all predictions, including the RSB, are invalidated, + * regardless of IBPB implementation. + */ + setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT); } } else { pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");