From patchwork Wed Jan 10 10:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 858213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-88991-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="qBnbbF5P"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGm3F0ZJGz9ryk for ; Wed, 10 Jan 2018 21:49:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= Pa2enxz73evzPyn0DLNgVUZ2X21R4A4d0D3f1N8ncOyNFMSIHCN88NLXrV4hSAf/ ajtkmPxR32UIp1RuAlDoGn86QcM1sVpjXMTxzQim+1d0tgA/1Zot91iXbDMcqvpk HHBW6kbM0oXqe5N1gmQ5HraGaJTUCfx6+Yq4odgAgzc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=5LabLV 1DnnSgoh0SnYhtHx6/PgM=; b=qBnbbF5Puf9BtPbC9USsx2rkNa2/ridJ0h+BcI U2GkuSdWavgE+bmO56fBUBb7XYHtXl5VL+F+eS8xcTOs44+glKAbAVzh0dSlxs3S +zdtwtTT1KHQSSnLkNMutV+tE251Qo3zqdWQWwXCSlAhTNrYFAPYC74vbz6hWVUG 9CU+I= Received: (qmail 126377 invoked by alias); 10 Jan 2018 10:49:07 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 126362 invoked by uid 89); 10 Jan 2018 10:49:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:887, resume X-HELO: mx1.redhat.com Date: Wed, 10 Jan 2018 11:49:03 +0100 To: libc-alpha@sourceware.org Subject: [PATCH] nptl: Open libgcc.so with RTLD_NOW during pthread_cancel User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20180110104903.A4F88439942E1@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) 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. 2018-01-10 Florian Weimer [BZ #22636] * sysdeps/nptl/unwind-forcedunwind.c (pthread_cancel_init): Open libgcc.so with RTLD_NOW, to avoid lazy binding during unwind. Reviewed-by: Adhemerval Zanella Reviewed-by: Carlos O'Donell diff --git a/sysdeps/nptl/unwind-forcedunwind.c b/sysdeps/nptl/unwind-forcedunwind.c index ab4350de99..67b8e74b53 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