From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36768 invoked by alias); 16 Jan 2018 08:49:14 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 36638 invoked by uid 89); 16 Jan 2018 08:49:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org 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,KAM_SHORT,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jan 2018 08:49:11 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85DB75BEBC for ; Tue, 16 Jan 2018 08:49:10 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-116-137.ams2.redhat.com [10.36.116.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9F3660177 for ; Tue, 16 Jan 2018 08:49:09 +0000 (UTC) Received: by oldenburg.str.redhat.com (Postfix, from userid 1000) id 07E39405D5841; Tue, 16 Jan 2018 09:49:04 +0100 (CET) Date: Mon, 01 Jan 2018 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.25 COMMITTED] nptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636] User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20180116084904.07E39405D5841@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 16 Jan 2018 08:49:10 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00047.txt.bz2 I verified that without the guard accounting change in commit 630f4cc3aa019ede55976ea561f1a7af2f068639 (Fix stack guard size accounting) and RTLD_NOW for libgcc_s introduced by commit f993b8754080ac7572b692870e926d8b493db16c (nptl: Open libgcc.so with RTLD_NOW during pthread_cancel), the tst-minstack-cancel test fails on an AVX-512F machine. tst-minstack-exit still passes, and either of the mentioned commit by itself frees sufficient stack space to make tst-minstack-cancel pass, too. Reviewed-by: Carlos O'Donell (cherry picked from commit d8b778907e5270fdeb70459842ffbc20bd2ca5e1) 2018-01-11 Florian Weimer [BZ #22636] * nptl/Makefile (tests): Add tst-minstack-cancel, tst-minstack-exit. * nptl/tst-minstack-cancel.c, nptl/tst-minstack-exit.c: New files. diff --git a/nptl/Makefile b/nptl/Makefile index 4a0d027fa2..8bcb346866 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -300,7 +300,7 @@ tests = tst-typesizes \ tst-bad-schedattr \ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \ tst-robust-fork tst-create-detached \ - tst-thread-exit-clobber + tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \ tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 diff --git a/nptl/tst-minstack-cancel.c b/nptl/tst-minstack-cancel.c new file mode 100644 index 0000000000..a306320e88 --- /dev/null +++ b/nptl/tst-minstack-cancel.c @@ -0,0 +1,48 @@ +/* Test cancellation with a minimal stack size. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Note: This test is similar to tst-minstack-exit, but is separate to + avoid spurious test passes due to warm-up effects. */ + +#include +#include +#include +#include + +static void * +threadfunc (void *closure) +{ + while (1) + pause (); + return NULL; +} + +static int +do_test (void) +{ + pthread_attr_t attr; + xpthread_attr_init (&attr); + xpthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); + pthread_t thr = xpthread_create (&attr, threadfunc, NULL); + xpthread_cancel (thr); + TEST_VERIFY (xpthread_join (thr) == PTHREAD_CANCELED); + xpthread_attr_destroy (&attr); + return 0; +} + +#include diff --git a/nptl/tst-minstack-exit.c b/nptl/tst-minstack-exit.c new file mode 100644 index 0000000000..9c7e9a4dfe --- /dev/null +++ b/nptl/tst-minstack-exit.c @@ -0,0 +1,46 @@ +/* Test that pthread_exit works with the minimum stack size. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Note: This test is similar to tst-minstack-cancel, but is separate + to avoid spurious test passes due to warm-up effects. */ + +#include +#include +#include +#include + +static void * +threadfunc (void *closure) +{ + pthread_exit (threadfunc); + return NULL; +} + +static int +do_test (void) +{ + pthread_attr_t attr; + xpthread_attr_init (&attr); + xpthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); + pthread_t thr = xpthread_create (&attr, threadfunc, NULL); + TEST_VERIFY (xpthread_join (thr) == threadfunc); + xpthread_attr_destroy (&attr); + return 0; +} + +#include