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 2278FC001B0 for ; Tue, 27 Jun 2023 08:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbjF0Iiq (ORCPT ); Tue, 27 Jun 2023 04:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjF0Iib (ORCPT ); Tue, 27 Jun 2023 04:38:31 -0400 Received: from cavan.codon.org.uk (cavan.codon.org.uk [176.126.240.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01C332D73 for ; Tue, 27 Jun 2023 01:37:48 -0700 (PDT) Received: by cavan.codon.org.uk (Postfix, from userid 1000) id DBB7240A40; Tue, 27 Jun 2023 09:37:46 +0100 (BST) Date: Tue, 27 Jun 2023 09:37:46 +0100 From: Matthew Garrett To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, Daniel Kiper , Glenn Washburn Subject: Re: [PATCH] efi/libstub: Disable PCI DMA before grabbing the EFI memory map Message-ID: <20230627083746.GA21374@srcf.ucam.org> References: <20230627074132.1016795-1-ardb@kernel.org> <20230627080039.GA20512@srcf.ucam.org> <20230627081706.GA20814@srcf.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Tue, Jun 27, 2023 at 10:32:36AM +0200, Ard Biesheuvel wrote: > On Tue, 27 Jun 2023 at 10:17, Matthew Garrett wrote: > > > > On Tue, Jun 27, 2023 at 10:14:16AM +0200, Ard Biesheuvel wrote: > > > > > Not quite. It should only fail the first time if the memory map > > > changed since the last call to GetMemoryMap(), and normally, this will > > > only happen if some kind of asynchronous event was triggered after > > > GetMemoryMap() but before ExitBootServices(). (This is why calling > > > ExitBootServices() at most twice should always suffice: the first call > > > disables the timer interrupt, so the second time around, no events > > > will fire in the mean time) > > > > Can't driver shutdown code also end up altering it? > > Yes, but doing so violates the UEFI spec: > EVT_SIGNAL_EXIT_BOOT_SERVICES is documented as not permitting the use > of memory allocation services, either directly or indirectly (via the > use of other external code that might use them) Maybe people have become better at observing that restriction! Anyway, feel free to ignore my nit in that case.