On 2024-02-05 17:49, Ard Biesheuvel wrote:
On Mon, 5 Feb 2024 at 14:44, Evgeniy Baskov <baskov@xxxxxxxxx> wrote:
Image loaders which check the contiguity of executable images consider
sections adjacent in the section table to be adjacent in virtual
memory.
Sort sections by their RVAs in PE section table.
Signed-off-by: Evgeniy Baskov <baskov@xxxxxxxxx>
---
arch/x86/boot/header.S | 56
+++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 28 deletions(-)
Hi,
I just sent a fix for this issue:
https://lore.kernel.org/linux-efi/20240205081106.2415414-2-ardb+git@xxxxxxxxxx/T/#u
Could you please check whether it works for you as well?
Yes, your patch works fine as well. Thanks!
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index b2771710ed98..097b84ab288c 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -153,6 +153,34 @@ section_table:
IMAGE_SCN_MEM_READ | \
IMAGE_SCN_MEM_DISCARDABLE # Characteristics
+ .ascii ".text"
+ .byte 0
+ .byte 0
+ .byte 0
+ .long ZO__data
+ .long setup_size
+ .long ZO__data # Size of initialized
data
+ # on disk
+ .long setup_size
+ .long 0 # PointerToRelocations
+ .long 0 # PointerToLineNumbers
+ .word 0 # NumberOfRelocations
+ .word 0 # NumberOfLineNumbers
+ .long IMAGE_SCN_CNT_CODE | \
+ IMAGE_SCN_MEM_READ | \
+ IMAGE_SCN_MEM_EXECUTE # Characteristics
+
+ .ascii ".data\0\0\0"
+ .long ZO__end - ZO__data # VirtualSize
+ .long setup_size + ZO__data # VirtualAddress
+ .long ZO__edata - ZO__data # SizeOfRawData
+ .long setup_size + ZO__data # PointerToRawData
+
+ .long 0, 0, 0
+ .long IMAGE_SCN_CNT_INITIALIZED_DATA | \
+ IMAGE_SCN_MEM_READ | \
+ IMAGE_SCN_MEM_WRITE # Characteristics
+
#ifdef CONFIG_EFI_MIXED
.asciz ".compat"
@@ -185,34 +213,6 @@ pecompat_fstart:
.set pecompat_vsize, 0
.set pecompat_fstart, setup_size
#endif
- .ascii ".text"
- .byte 0
- .byte 0
- .byte 0
- .long ZO__data
- .long setup_size
- .long ZO__data # Size of initialized
data
- # on disk
- .long setup_size
- .long 0 # PointerToRelocations
- .long 0 # PointerToLineNumbers
- .word 0 # NumberOfRelocations
- .word 0 # NumberOfLineNumbers
- .long IMAGE_SCN_CNT_CODE | \
- IMAGE_SCN_MEM_READ | \
- IMAGE_SCN_MEM_EXECUTE # Characteristics
-
- .ascii ".data\0\0\0"
- .long ZO__end - ZO__data # VirtualSize
- .long setup_size + ZO__data # VirtualAddress
- .long ZO__edata - ZO__data # SizeOfRawData
- .long setup_size + ZO__data # PointerToRawData
-
- .long 0, 0, 0
- .long IMAGE_SCN_CNT_INITIALIZED_DATA | \
- IMAGE_SCN_MEM_READ | \
- IMAGE_SCN_MEM_WRITE # Characteristics
-
.set section_count, (. - section_table) / 40
#endif /* CONFIG_EFI_STUB */
--
2.43.0