aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-12-21 12:35:47 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-12-22 05:12:30 -0800
commit163f625cf9becbb82dfec63a29e566324129c0cd (patch)
treea095c1741a3db5b0a9e82a262d8c68047ac5526d
parentd3e4f5a1014db09ff1c62c6506f92cba469e193d (diff)
downloadglibc-163f625cf9becbb82dfec63a29e566324129c0cd.zip
glibc-163f625cf9becbb82dfec63a29e566324129c0cd.tar.gz
glibc-163f625cf9becbb82dfec63a29e566324129c0cd.tar.bz2
elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688]
p_align does not have to be a multiple of the page size. Only PT_LOAD segment layout should be aligned to the page size. 1: Remove p_align check against the page size. 2. Use the page size, instead of p_align, to check PT_LOAD segment layout. Reviewed-by: Florian Weimer <fweimer@redhat.com>
-rw-r--r--elf/dl-load.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 7215931..2a14433 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1133,16 +1133,11 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
case PT_LOAD:
/* A load command tells us to map in part of the file.
We record the load commands and process them all later. */
- if (__glibc_unlikely ((ph->p_align & (GLRO(dl_pagesize) - 1)) != 0))
- {
- errstring = N_("ELF load command alignment not page-aligned");
- goto lose;
- }
if (__glibc_unlikely (((ph->p_vaddr - ph->p_offset)
- & (ph->p_align - 1)) != 0))
+ & (GLRO(dl_pagesize) - 1)) != 0))
{
errstring
- = N_("ELF load command address/offset not properly aligned");
+ = N_("ELF load command address/offset not page-aligned");
goto lose;
}