diff --git a/glibc/.md5sum b/glibc/.md5sum index e1889ee5..3ee8978a 100644 --- a/glibc/.md5sum +++ b/glibc/.md5sum @@ -1,5 +1,6 @@ 3402b18f924954aa68d1d59ed378545f glibc-2.16.0-multilib-dirs.patch 80b181b02ab249524ec92822c0174cf7 glibc-2.16.0.tar.xz +3a51662cd99783b3d01ceac2dca19597 glibc-CVE-2013-4332.patch d4a2a19efe1e9b59b86fd15a968f7e10 glibc-regexp_buffer_overrun.patch 7e6a5a13c37f93213db9803d9790b7de glibc-resolv_assert.patch 99ed7b88221475d51a073f00d7ee9c42 glibc-segfault_in_strncasecmp.patch diff --git a/glibc/Pkgfile b/glibc/Pkgfile index 20a9f7be..0ec459db 100644 --- a/glibc/Pkgfile +++ b/glibc/Pkgfile @@ -4,7 +4,7 @@ name=glibc version=2.16.0 -release=4 +release=5 source=(http://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ http://crux.nu/files/distfiles/kernel-headers-3.4.11.tar.xz \ $name-$version-multilib-dirs.patch \ @@ -12,7 +12,8 @@ source=(http://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ $name-resolv_assert.patch \ $name-segfault_in_strncasecmp.patch \ $name-strtod_integer_overflow.patch \ - $name-regexp_buffer_overrun.patch) + $name-regexp_buffer_overrun.patch \ + $name-CVE-2013-4332.patch) build() { # install kernel headers @@ -25,6 +26,7 @@ build() { patch -p1 -d $name-$version -i $SRC/$name-strtod_integer_overflow.patch patch -p1 -d $name-$version -i $SRC/$name-regexp_buffer_overrun.patch patch -p1 -d $name-$version -i $SRC/$name-$version-multilib-dirs.patch + patch -p1 -d $name-$version -i $SRC/$name-CVE-2013-4332.patch mkdir build cd build diff --git a/glibc/glibc-CVE-2013-4332.patch b/glibc/glibc-CVE-2013-4332.patch new file mode 100644 index 00000000..9f7f5886 --- /dev/null +++ b/glibc/glibc-CVE-2013-4332.patch @@ -0,0 +1,64 @@ +From 0d6085cb1b4330b835ad08a3ec8f80b30f0cadb4 Mon Sep 17 00:00:00 2001 +From: mancha +Date: Wed, 11 Sep 2013 +Subject: CVE-2013-4332 + +malloc: Check for integer overflow in pvalloc, valloc, and memalign. + +A large bytes parameter to pvalloc, valloc, or memalign could cause +an integer overflow and corrupt allocator internals. Check the +overflow does not occur before continuing with the allocation. + +Note: This is a backport to glibc 2.17 of the following three commits: + * https://sourceware.org/git/?p=glibc.git;a=commit;h=1159a193696a + * https://sourceware.org/git/?p=glibc.git;a=commit;h=55e17aadc1ef + * https://sourceware.org/git/?p=glibc.git;a=commit;h=b73ed247781d +--- + +malloc.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -3020,6 +3020,13 @@ __libc_memalign(size_t alignment, size_t + /* Otherwise, ensure that it is at least a minimum chunk size */ + if (alignment < MINSIZE) alignment = MINSIZE; + ++ /* Check for overflow. */ ++ if (bytes > SIZE_MAX - alignment - MINSIZE) ++ { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ + arena_get(ar_ptr, bytes + alignment + MINSIZE); + if(!ar_ptr) + return 0; +@@ -3051,6 +3058,13 @@ __libc_valloc(size_t bytes) + + size_t pagesz = GLRO(dl_pagesize); + ++ /* Check for overflow. */ ++ if (bytes > SIZE_MAX - pagesz - MINSIZE) ++ { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, + const __malloc_ptr_t)) = + force_reg (__memalign_hook); +@@ -3088,6 +3102,13 @@ __libc_pvalloc(size_t bytes) + size_t page_mask = GLRO(dl_pagesize) - 1; + size_t rounded_bytes = (bytes + page_mask) & ~(page_mask); + ++ /* Check for overflow. */ ++ if (bytes > SIZE_MAX - 2*pagesz - MINSIZE) ++ { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, + const __malloc_ptr_t)) = + force_reg (__memalign_hook);