From 57877d167e8fd63e008cbb0c7c2b8e4f863e40ba Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 31 Oct 2021 22:01:29 +0100 Subject: [PATCH] elf: Align range lengths to p_align --- stage23/lib/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stage23/lib/elf.c b/stage23/lib/elf.c index 6398c6ac..6238ab98 100644 --- a/stage23/lib/elf.c +++ b/stage23/lib/elf.c @@ -420,7 +420,7 @@ static void elf64_get_ranges(uint8_t *elf, uint64_t slide, bool use_paddr, struc uint64_t this_top = load_addr + phdr.p_memsz; ranges[r].base = load_addr & ~(phdr.p_align - 1); - ranges[r].length = ALIGN_UP(this_top - ranges[r].base, 4096); + ranges[r].length = ALIGN_UP(this_top - ranges[r].base, phdr.p_align); ranges[r].permissions = phdr.p_flags & 0b111; r++;