forked from pool/glibc
Accepting request 137557 from home:a_jaeger:my-factory-packages
Update to current 2.16 tree, various bugfixes. OBS-URL: https://build.opensuse.org/request/show/137557 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=221
This commit is contained in:
parent
27b9159250
commit
a7d7bf3a3f
3
glibc-2.16-a5cfcf08ffaa.tar.xz
Normal file
3
glibc-2.16-a5cfcf08ffaa.tar.xz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e578681e4f61512a8ff4b1e1f9918e1b641e09401fdf4940a61827977fbac75f
|
||||||
|
size 10145468
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:563674686eeff7d8473724f511a12506cfe4d40aca43c78f6156e75a84790c51
|
|
||||||
size 10168980
|
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 9 07:15:12 UTC 2012 - aj@suse.de
|
||||||
|
|
||||||
|
- Fix malloc_usable_size (swo#1349, bnc#745247) (patch
|
||||||
|
malloc-check-size.patch).
|
||||||
|
|
||||||
|
- Update to current glibc 2.16 (git a5cfcf08ffaa):
|
||||||
|
* fix fma detection
|
||||||
|
* Don't parse %s format argument as multibyte string
|
||||||
|
* Use size_t instead of int for internal variables in glob
|
||||||
|
* Properly handle fencepost with MALLOC_ALIGN_MASK
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Oct 6 08:51:46 UTC 2012 - meissner@suse.com
|
Sat Oct 6 08:51:46 UTC 2012 - meissner@suse.com
|
||||||
|
|
||||||
|
12
glibc.spec
12
glibc.spec
@ -122,7 +122,7 @@ Provides: ld-linux.so.3(GLIBC_2.4)
|
|||||||
Version: 2.16
|
Version: 2.16
|
||||||
Release: 0
|
Release: 0
|
||||||
%define glibc_major_version 2.16
|
%define glibc_major_version 2.16
|
||||||
%define git_id da1f43196321
|
%define git_id a5cfcf08ffaa
|
||||||
%define glibc_ports_ver 2.16
|
%define glibc_ports_ver 2.16
|
||||||
%define ports_git_id a20c2b3c87ae
|
%define ports_git_id a20c2b3c87ae
|
||||||
Url: http://www.gnu.org/software/libc/libc.html
|
Url: http://www.gnu.org/software/libc/libc.html
|
||||||
@ -251,6 +251,11 @@ Patch402: nscd-avoid-gcc-warning.diff
|
|||||||
###
|
###
|
||||||
# Patches from upstream
|
# Patches from upstream
|
||||||
###
|
###
|
||||||
|
# PATCH-FIX-UPSTREAM Fix malloc_usable_size swo#1349, bnc#745247 - aj@suse.de
|
||||||
|
Patch1001: malloc-check-size.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Fix mcount on PowerPC32 - aj@suse.de
|
||||||
|
Patch1002: glibc-2.16-ppc32-mcount.patch
|
||||||
|
|
||||||
# PATCH-FIX-UPSTREAM Fix dns buffer - aj@suse.de
|
# PATCH-FIX-UPSTREAM Fix dns buffer - aj@suse.de
|
||||||
Patch1021: glibc-2.16-getaddrinfo-buffer.patch
|
Patch1021: glibc-2.16-getaddrinfo-buffer.patch
|
||||||
# PATCH-FIX-UPSTREAM Fix sparc dynamic linker triggered by bind-now swo#14376 - aj@suse.de
|
# PATCH-FIX-UPSTREAM Fix sparc dynamic linker triggered by bind-now swo#14376 - aj@suse.de
|
||||||
@ -265,8 +270,6 @@ Patch2001: glibc-resolv-assert.diff
|
|||||||
Patch2005: glibc-elf-localscope.diff
|
Patch2005: glibc-elf-localscope.diff
|
||||||
# PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de
|
# PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de
|
||||||
Patch2008: glibc-ld-profile.patch
|
Patch2008: glibc-ld-profile.patch
|
||||||
# PATCH-FIX-OPENSUSE Fix mcount on PowerPC32 - aj@suse.de
|
|
||||||
Patch2009: glibc-2.16-ppc32-mcount.patch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The GNU C Library provides the most important standard libraries used
|
The GNU C Library provides the most important standard libraries used
|
||||||
@ -498,6 +501,8 @@ rm nscd/s-stamp
|
|||||||
%ifarch armv7l armv7hl
|
%ifarch armv7l armv7hl
|
||||||
%patch20 -p1
|
%patch20 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%patch1001 -p1
|
||||||
|
%patch1002 -p1
|
||||||
%patch1021 -p1
|
%patch1021 -p1
|
||||||
%patch1022 -p1
|
%patch1022 -p1
|
||||||
|
|
||||||
@ -507,7 +512,6 @@ rm nscd/s-stamp
|
|||||||
%patch2005 -p1
|
%patch2005 -p1
|
||||||
# XXX Disable, it breaks the testsuite, test elf/tst-audit2
|
# XXX Disable, it breaks the testsuite, test elf/tst-audit2
|
||||||
# %patch2008 -p1
|
# %patch2008 -p1
|
||||||
%patch2009 -p1
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
|
# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
|
||||||
|
176
malloc-check-size.patch
Normal file
176
malloc-check-size.patch
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
commit 6ef9cc37f0ea151a54e5c8a19950a6d5b6ff8a96
|
||||||
|
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
Date: Wed Sep 5 21:49:00 2012 +0530
|
||||||
|
|
||||||
|
Return requested size for malloc_usable_size when MALLOC_CHECK_ > 0
|
||||||
|
|
||||||
|
[BZ #1349]
|
||||||
|
|
||||||
|
malloc_usable_size returns the usable size in an allocated chunk,
|
||||||
|
which may be >= the requested size. In the case of MALLOC_CHECK_ being
|
||||||
|
exported to > 0 however, only the requested size is usable, since a
|
||||||
|
magic value is written at the end of the request size to trap writes
|
||||||
|
beyond request bounds. Hence, when MALLOC_CHECK_ is exported to > 0,
|
||||||
|
malloc_usable_size() should return the request size.
|
||||||
|
|
||||||
|
2012-09-05 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
|
[BZ #1349]
|
||||||
|
* malloc/Makefile (tests): Add tst-malloc-usable test case.
|
||||||
|
(tst-malloc-usable-ENV): Set environment for test case.
|
||||||
|
* malloc/hooks.c (malloc_check_get_size): New function to get
|
||||||
|
requested size.
|
||||||
|
* malloc/malloc.c (musable): Use malloc_check_get_size.
|
||||||
|
* malloc/tst-malloc-usable.c: New test case.
|
||||||
|
|
||||||
|
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||||
|
index 5d6d716..55c675b 100644
|
||||||
|
--- a/malloc/Makefile
|
||||||
|
+++ b/malloc/Makefile
|
||||||
|
@@ -1,5 +1,4 @@
|
||||||
|
-# Copyright (C) 1991-2003, 2005, 2006, 2007, 2009, 2011, 2012
|
||||||
|
-# Free Software Foundation, Inc.
|
||||||
|
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
|
||||||
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@@ -26,7 +25,7 @@ all:
|
||||||
|
dist-headers := malloc.h
|
||||||
|
headers := $(dist-headers) obstack.h mcheck.h
|
||||||
|
tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
|
||||||
|
- tst-mallocstate tst-mcheck tst-mallocfork tst-trim1
|
||||||
|
+ tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 tst-malloc-usable
|
||||||
|
test-srcs = tst-mtrace
|
||||||
|
|
||||||
|
routines = malloc morecore mcheck mtrace obstack
|
||||||
|
@@ -116,6 +115,7 @@ endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
tst-mcheck-ENV = MALLOC_CHECK_=3
|
||||||
|
+tst-malloc-usable-ENV = MALLOC_CHECK_=3
|
||||||
|
|
||||||
|
CPPFLAGS-malloc.c += -DPER_THREAD
|
||||||
|
# Uncomment this for test releases. For public releases it is too expensive.
|
||||||
|
diff --git a/malloc/hooks.c b/malloc/hooks.c
|
||||||
|
index 8a34c78..b38dffb 100644
|
||||||
|
--- a/malloc/hooks.c
|
||||||
|
+++ b/malloc/hooks.c
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
/* Malloc implementation for multiple threads without lock contention.
|
||||||
|
- Copyright (C) 2001-2009, 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
|
||||||
|
|
||||||
|
@@ -89,6 +89,35 @@ __malloc_check_init()
|
||||||
|
|
||||||
|
#define MAGICBYTE(p) ( ( ((size_t)p >> 3) ^ ((size_t)p >> 11)) & 0xFF )
|
||||||
|
|
||||||
|
+/* Visualize the chunk as being partitioned into blocks of 256 bytes from the
|
||||||
|
+ highest address of the chunk, downwards. The beginning of each block tells
|
||||||
|
+ us the size of the previous block, up to the actual size of the requested
|
||||||
|
+ memory. Our magic byte is right at the end of the requested size, so we
|
||||||
|
+ must reach it with this iteration, otherwise we have witnessed a memory
|
||||||
|
+ corruption. */
|
||||||
|
+static size_t
|
||||||
|
+malloc_check_get_size(mchunkptr p)
|
||||||
|
+{
|
||||||
|
+ size_t size;
|
||||||
|
+ unsigned char c;
|
||||||
|
+ unsigned char magic = MAGICBYTE(p);
|
||||||
|
+
|
||||||
|
+ assert(using_malloc_checking == 1);
|
||||||
|
+
|
||||||
|
+ for (size = chunksize(p) - 1 + (chunk_is_mmapped(p) ? 0 : SIZE_SZ);
|
||||||
|
+ (c = ((unsigned char*)p)[size]) != magic;
|
||||||
|
+ size -= c) {
|
||||||
|
+ if(c<=0 || size<(c+2*SIZE_SZ)) {
|
||||||
|
+ malloc_printerr(check_action, "malloc_check_get_size: memory corruption",
|
||||||
|
+ chunk2mem(p));
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* chunk2mem size. */
|
||||||
|
+ return size - 2*SIZE_SZ;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Instrument a chunk with overrun detector byte(s) and convert it
|
||||||
|
into a user pointer with requested size sz. */
|
||||||
|
|
||||||
|
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||||
|
index 0f1796c..bd562df 100644
|
||||||
|
--- a/malloc/malloc.c
|
||||||
|
+++ b/malloc/malloc.c
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
/* Malloc implementation for multiple threads without lock contention.
|
||||||
|
- Copyright (C) 1996-2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Wolfram Gloger <wg@malloc.de>
|
||||||
|
and Doug Lea <dl@cs.oswego.edu>, 2001.
|
||||||
|
@@ -4563,6 +4563,9 @@ musable(void* mem)
|
||||||
|
mchunkptr p;
|
||||||
|
if (mem != 0) {
|
||||||
|
p = mem2chunk(mem);
|
||||||
|
+
|
||||||
|
+ if (__builtin_expect(using_malloc_checking == 1, 0))
|
||||||
|
+ return malloc_check_get_size(p);
|
||||||
|
if (chunk_is_mmapped(p))
|
||||||
|
return chunksize(p) - 2*SIZE_SZ;
|
||||||
|
else if (inuse(p))
|
||||||
|
diff --git a/malloc/tst-malloc-usable.c b/malloc/tst-malloc-usable.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..18decd8
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/malloc/tst-malloc-usable.c
|
||||||
|
@@ -0,0 +1,49 @@
|
||||||
|
+/* Ensure that malloc_usable_size returns the request size with
|
||||||
|
+ MALLOC_CHECK_ exported to a positive value.
|
||||||
|
+
|
||||||
|
+ Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <malloc.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ size_t usable_size;
|
||||||
|
+ void *p = malloc (7);
|
||||||
|
+ if (!p)
|
||||||
|
+ {
|
||||||
|
+ printf ("memory allocation failed\n");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usable_size = malloc_usable_size (p);
|
||||||
|
+ if (usable_size != 7)
|
||||||
|
+ {
|
||||||
|
+ printf ("malloc_usable_size: expected 7 but got %zu\n", usable_size);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ memset (p, 0, usable_size);
|
||||||
|
+ free (p);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#define TEST_FUNCTION do_test ()
|
||||||
|
+#include "../test-skeleton.c"
|
Loading…
Reference in New Issue
Block a user