From patchwork Thu Aug 30 16:34:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 29135 Received: (qmail 82137 invoked by alias); 30 Aug 2018 16:34:35 -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 82128 invoked by uid 89); 30 Aug 2018 16:34:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=HX-Received:sk:q4-v6mr, Changelog X-HELO: mail-qt0-f174.google.com Return-Path: Subject: Re: [PATCHv2] Fix test failure with -DNDEBUG. To: Florian Weimer , GNU C Library References: <0792219b-b921-2d0e-3102-0095a45fc82f@redhat.com> <9114fb74-7592-bd62-1442-2e9a666972b0@redhat.com> From: Carlos O'Donell Openpgp: preference=signencrypt Message-ID: Date: Thu, 30 Aug 2018 12:34:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: On 08/30/2018 12:24 PM, Florian Weimer wrote: > On 08/30/2018 05:43 PM, Carlos O'Donell wrote: >> +    * elf/tst-dlopen-aout.c: Include support/check.h. Use TEST_VERIFY. > > Needs updating.  “e.g.” in the comment should probably be “that is” or “i.e.”.  Looks fine otherwise. Thanks. Committed v3 with Changelog and typo fix. From d330f31af68f96dde82840d1e9343b479a8c179e Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Thu, 30 Aug 2018 11:01:33 -0400 Subject: [PATCH] Fix test failure with -DNDEBUG. The elf/tst-dlopen-aout.c test uses asserts to verify properties of the test execution. Instead of using assert it should use xpthread_create and xpthread_join to catch errors starting the threads and fail the test. This shows up in Fedora 28 when building for i686-pc-linux-gnu and using gcc 8.1.1. Tested on i686, and fixes a check failure with -DNDEBUG. Signed-off-by: Carlos O'Donell --- ChangeLog | 5 +++++ elf/tst-dlopen-aout.c | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3689a68c9..21d914141c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-08-30 Carlos O'Donell + + * elf/tst-dlopen-aout.c: Include support/xthread.h. Use + xpthread_create and xpthread_join. + 2018-08-30 Florian Weimer * stdlib/stdlib.h (reallocarray): Make available under __USE_MISC. diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c index 9038e2096a..b0264515cf 100644 --- a/elf/tst-dlopen-aout.c +++ b/elf/tst-dlopen-aout.c @@ -27,6 +27,7 @@ #include #include #include +#include __thread int x; @@ -45,7 +46,6 @@ do_test (int argc, char *argv[]) { pthread_t thr; void *p; - int rc; p = dlopen (argv[0], RTLD_LAZY); if (p != NULL) @@ -53,11 +53,11 @@ do_test (int argc, char *argv[]) fprintf (stderr, "dlopen unexpectedly succeeded\n"); return 1; } - rc = pthread_create (&thr, NULL, fn, NULL); - assert (rc == 0); - - rc = pthread_join (thr, NULL); - assert (rc == 0); + /* We create threads to force TLS allocation, which triggers + the original bug i.e. running out of surplus slotinfo entries + for TLS. */ + thr = xpthread_create (NULL, fn, NULL); + xpthread_join (thr); } return 0; -- 2.17.1