From e171040ae8b9f610322ff388c8d15c9c914f2857 Mon Sep 17 00:00:00 2001 From: Sdrkun Date: Thu, 10 Sep 2020 20:16:18 +0800 Subject: [PATCH] fix CVE-2019-1010023. --- Fix-CVE-2019-1010023.patch | 65 ++++++++++++++++++++++++++++++++++++++ glibc.spec | 6 +++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 Fix-CVE-2019-1010023.patch diff --git a/Fix-CVE-2019-1010023.patch b/Fix-CVE-2019-1010023.patch new file mode 100644 index 0000000..0f6164f --- /dev/null +++ b/Fix-CVE-2019-1010023.patch @@ -0,0 +1,65 @@ +From d44c2d890a989bb67baaf6621858d9e8bde5bbf0 Mon Sep 17 00:00:00 2001 +From: lvying +Date: Sat, 8 Feb 2020 12:05:36 +0800 +Subject: [PATCH] glibc: fix CVE-2019-1010023 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +| PT_LOAD +| +| […] Loadable segment entries in the program header table appear in +| ascending order, sorted on the p_vaddr member. + +http://www.sco.com/developers/gabi/latest/ch5.pheader.html + +Some check needed to fix vulnerability in load commands mapping reported by + +https://sourceware.org/bugzilla/show_bug.cgi?id=22851 + +Signed-off-by: lvying +--- + elf/dl-map-segments.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h +index 084076a..20dfc5c 100644 +--- a/elf/dl-map-segments.h ++++ b/elf/dl-map-segments.h +@@ -33,6 +33,7 @@ _dl_map_segments (struct link_map *l, int fd, + struct link_map *loader) + { + const struct loadcmd *c = loadcmds; ++ ElfW(Addr) l_map_end_aligned; + + if (__glibc_likely (type == ET_DYN)) + { +@@ -61,6 +62,8 @@ _dl_map_segments (struct link_map *l, int fd, + return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT; + + l->l_map_end = l->l_map_start + maplength; ++ l_map_end_aligned = ((l->l_map_end + GLRO(dl_pagesize) - 1) ++ & ~(GLRO(dl_pagesize) - 1)); + l->l_addr = l->l_map_start - c->mapstart; + + if (has_holes) +@@ -85,10 +88,16 @@ _dl_map_segments (struct link_map *l, int fd, + /* Remember which part of the address space this object uses. */ + l->l_map_start = c->mapstart + l->l_addr; + l->l_map_end = l->l_map_start + maplength; ++ l_map_end_aligned = ((l->l_map_end + GLRO(dl_pagesize) - 1) ++ & ~(GLRO(dl_pagesize) - 1)); + l->l_contiguous = !has_holes; + + while (c < &loadcmds[nloadcmds]) + { ++ if ((l->l_addr + c->mapend) > l_map_end_aligned || ++ (l->l_addr + c->mapstart) < l->l_map_start) ++ return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT; ++ + if (c->mapend > c->mapstart + /* Map the segment contents from the file. */ + && (__mmap ((void *) (l->l_addr + c->mapstart), +-- +1.8.3.1 + diff --git a/glibc.spec b/glibc.spec index aa7fd79..87c4a6f 100644 --- a/glibc.spec +++ b/glibc.spec @@ -60,7 +60,7 @@ ############################################################################## Name: glibc Version: 2.31 -Release: 5 +Release: 6 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -95,6 +95,7 @@ Patch6014: Disable-warnings-due-to-deprecated-libselinux-symbol.patch Patch9000: delete-no-hard-link-to-avoid-all_language-package-to.patch Patch9001: build-extra-libpthreadcond-so.patch Patch9002: remove-country-selection-from-tzselect.patch +Patch9003: Fix-CVE-2019-1010023.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1188,6 +1189,9 @@ fi %doc hesiod/README.hesiod %changelog +* Thu Sep 10 2020 shanzhikun - 2.31-6 +- fix CVE-2019-1010023. + * Fri Sep 4 2020 MarsChan - 2.31-5 - For political reasons, remove country selection from tzselect.ksh -- Gitee