Andreas Schwab
9bc2056b1a
- get-nprocs-sched-uninit-read.patch: linux: __get_nprocs_sched: do not feed CPU_COUNT_S with garbage (BZ #28850) - get-nprocs-inaccurate.patch: linux: fix accuracy of get_nprocs and get_nprocs_conf (BZ #28865) - strcmp-rtm-fallback.path: x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case (BZ #28896) - pt-load-invalid-hole.patch: elf: Check invalid hole in PT_LOAD segments (BZ #28838) - localedef-ld-monetary.patch: localedef: Update LC_MONETARY handling (BZ #28845) OBS-URL: https://build.opensuse.org/request/show/958081 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=611
51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
From 1dd783fafdbc30bd82e078ccab42b9539d3274a5 Mon Sep 17 00:00:00 2001
|
|
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
Date: Tue, 15 Feb 2022 06:57:11 -0800
|
|
Subject: [PATCH] elf: Check invalid hole in PT_LOAD segments [BZ #28838]
|
|
|
|
Changes in v2:
|
|
|
|
1. Update commit log.
|
|
|
|
commit 163f625cf9becbb82dfec63a29e566324129c0cd
|
|
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
|
|
|
|
commit d8d94863ef125a392b929732b37e07dc927fbcd1
|
|
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>
|
|
(cherry picked from commit 2c0915cbf570cb9c8a65f1d20a55c5a7238e5b63)
|
|
---
|
|
elf/dl-map-segments.h | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
|
|
index 172692b120..fd24cf5d01 100644
|
|
--- a/elf/dl-map-segments.h
|
|
+++ b/elf/dl-map-segments.h
|
|
@@ -113,6 +113,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,
|
|
--
|
|
2.35.0
|
|
|