public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: libc-stable@sourceware.org
Cc: Florian Weimer <fweimer@redhat.com>
Subject: [2.24 COMMITTED 2/5] nptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]
Date: Mon, 01 Jan 2018 00:00:00 -0000	[thread overview]
Message-ID: <20181228222540.18325-2-aurelien@aurel32.net> (raw)
In-Reply-To: <20181228222540.18325-1-aurelien@aurel32.net>

From: Florian Weimer <fweimer@redhat.com>

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)
---
 ChangeLog                          | 6 ++++++
 NEWS                               | 1 +
 sysdeps/nptl/unwind-forcedunwind.c | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 7f37d678be..48292d6bf0 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 f2e9b3bf9f..9a11b86b11 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,7 @@ The following bugs are resolved with this release:
   [21609] x86-64: Align the stack in __tls_get_addr
   [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366)
   [21654] nss: Fix invalid cast in group merging
+  [22636] PTHREAD_STACK_MIN is too small on x86-64
   [22637] nptl: Fix stack guard size accounting
   [22644] string: memmove-sse2-unaligned on 32bit x86 produces garbage when
     crossing 2GB threshold (CVE-2017-18269)
diff --git a/sysdeps/nptl/unwind-forcedunwind.c b/sysdeps/nptl/unwind-forcedunwind.c
index ca757c48ce..24a1c5b30d 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
-- 
2.19.2

  reply	other threads:[~2018-12-28 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-01  0:00 [2.24 COMMITTED 1/5] [BZ #22637] Fix stack guard size accounting Aurelien Jarno
2018-01-01  0:00 ` Aurelien Jarno [this message]
2018-01-01  0:00 ` [2.24 COMMITTED 4/5] nptl/tst-minstack-throw: Compile in C++11 mode with GNU extensions Aurelien Jarno
2018-01-01  0:00 ` [2.24 COMMITTED 3/5] nptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636] Aurelien Jarno
2018-01-01  0:00 ` [2.24 COMMITTED 5/5] csu: Update __libgcc_s_init comment Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181228222540.18325-2-aurelien@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=fweimer@redhat.com \
    --cc=libc-stable@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).