From patchwork Tue Dec 13 12:28:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 87870 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2174863qgi; Tue, 13 Dec 2016 04:29:07 -0800 (PST) X-Received: by 10.98.68.84 with SMTP id r81mr99717421pfa.174.1481632147876; Tue, 13 Dec 2016 04:29:07 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g1si47880147plb.278.2016.12.13.04.29.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2016 04:29:07 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75828-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-75828-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75828-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:content-type; q=dns; s=default; b=AB9JdkHCpsuFM5gMFABCw Kp9Ym0ogR2ujSjHWXGnS+FMeWlm4smfwzZEiNi/X6xX/v/gnoEj2mL2TeEMIT35C AJeT6TIPkYG115efQBnSAqKxqxSkp81dq3BFjy2I83rIdMjMoEVFQ7mYiKGs5Qa7 RyJXgobFe0D3hinwgIPtCY= 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:message-id:date:from:mime-version:to:cc :subject:content-type; s=default; bh=MapGLkVyl2e6Q3XTso48i7NMOjk =; b=cvAt/FyueWjAU1uxBahs9IsqXZUl1WURX3JvvXiT4JkM3N0xvlLZn1m1NaV vcgAkm341OmjwmMf38WMhmDnrY6ip1jWK+nv/glCm2knxaWbBE56gr0Jryw5t3+5 PpUhf7LXedG/KNBCsMz1j5s/ct30tiAr7UiBaGfmd9UZEBe8= Received: (qmail 101013 invoked by alias); 13 Dec 2016 12:28:58 -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 101000 invoked by uid 89); 13 Dec 2016 12:28:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=2x, 4x, 5x, 1x X-HELO: EUR03-AM5-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Message-ID: <584FE979.3060001@arm.com> Date: Tue, 13 Dec 2016 12:28:41 +0000 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: GNU C Library CC: Subject: [PATCH v3] Test case for BZ 19329 X-ClientProxiedBy: DB5PR08CA0073.eurprd08.prod.outlook.com (10.166.166.169) To AM5PR0802MB2484.eurprd08.prod.outlook.com (10.175.42.151) X-MS-Office365-Filtering-Correlation-Id: 32beef3c-c4d0-4276-ab89-08d423539480 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM5PR0802MB2484; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2484; 3:LfAdFv7p/w1xpajD8WH1CNuh4bMBY5TSc/UghKXeSvdT7MtxZvd8JXHNC/tcuFlr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51+v1mfpcBHbj68rnOdb6DWDdegiQ== X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2484; 31:F1BKxE1n0EVe87rcduSc7GOMEhhJR5N3+p0ldptQ3ZeuGh4gUnf7ii5w6x4lZFdbZiHEBIPOPv/ZUSCBjDhmW3+nDvMe12uebJpDdz4HxAsUSWA6LcQLuhmdGKccXTZcLQ/1XWkOfYV69qvalAsV+WQ35hoMI8YrgGljyMaUg+A7kO65QmNwq3pBZpXo9B+6D9um0I+eSrWW/ig/M11LzAE9mlHW+QBt1a70qoUJeLEo6OIJStPBi2GMw6gWhbK0utMTab5zs4/Ra8jUQgwqRdrqulX59/Y0FbjfDdoaH6o=; 20:OEQjewvieF2sZswziS+3qc2we5rq9obncyuHbGbSfsbeCWpSvSM82EDa+FSrWD8kQ8xBO0I/FqfzEODwhhuVQ8HiWrLxj5nGLGtuVDLn1eeC9Xa2622M6TZIPhTnWRX+VexcQ8Njlu6UspVR7yxvl7HZQE7Gx652upJnLCq/fcY= NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:AM5PR0802MB2484; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2484; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2484; 4:ir5xu31634aNRzeOKnLyVzybYN1s5IrJG7lDj/TgraDtYF1fzC7MQkkIlpr6Za49H8sRd7hpKYgx6+DCW9XSAIUVoSKQ7QDbz5Jlz1be2C6K7V6IOXdph9aqOF8yXyM+Hf4kxdseLwqleQIjSoE5NcMcE/LX0sVRX3LyIQGABc0XtrBy5xcXLTE7LC2T6KMAKopM6G7/cpHvgFeZVcFTJwbNUpAw8exHP0kqFwUgeo50llWH1C9R0dqhHjbUi9Fbw+OAzo+0VLKVejS+xEJ2OPc1oOVKZMiB/9vWSU3CUnK3bgdcCSUbkDlihZ/UVrAO4e27MR7IIUphqIxQ4cdKZrAbZBiFor8qXdXBqjAhTPZl3dzB64xQsy1+7FwPLhKBDbY2F8yDM7q8SpURlJda1uPaOTQQh+PbgD7F+e62FlF97fYoWXlKQBJzX2YJZ1yEwtI4syQ7iOnUZWeHCrpZU1KOVM+j82tHHNum7CR+3AjLGCp+rLIMaCH7VVWTLnbtdBjSBosbWejAEVn8hEoJs389B3ed7ICWKUqtEKWs/2DLYAv4e0YmRdBOZT50luaZATVpocHJG5sI4vCMjm4gTMulPc1xICvtT6qLa5l+QkeIsbW913CEbAx4i7KYPVWJCMTAvwnquVPip7gnP6dR9w== X-Forefront-PRVS: 01559F388D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(39410400002)(39840400002)(39450400003)(39860400002)(39850400002)(377424004)(199003)(189002)(36756003)(106356001)(90366009)(66066001)(450100001)(97736004)(65956001)(4326007)(4001350100001)(50986999)(189998001)(54356999)(568964002)(4001150100001)(81156014)(87266999)(65816999)(101416001)(65806001)(42186005)(33656002)(305945005)(68736007)(7736002)(81166006)(80316001)(270700001)(6116002)(5660300001)(5000100001)(6486002)(512874002)(21490400002)(64126003)(2476003)(110136003)(2906002)(59896002)(8676002)(84326002)(4610100001)(6916009)(3846002)(83506001)(105586002)(38730400001)(77096006)(6666003)(86362001)(5890100001)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2484; H:[10.2.206.73]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2484; 23:2ODvi45C51LEkues4KC+MNkTXnyAE8RI4h06Viw?= =?us-ascii?Q?/yAWES3+xp6NW0bYNJR8njNNf1qdkqA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ant-OriginalArrivalTime: 13 Dec 2016 12:28:44.4308 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2484 Test concurrent dlopen and pthread_create when the loaded modules have TLS. This triggers dl-tls assertion failures more reliably than the tst-stack4 test. The dlopened module has 100 DT_NEEDED dependencies, the number of concurrent threads created during dlopen depends on filesystem speed and hardware. Doing the test in a fork loop can make it more reliable. v2: - undef NDEBUG. - join nop threads so at most 3 threads exist at a time. - remove stack size setting (resource usage is no longer a concern). - stop creating threads after dlopen observably finished. - print the number of threads created for debugging. v3: - use the new test support code. - better Makefile usage so modules are cleaned properly. 2016-12-13 Szabolcs Nagy * nptl/Makefile (tests): Add tst-tls7. (modules-names): Add tst-tls7mod, tst-tls7mod-dep. * nptl/tst-tls7.c: New file. * nptl/tst-tls7mod-dep.c: New file. * nptl/tst-tls7mod.c: New file. diff --git a/nptl/Makefile b/nptl/Makefile index 7ac9196..d942b54 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -345,20 +345,24 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ tst-oncex3 tst-oncex4 ifeq ($(build-shared),yes) tests += tst-atfork2 tst-tls3 tst-tls3-malloc tst-tls4 tst-tls5 tst-_res1 \ - tst-fini1 tst-stackguard1 + tst-fini1 tst-stackguard1 tst-tls7 tests-nolibpthread += tst-fini1 ifeq ($(have-z-execstack),yes) tests += tst-execstack endif endif +one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \ + 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x) +tst-tls7mod-deps = $(one-hundred:%=tst-tls7mod-dep-%.so) + modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \ tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \ tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \ tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod \ - tst-join7mod + tst-join7mod tst-tls7mod tst-tls7mod-dep extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ - tst-cleanup4aux.o tst-cleanupx4aux.o + tst-cleanup4aux.o tst-cleanupx4aux.o $(tst-tls7mod-deps) test-extras += $(modules-names) tst-cleanup4aux tst-cleanupx4aux test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) @@ -563,6 +567,12 @@ $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library) LDFLAGS-tst-tls5 = $(no-as-needed) LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so +$(objpfx)tst-tls7: $(libdl) $(shared-thread-library) +$(objpfx)tst-tls7.out: $(objpfx)tst-tls7mod.so +$(objpfx)tst-tls7mod.so: $(tst-tls7mod-deps:%=$(objpfx)%) +$(tst-tls7mod-deps:%=$(objpfx)%): $(objpfx)tst-tls7mod-dep.so + cp -f $< $@ + ifeq ($(build-shared),yes) $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \ $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \ diff --git a/nptl/tst-tls7.c b/nptl/tst-tls7.c new file mode 100644 index 0000000..f221ed2 --- /dev/null +++ b/nptl/tst-tls7.c @@ -0,0 +1,69 @@ +/* Test concurrent dlopen and pthread_create: BZ 19329. + Copyright (C) 2016 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 + . */ + +#include +#include +#include +#include + +#include + +#define THREADS 10000 + +static volatile int done; + +static void * +start (void *a) +{ + if (dlopen ("tst-tls7mod.so", RTLD_LAZY) == NULL) + { + printf ("dlopen failed: %s\n", dlerror ()); + exit (1); + } + atomic_store_relaxed (&done, 1); + return 0; +} + +static void * +nop (void *a) +{ + return 0; +} + +static int +do_test (void) +{ + pthread_t t1, t2; + int i; + + /* Load a module with lots of dependencies and TLS. */ + t1 = xpthread_create (0, start, 0); + + /* Concurrently create lots of threads until dlopen is observably done. */ + for (i = 0; i < THREADS && !atomic_load_relaxed (&done); i++) + { + t2 = xpthread_create (0, nop, 0); + xpthread_join (t2); + } + + xpthread_join (t1); + printf ("threads created during dlopen: %d\n", i); + return 0; +} + +#include diff --git a/nptl/tst-tls7mod-dep.c b/nptl/tst-tls7mod-dep.c new file mode 100644 index 0000000..206ece4 --- /dev/null +++ b/nptl/tst-tls7mod-dep.c @@ -0,0 +1 @@ +int __thread x; diff --git a/nptl/tst-tls7mod.c b/nptl/tst-tls7mod.c new file mode 100644 index 0000000..206ece4 --- /dev/null +++ b/nptl/tst-tls7mod.c @@ -0,0 +1 @@ +int __thread x;