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 58C68C433EF for ; Thu, 3 Mar 2022 14:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbiCCOQf (ORCPT ); Thu, 3 Mar 2022 09:16:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbiCCOQf (ORCPT ); Thu, 3 Mar 2022 09:16:35 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD7218CC65; Thu, 3 Mar 2022 06:15:48 -0800 (PST) Received: from mail.ispras.ru (unknown [83.149.199.84]) by mail.ispras.ru (Postfix) with ESMTPSA id AB11A40755C1; Thu, 3 Mar 2022 14:15:46 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 03 Mar 2022 17:15:46 +0300 From: baskov@ispras.ru To: Ard Biesheuvel Cc: Matthew Garrett , Peter Jones , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , linux-efi , Linux Kernel Mailing List Subject: Re: [PATCH RFC v2 0/2] Handle UEFI NX-restricted page tables In-Reply-To: References: <20220224154330.26564-1-baskov@ispras.ru> User-Agent: Roundcube Webmail/1.4.4 Message-ID: <773b799354b50adf854837d8a6d54b8f@ispras.ru> X-Sender: baskov@ispras.ru Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On 2022-02-28 19:45, Ard Biesheuvel wrote: > (cc Matt and Peter) > > > Thanks for exploring my suggestion to use the DXE services for this. > > Given that this is a workaround for a very specific issue arising on > PI based implementations of UEFI, I consider this a quirk, and so I > think this approach is reasonable. I'd still like to gate it on some > kind of identification, though - perhaps something related to DMI like > the x86 core kernel does as well. > > I've cc'ed Peter and Matt, who have much more experience dealing with > these kinds of things on x86 - my experience is mostly based on ARM, > which tends to be less quirky when it comes to UEFI support, given > that vendors that implement EFI actually care about being compliant > (instead of only about getting a windows sticker) > > Matt, Peter, any thoughts? > > >> Baskov Evgeniy (2): >> efi: declare DXE services table >> libstub: ensure allocated memory to be executable >> >> arch/x86/include/asm/efi.h | 5 ++ >> drivers/firmware/efi/libstub/efistub.h | 53 ++++++++++++++++++++ >> drivers/firmware/efi/libstub/x86-stub.c | 73 >> ++++++++++++++++++++++++++-- >> include/linux/efi.h | 2 + >> 4 files changed, 128 insertions(+), 5 deletions(-) We now have tested the patch on major platforms, and it works without any issues. But in case of firmware bugs I have changed the code to only modify attributes if either EFI_MEMORY_RO or EFI_MEMORY_WP is set and the memory has type EfiGcdMemoryTypeSystemMemory. I also added option CONFIG_EFI_DXE_MEM_ATTRIBUTES (enabled by default), to allow this code to be disabled at compile time. These changes will be sent in version 3 of the patch. Thanks, Baskov Evgeniy