From patchwork Mon Feb 15 11:59:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1440476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=j2zCeIhn; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DfN226wdhz9rx6 for ; Mon, 15 Feb 2021 22:59:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90DFF395041B; Mon, 15 Feb 2021 11:59:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90DFF395041B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390376; bh=ZWD4OytWn/RvcGUGbrq4HHkHKaB8vQdFBNEIlxfdmSw=; 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=j2zCeIhnWQgViF239FGIyPJjFGHHgaXEH9uuGG4QHwuha96KVFNQ9aQAfsCkvg5an h+xSBTN6ZY11k7jGElOoDm4K7h+mx1nw0jGk/60OZu2+ymD8oX9uu6GMaCZSrhzTGU DdDIY+gVRo1zf3MyCcaP+F4WobSr9+akcjF1WbGk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2040.outbound.protection.outlook.com [40.107.21.40]) by sourceware.org (Postfix) with ESMTPS id 7B805386EC5D for ; Mon, 15 Feb 2021 11:59:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7B805386EC5D Received: from DB8PR09CA0016.eurprd09.prod.outlook.com (2603:10a6:10:a0::29) by DB8PR08MB5050.eurprd08.prod.outlook.com (2603:10a6:10:e2::18) 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 11:59:31 +0000 Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:a0:cafe::b9) by DB8PR09CA0016.outlook.office365.com (2603:10a6:10:a0::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Mon, 15 Feb 2021 11:59:31 +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 DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) 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:30 +0000 Received: ("Tessian outbound af289585f0f4:v71"); Mon, 15 Feb 2021 11:59:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a8992fe480e0b19f X-CR-MTA-TID: 64aa7808 Received: from 5f175ec9ff45.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A859025-1E0A-4566-B295-FD1DAA0B7699.1; Mon, 15 Feb 2021 11:59:20 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5f175ec9ff45.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 11:59:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ald6vPpDx+kMBWwElMHVo3CklwXZ5C6gGmMyKYW3k2yuSJXX2pRmjN4ONf4m2GeD2YAWSwZ8oNwY7/OSpCYmTmdt/bJfzLeH6JCUWIyhfBc5ZmraUx8MFuUuNBMjue0t7tCVGdnd+LasrrCoLvZZKTaHxLy8FzAgkeNZdPQOZ4qGR8QpKW5pbn1TV7+NSM1g35R03k59ZOq1WBfGaVE7O2MqHhwcfO/pe9jTnynSLaT4lDyrnXG9K0Gjr6S8QjKVLHa1uAUPPL4eeK2+lQn6zxYtPQsnhKMa35U0ubjF1I09OvVFs0Zn0dIcSdg8j9fxqc5VytYETsCvjLbmg2/Odg== 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=ZWD4OytWn/RvcGUGbrq4HHkHKaB8vQdFBNEIlxfdmSw=; b=C3asvDfeK5X3g5nS9RJuJwZqtFYXoSc6d8rxiyG5BdukRI322yY2mT3aA9OMOluDqB1ZK84GZYTEkf8LK+BJiU+E9gdhgdl9Jw/0jZKApmIoC6AfMDSmK1E1OvUMUJqr096nkrpjRxLa7RNtJekNhZGuQ6ul+8500syDMJwEIcX8IlF0PbPejFyLVYskmFo6yvcoxq5eO82p4IZzgwqX9RA8OcOV1ulEwTJWkaaCFuU9hGEIsCOjdIywg0s8mgudNDm0rIeLesH/Ynd9MgbjxRQQIdxPSYt5KPaqT+CrkxyC1B+d6LpTBkF/t/Z/el2jsdQfNdei3ffse05AasUPjw== 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:18 +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:18 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 04/15] Add a DTV setup test [BZ #27136] Date: Mon, 15 Feb 2021 11:59:12 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: LO4P123CA0284.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::19) 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 LO4P123CA0284.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39 via Frontend Transport; Mon, 15 Feb 2021 11:59:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e2dcffde-797f-4f9d-ed86-08d8d1a9272c X-MS-TrafficTypeDiagnostic: PAXPR08MB6558:|DB8PR08MB5050: 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: 8ynQLcQMcZl890NQPrGrszu4Yo3n2RMTf5NpD3qh3FRxfATRu48n62qer4meG2g+KhnrXmSgB925cCCfW3y3zios/Q9mkS8kY51sW1JpWUC75I0QlStuAWHpInTtdOcwpOg2se3MTCJ5DerirfbzGpDIqRsz45F6xEeFpOENLIhHjjtJKe5ifYfrIH9mCOrIs4U/lDt7yhugbnujJJ7AbeZv/BKgNPvV5RCM9Bpe9qH96wgkI8e4aCDiprX5VWigAaZAyCgcRS/ZxFpVVKQyK25nAR0O8LnznegXy5RIblUy2oIvLU9hKkGrfBH+h4+AyUZvPhpec9O2KkY7lifQf4Ovt+jqd8yUjm170DBPmdDCzdI4VB6pkuFE4NGL8M9jlO9whbEqHB7zDJBHMuE7QQSSjnEYW86UGb864QZhtiojZUg97v66f2frA2x7IoRAGF7tE/E+TY9gw2H7mfnnq41VgzUUCxWYx4GaKUxnvwOzBLZkLTk5wOKK0IRJsG6RBXE+Apcbg9OoPu9yRfqrmMR929yoUrxKdIZ++tuI/+wJdUCqH0mVs6xltT0jR6sEqaXR55/MSBQPrFEo49Qbj02ZDwivP7Ng+gIQHZZRzNdO7eQzmQXLoMB7M8HBzbU4SP2vS5xQrjjywNzso8myVt+XKCNbsB2jfPntMEQ3aOpQzyJocz8If+E043r80uc5 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)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Nc1aCMhdzJhihr3UKl1V1u9KETlHmzedSvreO+ED1+P45fQTgxcXFkw147jvG+NxduBZ55LPzNzVrtZmD+qa6+KX+jyml3IZRBBv8rn7Nj+YZ9OcBWJmLLQT2+24xT2iLcTcUqKThj4rLBMQ41bsiQylYnjMIVrHIEwK7LH7UU//zzVSleAdPczuzCenpbKpOdBwODaJaT5P0wPDZ7/sJFTwwZRYw1DAy0HrxhJnuxdyc/h2HcGeMF5PZFeZUnkoXrq9qtiQ2/KwO8waqEZfoI1TSO3lkXCbM78Z2YkpM+xosEcNeCFwSAiH42wldrExs33wYthEM1D1/vVEbRm/15BrW+gNxQ/ADNvSvvT5afhaTY8YhhT9S8BL5SpRbNK9d9RZ2dkEatcx/OOi44cmQmXQkVLRMoB5DoCwWF9BSUfVA4oBDhE1xfgrBECJJXDZyZdNQ3T2mSpQ4QAUA0jN4/xI0NuxknmdMtK0lgOVsWsDmZIqZIP2gTCY4D67CRA7u82rr0askog+lQV26lrM2FoyQzxP2tHN0Py4Oqdxkjc8iw2q6pSjMP+QFDqqcjE4Rov3ZfOAM6NSAmHfcfHWCxkDFc9dSoyeIUm/13LuG8qLd5aT0K+huqjOWGQDel+TKm4iLGEJpRCb/jxPBZSTi3U5m+srw/bpfFaMc4SabZ0WByGhAu2SmVVm8om50kusE5c/u/GdAow9ZS9lyZWP6H2N37LzH69UkjdN199QrFVnzztSpzoGMnZ2wlQqsISUTVYzw63P+7JmSDuZDIhIVu+D136cpx4jvaasn38QrmPilPhgcdA4Q+HtqeCZxN6REctP0jbbC1QFFzQO0DC1UQbjc4uPc7qJUvl1RaQwSVeBAB4Qpml8EOY4Hd3TBHdD92OxClx7x0OZzAE08cI0hjyGCSTbvCvPqdaqJ9M5jvXt5WMqsMVUI3/GxrQbi214s9FCFPvVsaKt8TS1ACTAZRobr4xSPNt8eQ3e+XSqjirI0EzIJ8UeX6od9uy18+Ignx+qp0Qn8Dg20q79lwOmZu3//W1glQTWIR+GjuJdMl4e7FaZs0kabVu6wLCR5mnp6wheLpnQLbTFliNAWBd3mtmEgoxlm2jZl6wjRKr4JDbddhj6rG70jU1VEyAC2q897fL671YGzOUH0tPt/m6h2tY6tR/njkMq9EChB1v47oZv7MFEb/JSsD2CUwxDJklX/TLK7sfBhxS9jiQ3Cx+xeUY8t/eJ24W0aevVRTqYSvCUn+uHkbeRHYJUTTl4n+exqTWMMdlYyeWc7Ym85NBNhFUwQS4yPyysWIMLwgzYIvXNKK5ECfM8vr2yos7i5d79 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: DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 504a2157-872e-407b-1b53-08d8d1a91fda X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N+2bQRvmhDQabgDAgcEkVddrcoAv6d+jhft9JM21d8hJHRapJshFcSg8pyJXr9yuNzjmtWUfAAP+Gy3IkQvioDcbLROzDs+wvV6DfcHkqWEjrTeUV5KyzEJ5OwFnj3BW6LDFdmWSBaDlqpRPSoOh88ott4ou5PRiqhyTnJIsXT8Kv6Rg4VrW/+7Wj8i7VfZb3D0R47lpCp/ypiBHgZxKfiJJO1pdSVDejTEqp24eOe7LIyFmRzuyXgmdpkjZTNh5JON0rbHPCLIDX3DfXEhHj2JyV9PMqNDpZas9XxBidzYDIEzax0FQX6zgqe+VgkKOj/xiJenOwEFh7kZV/TSQANUhfV4LEf0ZHMburdyCqI5IU1nLEkRqI3REu0Y33aLTdHvCGesZgB2MMvNZLgIljT1aFKsk2rAr2kWyz9QB8zO7F4ORx2rLEtJvFeHDSBVIPCm20ZgJo9LQ/jZE1erwDUVqABJ7D8QhhxMGv6Gip/vWB4CsWUKgsNd70Swhkskh4vO/O1SV6CdUJ8JY8fVsGa0KnsgWBlZZ6kTa7P4gMCxJrW0LXR5Zq5JWxVBKi9vL2o6vwHm6jBYU8OC+WjA3kJttmlScpUMZMYgVXZXbedAtDZLGxLHgFboaXoDssicXhEi3j7qG8YG7+6+yZy+lB0YFz40C0/IcoHv2S/yhbpOZ40kZB1ScKB7hzREZjLfY1+rxBuekJoHZ0njaCFOMrz3kw7lYSAlUG1UOWqD7IBe+3BpsbevJ1s+we+zY7YiclSuujB3QFgh0z7iJ/Q6WJOUjf3lP48S2rUekoahPlOg= 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)(39850400004)(346002)(396003)(136003)(376002)(36840700001)(46966006)(70206006)(956004)(2616005)(70586007)(478600001)(6666004)(36756003)(47076005)(2906002)(8676002)(44832011)(83380400001)(186003)(6916009)(16526019)(36860700001)(26005)(6506007)(8936002)(336012)(356005)(82310400003)(82740400003)(69590400012)(6512007)(6486002)(5660300002)(316002)(81166007)(86362001)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 11:59:30.9789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2dcffde-797f-4f9d-ed86-08d8d1a9272c 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: DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5050 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, 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" The test relies on reusing slotinfo entries after dlclose which can result in non-monotonic increasing generation counters in the slotinfo list. It can trigger bug 27136. The test requires large number of modules with TLS so the modules of tst-tls7 are used instead of duplicating them. --- nptl/Makefile | 10 ++++- nptl/tst-tls8.c | 96 ++++++++++++++++++++++++++++++++++++++++++ nptl/tst-tls8mod-bad.c | 2 + 3 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 nptl/tst-tls8.c create mode 100644 nptl/tst-tls8mod-bad.c diff --git a/nptl/Makefile b/nptl/Makefile index 208629876d..a11b598efd 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -354,7 +354,7 @@ LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4 ifeq ($(build-shared),yes) -tests += tst-compat-forwarder tst-audit-threads +tests += tst-compat-forwarder tst-audit-threads tst-tls8 tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 tst-tls7 ifeq ($(have-z-execstack),yes) tests += tst-execstack @@ -371,7 +371,7 @@ modules-names = tst-tls3mod \ tst-execstack-mod \ tst-compat-forwarder-mod tst-audit-threads-mod1 \ tst-audit-threads-mod2 \ - tst-tls7mod tst-tls7mod-dep + tst-tls7mod tst-tls7mod-dep tst-tls8mod-bad extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o tst-cleanupx4aux.o $(tst-tls7mod-deps) test-extras += tst-cleanup4aux tst-cleanupx4aux @@ -528,6 +528,12 @@ $(objpfx)tst-tls7mod.so: $(tst-tls7mod-deps:%=$(objpfx)%) $(tst-tls7mod-deps:%=$(objpfx)%): $(objpfx)tst-tls7mod-dep.so cp -f $< $@ +# Reuse tst-tls7mod-dep*.so. +tst-tls8mod-bad.so-no-z-defs = yes +$(objpfx)tst-tls8: $(libdl) $(shared-thread-library) +$(objpfx)tst-tls8.out: $(objpfx)tst-tls8mod-bad.so \ + $(tst-tls7mod-deps:%=$(objpfx)%) + $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library) ifeq (yes,$(build-shared)) diff --git a/nptl/tst-tls8.c b/nptl/tst-tls8.c new file mode 100644 index 0000000000..be7b64c9be --- /dev/null +++ b/nptl/tst-tls8.c @@ -0,0 +1,96 @@ +/* Test dtv setup if entries don't have monoton increasing generation. + 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 +#include +#include + +#define NMOD 100 +static void *mod[NMOD]; + +static void +load_fail (void) +{ + /* Expected to fail because of a missing symbol. */ + void *m = dlopen ("tst-tls8mod-bad.so", RTLD_NOW); + if (m != NULL) + FAIL_EXIT1 ("dlopen of tst-tls8mod-bad.so succeeded\n"); +} + +static void +load_mod (int i) +{ + char buf[100]; + sprintf (buf, "tst-tls7mod-dep-%02d.so", i); + mod[i] = xdlopen (buf, RTLD_LAZY); +} + +static void +unload_mod (int i) +{ + if (mod[i]) + xdlclose (mod[i]); + mod[i] = 0; +} + +static void +access (int i) +{ + dlerror (); + int *p = dlsym (mod[i], "x"); + printf ("mod[%d]: &x = %p\n", i, p); + if (p == NULL) + FAIL_EXIT1 ("dlsym failed: %s\n", dlerror ()); + ++*p; +} + +static void * +start (void *a) +{ + for (int i = 0; i < NMOD; i++) + if (mod[i]) + access (i); + return 0; +} + +static int +do_test (void) +{ + int i; + + for (i = 0; i < NMOD; i++) + { + load_mod (i); + /* Bump the generation of mod[0] without using new dtv slot. */ + unload_mod (0); + load_fail (); /* Ensure GL(dl_tls_dtv_gaps) is true: see bug 27135. */ + load_mod (0); + /* Access TLS in all loaded modules. */ + pthread_t t = xpthread_create (0, start, 0); + xpthread_join (t); + } + for (i = 0; i < NMOD; i++) + unload_mod (i); + return 0; +} + +#include diff --git a/nptl/tst-tls8mod-bad.c b/nptl/tst-tls8mod-bad.c new file mode 100644 index 0000000000..c1aed8ea7d --- /dev/null +++ b/nptl/tst-tls8mod-bad.c @@ -0,0 +1,2 @@ +void missing_symbol (void); +void f (void) {missing_symbol ();}