From e38ad8e6a406ef7a5fd6cdfcbf2c4ab5859cb2af Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 10 Aug 2024 16:11:08 +0100 Subject: [PATCH] Mark EFI image .text section as writable. The EFI image .text section is taken from memtest_shared.bin, which is a combined code and data section. Some recent UEFI BIOSs set the page protection attributes when loading EFI images, so we need to mark this section as both executable and writable to prevent page faults. Fixes issue #413 and should fix issue #377. --- boot/header.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boot/header.S b/boot/header.S index 23e9a14..6380b32 100644 --- a/boot/header.S +++ b/boot/header.S @@ -7,7 +7,7 @@ // end of the boot sector), with the remainder of the header being provided by // setup.S. // -// Copyright (C) 2020-2023 Martin Whitaker. +// Copyright (C) 2020-2024 Martin Whitaker. // // Derived from Linux 5.6 arch/x86/boot/header.S: // @@ -190,6 +190,7 @@ section_table: .word 0 # NumberOfRelocations .word 0 # NumberOfLineNumbers .long IMAGE_SCN_MEM_READ \ + | IMAGE_SCN_MEM_WRITE \ | IMAGE_SCN_MEM_EXECUTE \ | IMAGE_SCN_CNT_CODE # Characteristics (section flags)