From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1ncT34-0001Pr-Bm for mharc-grub-devel@gnu.org; Thu, 07 Apr 2022 10:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncIto-0005cx-9k for grub-devel@gnu.org; Wed, 06 Apr 2022 23:33:32 -0400 Received: from mail.ispras.ru ([83.149.199.84]:38866) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncItk-0007RD-Nt for grub-devel@gnu.org; Wed, 06 Apr 2022 23:33:32 -0400 Received: from localhost.localdomain (unknown [80.240.223.29]) by mail.ispras.ru (Postfix) with ESMTPSA id 0CA3F40755C7; Thu, 7 Apr 2022 03:32:57 +0000 (UTC) From: Baskov Evgeniy To: grub-devel@gnu.org Cc: Baskov Evgeniy Subject: [PATCH RFC 0/3] EFI memory attributes Date: Thu, 7 Apr 2022 06:32:25 +0300 Message-Id: <20220407033228.30242-1-baskov@ispras.ru> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=83.149.199.84; envelope-from=baskov@ispras.ru; helo=mail.ispras.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 07 Apr 2022 10:23:45 -0400 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2022 03:33:32 -0000 UEFI specification does not guarantee that all memory would be executable and there exist some UEFI implementations imposing stricter memory management policies and restricting execution of memory where trampoline code generated by relocator is placed. That causes page fault during boot. Explicitly set memory attributes using DXE services for memory region possibly occupied with trampoline code and data. This patch works in the same way as the following patch for the Linux kernel [1]. Later the use of DXE services can be replaced with UEFI_MEMORY_ATTRIBUTE protocol, when it will become ready [2]. [1] https://lkml.org/lkml/2022/3/3/532 [2] https://bugzilla.tianocore.org/show_bug.cgi?id=3519 Baskov Evgeniy(3): efi: explicitly set memory attributes for memory relocator: allocate trampoline in lower 640k efi: provide definitions of DXE services table grub-core/kern/efi/efi.c | 11 + grub-core/kern/efi/mm.c | 67 ++++++++++++ grub-core/lib/i386/relocator.c | 5 grub-core/lib/relocator.c | 1 grub-core/lib/x86_64/efi/relocator.c | 6 - grub-core/loader/i386/bsd.c | 2 include/grub/efi/api.h | 149 +++++++++++++++++++++++++++ include/grub/efi/efi.h | 3 include/grub/i386/relocator.h | 3 9 files changed, 238 insertions(+), 9 deletions(-)