From patchwork Mon Feb 15 12:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42045 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C590F394D8B0; Mon, 15 Feb 2021 12:09:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C590F394D8B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390953; bh=xAvY0HXyfvm02f5AyTNLjskqL0jB9TEdNZKEsyNB+qY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XyfgV+huWAJQqKjlms1j7mk3JA1bs/RG0cpgojV9HmMXhAJjBOyhlCVS1hRAXYyyA rd4uFdaqZ8tlsWHqOaI2U+kzLUUQ/dB/YOGFqJOb3ELnm45LU3Dzo6eArtNwxH1b37 6rjK4629GMZjbq4TFmaVRJLXPwDk+Ctke4rKyNdc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80078.outbound.protection.outlook.com [40.107.8.78]) by sourceware.org (Postfix) with ESMTPS id 2F760394D8B0 for ; Mon, 15 Feb 2021 12:09:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F760394D8B0 Received: from AM9P195CA0024.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:21f::29) by DB8PR08MB5308.eurprd08.prod.outlook.com (2603:10a6:10:f9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39; Mon, 15 Feb 2021 12:09:08 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:21f:cafe::b4) by AM9P195CA0024.outlook.office365.com (2603:10a6:20b:21f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 12:09:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 12:09:07 +0000 Received: ("Tessian outbound 8418c949a3fa:v71"); Mon, 15 Feb 2021 12:09:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f9bbd9a13a3731c1 X-CR-MTA-TID: 64aa7808 Received: from 0a85dc3cb3ea.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1E8DBD61-8EC2-4E7B-84F7-5061E8C2CA07.1; Mon, 15 Feb 2021 12:09:01 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0a85dc3cb3ea.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 12:09:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iC8gOHCgIJ+Y9vDLnzEcgud8iUsyLU+Myy6ZNI1jIMqJLnRrK9zn6E8ONNP1iPl/S+f0QOZGC5iGlmEEVAN6fpneL8xqwKMgSH/msfpMQ/N5raEpuj9CRhFgw/uPx10ooXUjV5SA4FFtoRuM6hD98gz8akmItXnESdBDucpehTIpE81yg1nDwJTvgIpGDgWycteaS2THHCpcN51ixneSAQDApmMXeHSBDirwMPwaTwLy9KjxXxDAMdGzLM+rjzrVI5C3sI7gK7/bly71IQHWseZWxAwPJ7yiGp0bpFRhf6x3ag+7AEysx2jTznb5Jy50LUeDPs9f1UJtDGQBAb2Pjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xAvY0HXyfvm02f5AyTNLjskqL0jB9TEdNZKEsyNB+qY=; b=hLLpJziQgFn7BsxE+eO6P1yAbOE99WifXlS78WCaaw7xfZSYNQJKZ2ivsdQ+/bEg2MW0u2OhA2i0Eqcn5+5O2N8qUQKn+pArWVQVKUWqZdzIQaSib2LwRWaEvMYkOrQ+K3r/qcvH3qaGhcmmbe+9EKvzxw7vQ4ZzyXUZbZX/mByozxsLnyPNjiJEylRJAa9ZTV73x8Xg4wi/2vlqfHMST2+vWL5xhuMwHwvMJEmwGPnA+URGK5/9Yr+lnXTmGbOSEeO9rAnXz+35SfeYMCGEe9yYHG6sCZ8YJEpbmQApEkRz724zVfGScX46cFkw7+EAsS6iIvSo7L6cAd+WgR8UTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6286.eurprd08.prod.outlook.com (2603:10a6:102:f2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Mon, 15 Feb 2021 12:08:58 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336%2]) with mapi id 15.20.3846.042; Mon, 15 Feb 2021 12:08:58 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 03/15] Add test case for [BZ #19329] Date: Mon, 15 Feb 2021 12:08:52 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: LO3P265CA0009.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:bb::14) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.49) by LO3P265CA0009.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:bb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38 via Frontend Transport; Mon, 15 Feb 2021 12:08:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 725e2c00-fd0c-4378-361a-08d8d1aa7eca X-MS-TrafficTypeDiagnostic: PA4PR08MB6286:|DB8PR08MB5308: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GSCPpyJlsvHBbukf5pMkW0bhYhNvwLI7XYbjoFrC9VU+S8UMdy0JC141tNOv3JldY/m6J8sak3UKnewIOrNYTdgdrlM0eFAaoC8QiT++2mnKbZCY5fbhzBc3s+uO4XJCzZK4XFvE8ztqrCv1IY4cadglHTegFUREHVrCVyGh0rS2bsbrAHX9vuRJ5bD4PDz00mWVrWYpf0+0gWhDMkVNiItpYX1PQR89RSjqVReMkld9LaOMAAZn/45xzp4R84698ommsjNTlEmD8nYVYKjEFwVPFpUMwkqEAju1gs5AoFyvpH+KARsqDCAPWyMwrD7NQ/dk9NH+O88pxbFIzSAqeXOcl96glhPXMxe+v0XPKYGd47OWIdMOSyIkDwNr/3Jxn+tka8sz/ZPdwnie17TIhZr4ZS26O3WW8klR3U8nDhNnHz3DmNIMH8Mi04HaJL4IF/MEL9oHfDJ1vNyPlCdHjLn3wVbdcjVcf5/RWsocH6gez8GwjWk9/iO2QpZDqfI5IfAmyBpIYqYgcRlZ6wpPvVsj6uProxRF4LxZEuPBrbj8e+m7O/K3YeHpithl/msMu3fKTxTNvlt26uXlDU8JbPBef91kmpSLw6JbrTlaWITkUONPi2S18942sfdzobt77qxtKeUoQxhXt5SyZt4vkP3FTDFGukb2Wu7retMhnDU= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(346002)(376002)(396003)(366004)(136003)(52116002)(316002)(5660300002)(86362001)(6512007)(44832011)(6486002)(6916009)(6666004)(26005)(4001150100001)(16526019)(66476007)(83380400001)(66556008)(69590400012)(66946007)(186003)(36756003)(6506007)(2906002)(2616005)(478600001)(956004)(8676002)(8936002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: L3xsF/jzt5RMpUm59dEzCVraLCcZZ5XOtBcw5Rk4BVQZui43/KiL0/IK35Oj67xpE/gR6QzEgntfx3BmXYGP5PW7c6/lV/ufZMCwQqslk2syolx20MtkrTnSIfn5hAqQ142irJ2oYEx9OBSoaYNKZb8+yyVa252T009BfmkG0Dz5TbdGZlLkDGCT8mhEXGrcIkA332Rss7Hhj6bLBv8VBIf1UIf0myWLy6ipK8UtvySPKMGgyGMN8lDbl1YDOTwTmbL6y9Ag5tMbsBH/cMxAHJWls5enYcsBGJs8VaQe9lp5ire8ZRoCfgjocwaZWYujn+G5C2SuXqa/P1hHtviq42zLVmmOipNpgCgaUMqIW/a6G5OQqORpZt+DCqdMRIs/eTHpd/J5qnWPwg9aQ+5g/VA9hySxCyZODw8B2//On0D26hiTrsTo4uA78rvSiIa5mWKjgou+Ed7aS/AB8H6ysNiLVYuN8WUkE+uAZiXKx2r8KD+FPw1YX3H46RwdVW7r281lfK5jSnIzFVeM8pUnOwAjbiaq2ddPFpAedcLJM9O1Eh865ztol5rg8XBYO0Y9MjmpDeLBPi9qcE7OmmbN4PHtV6d35xW+ZuV17fsYwUNQ2vRTinUmc+9QIJ1am0lLAklJ12u10849r2VGG9iAy4PisSjvTpBzAZ6ndzh4SXLkGJG6H5Tn6PkOf4/TCAFLvJW6WWWCuIYYM4JI/tlLRjCjEmIxyE0xeOucyuVOzV8VdblYnYiXyDCsaUEUkfj3iccyPrPQJiRDgNF1oOWDLONzjMzBTpWE1hGQigFjGv1esBv6VxdAY/g5ip6Io27QOfW7QAgqZipE48sy9SkMrGmDhHVLGfAdm7sAI2vepb+p3MUfor4Fy+vnRCcXc0BAMBk1BsdSvg+oeTQkNXT0U3VNpK9jM74HAh+WW5uKz0GabI2CooVjDoSPqPH98IFIYMHaRWH+bSvFkn3GLBvjhB7s1/bSagoGXOtTi4bkdNB7GhpxwojNn7oSL91LnBdMGqWjQoC3FS5Q8wIe01gYty1bUl3OaDuxtxXiKfT2yNekPbcsoiaQfxrQgWDnkiP3L5XOQ/1ly/oU554n7bVgdxzarcVDf5ofRdtk7iyHbmFWj/XbYW2sbAcVaL/HvCofOm04N+7ZAgHOS7IeNJkih9dVQM9hA8HmsqC+dkxAAu7jHNrVV5J65fENPxlhexZBfqr58SsRHyuCek9bYLw1n2xhC6MMRn1UZZ+Ea3MqgU4tbZ1cCdDVlL35FqonQvZ/3bbBHQnE/rN5zqo9TO5uV7uj9SdcS1Ig0wE6WBekzV6ztdzS+RAYV/eQejD7j5Zo X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6286 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 50c5b6a2-63e1-4b0a-f4bb-08d8d1aa7939 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V7lDK1oN+e6zNfByStJDoOt+sjximNFn/Fg5IGgtczI1zPc++tXp9U5QWuIwae/JCRpIj8k2o8Zg/dC5tKzMkXJCmq9gSA0qIpyrPRs+82mh6h/clC5SsVBVtAz6h5B2YsCMKdIgFe2JYuUeuGn0fLnBWr4I28T+IvwQiv90V+d4s6Fewhy/1r99jiEGecVCDEdwwkBs3SStLVsfmjoRDTNqoWYpQHej3n1AeH91scrJtMtf1pYEnjyEYtxu4jkgwgqWEB3C69EEZyDmz66qFQfq6qB/PZAM7MvVVhwzDGZbXtAr9uZm6+nEI8Sl6YC78r0YAr1dBNOpTCEegv0/8kNsxGLKuH7jRBGTXRySZeBl/vkccpAU+ZLQxjQjTPE5Q+Yqd9BtsrdhhZbzNz1UbSs8DrIU6IGYzoyXYX6xcNelV2fcQoqGyNshcrNXKVgBxaPSJ2y7K40bd8Dsm1SYqU6cM+7B9pEmc/lQA0RMwHhH63jWrpoK+niderUM7CE1c6R30E1psAbWW1RXDB+LVBprEHGFSztRI7MPuq/lWYw8QyqQPWkVHnh+z960HCe7u9Je++35v6tHpndth5XGOQY5YD+lFEzjkcHkNJo90vOXAemOua+pgfNXodMuwlvDwcPMOL/1bmRSEKG7H7NmJb2+XvVetIzZrIxD6e5ulHgwPQMCIj9iMm/M4ksxxz+erSSe05u0hfxWWKbK6tAMLTJgDHdc4bC4RblvJyx7imQJ8OQZ7qWwf7ifxVFY9whqX+ukVpswsNOOehBz9zhHVLQZKiIbghS+fdF1Sjlue3w= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(346002)(376002)(396003)(136003)(39850400004)(36840700001)(46966006)(82310400003)(478600001)(44832011)(36860700001)(8676002)(6486002)(6916009)(82740400003)(4001150100001)(86362001)(8936002)(16526019)(2616005)(336012)(356005)(2906002)(83380400001)(81166007)(47076005)(6506007)(69590400012)(956004)(70586007)(70206006)(5660300002)(26005)(316002)(6512007)(6666004)(186003)(36756003)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 12:09:07.3922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 725e2c00-fd0c-4378-361a-08d8d1aa7eca X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5308 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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. At most 3 threads exist at a time to limit resource usage. Doing the test in a fork loop can make it more reliable. --- v4: - rebased, updated copyright year. - moved to tests-internal because of v3: - use the new test support code. - better Makefile usage so modules are cleaned properly. 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. 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. --- nptl/Makefile | 17 +++++++++-- nptl/tst-tls7.c | 69 ++++++++++++++++++++++++++++++++++++++++++ nptl/tst-tls7mod-dep.c | 1 + nptl/tst-tls7mod.c | 1 + 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 nptl/tst-tls7.c create mode 100644 nptl/tst-tls7mod-dep.c create mode 100644 nptl/tst-tls7mod.c diff --git a/nptl/Makefile b/nptl/Makefile index 8fb7fee6db..208629876d 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -355,20 +355,25 @@ tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4 ifeq ($(build-shared),yes) tests += tst-compat-forwarder tst-audit-threads -tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 +tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 tst-tls7 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-tls3mod \ tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \ tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \ tst-execstack-mod \ tst-compat-forwarder-mod tst-audit-threads-mod1 \ - tst-audit-threads-mod2 + tst-audit-threads-mod2 \ + 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 += tst-cleanup4aux tst-cleanupx4aux tst-tls3mod.so-no-z-defs = yes @@ -517,6 +522,12 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \ $(evaluate-test) endif +$(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 $< $@ + $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library) ifeq (yes,$(build-shared)) diff --git a/nptl/tst-tls7.c b/nptl/tst-tls7.c new file mode 100644 index 0000000000..4b3f9005fe --- /dev/null +++ b/nptl/tst-tls7.c @@ -0,0 +1,69 @@ +/* Test concurrent dlopen and pthread_create: BZ 19329. + Copyright (C) 2021 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 0000000000..206ece4fb3 --- /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 0000000000..206ece4fb3 --- /dev/null +++ b/nptl/tst-tls7mod.c @@ -0,0 +1 @@ +int __thread x;