From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 367FECCA486 for ; Mon, 18 Jul 2022 16:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235328AbiGRQjP (ORCPT ); Mon, 18 Jul 2022 12:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235768AbiGRQi5 (ORCPT ); Mon, 18 Jul 2022 12:38:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36BE4656F; Mon, 18 Jul 2022 09:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=q498TUyBgFKahP8/Mq2OBXRnjBoiDJLsVpL5QujD8eg=; b=qicc0heer4g3rBVZzes21636YX z5abYKnvAGcm6lO029U6O0Kk4hFYne39T6B1xyn3/U92xzDWz9Ex5MPFRTUmxHEnhOqOD4FxatXt9 C2DXdlsc12Luig8IxG2U5QN1W3er6+ldLP+AQk2J0EV5tG4nCjZ70XdHJXC3AAbNrzCAPS0HxA+44 YcQk/ji8kH1A+uvhrcNFvPvU2AeJPMCWvJAfcZ4bwwTUPPHkXC4m/V9qWFwR1b4DvC1P5nYWxZqeg kwKBRMpbEzkNwYyzAGkE6dYnK/MaELLQcV1Bh/UxL8TsVVWw2MNBoj3UmalN2/Cbr2f6WfUHyYOs7 DnJfNLSQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDTlT-00Cq9G-Lk; Mon, 18 Jul 2022 16:38:35 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 32FBB9802A7; Mon, 18 Jul 2022 18:38:35 +0200 (CEST) Date: Mon, 18 Jul 2022 18:38:35 +0200 From: Peter Zijlstra To: Borislav Petkov Cc: Thadeu Lima de Souza Cascardo , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, x86@kernel.org, ardb@kernel.org, tglx@linutronix.de, gregkh@linuxfoundation.org, torvalds@linux-foundation.org, Guenter Roeck , Josh Poimboeuf , stable@vger.kernel.org, Andrew Cooper Subject: Re: [PATCH] efi/x86: use naked RET on mixed mode call wrapper Message-ID: References: <20220715194550.793957-1-cascardo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 18, 2022 at 06:28:27PM +0200, Borislav Petkov wrote: > On Mon, Jul 18, 2022 at 01:41:37PM +0200, Peter Zijlstra wrote: > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > > index 10a3bfc1eb23..f934dcdb7c0d 100644 > > --- a/arch/x86/include/asm/nospec-branch.h > > +++ b/arch/x86/include/asm/nospec-branch.h > > @@ -297,6 +297,8 @@ do { \ > > alternative_msr_write(MSR_IA32_SPEC_CTRL, \ > > spec_ctrl_current() | SPEC_CTRL_IBRS, \ > > X86_FEATURE_USE_IBRS_FW); \ > > + altnerative_msr_write(MSR_IA32_PRED_CMD, PRED_CMD_IBPB, \ > > + X86_FEATURE_USE_IBPB_FW); \ > > } while (0) > > So I'm being told we need to untrain on return from EFI to protect the > kernel from it. Ontop of yours. I don't think there's any credible way we can protect against EFI taking over the system if it wants to. It runs at CPL0 and has access to the direct map. If EFI wants it can take over the system without trying.