tamiko      17/06/14 22:28:44

  Modified:             README.history
  Added:               
                        
00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
                        00_all_0048-sh-Fix-building-with-gcc5-6.patch
  Log:
  glibc-2.24 Update to patchset 7

Revision  Changes    Path
1.7                  src/patchsets/glibc/2.24/README.history

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/README.history?rev=1.7&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/README.history?rev=1.7&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/README.history?r1=1.6&r2=1.7

Index: README.history
===================================================================
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.24/README.history,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- README.history      20 Mar 2017 15:06:11 -0000      1.6
+++ README.history      14 Jun 2017 22:28:44 -0000      1.7
@@ -1,3 +1,7 @@
+7              15 June 2017
+       + 00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
+       + 00_all_0048-sh-Fix-building-with-gcc5-6.patch
+
 6              20 Mar 2017
        + 00_all_0046-posix_spawn-fix-stack-setup-on-ia64-BZ-21275.patch
 



1.1                  
src/patchsets/glibc/2.24/00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch?rev=1.1&content-type=text/plain

Index: 00_all_0047-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
===================================================================
>From 21f042c804835d1f7a4a8e06f2c93ca35a182042 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vap...@gentoo.org>
Date: Wed, 15 Mar 2017 23:59:31 -0700
Subject: [PATCH] posix_spawn: use a larger min stack for -fstack-check [BZ
 #21253]

When glibc is built with -fstack-check, trying to use posix_spawn can
lead to segfaults due to gcc internally probing stack memory too far.
The new spawn API will allocate a minimum of 1 page, but the stack
checking logic might probe a couple of pages.  When it tries to walk
them, everything falls apart.

The gcc internal docs [1] state the default interval checking is one
page.  Which means we need two pages (the current one, and the next
probed).  No target currently defines it larger.

Further, it mentions that the default minimum stack size needed to
recover from an overflow is 4/8KiB for sjlj or 8/12KiB for others.
But some Linux targets (like mips and ppc) go up to 16KiB (and some
non-Linux targets go up to 24KiB).

Let's create each child with a minimum of 32KiB slack space to support
them all, and give us future breathing room.

No test is added as existing ones crash.  Even a simple call is
enough to trigger the problem:
        char *argv[] = { "/bin/ls", NULL };
        posix_spawn(NULL, "/bin/ls", NULL, NULL, argv, NULL);

[1] https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Stack-Checking.html
---
 sysdeps/unix/sysv/linux/spawni.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index c946120..b5f20a7 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -326,6 +326,11 @@ __spawnix (pid_t * pid, const char *file,
 
   /* Add a slack area for child's stack.  */
   size_t argv_size = (argc * sizeof (void *)) + 512;
+  /* We need at least a few pages in case the compiler's stack checking is
+     enabled.  In some configs, it is known to use at least 24KiB.  We use
+     32KiB to be "safe" from anything the compiler might do.  Besides, the
+     extra pages won't actually be allocated unless they get used.  */
+  argv_size += (32 * 1024);
   size_t stack_size = ALIGN_UP (argv_size, GLRO(dl_pagesize));
   void *stack = __mmap (NULL, stack_size, prot,
                        MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);



1.1                  
src/patchsets/glibc/2.24/00_all_0048-sh-Fix-building-with-gcc5-6.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/00_all_0048-sh-Fix-building-with-gcc5-6.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.24/00_all_0048-sh-Fix-building-with-gcc5-6.patch?rev=1.1&content-type=text/plain

Index: 00_all_0048-sh-Fix-building-with-gcc5-6.patch
===================================================================
>From d40dbe722f004f999b589de776f7e57e564dda01 Mon Sep 17 00:00:00 2001
From: Alexey Neyman <sti...@att.net>
Date: Wed, 8 Feb 2017 16:00:57 -0200
Subject: [PATCH] sh: Fix building with gcc5/6

Build glibc for sh4-unknown-linux-gnu currently fails if one's
using GCC5/6: in dl-conflict.c, the elf_machine_rela() function
is called with NULL as its 3rd argument, sym. The implementation
of that function in sysdeps/sh/dl-machine.h dereferences that pointer:

const Elf32_Sym *const refsym = sym;
...
if (map == &GL(dl_rtld_map))
  value -= map->l_addr + refsym->st_value + reloc->r_addend;

GCC discovers a null pointer dereference, and in accordance with
-fdelete-null-pointer-checks (which is enabled in -O2) replaces this
code with a trap - which, as SH does not implement a trap pattern in
GCC, evaluates to an abort() call. This abort() call pulls many more
objects from libc_nonshared.a, eventually resulting in link failure
due to multiple definitions for a number of symbols.

As far as I see, the conditional before this code is always false in
rtld: _dl_resolve_conflicts() is called with main_map as the first
argument, not GL(_dl_rtld_map), but since that call is in yet another
compilation unit, GCC does not know about it. Patch that wraps this
conditional into !defined RESOLVE_CONFLICT_FIND_MAP attached.

        * sysdeps/sh/dl-machine.h (elf_machine_rela): The condition
        in R_SH_DIR32 case is always false when inlined from
        dl-conflict.c. Ifdef out to prevent GCC from insertin an
        abort() call.
---
 sysdeps/sh/dl-machine.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 5bb37d0..6509055 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -389,7 +389,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela 
*reloc,
          break;
        case R_SH_DIR32:
          {
-#ifndef RTLD_BOOTSTRAP
+#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
           /* This is defined in rtld.c, but nowhere in the static
              libc.a; make the reference weak so static programs can
              still link.  This declaration cannot be done when




Reply via email to