Message ID | 9a591c9dc467341d41766ce388fbb500f8c0bb3e.1613390045.git.szabolcs.nagy@arm.com |
---|---|
State | New |
Headers | show
Return-Path: <libc-alpha-bounces@sourceware.org> 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=<UNKNOWN>) 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=RxJPil1b; 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 4DfN561BKCz9sRR for <incoming@patchwork.ozlabs.org>; Mon, 15 Feb 2021 23:02:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2592395188A; Mon, 15 Feb 2021 12:02:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2592395188A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390535; bh=xI4HhTiZQSuBUv2nCDJliLR3jzjqJlrPMoxOoThSUCE=; 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=RxJPil1bG4tyBwRt1MxBXviHzSKckjb5KfoK87XWN+zkVHt5kGfrADqz0g7uNVl1U umlaa+HfzFQhXK7BpxgpYoMzYsZpjZWeJyruw9Q/6Clc0O2JpEo7K4pRzGuWOwBXX1 7w7b8p3ckucK1EEMGwihFONnBLgM74Knp0XCJ1rs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70084.outbound.protection.outlook.com [40.107.7.84]) by sourceware.org (Postfix) with ESMTPS id 56E0C3951825 for <libc-alpha@sourceware.org>; Mon, 15 Feb 2021 12:02:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56E0C3951825 Received: from DB6PR07CA0165.eurprd07.prod.outlook.com (2603:10a6:6:43::19) by DB6PR0802MB2216.eurprd08.prod.outlook.com (2603:10a6:4:85::9) 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 12:02:02 +0000 Received: from DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:43:cafe::8a) by DB6PR07CA0165.outlook.office365.com (2603:10a6:6:43::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.12 via Frontend Transport; Mon, 15 Feb 2021 12:02:02 +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 DB5EUR03FT039.mail.protection.outlook.com (10.152.21.120) 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:02:02 +0000 Received: ("Tessian outbound e989e14f9207:v71"); Mon, 15 Feb 2021 12:02:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 84dbe060c99ba649 X-CR-MTA-TID: 64aa7808 Received: from d58b7ed1890c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 23423B60-87F8-429C-9AD5-12A8D88E0FD8.1; Mon, 15 Feb 2021 12:01:56 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d58b7ed1890c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 12:01:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YiOKtRucl0L4BJmlP6kF7VxDOhyIOqvmRs68REiWe+TKz0LA9GOwkY2bxWQfNTWrztP3bUP8yOBGLaxOm0y15qhzjRP8Ur2pzbE9+m6C0shsze2EncuQKHreowC2Ez9cZDpdz7uuFzo9UqiRQjsSStazjDYP9lI0iNQNneqEl5iGG4rI505hYKsBhxb5aX44fJB5fvVHaSR31xrk6pEPIbu2MhoLkrdew2qgzGPNCvVBkOQg5eMOMA1ysI9YR1VZP8w+Q+/QDWe/8YUTlYF8Nj9BrtMJx0FBt7g7CNffjKc/4+SMeFwyOe0lP79hUBWfGqGRoeEglkNdRFoNs+gRJA== 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=xI4HhTiZQSuBUv2nCDJliLR3jzjqJlrPMoxOoThSUCE=; b=J74DVwxmfc51Vuvg7ky7O8u6AkewhCgc/vNdSXl6xpXV+YSoLv+UD4iRDEQjDfOGYD6ECSzXSHT/bswaPQ782w4FXwyJ9fYJQtGsnUCYmMxSIYUqg/BZenp+r7QvQ185k/ch6mNQyJAMgP7IJmqBbBJfaceF+/kwoS4PCgosjWkV+9Me/slJF/J5VxG41Lt8QmFdVBsRl/nB3gZawq3ltOfRdg9dWVQRxPEgcB/nq09qy1b8zLSMxgNeqM2yCGX9iAmu6Tr9iY2NDpSlyUUsT/aD9sTD0jFP61iXrayi/QqWzR+GsU4SoafrRP96iweyWhLeLY82F1aOgP8o1nriPg== 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 PA4PR08MB6208.eurprd08.prod.outlook.com (2603:10a6:102:e5::18) 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 12:01:54 +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:01:54 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 10/15] elf: Fix DTV gap reuse logic [BZ #27135] Date: Mon, 15 Feb 2021 12:01:43 +0000 Message-Id: <9a591c9dc467341d41766ce388fbb500f8c0bb3e.1613390045.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <cover.1613390045.git.szabolcs.nagy@arm.com> References: <cover.1613390045.git.szabolcs.nagy@arm.com> Content-Type: text/plain X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: SN4PR0201CA0046.namprd02.prod.outlook.com (2603:10b6:803:2e::32) 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 SN4PR0201CA0046.namprd02.prod.outlook.com (2603:10b6:803:2e::32) 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 12:01:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7ff7cecf-34a6-4877-6ac9-08d8d1a98131 X-MS-TrafficTypeDiagnostic: PA4PR08MB6208:|DB6PR0802MB2216: X-Microsoft-Antispam-PRVS: <DB6PR0802MB2216AC415D7B5B739C2611A8ED889@DB6PR0802MB2216.eurprd08.prod.outlook.com> x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: CbC1Z1siapGdZm3U3HlLvbhNMMBrf/OnbNaY0WTulLUdoAAfJh0ak3S8ufaRkbD+lbTkPiDEvpZ5446w/HMok8/6s0QRTsrnDz5EpE/+kqgehI4lll7QZ6dhmNkQNwaiuUevMFijg4/ZbS19TtwXgo/t50A8aMPJtdl7TTdFr1qa6TaytsDF1+zD5o+AD9gRbSRUJWztrFuFSD1MVpHzW5gJ4wgk09CD3p0pez/oc8HBmZ3G/NFWny1rxKZ9vSz/ck8iKbupCSf+wepoRyFOH0bQDu472uyrLfZ6TwztOSlFV2dVTXgtQ2M8Yh5lk/0IiEoTs2N/PYV6tXp2TCVjzp1jLVrMprfQDMRe4v7d57SBs8sN6CXD2x16i5jF2yxxllGTOSiijK8UW4mbFiuCxPupHKDrtQx4xdVBO3c/JjlS4H8HgNlF3XMfqDBSN+uC4PNAKkQ80g6TtuRWKZ6I8Mzljbd0AfNlgt17iXAQ5CskmZSYdt/hUvPFTN9+hKdIQHCXklreghiMh271B8zRK5sGGZrV87IWRdr8ExR8Z2BD135yewlpHEKb5Z5V4NHtTepNlLHRsjUu/Bw4O51RXA== 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)(366004)(396003)(346002)(136003)(376002)(39850400004)(2616005)(956004)(44832011)(66476007)(2906002)(16526019)(66946007)(66556008)(6916009)(186003)(36756003)(6486002)(478600001)(5660300002)(26005)(6666004)(86362001)(6506007)(69590400012)(316002)(83380400001)(8936002)(8676002)(52116002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: j7K9GNV9FV2em0XniCJng0954vw1ant9/+zQ+mfc7pUq1Jz1BAnROiqR91GKnNASrmnaPmBDnCE7uIYCjN929DxRiYZv2XJrWHrG9aKjcfWZ51N/22NvgQb2nyNK5Av05o1kufEwNFKoKRbPuYWb4lSqlRuUDlZQewvNIj/TKX9voPpL1HFxSZs+acZr1wIqjYX6BNzXd9YvzBT5XPZi36rmLbvsdx6GHKdgTBrdzOIEwJ42v7r2pHJO2kXOXiP2EBJY9nGzv90LJMK/GZyM7ZOSfrKKwEzHivce+GNwbZnWSJ1Y0GEBlCQ/aFYqZTVX35jrGewhYzkPoMMFT9ilGRB7F9+yTs4jV4AqieXJcyNC2UAApKr9TsYRj3vr0ftYk56OavHJFlqe6ty5nqE13Vj9Hjhlr+hWzPSEwkaqfP8Dh5neKt4ignDtxph9T57CgAh8SEu9aotZs9KpZkyrbvvGhV9h6qgtxCxZv2kRpSOG9lEsFUpin8o8U1R7R+H9ablnZxSGt9H0r8+PGpMFedCoujCZNGG4kBuKGTAapq++9Elro9RQY94woeD4A+wJsuW9PZDBW7aJ/0MONt3kQIH6Uurmo2LxKvSEP3ivkh/HnyML3+yZIrFlVTF2yy0vdy/ahweSfHXL7997W74olIsXQYsLne7U+6WkHatMMWae5s9LiTyT/IhOThlBLGKZ1xoXHfAckVq9bEffNlSNcAoPrcIbJtN8HPL+dQ30yTxcWFJAd4juIYQJXI1MPZEOoFJXlPzq2EAKpGurKbYKmGfUvJ9AArqZz53Zoszr8kn3sOlB/eX+XrKE89HyXIe3NmrvkpISctC7ExW/I6c4miqyyXSgyW48E5F/R9V8VjStzzPgZo/vIMJz3t7ArLBKMSZmwrE+JhBk+CEgJpdrvqG1KtHECoDLaCQsnPnMSLZygo/DCf0pz1iTmfLZByka4GU4OZzqIGz4DuC/w73w4mxlfBPk9jxvI0nDmzDQzFNTAxk3oOtPpfnYkWmmGG7oSE4jjV5wLVhRvLmiLJAvYtzCedEQyxBCYcTGBKBbA22gwME4JtuYMcRWCQ00Z3F7OZ9aYXBGUiPLgOJdBys/6RRLQtNUHNrXgPXuL9eTk0BZP4PAVDvXfuoPehWGs3nk8/fCZoPuWaAUJbhUGWPp5SIOqln46mt/+xzj2CsYCQbyzXpDLyqrFgJ2z9FeJFItxJ4+9q5mfy9Xp9Jnt5Ds6D8Lf5BOVFBr6/RGGlU8uSBJ45ZX2BZSqFSSVH4AI2fzhKO/2jVK3qK3vV+AkI8bSTW6U47LEyqF+1Vc6tm/nX1RJ4PpxWMLX5XldOJEXDcJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6208 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: DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: af85961d-1192-4293-6b7b-08d8d1a97cb9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dlh17JmU6lHkcF98ufksKd/UTR71Co2W2LaOFzhRcMJzzu5v0WkoRys7xClMb3gBzvZh103NsFXjupjWjpWj/1JzV+OBat3agJilRTwrVH3+3PjOKBrWPkMLUGgw/8u0+enJRbILXXoH8gZes4qT1qSQPa700GxuPQqwRRjOrYN/PzBaHFGd51Wd3tfI36fzROleLR4coXLYOQNN85sf912qBiEP+kIlRCH3myuLkUsBHmyZ5eVWy3GZFPCWRGX5HCI5Yu2sqGXaxi1fRGe58HY5buiKskcmd89/Ag4RPx86VVE/IqGg/oCaLGU1b91jK04g6gzIBH+8ly+6tUpkQNHATMzkHtg40PNGnfBnqczVk0CANy7WVFza7URAy77pVVsz60COc96rqRTy8dXH0n0K46J9ehjRYZyYe1wmZU8pqZhuxSGn3cvUwQa8A/mJHmrxXCb3cDYB9O6D6qC25OA23DNiN8E6iOW/AayouikAsFbnJ0tpTk+JUZTPbu72iieGzPERrXZuIfoTyI48DAxR1LktZRgoOqa/pNmxKZ0OnXZzd8VED9fZgFIcULJOByI4H753PCRktUKrC8DrSEuyy82BNoxy7jKyI+95N12vRaLFNni2rwBFQkcpc93SnPWYKv9MWaMiPMuEvg2tBxRI+RAnMSEHJeV8NSUQfmjY9WTVgcDwwTey6DAgKVLh 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)(376002)(136003)(396003)(346002)(39850400004)(46966006)(36840700001)(186003)(16526019)(356005)(316002)(36756003)(6512007)(6486002)(2906002)(6916009)(26005)(81166007)(6506007)(82740400003)(86362001)(82310400003)(70206006)(69590400012)(47076005)(36860700001)(5660300002)(8676002)(70586007)(336012)(478600001)(83380400001)(8936002)(6666004)(956004)(2616005)(44832011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 12:02:02.0032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ff7cecf-34a6-4877-6ac9-08d8d1a98131 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: DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2216 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Szabolcs Nagy via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Szabolcs Nagy <szabolcs.nagy@arm.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
Dynamic TLS related data race fixes
|
expand
|
diff --git a/elf/dl-close.c b/elf/dl-close.c index 3720e47dd1..9f31532f41 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -88,7 +88,11 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp, /* If this is not the last currently used entry no need to look further. */ if (idx != GL(dl_tls_max_dtv_idx)) - return true; + { + /* There is an unused dtv entry in the middle. */ + GL(dl_tls_dtv_gaps) = true; + return true; + } } while (idx - disp > (disp == 0 ? 1 + GL(dl_tls_static_nelem) : 0)) diff --git a/elf/dl-open.c b/elf/dl-open.c index 83b8e96a5c..661f26977e 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -890,16 +890,6 @@ no more namespaces available for dlmopen()")); state if relocation failed, for example. */ if (args.map) { - /* Maybe some of the modules which were loaded use TLS. - Since it will be removed in the following _dl_close call - we have to mark the dtv array as having gaps to fill the - holes. This is a pessimistic assumption which won't hurt - if not true. There is no need to do this when we are - loading the auditing DSOs since TLS has not yet been set - up. */ - if ((mode & __RTLD_AUDIT) == 0) - GL(dl_tls_dtv_gaps) = true; - _dl_close_worker (args.map, true); /* All l_nodelete_pending objects should have been deleted diff --git a/elf/dl-tls.c b/elf/dl-tls.c index c4466bd9fc..b0257185e9 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -187,10 +187,7 @@ _dl_next_tls_modid (void) size_t _dl_count_modids (void) { - /* It is rare that we have gaps; see elf/dl-open.c (_dl_open) where - we fail to load a module and unload it leaving a gap. If we don't - have gaps then the number of modids is the current maximum so - return that. */ + /* The count is the max unless dlclose or failed dlopen created gaps. */ if (__glibc_likely (!GL(dl_tls_dtv_gaps))) return GL(dl_tls_max_dtv_idx);