From patchwork Thu Nov 24 11:18:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 83858 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp78705qgi; Thu, 24 Nov 2016 03:19:02 -0800 (PST) X-Received: by 10.98.63.148 with SMTP id z20mr1722607pfj.151.1479986342904; Thu, 24 Nov 2016 03:19:02 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b14si10353699pli.234.2016.11.24.03.19.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 03:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75130-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-75130-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75130-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=vglP+eu+3rVB0KSFdZOlh eps0N4iT8TIFZhtgA9T7CFqA+VsrQQ8tliLhvwCR2koR4cAbWtE17CMSgi2XuT/G a/moU+xU+i/9Qv38KmX4ugOJnPHwsmoACoZig6YFL7mjbgRy0eTmdGBTRNBtfil+ 6jryR9IPqdmgWejQWEkoY4= 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=mV85Ljkdprjp+Ru5mErdeT7y95A =; b=BHYVwcvA30NZgV3tQQt/yYcJThlNf+yplSD/Ev6qmxLnfNvlJbDMsPZefje 3Vr4GvJXh0NqRU0ovutV02j3JIafpT3oURD3hus4Q1ehXGLWTGwOeGn/v9Iez1kY 7i4MDQOHk5jsiYmvlCbp70fM3JBmS+S/rzp708rqWv30kxBI= Received: (qmail 4392 invoked by alias); 24 Nov 2016 11:18:44 -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 4382 invoked by uid 89); 24 Nov 2016 11:18:43 -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=4000, os, libdl, (unknown) X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Message-ID: <5836CC80.9070101@arm.com> Date: Thu, 24 Nov 2016 11:18:24 +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] Test case for BZ 19329 X-ClientProxiedBy: AM4PR0101CA0017.eurprd01.prod.exchangelabs.com (10.167.254.27) To HE1PR0802MB2154.eurprd08.prod.outlook.com (10.172.126.14) X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2154; 2:zbI3InH2fC1L5B8SoSyaGCh7lr9TzKEqOrBMlA6fHbHQjD9khGRMOi9xMwzzKegQ8O2wppDEyFdU4y+X5QRCfzf/eBKREASj5GvWxb9tq3Hg0bHDDPKYE74JI3hdd72jGMm+OqXtSMcgOyzk/oJE+pPTCs5dDl2U1vRMDwaBKP8=; 3:Jb7jwduaooGIof8ZvNf6z5GxUxWdqwyKBaRcb6P7+RgpFsZsXu9xB7m+HGTqs4L7KZCkpJQEiC3QgAkv9qXJUKdKAFblKUJHCVUPxxjzwd3cn/pzvyXhj01qcc1L9wik4QMOyxreDdJolxA4+XPbC+dwdeROHNlBHOE74lhvL+8=; 25:eTcRs5ChyoxftuAUV2JA4zCO0LAlBhJT/mjAcsv1bBOND1re2q4/G609ocgpRCMPzwLtD8YLcykqIVyVMwL4EFFAu3uk27kBrYqIfBWW0fzRI5b3xO5QD5jX9wAMu3z/ewbs+B3y/Y80Indigy44Z57mXutoZljTiLPCs2TV4Nu/i1guQyNmWgCvNTHpxjNn1dsa3Pgg+Wn62k6j6kgnDbZyQ41kAJs6gb+AdU9towp/8nE4G6RnAsOsyqc7XZCcPOXt92YZy+h1z3ejcuXW9Gn5Z3u328DhqDBBqswhDgBnSp34HAvT9S9mm5NXjllISpNX9HjV9yxVTcR30Ey+OY6sHAVjcVPR9+1xmbGzcYlwR4De7OYGLgt6obFrWjYBRUaz9Zd/itEed9TX2VrU8Ge4a4ErlQ5pec+930t+yRBlxeMkQDvNZuwzuuUy/fbCenS9JF5JKce4yVlKjY30yGmva5e9cROl1iw/HPokmCg= X-MS-Office365-Filtering-Correlation-Id: 87375581-59b0-4b9d-4859-08d4145b9e24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HE1PR0802MB2154; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2154; 31:+QvoG/GgNP/hqD6kEtPDHUsz1jKL6bipdfTFFg8k2Spjnsza0fNz6lgASYAJJ/CYdFRSLQn/81hDsyQLQwi2kKju+Wov2f7E0WjSnEEtckx3LMbzVhqtb8oOWAXvGnpm9g7W2YNylQbFHuoVrkMW+CxzIfqToY4/vCstuAX0c6/oTSALKVCn+EjRJPx3jwYg5oOAVVFS8A37p9Xrck1GdEwuHIfhSThx7GX40zVaZkjH5pyg2Fs6gOLqnKpShsB14a1GYy7/MdLqwlcmiWIh7gNMr3cAbbS+rD/HYw5d4PzAfcLceEdiHH2lyEJKCIx7; 20:qh4vaxBSxZv2ibbEmqx5S61NnUBojH7L3WLNNWVa5GRXfTbYyuWMG0EgzblGGjz1vvisSCHAuLnpyihayBNcCs42UfchH8INU1xzYtZdYNVTULlpl4dye5LzwnrQmOB0k9d8clao/yG+J2uJ5xOe1RqNwNTD4Ti35HrIVPrgxKw= 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)(6045199)(6040361)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025); SRVR:HE1PR0802MB2154; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0802MB2154; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2154; 4:eRGUNmlii39FuEWlTgNTomyQWlpNEpL0gtn4iQHssCKk777d1o/oD0RQX5jIGWHUe3JMDCkOpPkfUMj7ULvY2x+WigQ6WZq4euWXB39jvNcqhwokn8qbLySPIzi56iMrT33bY9S32RNzEs0qDHAQ8O3bSn4vIBQH4AgjZdarjlsIthf/APtEDbiB3/K26V83ZhR5laPWUSv/4r9DddqP/nsXaunn1ZCk6W31vAmzmYo89oYk2+BIsReFZsJeOxR+6/CZvXRDjS06oAYOe5T9i18Gjjs1viWqfCAArZTODODd+hvXJxFGt9CiphT0HKkFXOWnKRz44LdMiTLGjsQk+TNgZ3rYtd/CwII84Jbcg8q6tes9YLP4JeeJvy4DrazOG0r/swAq4fJfnSCyAUyw7uXjObevU2s5rcilxIqQD04lLVSXKe+vEzhJ9EvBgz/mPfw8osud+3kRYCaqJ5TJp8q4zz4UmgzH7ohLQyxF5PTl+t2oPV1lngYG/Y1DCkIlxEoybg9XWgEzxc5zR+99xC5tDyLC9xdL3a/9CMWcBskZd4HfyFK76ArhMiqm4bxW7WzHJLiF3FGAeOmMYoPU92VaKM8pGir6SPPTOw7vzXzH8E0VP/TqucJ1IoAYgkUCVytX/R5sopnhZOIxURsMYA== X-Forefront-PRVS: 0136C1DDA4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(377424004)(199003)(189002)(5660300001)(105586002)(568964002)(21490400002)(106356001)(87266999)(6666003)(65816999)(270700001)(80316001)(54356999)(33656002)(84326002)(42186005)(50986999)(4001350100001)(39380400001)(39400400001)(81166006)(7736002)(97736004)(450100001)(7846002)(305945005)(101416001)(77096005)(6916009)(8676002)(4001150100001)(59896002)(65806001)(6116002)(512874002)(189998001)(3846002)(36756003)(2906002)(83506001)(64126003)(5000100001)(39410400001)(66066001)(4326007)(2476003)(65956001)(86362001)(5890100001)(81156014)(110136003)(68736007)(92566002)(4610100001)(38730400001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0802MB2154; 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; HE1PR0802MB2154; 23:cZ3PAg3Xdi7qanXI3L4auRmXXlCt2qH8KueRVg9?= =?us-ascii?Q?hNoAi/TDuTCyjqMT5Z9HzvT/5USvv6r4McK2p+mfT+Xktoq7OS8OlSRl7PMw?= =?us-ascii?Q?ZQ8ACA6C/OziHQnhbDw9QlAMKSNPVCgKleaF72ad+eGyTIRvxmXMkrAgxSuU?= =?us-ascii?Q?wiJjYB9bBLcygxpMW7kDwVi/KVlCDgi9CIonm4q0VcKhXWIyG+TnxHzZu7Qj?= =?us-ascii?Q?/I2RbnfRb/l4dvdXrY4XlzOFUOwZOiOLJhMZcpjH+u5stW0N1q5DMY6tWNlk?= =?us-ascii?Q?9Ujr7M9bkTDpTxKr81ElCc7srsZW95BvfbQV1i57NbDn619TwpDL+AGYWzW5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aqMVdagsqAkNpJzyFdU9?= =?us-ascii?Q?E8AetNcbi9I2kn00xamtvvJRN+qtqPhS99uQPDIZy3FxdINC9bUC6bpvvsVs?= =?us-ascii?Q?905w6wSEFDnWO5uc0aa4fWvd9R9so8k5jDLWPp06fj7mRw37AYnqNRIKQxhx?= =?us-ascii?Q?z3rale+XQfEa3B7av3Wx6wJZSBoYZtZm9SDtYLf6lMjIm2XgiVC4kgKVBbN8?= =?us-ascii?Q?S8avrn7+U+7dL9IOSkQGsZo4wgQ6Tasfmc0GpjMDS4i99NHI9Yvyjs0w2t1g?= =?us-ascii?Q?7kl+YUKBEJc61vcOeScFzsPkIQGXPXtan5Hw=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2154; 6:NAr8/kPsJhybgoDp9JasC9MhqPxoVowOh7P0r1I7PIHS7pxjveqodzC8ENFcBClq+BjLCF9LJ9GzABkUfpygCt+8EvIACkv6/GOD8QAM3aLOiHZwYwEsEw08reOezZ/nMh7NuKkininB1QM/JlOi8C056M7b+ktN6jx4z6gbokr1ZqQROkKgwwABGHgC6CDmgNGwDOx+XGjy+gt7dLyNKNrzNtGVt5YFRsNvy72pN84wPHDF5vUtS+xMa7Gldul7Yv1g4X+3FMqIN4AUjmoo0dtD3I7U7iLNpIcl0a8vwcUvwBdtPEJdjP0G0S8xvbAFIuYChcQeoKsDF98Xnx+2/Q==; 5:mTkVyuNWxHVpn6/K4Z/I2LkJrO6Pe8Iczsi2qM2MYO5XgAV7sugyzmBV27VRm6epTApZOIVlVfS+uwLLqAvqRV6l4Oa8DiDMf5jZlSUsoBsy6U95Zcdfcb8PycNqkGgmrSHxBqPw5Pvp4gQtogouZQ==; 24:zcDHQpZH7QFplV2bcxlaGk9TSb2d75qb3LOIWRrAcOZuNAzfVFCMXuXspFH002fCg8IN7Yq1yOz+wmrJgSqdw/Br9X1RGHDdDc1AvYKDpFk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2154; 7:7pEZdgXZecD4LZMOJVx8c1zz0ydKZHKii/jp/IUDF8fv9v3zcvL66w4pmPFbOCqsopIQRru3WVOwjGiBDpY299qljZmbnIygoRRfPlR9EVk0fmNc2xDDY5tE0YpJrVae6wRSDNbMM/sWWLcb0gWrSAG6JEg+aveovnk11tQijHnkotdEvUiazhD/5aVfr4ycC3gyJsAel22oHDHzR3km4pGxjPZW0npfQdEl4YpqkuqHQnDpPR/1hMTq44FoFuJVGenAMbx6AN1evFefLhgHjZCDeCNiAs/etOc2exJpFfN5LxA97iYt4AkYQW4U2L0BqQdfXeyBspLEMr5XZ23rbYYbiwgW5iJTAa/Dz4x6YwM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2016 11:18:29.1808 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2154 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 and for me about 4000 concurrent thread creations are needed to see failures on x86_64. 2016-11-24 Szabolcs Nagy [BZ #19329] * 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 11588fe..90152d2 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -327,7 +327,7 @@ 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 @@ -338,7 +338,7 @@ 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 test-extras += $(modules-names) tst-cleanup4aux tst-cleanupx4aux @@ -545,6 +545,18 @@ $(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) +tst-tls7mod-deps = $(shell for i in 0 1 2 3 4 5 6 7 8 9; do \ + for j in 0 1 2 3 4 5 6 7 8 9; do \ + echo $(objpfx)tst-tls7mod-dep-$$i-$$j.so; \ + done; done) +$(objpfx)tst-tls7.out: $(objpfx)tst-tls7mod.so +$(objpfx)tst-tls7mod.so: $(tst-tls7mod-deps) +$(tst-tls7mod-deps): $(objpfx)tst-tls7mod-dep.so + cp -f $< $@ +clean: + rm -f $(tst-tls7mod-deps) + 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..e4c7db2 --- /dev/null +++ b/nptl/tst-tls7.c @@ -0,0 +1,62 @@ +/* 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 + +#define THREADS 4000 + +static void * +start (void *a) +{ + assert (dlopen ("tst-tls7mod.so", RTLD_LAZY)); + return 0; +} + +static void * +nop (void *a) +{ + return 0; +} + +static int +do_test (void) +{ + pthread_t td; + pthread_attr_t attr; + + assert (pthread_attr_init (&attr) == 0); + assert (pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN) == 0); + + /* Load a module with lots of dependencies and TLS. */ + assert (pthread_create (&td, 0, start, 0) == 0); + + /* Concurrently create lots of threads. */ + for (int i = 0; i < THREADS; i++) + assert (pthread_create (&(pthread_t){0}, &attr, nop, 0) == 0); + + /* Wait for the loading to finish, ignore other threads. */ + assert (pthread_join (td, 0) == 0); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" 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;