diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h index b3513e7909..024175b2d5 100644 --- a/elf/dl-map-segments.h +++ b/elf/dl-map-segments.h @@ -112,6 +112,9 @@ _dl_map_segments (struct link_map *l, int fd, unallocated. Then jump into the normal segment-mapping loop to handle the portion of the segment past the end of the file mapping. */ + if (__glibc_unlikely (loadcmds[nloadcmds - 1].mapstart < + c->mapend)) + return N_("ELF load command address/offset not page-aligned"); if (__glibc_unlikely (__mprotect ((caddr_t) (l->l_addr + c->mapend), loadcmds[nloadcmds - 1].mapstart - c->mapend,