]> git.ipfire.org Git - thirdparty/grub.git/commit
modules: Load module sections at page-aligned addresses
authorMate Kukri <mate.kukri@canonical.com>
Wed, 9 Oct 2024 08:16:39 +0000 (09:16 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 11 Oct 2024 12:34:28 +0000 (14:34 +0200)
commit9fb80dd57eeca261e9a58a30a0915a2371dbaeba
tree697c0983e3671d4cdbf5b417082567030619fb96
parent6e2fe134ef536b178a8ae16d68fd2f55625c08fb
modules: Load module sections at page-aligned addresses

Currently we load module sections at whatever alignment gcc+ld happened
to dump into the ELF section header which is often less then the page
size. Since NX protections are page based this alignment must be rounded
up to page size on platforms supporting NX protections. This patch
switches EFI platforms to load module sections at 4 KiB page-aligned
addresses. It then changes the allocation size computation and the
loader code in grub_dl_load_segments() to align the locations and sizes
up to these boundaries and fills any added padding with zeros. All of
this happens before relocations are applied, so the relocations factor
that in with no change.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
Signed-off-by: Mate Kukri <mate.kukri@canonical.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/kern/dl.c