about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-01-15 16:05:36 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-01-16 09:23:12 +0100
commit3e75e676da29d95cf8fbef1b1a441a40cba7ac2b (patch)
treeafb79a2cbe31cc80be9f4093fc850f44ab9ea7ca
parent5d4c589ca4b527f24f04b8ad23c579499aa510bc (diff)
downloadglibc-3e75e676da29d95cf8fbef1b1a441a40cba7ac2b.tar.gz
glibc-3e75e676da29d95cf8fbef1b1a441a40cba7ac2b.tar.xz
glibc-3e75e676da29d95cf8fbef1b1a441a40cba7ac2b.zip
nptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]
Disabling lazy binding reduces stack usage during unwinding.

Note that RTLD_NOW only makes a difference if libgcc.so has not
already been loaded, so this is only a partial fix.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit f993b8754080ac7572b692870e926d8b493db16c)
-rw-r--r--ChangeLog6
-rw-r--r--NEWS1
-rw-r--r--sysdeps/nptl/unwind-forcedunwind.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e80c8e4c6..2cdd081116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-10  Florian Weimer  <fweimer@redhat.com>
+
+	[BZ #22636]
+	* sysdeps/nptl/unwind-forcedunwind.c (pthread_cancel_init): Open
+	libgcc.so with RTLD_NOW, to avoid lazy binding during unwind.
+
 2018-01-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	[BZ #22637]
diff --git a/NEWS b/NEWS
index fb54fa069c..e7eba7610d 100644
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,7 @@ The following bugs are resolved with this release:
   [21972] assert macro requires operator== (int) for its argument type
   [22078] nss_files performance issue in hosts multi mode
   [22322] libc: [mips64] wrong bits/long-double.h installed
+  [22636] PTHREAD_STACK_MIN is too small on x86-64
   [22627] $ORIGIN in $LD_LIBRARY_PATH is substituted twice
   [22637] nptl: Fix stack guard size accounting
   [22679] getcwd(3) can succeed without returning an absolute path
diff --git a/sysdeps/nptl/unwind-forcedunwind.c b/sysdeps/nptl/unwind-forcedunwind.c
index 33a1975f5e..ace58b2468 100644
--- a/sysdeps/nptl/unwind-forcedunwind.c
+++ b/sysdeps/nptl/unwind-forcedunwind.c
@@ -49,7 +49,7 @@ pthread_cancel_init (void)
       return;
     }
 
-  handle = __libc_dlopen (LIBGCC_S_SO);
+  handle = __libc_dlopen_mode (LIBGCC_S_SO, RTLD_NOW | __RTLD_DLOPEN);
 
   if (handle == NULL
       || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL