mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 14:00:30 +00:00
elf: Check invalid hole in PT_LOAD segments [BZ #28838]
Changes in v2: 1. Update commit log. commit163f625cf9
Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Dec 21 12:35:47 2021 -0800 elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688] removed the p_align check against the page size. It caused the loader error or crash on elf/tst-p_align3 when loading elf/tst-p_alignmod3.so, which has the invalid p_align in PT_LOAD segments, added by commitd8d94863ef
Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Dec 21 13:42:28 2021 -0800 The loader failure caused by a negative length passed to __mprotect is random, depending on architecture and toolchain. Update _dl_map_segments to detect invalid holes. This fixes BZ #28838. Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
parent
949ad78a18
commit
2c0915cbf5
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user