From patchwork Mon Feb 15 11:57:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42032 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 92BA13950401; Mon, 15 Feb 2021 11:59:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92BA13950401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390364; bh=yhpNuyDfEq/hpCR5gx+N6PW8zaPs/M3A7FJChbBZEKU=; 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=KDUunjbUkQ2hh7NMPcDTckWIJMWkeEoFwkrL0NPZTbYyPqEOpePx6inG+FZG+Jkl2 ESUB3+DmHNHRHWcpI0aJ/qa7v50TINbPLahc0LUWHW+pnpfnFVYdp5F2nySmFJt/aw DbOf66bkiA/OoSjHcpyYYCW9Xp/7XSo41WfJ3On8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60086.outbound.protection.outlook.com [40.107.6.86]) by sourceware.org (Postfix) with ESMTPS id 78776394EC1E for ; Mon, 15 Feb 2021 11:59:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 78776394EC1E Received: from AM5PR0301CA0019.eurprd03.prod.outlook.com (2603:10a6:206:14::32) by AM0PR08MB3331.eurprd08.prod.outlook.com (2603:10a6:208:5b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Mon, 15 Feb 2021 11:59:20 +0000 Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:14:cafe::1) by AM5PR0301CA0019.outlook.office365.com (2603:10a6:206:14::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26 via Frontend Transport; Mon, 15 Feb 2021 11:59:20 +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 VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) 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 11:59:19 +0000 Received: ("Tessian outbound 587c3d093005:v71"); Mon, 15 Feb 2021 11:59:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4e136577a6ed6d01 X-CR-MTA-TID: 64aa7808 Received: from 117db31586e5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 21755682-B04C-4015-B3A3-52C9731EEC0E.1; Mon, 15 Feb 2021 11:59:13 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 117db31586e5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 11:59:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hWZZVnAK/TXqdamMPJ2dkn9YZYHoizpb9bzF5GlEvpscuKkt6UKX7HJXbw4QCKhphFzheCQ8JBH6U80nrPEFoHxPIulNcdGGz2N+yYWfEmNuvwOTqApL8Nfu9iJvpMKhmlyqCZhxnclnTjeekRI8AQBmJui6mYBsr5oO6DHQx7P2wjud3vM0EtldBFdXYrLR2xKDYakWLZ5kgV8c4fzxhPUaFtVhBL6OLYp1DEX9mH7ogQyrU7jGMvqLe/eoLY4IJTTjq+nhiravEQPKnYgjGF8Tabd6aVtMp3myVxo8LekuhPvl1QNREcw2xCzgRgnYc4htAo5FQasdWGZUPQZFvw== 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=yhpNuyDfEq/hpCR5gx+N6PW8zaPs/M3A7FJChbBZEKU=; b=VPh0z3AjcpvyfwRac60Hdi7oLphnmaKZyF6EMRZHGMDvuSfbyoh5CfEKiTZ9IkWoFlfM335D+C812n2qf/1vl7PBMf4r1SHo/MDSKI2QF+RdoX4jGXEzFrI/401D3nMDB3pClDHnnJV+XhvKoX2SQxqbhYW7fO6xuql8zdnvlsWcfazjMwOGMsjn2gr1OLEtDxWcRU3gj65b1vxQRyXAKJJo1OPsAC+c714wn1kQn/wos1/hHNtNVBeYcmaLQ1S3Kt6iJbXLg634ptaaplUUcqSm1dLwVmP/H4o18E45LyrtaowxV9w+WYLLRVAsjp0KGbGEnFKMbdVrxDcvYR0Jgg== 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 PAXPR08MB6558.eurprd08.prod.outlook.com (2603:10a6:102:151::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.28; Mon, 15 Feb 2021 11:59:04 +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 11:59:02 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 03/15] Add test case for [BZ #19329] Date: Mon, 15 Feb 2021 11:57:15 +0000 Message-Id: <34be48a80b03bed2fe8f3aff020f8b6b77858e97.1613390045.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: LO2P265CA0498.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::23) 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 LO2P265CA0498.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.36 via Frontend Transport; Mon, 15 Feb 2021 11:59:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 697061f8-1e7d-49cd-b4dd-08d8d1a92063 X-MS-TrafficTypeDiagnostic: PAXPR08MB6558:|AM0PR08MB3331: 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: yi3dVsUrxSN/FGy4pz7pXXeX+dlQTLPbm4jcaRgBvygeMPPzei1Kaz6aOA+cYdgUo27L0BqKvhCOoMc5v5jJbCjUkOI2uqVM8Hp246UaGGcbxhVSqGEjqHiOmR/jUAyWmRoc/RLdpjQZz1/DHhCZYRgj/jIT0saib2TXEmb6xhN11Him7ZBpZAGZEEzxJyZRJDHysXeb2QuqycZ42I6vyDKNVkkMY3YQjC4ECggTe0fDOaHXGfA+zZ2qfKAEq8AjwD3/ajlm3Ey0k14J+tF4u4qPnEQHSsWLN0EfB5zpxehsOgNt1oH5ja2lZJOejjpN/8ULi4Z8L9YG3dBcMKXmXjsN5wz9avcPbUp/it3i5LUrJ4F8RV213CwP6QHPagiZiol9Ikr4moaO5yS1MCxCBhjdokSGYg7vXIvgCpzelstrXpxfL546KH4sxs8W6G4eNcF1trK2VEE02f4YXhquaS231brcXHcv44+jJkpxoqYkBYeWvFcXOumYrDy3xgWJKjpBNOzgoFvPmJLWiB3/HusrqsLHLaNrXG5LkwTXsQEwZICluaTm3BjNW+s+AwfYF/0yCZRy6+9zsoEaMftfQlLHTfpwLSXvBmkKlC0BInq/pYA5gqJN80P+1gt4pQu77JgSysCkc2lxTqd7aEt1Wu6yRJEmhIg0noehIv8POSE= 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)(136003)(376002)(39850400004)(396003)(346002)(366004)(956004)(2616005)(66556008)(44832011)(6916009)(66476007)(6486002)(16526019)(66946007)(478600001)(36756003)(186003)(2906002)(5660300002)(26005)(6666004)(86362001)(6506007)(6512007)(69590400012)(83380400001)(8676002)(52116002)(316002)(8936002)(4001150100001)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Z3y2h9uD4Dulj7vVsjDmm9WF0ibwxpYJEzj5LX4hG9d7sa3lGwEJRISHxjVFa4d0zSwpRN7DZlH/wy/17PBOBdDiCsq7bQuzD1hR8J6bJQsz409PlY89KGwsdfh1BqW2xAs0My4jDbKFLh94QeCyj/oUHM+zFQmBvIgtFzZMgE7PCnjUUrKGBNybk4bLPT5NXU3+1mOTXkICfY7kpWkiffooHtPlnEX/W1qYZnNOFJU2u52Ae4dGPWvWYbSEwkIDfhn6jBRtEjm0g8qS4Dj5HiIyw1HmffEJKHMi/+yuqOpUoilfJxrlGAlRvCMR7wOt6TqCmRV9n3iwzA/qV6rMrWvZgvwroHfAV2937IP9g/MeuQvYpcwFztCRYasqqcUW2Nvlk+1OI5CuHM68UUu2PjR2CQOFbcVbQIoWQazKvxfBu9uQp48zzslhXsPzuVtXZLzE7cOJUFglf3ThEpjQjoNXpLa4HsYCyvxzXVVQAZuz48C8vbqJeDRzLCbGt3keud5QHLUOzgHq3ZLxUyzx0/aTCxYP49WUqPNv6SmyyNqcm4Mgf7AOyOZZpOa9E3DLak/aSOZGD+pf5UZ4iWmUHKqJ8vxHv/HyRARlUlSaDNB+xeoJalg0v2rn7bJtD1QRtKkjaECrnRhyF6umT1neglXke8ueTmM8F5DDJYeu7r5kP9fL4k/61MUqiqo1PwmWEdV7ouZ2MFh2nZed4t6T4laPY2nlJmPdZjsXzVWGsPPPCBSoxRJZI6ChLI+xYdQwUbYECnvHu46/eWWhSNohkSlU+jhtCMC+EPZ7ZcVE/K0HLg/6qzTNdqMLZA+JfeegNb4F2jsKB7HpQyLQ4R7Jww1hOJ9un/NhpoISJkGccmHU/C/5k3pmJbG4E/sXqOWdP4SA2VKwCwJw+ILQasHsldBXiwmjhSUmffy5FSPYJYgg9kY8DcXmxwhOSwCeb8+NNBo+ys0eToZggItLsDvf1fEq64kTEaOnLYCgwskeHAlgBjRfZ6EoKXGI6veBISueHDOqC+xSQTSfI8Ezj1QxitvCsy9OakLIh9KT/VTr4LD74VlrX5Aw3ygAVq4o9iuEY1Zcm9H/DCoupU9CIvmLI9vXXZSDRObhntlc4dMfHqi5lLKrZhNsciYW0OEdQMAiaHc+bgVqPFq0zpSBREzmjSddXVcknzLU093b+wCuPPljRkCkOX7V4wwTk+bGihB7L8aejf8tL98WPJk5r26ChsCTnEht8sFZm0rNqblcFt8boXKFgrwDXflaQaJPBpcc/IiwJgP+cYNHKIJmEyIcHPHJbRW5jqKj7q2QWRTQWCzFK5j0VtIfYET4lwxmxWv1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6558 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: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 564da7e4-7413-432d-9fa2-08d8d1a915db X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yVImaEyvN+xzDNsFXWEOK5Xifgf9OFIhX9rO54Oiik3xNjG5OmqT5yqNgzx6HVHRP94bLfhkvI3K6EaRURSvqRLpAUb89fuW59JqJ9qTWthGP+mhw3aEa/b8wEkHexZhJrV7vPgM9Mmym7K79jz3JOA5oLmEZ0BrKhHjU71JaRgZZ+HP4D9uDZZUHuv9Er9PUUNYuA6SB4w3Y7B/C1KnYTwvnkkmmzctDgDCgzLKpxZsXU/9JmzdgGGtXdX082QoqhgF18gyX/VEoWrJmmgrY+gz1h0ifBrYIrlV3HlXshzQC63xgRKKi7Mz2XV30yb3s8E5lFL9ziUT13pxGz8n/rCVC7i2XjaZD2h0E/gtTCghO8/KIAAPVd4QSc8LB0Hk7v+ERStenEaq0Cu2mssDR7VZjkhDdYv8aG4IoA4V0mtG7hwnWyPA6ns7kvnapTkNXisj01vd6V7woO1ucLjKwekSrVoqZsek3JEJBxPSzFld+V/1S+hoxpdt6FX80rRbmCeB5XvSYSyoNKDcte38+VBAk4MGGTrcqJ1Qh7R2ZoJZbwvoNlPS2QSsFyk73dPKLcuc+A35FqN7jxlRoHZG7ln0Y6EBOm5WjFZ/Ni49MiUiwR3OrzEYPN8B5LeFQSTitXk7W/uVP10/eguIkS00Ta25UU++lr2S5i1zzbToqfgyGyp+8JdhvWcHgvxOFe7sebGtGQa3SojtxQ9khk+tJfR/tdquSatU6M2HP/N0m+Fle//2DZsEGNDQUDzFiYs9KejFR+9LvggdDSfGZkMsG8BV7XWqpdioJk0vSRiwgGk= 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)(396003)(39850400004)(136003)(346002)(376002)(36840700001)(46966006)(86362001)(82310400003)(36756003)(4001150100001)(478600001)(47076005)(70206006)(5660300002)(316002)(44832011)(70586007)(6486002)(69590400012)(356005)(8676002)(81166007)(336012)(956004)(2616005)(6506007)(6512007)(8936002)(6916009)(36860700001)(83380400001)(82740400003)(2906002)(26005)(6666004)(186003)(16526019)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 11:59:19.4719 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 697061f8-1e7d-49cd-b4dd-08d8d1a92063 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: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3331 X-Spam-Status: No, score=-14.2 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" From: Szabolcs Nagy 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;