Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp751193ybt; Wed, 24 Jun 2020 10:17:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9akbG9pPDDIpMe8Zif3cKk7M28B5ZP9vRik2YkAiQWu8CxJuCDuXVdDosogn/jTs6Dn1k X-Received: by 2002:a17:906:5fc4:: with SMTP id k4mr16151526ejv.94.1593019055970; Wed, 24 Jun 2020 10:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593019055; cv=none; d=google.com; s=arc-20160816; b=H93e7z8gznG+bLPFzSPgxLufewsrh2xzuS4QXwsgUZlZDYRdVtqn0gSIbr33vO7ip3 it0yC9cWg6N5nxo8i4WiF59dfhIrlK4BshhIIk8p9zrwu6+CcUZGPoNdzw4jygkiBdAX ysIGFm3jce7c0lV/jIQZ+H8OboW6SvSTOW91m+XOSWTsFfSqWwKbICco6MgVjWacYBzD HgNefG0JgHdi+cS5ZqmnANwMKchz7slHvHlNYp4TPahZg+vuPeKsXi0wNbckKc8a1Qyy qrL5MJwXHzQL/87dtX2sgT7BEVV2uG2zofAvMF2TYLdkEJGNQsTwh34Vuq5XggHX9uU3 oGLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tqgzNqndivUiYtdHJZZ1IFqn3lNosk3ZvciM/uXv4Y4=; b=uUz1bkYWPPSTfF1DeBtCqmaUm8S1njQ0sgpSoYlzGR0Z1J9HsSk490jZDn3rKGlZBT htlwYFu/Ww0o0QJ8fC59wikhWPzdkX9b2qZyOBC2FP5xD+z2YBBL/4qeZoNaARUaqcRs 55ArFnYyzs57JY9I4Wln7jZmJoQkXhl84U5+Lp7FKr3Rz9GiKK4YOdFWvx0UVYL3MDjV OmmuvgsGtLsr1WV6L3fMhKZef8IgoA+4rcCUE/mLz65PpLqAnQzZGfQLnrqe+Pso2xpf B9ZFxdQyQ2azIcDBzDrGm3rvaGw6X038juSkrVvFOjFSM01uy8mGbWTWBB+xEp1LHFNg 2EmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn12si16364854ejc.287.2020.06.24.10.17.12; Wed, 24 Jun 2020 10:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405423AbgFXRQU (ORCPT + 99 others); Wed, 24 Jun 2020 13:16:20 -0400 Received: from foss.arm.com ([217.140.110.172]:45398 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405292AbgFXRQT (ORCPT ); Wed, 24 Jun 2020 13:16:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B1C8B1FB; Wed, 24 Jun 2020 10:16:18 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F027B3F71E; Wed, 24 Jun 2020 10:16:15 -0700 (PDT) Date: Wed, 24 Jun 2020 18:16:13 +0100 From: Dave Martin To: Ard Biesheuvel Cc: Mark Rutland , linux-efi , Catalin Marinas , Arvind Sankar , Will Deacon , Nathan Chancellor , linux-arch , Fangrui Song , Masahiro Yamada , X86 ML , Russell King , clang-built-linux , Ingo Molnar , Borislav Petkov , Kees Cook , Arnd Bergmann , Thomas Gleixner , Peter Collingbourne , Linux ARM , Nick Desaulniers , Linux Kernel Mailing List , James Morse Subject: Re: [PATCH v3 3/9] efi/libstub: Remove .note.gnu.property Message-ID: <20200624171613.GJ25945@arm.com> References: <20200624033142.cinvg6rbg252j46d@google.com> <202006232143.66828CD3@keescook> <20200624104356.GA6134@willie-the-truck> <202006240820.A3468F4@keescook> <202006240844.7BE48D2B5@keescook> <20200624162919.GH25945@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 06:40:48PM +0200, Ard Biesheuvel wrote: > On Wed, 24 Jun 2020 at 18:29, Dave Martin wrote: > > > > On Wed, Jun 24, 2020 at 05:48:41PM +0200, Ard Biesheuvel wrote: > > > On Wed, 24 Jun 2020 at 17:45, Kees Cook wrote: > > > > > > > > On Wed, Jun 24, 2020 at 05:31:06PM +0200, Ard Biesheuvel wrote: > > > > > On Wed, 24 Jun 2020 at 17:21, Kees Cook wrote: > > > > > > > > > > > > On Wed, Jun 24, 2020 at 12:46:32PM +0200, Ard Biesheuvel wrote: > > > > > > > I'm not sure if there is a point to having PAC and/or BTI in the EFI > > > > > > > stub, given that it runs under the control of the firmware, with its > > > > > > > memory mappings and PAC configuration etc. > > > > > > > > > > > > Is BTI being ignored when the firmware runs? > > > > > > > > > > Given that it requires the 'guarded' attribute to be set in the page > > > > > tables, and the fact that the UEFI spec does not require it for > > > > > executables that it invokes, nor describes any means of annotating > > > > > such executables as having been built with BTI annotations, I think we > > > > > can safely assume that the EFI stub will execute with BTI disabled in > > > > > the foreseeable future. > > > > > > > > yaaaaaay. *sigh* How long until EFI catches up? > > > > > > > > That said, BTI shouldn't _hurt_, right? If EFI ever decides to enable > > > > it, we'll be ready? > > > > > > > > > > Sure. Although I anticipate that we'll need to set some flag in the > > > PE/COFF header to enable it, and so any BTI opcodes we emit without > > > that will never take effect in practice. > > > > In the meantime, it is possible to build all the in-tree parts of EFI > > for BTI, and just turn it off for out-of-tree EFI binaries? > > > > Not sure I understand the question. What do you mean by out-of-tree > EFI binaries? And how would the firmware (which is out of tree itself, > and is in charge of the page tables, vector table, timer interrupt etc > when the EFI stub executes) distinguish such binaries from the EFI > stub? I'm not an EFI expert, but I'm guessing that you configure EFI with certain compiler flags and build it. Possibly some standalone EFI executables are built out of the same tree and shipped with the firmware from the same build, but I'm speculating. If not, we can just run all EFI executables with BTI off. > > If there's no easy way to do this though, I guess we should wait for / > > push for a PE/COFF flag to describe this properly. > > > > Yeah good point. I will take this to the forum. In the interim, we could set the GP bit in EFI's page tables for the executable code from the firmware image if we want this protection, but turn it off in pages mapping the executable code of EFI executables. This is better than nothing. Cheers ---Dave