Accepting request 703415 from home:Andreas_Schwab:Factory
- dl-show-auxv.patch: Fix output of LD_SHOW_AUXV=1 - s390-vx-vxe-hwcap.patch: S390: Mark vx and vxe as important hwcap - taisho-era-string.patch: ja_JP: Change the offset for Taisho gan-nen from 2 to 1 (BZ #24162) - malloc-tracing-hooks.patch: malloc: Set and reset all hooks for tracing (BZ #16573) - pldd-inf-loop.patch: elf: Fix pldd (BZ#18035) - malloc-large-bin-corruption-check.patch: malloc: Check for large bin list corruption when inserting unsorted chunk (BZ #24216) - wfile-sync-crash.patch: Fix crash in _IO_wfile_sync (BZ #20568) OBS-URL: https://build.opensuse.org/request/show/703415 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=527
This commit is contained in:
parent
8b74a572f5
commit
2d58c46aab
107
dl-show-auxv.patch
Normal file
107
dl-show-auxv.patch
Normal file
@ -0,0 +1,107 @@
|
||||
2019-03-13 Stefan Liebler <stli@linux.ibm.com>
|
||||
|
||||
* elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always
|
||||
call _dl_procinfo.
|
||||
* sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo):
|
||||
Ignore types other than AT_HWCAP.
|
||||
* sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo):
|
||||
Likewise.
|
||||
* sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Adjust comment
|
||||
in the case of falling back to generic output mechanism.
|
||||
* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo):
|
||||
Likewise.
|
||||
|
||||
Index: glibc-2.29/elf/dl-sysdep.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/elf/dl-sysdep.c
|
||||
+++ glibc-2.29/elf/dl-sysdep.c
|
||||
@@ -328,14 +328,9 @@ _dl_show_auxv (void)
|
||||
assert (AT_NULL == 0);
|
||||
assert (AT_IGNORE == 1);
|
||||
|
||||
- if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2
|
||||
- || AT_L1I_CACHEGEOMETRY || AT_L1D_CACHEGEOMETRY
|
||||
- || AT_L2_CACHEGEOMETRY || AT_L3_CACHEGEOMETRY)
|
||||
- {
|
||||
- /* These are handled in a special way per platform. */
|
||||
- if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
|
||||
- continue;
|
||||
- }
|
||||
+ /* Some entries are handled in a special way per platform. */
|
||||
+ if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
|
||||
+ continue;
|
||||
|
||||
if (idx < sizeof (auxvars) / sizeof (auxvars[0])
|
||||
&& auxvars[idx].form != unknown)
|
||||
Index: glibc-2.29/sysdeps/powerpc/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/powerpc/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/powerpc/dl-procinfo.h
|
||||
@@ -225,7 +225,7 @@ _dl_procinfo (unsigned int type, unsigne
|
||||
break;
|
||||
}
|
||||
default:
|
||||
- /* This should not happen. */
|
||||
+ /* Fallback to generic output mechanism. */
|
||||
return -1;
|
||||
}
|
||||
_dl_printf ("\n");
|
||||
Index: glibc-2.29/sysdeps/sparc/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/sparc/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/sparc/dl-procinfo.h
|
||||
@@ -31,8 +31,8 @@ _dl_procinfo (unsigned int type, unsigne
|
||||
{
|
||||
int i;
|
||||
|
||||
- /* Fallback to unknown output mechanism. */
|
||||
- if (type == AT_HWCAP2)
|
||||
+ /* Fallback to generic output mechanism. */
|
||||
+ if (type != AT_HWCAP)
|
||||
return -1;
|
||||
|
||||
_dl_printf ("AT_HWCAP: ");
|
||||
Index: glibc-2.29/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
|
||||
@@ -67,7 +67,7 @@ _dl_procinfo (unsigned int type, unsigne
|
||||
break;
|
||||
}
|
||||
default:
|
||||
- /* This should not happen. */
|
||||
+ /* Fallback to generic output mechanism. */
|
||||
return -1;
|
||||
}
|
||||
_dl_printf ("\n");
|
||||
Index: glibc-2.29/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
|
||||
@@ -30,8 +30,8 @@ _dl_procinfo (unsigned int type, unsigne
|
||||
in the kernel sources. */
|
||||
int i;
|
||||
|
||||
- /* Fallback to unknown output mechanism. */
|
||||
- if (type == AT_HWCAP2)
|
||||
+ /* Fallback to generic output mechanism. */
|
||||
+ if (type != AT_HWCAP)
|
||||
return -1;
|
||||
|
||||
_dl_printf ("AT_HWCAP: ");
|
||||
Index: glibc-2.29/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
|
||||
@@ -32,8 +32,8 @@ _dl_procinfo (unsigned int type, unsigne
|
||||
in the kernel sources. */
|
||||
int i;
|
||||
|
||||
- /* Fallback to unknown output mechanism. */
|
||||
- if (type == AT_HWCAP2)
|
||||
+ /* Fallback to generic output mechanism. */
|
||||
+ if (type != AT_HWCAP)
|
||||
return -1;
|
||||
|
||||
_dl_printf ("AT_HWCAP: ");
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed May 15 15:55:36 UTC 2019 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
- dl-show-auxv.patch: Fix output of LD_SHOW_AUXV=1
|
||||
- s390-vx-vxe-hwcap.patch: S390: Mark vx and vxe as important hwcap
|
||||
- taisho-era-string.patch: ja_JP: Change the offset for Taisho gan-nen
|
||||
from 2 to 1 (BZ #24162)
|
||||
- malloc-tracing-hooks.patch: malloc: Set and reset all hooks for tracing
|
||||
(BZ #16573)
|
||||
- pldd-inf-loop.patch: elf: Fix pldd (BZ#18035)
|
||||
- malloc-large-bin-corruption-check.patch: malloc: Check for large bin
|
||||
list corruption when inserting unsorted chunk (BZ #24216)
|
||||
- wfile-sync-crash.patch: Fix crash in _IO_wfile_sync (BZ #20568)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 3 14:56:02 UTC 2019 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
|
21
glibc.spec
21
glibc.spec
@ -286,6 +286,20 @@ Patch1006: add-new-Fortran-vector-math-header-file.patch
|
||||
Patch1007: regex-read-overrun.patch
|
||||
# PATCH-FIX-UPSTREAM ja_JP locale: Add entry for the new Japanese era (BZ #22964)
|
||||
Patch1008: japanese-era-name-may-2019.patch
|
||||
# PATCH-FIX-UPSTREAM Fix output of LD_SHOW_AUXV=1
|
||||
Patch1009: dl-show-auxv.patch
|
||||
# PATCH-FIX-UPSTREAM S390: Mark vx and vxe as important hwcap
|
||||
Patch1010: s390-vx-vxe-hwcap.patch
|
||||
# PATCH-FIX-UPSTREAM ja_JP: Change the offset for Taisho gan-nen from 2 to 1 (BZ #24162)
|
||||
Patch1011: taisho-era-string.patch
|
||||
# PATCH-FIX-UPSTREAM malloc: Set and reset all hooks for tracing (BZ #16573)
|
||||
Patch1012: malloc-tracing-hooks.patch
|
||||
# PATCH-FIX-UPSTREAM elf: Fix pldd (BZ#18035)
|
||||
Patch1013: pldd-inf-loop.patch
|
||||
# PATCH-FIX-UPSTREAM malloc: Check for large bin list corruption when inserting unsorted chunk (BZ #24216)
|
||||
Patch1014: malloc-large-bin-corruption-check.patch
|
||||
# PATCH-FIX-UPSTREAM Fix crash in _IO_wfile_sync (BZ #20568)
|
||||
Patch1015: wfile-sync-crash.patch
|
||||
|
||||
###
|
||||
# Patches awaiting upstream approval
|
||||
@ -506,6 +520,13 @@ makedb: A program to create a database for nss
|
||||
%patch1006 -p1
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%patch1009 -p1
|
||||
%patch1010 -p1
|
||||
%patch1011 -p1
|
||||
%patch1012 -p1
|
||||
%patch1013 -p1
|
||||
%patch1014 -p1
|
||||
%patch1015 -p1
|
||||
|
||||
%patch2000 -p1
|
||||
%patch2004 -p1
|
||||
|
19
malloc-large-bin-corruption-check.patch
Normal file
19
malloc-large-bin-corruption-check.patch
Normal file
@ -0,0 +1,19 @@
|
||||
Index: glibc-2.29/malloc/malloc.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/malloc/malloc.c
|
||||
+++ glibc-2.29/malloc/malloc.c
|
||||
@@ -3876,10 +3876,14 @@ _int_malloc (mstate av, size_t bytes)
|
||||
{
|
||||
victim->fd_nextsize = fwd;
|
||||
victim->bk_nextsize = fwd->bk_nextsize;
|
||||
+ if (__glibc_unlikely (fwd->bk_nextsize->fd_nextsize != fwd))
|
||||
+ malloc_printerr ("malloc(): largebin double linked list corrupted (nextsize)");
|
||||
fwd->bk_nextsize = victim;
|
||||
victim->bk_nextsize->fd_nextsize = victim;
|
||||
}
|
||||
bck = fwd->bk;
|
||||
+ if (bck->fd != fwd)
|
||||
+ malloc_printerr ("malloc(): largebin double linked list corrupted (bk)");
|
||||
}
|
||||
}
|
||||
else
|
156
malloc-tracing-hooks.patch
Normal file
156
malloc-tracing-hooks.patch
Normal file
@ -0,0 +1,156 @@
|
||||
2019-04-09 Carlos O'Donell <carlos@redhat.com>
|
||||
Kwok Cheung Yeung <kcy@codesourcery.com>
|
||||
|
||||
[BZ #16573]
|
||||
* malloc/mtrace.c: Define prototypes for all hooks.
|
||||
(set_default_hooks): New function.
|
||||
(set_trace_hooks): Likewise.
|
||||
(save_default_hooks): Likewise.
|
||||
(tr_freehook): Use new s*_hooks functions.
|
||||
(tr_mallochook): Likewise.
|
||||
(tr_reallochook): Likewise.
|
||||
(tr_memalignhook): Likewise.
|
||||
(mtrace): Likewise.
|
||||
(muntrace): Likewise.
|
||||
|
||||
Index: glibc-2.29/malloc/mtrace.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/malloc/mtrace.c
|
||||
+++ glibc-2.29/malloc/mtrace.c
|
||||
@@ -121,6 +121,41 @@ lock_and_info (const void *caller, Dl_in
|
||||
return res;
|
||||
}
|
||||
|
||||
+static void tr_freehook (void *, const void *);
|
||||
+static void * tr_mallochook (size_t, const void *);
|
||||
+static void * tr_reallochook (void *, size_t, const void *);
|
||||
+static void * tr_memalignhook (size_t, size_t, const void *);
|
||||
+
|
||||
+/* Set all the default non-trace hooks. */
|
||||
+static __always_inline void
|
||||
+set_default_hooks (void)
|
||||
+{
|
||||
+ __free_hook = tr_old_free_hook;
|
||||
+ __malloc_hook = tr_old_malloc_hook;
|
||||
+ __realloc_hook = tr_old_realloc_hook;
|
||||
+ __memalign_hook = tr_old_memalign_hook;
|
||||
+}
|
||||
+
|
||||
+/* Set all of the tracing hooks used for mtrace. */
|
||||
+static __always_inline void
|
||||
+set_trace_hooks (void)
|
||||
+{
|
||||
+ __free_hook = tr_freehook;
|
||||
+ __malloc_hook = tr_mallochook;
|
||||
+ __realloc_hook = tr_reallochook;
|
||||
+ __memalign_hook = tr_memalignhook;
|
||||
+}
|
||||
+
|
||||
+/* Save the current set of hooks as the default hooks. */
|
||||
+static __always_inline void
|
||||
+save_default_hooks (void)
|
||||
+{
|
||||
+ tr_old_free_hook = __free_hook;
|
||||
+ tr_old_malloc_hook = __malloc_hook;
|
||||
+ tr_old_realloc_hook = __realloc_hook;
|
||||
+ tr_old_memalign_hook = __memalign_hook;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
tr_freehook (void *ptr, const void *caller)
|
||||
{
|
||||
@@ -138,12 +173,12 @@ tr_freehook (void *ptr, const void *call
|
||||
tr_break ();
|
||||
__libc_lock_lock (lock);
|
||||
}
|
||||
- __free_hook = tr_old_free_hook;
|
||||
+ set_default_hooks ();
|
||||
if (tr_old_free_hook != NULL)
|
||||
(*tr_old_free_hook)(ptr, caller);
|
||||
else
|
||||
free (ptr);
|
||||
- __free_hook = tr_freehook;
|
||||
+ set_trace_hooks ();
|
||||
__libc_lock_unlock (lock);
|
||||
}
|
||||
|
||||
@@ -155,12 +190,12 @@ tr_mallochook (size_t size, const void *
|
||||
Dl_info mem;
|
||||
Dl_info *info = lock_and_info (caller, &mem);
|
||||
|
||||
- __malloc_hook = tr_old_malloc_hook;
|
||||
+ set_default_hooks ();
|
||||
if (tr_old_malloc_hook != NULL)
|
||||
hdr = (void *) (*tr_old_malloc_hook)(size, caller);
|
||||
else
|
||||
hdr = (void *) malloc (size);
|
||||
- __malloc_hook = tr_mallochook;
|
||||
+ set_trace_hooks ();
|
||||
|
||||
tr_where (caller, info);
|
||||
/* We could be printing a NULL here; that's OK. */
|
||||
@@ -185,16 +220,12 @@ tr_reallochook (void *ptr, size_t size,
|
||||
Dl_info mem;
|
||||
Dl_info *info = lock_and_info (caller, &mem);
|
||||
|
||||
- __free_hook = tr_old_free_hook;
|
||||
- __malloc_hook = tr_old_malloc_hook;
|
||||
- __realloc_hook = tr_old_realloc_hook;
|
||||
+ set_default_hooks ();
|
||||
if (tr_old_realloc_hook != NULL)
|
||||
hdr = (void *) (*tr_old_realloc_hook)(ptr, size, caller);
|
||||
else
|
||||
hdr = (void *) realloc (ptr, size);
|
||||
- __free_hook = tr_freehook;
|
||||
- __malloc_hook = tr_mallochook;
|
||||
- __realloc_hook = tr_reallochook;
|
||||
+ set_trace_hooks ();
|
||||
|
||||
tr_where (caller, info);
|
||||
if (hdr == NULL)
|
||||
@@ -230,14 +261,12 @@ tr_memalignhook (size_t alignment, size_
|
||||
Dl_info mem;
|
||||
Dl_info *info = lock_and_info (caller, &mem);
|
||||
|
||||
- __memalign_hook = tr_old_memalign_hook;
|
||||
- __malloc_hook = tr_old_malloc_hook;
|
||||
+ set_default_hooks ();
|
||||
if (tr_old_memalign_hook != NULL)
|
||||
hdr = (void *) (*tr_old_memalign_hook)(alignment, size, caller);
|
||||
else
|
||||
hdr = (void *) memalign (alignment, size);
|
||||
- __memalign_hook = tr_memalignhook;
|
||||
- __malloc_hook = tr_mallochook;
|
||||
+ set_trace_hooks ();
|
||||
|
||||
tr_where (caller, info);
|
||||
/* We could be printing a NULL here; that's OK. */
|
||||
@@ -305,14 +334,8 @@ mtrace (void)
|
||||
malloc_trace_buffer = mtb;
|
||||
setvbuf (mallstream, malloc_trace_buffer, _IOFBF, TRACE_BUFFER_SIZE);
|
||||
fprintf (mallstream, "= Start\n");
|
||||
- tr_old_free_hook = __free_hook;
|
||||
- __free_hook = tr_freehook;
|
||||
- tr_old_malloc_hook = __malloc_hook;
|
||||
- __malloc_hook = tr_mallochook;
|
||||
- tr_old_realloc_hook = __realloc_hook;
|
||||
- __realloc_hook = tr_reallochook;
|
||||
- tr_old_memalign_hook = __memalign_hook;
|
||||
- __memalign_hook = tr_memalignhook;
|
||||
+ save_default_hooks ();
|
||||
+ set_trace_hooks ();
|
||||
#ifdef _LIBC
|
||||
if (!added_atexit_handler)
|
||||
{
|
||||
@@ -338,10 +361,7 @@ muntrace (void)
|
||||
file. */
|
||||
FILE *f = mallstream;
|
||||
mallstream = NULL;
|
||||
- __free_hook = tr_old_free_hook;
|
||||
- __malloc_hook = tr_old_malloc_hook;
|
||||
- __realloc_hook = tr_old_realloc_hook;
|
||||
- __memalign_hook = tr_old_memalign_hook;
|
||||
+ set_default_hooks ();
|
||||
|
||||
fprintf (f, "= End\n");
|
||||
fclose (f);
|
393
pldd-inf-loop.patch
Normal file
393
pldd-inf-loop.patch
Normal file
@ -0,0 +1,393 @@
|
||||
2019-04-23 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
[BZ #18035]
|
||||
* elf/pldd-xx.c: Use _Static_assert in of pldd_assert.
|
||||
(E(find_maps)): Avoid use alloca, use default read file operations
|
||||
instead of explicit LFS names, and fix infinite loop.
|
||||
* elf/pldd.c: Explicit set _FILE_OFFSET_BITS, cleanup headers.
|
||||
(get_process_info): Use _Static_assert instead of assert, use default
|
||||
directory operations instead of explicit LFS names, and free some
|
||||
leadek pointers.
|
||||
|
||||
Index: glibc-2.29/elf/pldd-xx.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/elf/pldd-xx.c
|
||||
+++ glibc-2.29/elf/pldd-xx.c
|
||||
@@ -23,10 +23,6 @@
|
||||
#define EW_(e, w, t) EW__(e, w, _##t)
|
||||
#define EW__(e, w, t) e##w##t
|
||||
|
||||
-#define pldd_assert(name, exp) \
|
||||
- typedef int __assert_##name[((exp) != 0) - 1]
|
||||
-
|
||||
-
|
||||
struct E(link_map)
|
||||
{
|
||||
EW(Addr) l_addr;
|
||||
@@ -39,12 +35,12 @@ struct E(link_map)
|
||||
EW(Addr) l_libname;
|
||||
};
|
||||
#if CLASS == __ELF_NATIVE_CLASS
|
||||
-pldd_assert (l_addr, (offsetof (struct link_map, l_addr)
|
||||
- == offsetof (struct E(link_map), l_addr)));
|
||||
-pldd_assert (l_name, (offsetof (struct link_map, l_name)
|
||||
- == offsetof (struct E(link_map), l_name)));
|
||||
-pldd_assert (l_next, (offsetof (struct link_map, l_next)
|
||||
- == offsetof (struct E(link_map), l_next)));
|
||||
+_Static_assert (offsetof (struct link_map, l_addr)
|
||||
+ == offsetof (struct E(link_map), l_addr), "l_addr");
|
||||
+_Static_assert (offsetof (struct link_map, l_name)
|
||||
+ == offsetof (struct E(link_map), l_name), "l_name");
|
||||
+_Static_assert (offsetof (struct link_map, l_next)
|
||||
+ == offsetof (struct E(link_map), l_next), "l_next");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -54,10 +50,10 @@ struct E(libname_list)
|
||||
EW(Addr) next;
|
||||
};
|
||||
#if CLASS == __ELF_NATIVE_CLASS
|
||||
-pldd_assert (name, (offsetof (struct libname_list, name)
|
||||
- == offsetof (struct E(libname_list), name)));
|
||||
-pldd_assert (next, (offsetof (struct libname_list, next)
|
||||
- == offsetof (struct E(libname_list), next)));
|
||||
+_Static_assert (offsetof (struct libname_list, name)
|
||||
+ == offsetof (struct E(libname_list), name), "name");
|
||||
+_Static_assert (offsetof (struct libname_list, next)
|
||||
+ == offsetof (struct E(libname_list), next), "next");
|
||||
#endif
|
||||
|
||||
struct E(r_debug)
|
||||
@@ -69,16 +65,17 @@ struct E(r_debug)
|
||||
EW(Addr) r_map;
|
||||
};
|
||||
#if CLASS == __ELF_NATIVE_CLASS
|
||||
-pldd_assert (r_version, (offsetof (struct r_debug, r_version)
|
||||
- == offsetof (struct E(r_debug), r_version)));
|
||||
-pldd_assert (r_map, (offsetof (struct r_debug, r_map)
|
||||
- == offsetof (struct E(r_debug), r_map)));
|
||||
+_Static_assert (offsetof (struct r_debug, r_version)
|
||||
+ == offsetof (struct E(r_debug), r_version), "r_version");
|
||||
+_Static_assert (offsetof (struct r_debug, r_map)
|
||||
+ == offsetof (struct E(r_debug), r_map), "r_map");
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
|
||||
-E(find_maps) (pid_t pid, void *auxv, size_t auxv_size)
|
||||
+E(find_maps) (const char *exe, int memfd, pid_t pid, void *auxv,
|
||||
+ size_t auxv_size)
|
||||
{
|
||||
EW(Addr) phdr = 0;
|
||||
unsigned int phnum = 0;
|
||||
@@ -104,12 +101,9 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
if (phdr == 0 || phnum == 0 || phent == 0)
|
||||
error (EXIT_FAILURE, 0, gettext ("cannot find program header of process"));
|
||||
|
||||
- EW(Phdr) *p = alloca (phnum * phent);
|
||||
- if (pread64 (memfd, p, phnum * phent, phdr) != phnum * phent)
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read program header"));
|
||||
- return EXIT_FAILURE;
|
||||
- }
|
||||
+ EW(Phdr) *p = xmalloc (phnum * phent);
|
||||
+ if (pread (memfd, p, phnum * phent, phdr) != phnum * phent)
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read program header"));
|
||||
|
||||
/* Determine the load offset. We need this for interpreting the
|
||||
other program header entries so we do this in a separate loop.
|
||||
@@ -129,24 +123,18 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
if (p[i].p_type == PT_DYNAMIC)
|
||||
{
|
||||
EW(Dyn) *dyn = xmalloc (p[i].p_filesz);
|
||||
- if (pread64 (memfd, dyn, p[i].p_filesz, offset + p[i].p_vaddr)
|
||||
+ if (pread (memfd, dyn, p[i].p_filesz, offset + p[i].p_vaddr)
|
||||
!= p[i].p_filesz)
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read dynamic section"));
|
||||
- return EXIT_FAILURE;
|
||||
- }
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read dynamic section"));
|
||||
|
||||
/* Search for the DT_DEBUG entry. */
|
||||
for (unsigned int j = 0; j < p[i].p_filesz / sizeof (EW(Dyn)); ++j)
|
||||
if (dyn[j].d_tag == DT_DEBUG && dyn[j].d_un.d_ptr != 0)
|
||||
{
|
||||
struct E(r_debug) r;
|
||||
- if (pread64 (memfd, &r, sizeof (r), dyn[j].d_un.d_ptr)
|
||||
+ if (pread (memfd, &r, sizeof (r), dyn[j].d_un.d_ptr)
|
||||
!= sizeof (r))
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read r_debug"));
|
||||
- return EXIT_FAILURE;
|
||||
- }
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read r_debug"));
|
||||
|
||||
if (r.r_map != 0)
|
||||
{
|
||||
@@ -160,13 +148,10 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
}
|
||||
else if (p[i].p_type == PT_INTERP)
|
||||
{
|
||||
- interp = alloca (p[i].p_filesz);
|
||||
- if (pread64 (memfd, interp, p[i].p_filesz, offset + p[i].p_vaddr)
|
||||
+ interp = xmalloc (p[i].p_filesz);
|
||||
+ if (pread (memfd, interp, p[i].p_filesz, offset + p[i].p_vaddr)
|
||||
!= p[i].p_filesz)
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read program interpreter"));
|
||||
- return EXIT_FAILURE;
|
||||
- }
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read program interpreter"));
|
||||
}
|
||||
|
||||
if (list == 0)
|
||||
@@ -174,14 +159,16 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
if (interp == NULL)
|
||||
{
|
||||
// XXX check whether the executable itself is the loader
|
||||
- return EXIT_FAILURE;
|
||||
+ exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// XXX perhaps try finding ld.so and _r_debug in it
|
||||
-
|
||||
- return EXIT_FAILURE;
|
||||
+ exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+ free (p);
|
||||
+ free (interp);
|
||||
+
|
||||
/* Print the PID and program name first. */
|
||||
printf ("%lu:\t%s\n", (unsigned long int) pid, exe);
|
||||
|
||||
@@ -192,47 +179,27 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
do
|
||||
{
|
||||
struct E(link_map) m;
|
||||
- if (pread64 (memfd, &m, sizeof (m), list) != sizeof (m))
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read link map"));
|
||||
- status = EXIT_FAILURE;
|
||||
- goto out;
|
||||
- }
|
||||
+ if (pread (memfd, &m, sizeof (m), list) != sizeof (m))
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read link map"));
|
||||
|
||||
EW(Addr) name_offset = m.l_name;
|
||||
- again:
|
||||
while (1)
|
||||
{
|
||||
- ssize_t n = pread64 (memfd, tmpbuf.data, tmpbuf.length, name_offset);
|
||||
+ ssize_t n = pread (memfd, tmpbuf.data, tmpbuf.length, name_offset);
|
||||
if (n == -1)
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot read object name"));
|
||||
- status = EXIT_FAILURE;
|
||||
- goto out;
|
||||
- }
|
||||
+ error (EXIT_FAILURE, 0, gettext ("cannot read object name"));
|
||||
|
||||
if (memchr (tmpbuf.data, '\0', n) != NULL)
|
||||
break;
|
||||
|
||||
if (!scratch_buffer_grow (&tmpbuf))
|
||||
- {
|
||||
- error (0, 0, gettext ("cannot allocate buffer for object name"));
|
||||
- status = EXIT_FAILURE;
|
||||
- goto out;
|
||||
- }
|
||||
+ error (EXIT_FAILURE, 0,
|
||||
+ gettext ("cannot allocate buffer for object name"));
|
||||
}
|
||||
|
||||
- if (((char *)tmpbuf.data)[0] == '\0' && name_offset == m.l_name
|
||||
- && m.l_libname != 0)
|
||||
- {
|
||||
- /* Try the l_libname element. */
|
||||
- struct E(libname_list) ln;
|
||||
- if (pread64 (memfd, &ln, sizeof (ln), m.l_libname) == sizeof (ln))
|
||||
- {
|
||||
- name_offset = ln.name;
|
||||
- goto again;
|
||||
- }
|
||||
- }
|
||||
+ /* The m.l_name and m.l_libname.name for loader linkmap points to same
|
||||
+ values (since BZ#387 fix). Trying to use l_libname name as the
|
||||
+ shared object name might lead to an infinite loop (BZ#18035). */
|
||||
|
||||
/* Skip over the executable. */
|
||||
if (((char *)tmpbuf.data)[0] != '\0')
|
||||
@@ -242,7 +209,6 @@ E(find_maps) (pid_t pid, void *auxv, siz
|
||||
}
|
||||
while (list != 0);
|
||||
|
||||
- out:
|
||||
scratch_buffer_free (&tmpbuf);
|
||||
return status;
|
||||
}
|
||||
Index: glibc-2.29/elf/pldd.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/elf/pldd.c
|
||||
+++ glibc-2.29/elf/pldd.c
|
||||
@@ -17,23 +17,17 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
-#include <alloca.h>
|
||||
+#define _FILE_OFFSET_BITS 64
|
||||
+
|
||||
#include <argp.h>
|
||||
-#include <assert.h>
|
||||
#include <dirent.h>
|
||||
-#include <elf.h>
|
||||
-#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
#include <libintl.h>
|
||||
-#include <link.h>
|
||||
-#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
-#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ptrace.h>
|
||||
-#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <scratch_buffer.h>
|
||||
|
||||
@@ -76,14 +70,9 @@ static struct argp argp =
|
||||
options, parse_opt, args_doc, doc, NULL, more_help, NULL
|
||||
};
|
||||
|
||||
-// File descriptor of /proc/*/mem file.
|
||||
-static int memfd;
|
||||
-
|
||||
-/* Name of the executable */
|
||||
-static char *exe;
|
||||
|
||||
/* Local functions. */
|
||||
-static int get_process_info (int dfd, long int pid);
|
||||
+static int get_process_info (const char *exe, int dfd, long int pid);
|
||||
static void wait_for_ptrace_stop (long int pid);
|
||||
|
||||
|
||||
@@ -102,8 +91,10 @@ main (int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
- assert (sizeof (pid_t) == sizeof (int)
|
||||
- || sizeof (pid_t) == sizeof (long int));
|
||||
+ _Static_assert (sizeof (pid_t) == sizeof (int)
|
||||
+ || sizeof (pid_t) == sizeof (long int),
|
||||
+ "sizeof (pid_t) != sizeof (int) or sizeof (long int)");
|
||||
+
|
||||
char *endp;
|
||||
errno = 0;
|
||||
long int pid = strtol (argv[remaining], &endp, 10);
|
||||
@@ -119,25 +110,24 @@ main (int argc, char *argv[])
|
||||
if (dfd == -1)
|
||||
error (EXIT_FAILURE, errno, gettext ("cannot open %s"), buf);
|
||||
|
||||
- struct scratch_buffer exebuf;
|
||||
- scratch_buffer_init (&exebuf);
|
||||
+ /* Name of the executable */
|
||||
+ struct scratch_buffer exe;
|
||||
+ scratch_buffer_init (&exe);
|
||||
ssize_t nexe;
|
||||
while ((nexe = readlinkat (dfd, "exe",
|
||||
- exebuf.data, exebuf.length)) == exebuf.length)
|
||||
+ exe.data, exe.length)) == exe.length)
|
||||
{
|
||||
- if (!scratch_buffer_grow (&exebuf))
|
||||
+ if (!scratch_buffer_grow (&exe))
|
||||
{
|
||||
nexe = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nexe == -1)
|
||||
- exe = (char *) "<program name undetermined>";
|
||||
+ /* Default stack allocation is at least 1024. */
|
||||
+ snprintf (exe.data, exe.length, "<program name undetermined>");
|
||||
else
|
||||
- {
|
||||
- exe = exebuf.data;
|
||||
- exe[nexe] = '\0';
|
||||
- }
|
||||
+ ((char*)exe.data)[nexe] = '\0';
|
||||
|
||||
/* Stop all threads since otherwise the list of loaded modules might
|
||||
change while we are reading it. */
|
||||
@@ -155,8 +145,8 @@ main (int argc, char *argv[])
|
||||
error (EXIT_FAILURE, errno, gettext ("cannot prepare reading %s/task"),
|
||||
buf);
|
||||
|
||||
- struct dirent64 *d;
|
||||
- while ((d = readdir64 (dir)) != NULL)
|
||||
+ struct dirent *d;
|
||||
+ while ((d = readdir (dir)) != NULL)
|
||||
{
|
||||
if (! isdigit (d->d_name[0]))
|
||||
continue;
|
||||
@@ -182,7 +172,7 @@ main (int argc, char *argv[])
|
||||
|
||||
wait_for_ptrace_stop (tid);
|
||||
|
||||
- struct thread_list *newp = alloca (sizeof (*newp));
|
||||
+ struct thread_list *newp = xmalloc (sizeof (*newp));
|
||||
newp->tid = tid;
|
||||
newp->next = thread_list;
|
||||
thread_list = newp;
|
||||
@@ -190,17 +180,22 @@ main (int argc, char *argv[])
|
||||
|
||||
closedir (dir);
|
||||
|
||||
- int status = get_process_info (dfd, pid);
|
||||
+ if (thread_list == NULL)
|
||||
+ error (EXIT_FAILURE, 0, gettext ("no valid %s/task entries"), buf);
|
||||
+
|
||||
+ int status = get_process_info (exe.data, dfd, pid);
|
||||
|
||||
- assert (thread_list != NULL);
|
||||
do
|
||||
{
|
||||
ptrace (PTRACE_DETACH, thread_list->tid, NULL, NULL);
|
||||
+ struct thread_list *prev = thread_list;
|
||||
thread_list = thread_list->next;
|
||||
+ free (prev);
|
||||
}
|
||||
while (thread_list != NULL);
|
||||
|
||||
close (dfd);
|
||||
+ scratch_buffer_free (&exe);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -281,9 +276,10 @@ warranty; not even for MERCHANTABILITY o
|
||||
|
||||
|
||||
static int
|
||||
-get_process_info (int dfd, long int pid)
|
||||
+get_process_info (const char *exe, int dfd, long int pid)
|
||||
{
|
||||
- memfd = openat (dfd, "mem", O_RDONLY);
|
||||
+ /* File descriptor of /proc/<pid>/mem file. */
|
||||
+ int memfd = openat (dfd, "mem", O_RDONLY);
|
||||
if (memfd == -1)
|
||||
goto no_info;
|
||||
|
||||
@@ -333,9 +329,9 @@ get_process_info (int dfd, long int pid)
|
||||
|
||||
int retval;
|
||||
if (e_ident[EI_CLASS] == ELFCLASS32)
|
||||
- retval = find_maps32 (pid, auxv, auxv_size);
|
||||
+ retval = find_maps32 (exe, memfd, pid, auxv, auxv_size);
|
||||
else
|
||||
- retval = find_maps64 (pid, auxv, auxv_size);
|
||||
+ retval = find_maps64 (exe, memfd, pid, auxv, auxv_size);
|
||||
|
||||
free (auxv);
|
||||
close (memfd);
|
19
s390-vx-vxe-hwcap.patch
Normal file
19
s390-vx-vxe-hwcap.patch
Normal file
@ -0,0 +1,19 @@
|
||||
2019-03-21 Stefan Liebler <stli@linux.ibm.com>
|
||||
|
||||
* sysdeps/s390/dl-procinfo.h (HWCAP_IMPORTANT):
|
||||
Add HWCAP_S390_VX and HWCAP_S390_VXE.
|
||||
|
||||
Index: glibc-2.29/sysdeps/s390/dl-procinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/sysdeps/s390/dl-procinfo.h
|
||||
+++ glibc-2.29/sysdeps/s390/dl-procinfo.h
|
||||
@@ -57,7 +57,8 @@ enum
|
||||
};
|
||||
|
||||
#define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
|
||||
- | HWCAP_S390_EIMM | HWCAP_S390_DFP)
|
||||
+ | HWCAP_S390_EIMM | HWCAP_S390_DFP \
|
||||
+ | HWCAP_S390_VX | HWCAP_S390_VXE)
|
||||
|
||||
/* We cannot provide a general printing function. */
|
||||
#define _dl_procinfo(type, word) -1
|
19
taisho-era-string.patch
Normal file
19
taisho-era-string.patch
Normal file
@ -0,0 +1,19 @@
|
||||
2019-03-02 TAMUKI Shoichi <tamuki@linet.gr.jp>
|
||||
|
||||
[BZ #24162]
|
||||
* localedata/locales/ja_JP (LC_TIME): Change the offset for Taisho
|
||||
gan-nen from 2 to 1. Problem reported by Morimitsu, Junji.
|
||||
|
||||
Index: glibc-2.29/localedata/locales/ja_JP
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/localedata/locales/ja_JP
|
||||
+++ glibc-2.29/localedata/locales/ja_JP
|
||||
@@ -14953,7 +14953,7 @@ era "+:2:2020//01//01:+*:<U4EE4><U548C>:
|
||||
"+:2:1927//01//01:1989//01//07:<U662D><U548C>:%EC%Ey<U5E74>";/
|
||||
"+:1:1926//12//25:1926//12//31:<U662D><U548C>:%EC<U5143><U5E74>";/
|
||||
"+:2:1913//01//01:1926//12//24:<U5927><U6B63>:%EC%Ey<U5E74>";/
|
||||
- "+:2:1912//07//30:1912//12//31:<U5927><U6B63>:%EC<U5143><U5E74>";/
|
||||
+ "+:1:1912//07//30:1912//12//31:<U5927><U6B63>:%EC<U5143><U5E74>";/
|
||||
"+:6:1873//01//01:1912//07//29:<U660E><U6CBB>:%EC%Ey<U5E74>";/
|
||||
"+:1:0001//01//01:1872//12//31:<U897F><U66A6>:%EC%Ey<U5E74>";/
|
||||
"+:1:-0001//12//31:-*:<U7D00><U5143><U524D>:%EC%Ey<U5E74>"
|
100
wfile-sync-crash.patch
Normal file
100
wfile-sync-crash.patch
Normal file
@ -0,0 +1,100 @@
|
||||
2019-05-15 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
[BZ #20568]
|
||||
* libio/wfileops.c (_IO_wfile_sync): Correct last argument to
|
||||
__codecvt_do_length.
|
||||
* libio/Makefile (tests): Add tst-wfile-sync.
|
||||
($(objpfx)tst-wfile-sync.out): Depend on $(gen-locales).
|
||||
* libio/tst-wfile-sync.c: New file.
|
||||
* libio/tst-wfile-sync.input: New file.
|
||||
|
||||
Index: glibc-2.29/libio/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/libio/Makefile
|
||||
+++ glibc-2.29/libio/Makefile
|
||||
@@ -65,7 +65,7 @@ tests = tst_swprintf tst_wprintf tst_sws
|
||||
tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
|
||||
tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
|
||||
tst-ftell-append tst-fputws tst-bz22415 tst-fgetc-after-eof \
|
||||
- tst-sprintf-ub tst-sprintf-chk-ub
|
||||
+ tst-sprintf-ub tst-sprintf-chk-ub tst-wfile-sync
|
||||
|
||||
tests-internal = tst-vtables tst-vtables-interposed tst-readline
|
||||
|
||||
@@ -212,6 +212,7 @@ $(objpfx)tst-ungetwc1.out: $(gen-locales
|
||||
$(objpfx)tst-ungetwc2.out: $(gen-locales)
|
||||
$(objpfx)tst-widetext.out: $(gen-locales)
|
||||
$(objpfx)tst_wprintf2.out: $(gen-locales)
|
||||
+$(objpfx)tst-wfile-sync.out: $(gen-locales)
|
||||
endif
|
||||
|
||||
$(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
|
||||
Index: glibc-2.29/libio/tst-wfile-sync.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.29/libio/tst-wfile-sync.c
|
||||
@@ -0,0 +1,39 @@
|
||||
+/* Test that _IO_wfile_sync does not crash (bug 20568).
|
||||
+ Copyright (C) 2019 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 <locale.h>
|
||||
+#include <stdio.h>
|
||||
+#include <wchar.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xunistd.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ TEST_VERIFY_EXIT (setlocale (LC_ALL, "de_DE.UTF-8") != NULL);
|
||||
+ /* Fill the stdio buffer and advance the read pointer. */
|
||||
+ TEST_VERIFY_EXIT (fgetwc (stdin) != WEOF);
|
||||
+ /* This calls _IO_wfile_sync, it should not crash. */
|
||||
+ TEST_VERIFY_EXIT (setvbuf (stdin, NULL, _IONBF, 0) == 0);
|
||||
+ /* Verify that the external file offset has been synchronized. */
|
||||
+ TEST_COMPARE (xlseek (0, 0, SEEK_CUR), 1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
Index: glibc-2.29/libio/tst-wfile-sync.input
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.29/libio/tst-wfile-sync.input
|
||||
@@ -0,0 +1 @@
|
||||
+This is a test of _IO_wfile_sync.
|
||||
Index: glibc-2.29/libio/wfileops.c
|
||||
===================================================================
|
||||
--- glibc-2.29.orig/libio/wfileops.c
|
||||
+++ glibc-2.29/libio/wfileops.c
|
||||
@@ -508,11 +508,12 @@ _IO_wfile_sync (FILE *fp)
|
||||
generate the wide characters up to the current reading
|
||||
position. */
|
||||
int nread;
|
||||
-
|
||||
+ size_t wnread = (fp->_wide_data->_IO_read_ptr
|
||||
+ - fp->_wide_data->_IO_read_base);
|
||||
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
|
||||
nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
|
||||
fp->_IO_read_base,
|
||||
- fp->_IO_read_end, delta);
|
||||
+ fp->_IO_read_end, wnread);
|
||||
fp->_IO_read_ptr = fp->_IO_read_base + nread;
|
||||
delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
|
||||
}
|
Loading…
Reference in New Issue
Block a user