* [gentoo-commits] gentoo commit in src/patchsets/glibc/2.25: 00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch 00_all_0014-sh-Fix-building-with-gcc5-6.patch README.history
@ 2017-06-14 22:34 Matthias Maier (tamiko)
0 siblings, 0 replies; only message in thread
From: Matthias Maier (tamiko) @ 2017-06-14 22:34 UTC (permalink / raw
To: gentoo-commits
tamiko 17/06/14 22:34:45
Modified: README.history
Added:
00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
00_all_0014-sh-Fix-building-with-gcc5-6.patch
Log:
glibc-2.25 Update to patchset 4
Revision Changes Path
1.4 src/patchsets/glibc/2.25/README.history
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/README.history?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/README.history?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/README.history?r1=1.3&r2=1.4
Index: README.history
===================================================================
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.25/README.history,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- README.history 20 Mar 2017 15:06:11 -0000 1.3
+++ README.history 14 Jun 2017 22:34:45 -0000 1.4
@@ -1,3 +1,7 @@
+4 15 Jun 2017
+ + 00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
+ + 00_all_0014-sh-Fix-building-with-gcc5-6.patch
+
3 20 Mar 2017
+ 00_all_0012-posix_spawn-fix-stack-setup-on-ia64-BZ-21275.patch
1.1 src/patchsets/glibc/2.25/00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/00_all_0013-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.25/00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch?rev=1.1&content-type=text/plain
Index: 00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch
===================================================================
From 21f042c804835d1f7a4a8e06f2c93ca35a182042 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@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.25/00_all_0014-sh-Fix-building-with-gcc5-6.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/00_all_0014-sh-Fix-building-with-gcc5-6.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.25/00_all_0014-sh-Fix-building-with-gcc5-6.patch?rev=1.1&content-type=text/plain
Index: 00_all_0014-sh-Fix-building-with-gcc5-6.patch
===================================================================
From d40dbe722f004f999b589de776f7e57e564dda01 Mon Sep 17 00:00:00 2001
From: Alexey Neyman <stilor@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-14 22:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14 22:34 [gentoo-commits] gentoo commit in src/patchsets/glibc/2.25: 00_all_0013-posix_spawn-use-a-larger-min-stack-for-fstack-check-.patch 00_all_0014-sh-Fix-building-with-gcc5-6.patch README.history Matthias Maier (tamiko)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox