From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by sourceware.org (Postfix) with ESMTPS id 65E1E393C85F for ; Tue, 13 Apr 2021 08:19:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 65E1E393C85F Received: from AM6PR01CA0061.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::38) by HE1PR0802MB2377.eurprd08.prod.outlook.com (2603:10a6:3:c9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Tue, 13 Apr 2021 08:19:12 +0000 Received: from VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::98) by AM6PR01CA0061.outlook.office365.com (2603:10a6:20b:e0::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 08:19:12 +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 VE1EUR03FT042.mail.protection.outlook.com (10.152.19.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 08:19:12 +0000 Received: ("Tessian outbound 82c2d58b350b:v90"); Tue, 13 Apr 2021 08:19:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b5d1699080f75efb X-CR-MTA-TID: 64aa7808 Received: from 6615f889b6a9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CCE22BEA-49C0-4A0F-9B70-8AA35C588512.1; Tue, 13 Apr 2021 08:18:47 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6615f889b6a9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 13 Apr 2021 08:18:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQZ3p2n99eJp0sUvDwk8XSE0mFI4VXqE5/eiYYWf2p6lIp3nAovanrjz1BQmjfHoVsna9EliapoD+tJXqlMKr8ATcGUhHS2egYiGjE3SQ2xGpP5Jm93ezNWsKWx7huq1eqbHEw2nW2aRhh15AoufikpRFy9AkFpKeccWfuFQabY/lSxSYtrU+1yqWH8ezTAUqpix86hYUm4z3jRx5C1/znZKCSaraZ/IqnntarkJKPV0lXrIwVYWWVfDg73YoXJ3h3cvT7QvLhvofjwwzsgO0/W8Z1B3Wp9GPh32cHp4Kh1bdcdztPMi072wkT5AJsLzdSqk5K97RWAd54R3MRMYUg== 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=62ZpOw/uiu2AgHBbXamK8GyV18i8m8RsEFD1DrCK8F0=; b=lTLrAgIbZVGbY0ITmsNpHvm7CJGZfYOOfe5u4rN21Zu6dmKSTPv9xQOiNdRF8+O8LDSvWr7bfErtSMxbfmaH9gMX1XkZ+sDdOQLP+zQUYIDTM2z0tOucy0vRnZTTYdCfiijcrXpcBizh0pBfjzUO6uq2mYLxUtlio4397MKt2sowu4byC1zM9buHKOr9Gi5y9ZHaqsELUkICDIkFR3iLVjVUI82UczCUKsZ5GYaSRw++hZJK0WbLi/17Fa70Cba4Ejx41VP3ggw7jfLkfH8wlkVGJvXQOXzDVVr2WmXwG17x7vhdqeNUGc0J2VybKm5TigniL80y1tsJh0TaMFnCMA== 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 PAXPR08MB6397.eurprd08.prod.outlook.com (2603:10a6:102:12f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Tue, 13 Apr 2021 08:18:45 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b%7]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 08:18:45 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v2 03/14] elf: Fix comments and logic in _dl_add_to_slotinfo Date: Tue, 13 Apr 2021 09:18:39 +0100 Message-Id: <6b63f027658b2bbe41f2da374da0aff63a77647f.1618301209.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Content-Type: text/plain X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO4P123CA0469.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::6) 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.55) by LO4P123CA0469.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Tue, 13 Apr 2021 08:18:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4dc63003-b8a2-44fc-cd8e-08d8fe54d1bc X-MS-TrafficTypeDiagnostic: PAXPR08MB6397:|HE1PR0802MB2377: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3631;OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kPhO8klRRh/IJSwjL6Sxqo+NEbRfy8JIjAdJgJPtpjtm5qkgZJGTcyf+1ynAxhvOLnlqxEKTr4ZCHCFzDhyUg6+SEr4h594knm1A37Vio+q0380UR0sxPnanGxHGZuO2BJBfQoIo1eMFz5wDOWebyTk6x7MGo6+XieafuXZD7/G+7c0yu7NPbYdNBdKm4z1LQLqLN+YE+cQFixzr9bSDf6W7yz1wqizfZ9//9k/S51yIZiVmKWopBt9VPogZXjk4wcYCax/AdQoT0vQ8+JYkfiszm5zVGZrTPwBgN8d4lnuRQTEaSWQzVSG/5xM9VJMCKE/S2mcSUMx0PKVoZ2tsAqGIwOkLN7KwX/k94ChQJ0MchhhA9FERiJjXm/PkU4o+pJLMupXZ1vPBg2HZDADotFGZO2Qtn5ZWIgnVs28H0cf0S4wih6+2PUgf1sh9k07Br9rmpXJChDcUZNTxi8f4G7za3PdmrZtw0tkvhMnPUzmns/GJVkMrR2TXekZT1HrWrBOhphVbbACw6LWISHnVRLeBud01ZE8qxbHfrla3lLq7BCMz5bxKwQOGwank7LLGBZyVHRP8u68EvuC+YULrybmT9CofS3JF6kgL6zjJ0TltLSrLqUZ1b4tZKjFjuGf2w6oylX6Xta76l/4WUl0HH3TMxD2lGoB67haa//0GrDQcxkwEbXDthxw1Iz3LrvAr 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)(346002)(396003)(39860400002)(376002)(366004)(2906002)(6666004)(66556008)(6506007)(36756003)(26005)(66946007)(69590400012)(44832011)(38350700002)(83380400001)(956004)(86362001)(6486002)(16526019)(8676002)(316002)(8936002)(478600001)(6512007)(52116002)(38100700002)(5660300002)(2616005)(186003)(66476007)(6916009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?kHQ9qD5XeIpDHdm926iUm7d0SHXD4blEEsRE4oXpcL5yQJ/W/JIJky7gUgxS?= =?us-ascii?Q?suWwZbTrvtck1syxXCoecL8uOrl53Xz5VyjXRoH3dTAdQ/WbUq3aksnzrgiT?= =?us-ascii?Q?dWo64jSuItLDed/q8+M3hWSYVzcyaFN0QhlLU5uae1DB3thuON3dSpNi/KJB?= =?us-ascii?Q?+Bz7mSY/A8INJP6VtxKQI8SoBNvJrW6REgn89RkTyWVCup1xWTIgM3kcoyl3?= =?us-ascii?Q?YIXV3VmGQFxMWJOVBL1StrkiXhoRb5ExcIJH9JEcfwqQL0FhsFVUvrXjiUet?= =?us-ascii?Q?nVIAbfeqXi70CpsT1tTqXxJ2l4FQXOvKwQIibjuvr9TFsjp4ORsihn/LKiIU?= =?us-ascii?Q?o0ustqyIRJkg1XmgepR24Wluos8JAY89niNmXi2DHbNkBPAX90zVrnuEog+z?= =?us-ascii?Q?MJVOqo1KKUqLCXCFTukyHLuNDowCBdY46uzh4V3az9aHEJyjJLgwPK2QIvD1?= =?us-ascii?Q?rAJrQFs0BudZbgEIUKUiSh1efWpvedf+sIYu7MPV6HErnpuKvVX89m1vO1L+?= =?us-ascii?Q?VWGSwx6B5KecCWYx/KKApU6asMAeV1Na8JWeYT+tJRqCVbcmGU/DpNQXWyRm?= =?us-ascii?Q?WUam5E/nDVG3uvRRitTyz03JFd7j/hmHfe6AKr29N/+UCL1gcQ4pQ/i+aFXe?= =?us-ascii?Q?8vCE0LHi4UO1mdwplYienXSUJja6iyQFwY1NRQ6rW1V4/GpSAMS0mNaZBwMN?= =?us-ascii?Q?+FJmkktNwc2tOITqz0AmLU5/VppEIA1YqSgAmELu7XXjeqfVLhPw+PK94GuI?= =?us-ascii?Q?eOpUKBrbBc61syFqBQ8ZYztWHSgZwwzQwV6KwTIC9+YwTqMuEMnoyfhRMuyi?= =?us-ascii?Q?EYdqKiji7SYxsEbV9wSArodnOp6cQ+0bqCG9wJEqNxbBHhvR3VZWwgyqV5uE?= =?us-ascii?Q?u1u/XfY4jy5ldtFtnMBrSLbY6d2bcFSDFVYo8huKFyr7mihvsPAu5EbbGBIa?= =?us-ascii?Q?SVeBxa16iaEZ9lMJdKthJKefpRdqNA/d1sOqO6CdklPu99heBFfFuAuZ6fCq?= =?us-ascii?Q?f+6ceH8us0Y+o7XBNLDwrwVqiVQaz++HehYOoL4LZc+GmKmUwdWdMPMnLjti?= =?us-ascii?Q?1joSby8hg7u7ioc4StDDQZhEVIr4stxIuWsPuHzJPwHXh7nb/REiu5b85xs0?= =?us-ascii?Q?Oh0w995ri9xuOKJfTg0uuH0zU6oPcDrWZLTZBiMkI/8EFa+LOPV8wZ8+eM3V?= =?us-ascii?Q?fMcYDTav3wYOvYyB897BTVII3yvKZYi9UaRrvVlF3xFNCfPng7iqTMe62peJ?= =?us-ascii?Q?VLh/4RG8lk2ykZ8/y5zG47GobMyBo5gWaZe4tA36anAYL6JmWiiSRipc4W2C?= =?us-ascii?Q?uSWpoQAq8PEl8s9c23mTkf3i?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6397 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: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 624b626a-fe26-4340-1e66-08d8fe54c1bd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ua9We5zm92M/7+zt28Ae/MVV1Sz14zBxc894+C7D+SnftgliNx0eo72OYfA2HGCDIcVy2r08sG/L2mj+TBcI53FCQr3g3rq4g8QDw6c/dq9UO0b++2tNmQIbhc7d5s7ZaSl7zOQZerIV14nYxlPTR5rpOETD++qtOtV7Fvqo1pNpvulpk7Q7JNiFUYacSk645ky3paMZLtDkRJAO9tVY/ZAkKEjs7vezMJ2zBhCOFcKlL1TtS9pAMcyL04476NSJon9BphTWOwb9NzJr9tXtlh7ujQQu8p0N6aXclmp4Jqh/HHvf7Lu4cJdunFwReSnGdOJNZAiSSxBYUPTA8hYPI47k++9nz5HDdJ2dbmNqmImTJqhOEWLf2u1Ccg0k2fVtP9su/BoWW4yMMTwzoMeKV1fhN/b+Tz/+VbwMtzaJAxf1kac8EvCjP4MH4UdAZ4ii9Dingc5ubQi11dYFVFBI3tYNcfsm6fcGoe1YAF1oe0LIGzomKLT22CVk6QHcJibNwX9EAD0GR4epdoLs1qNizjo9qQqTA5M2LTjh31K/tw5zipfvFuoXD3X1toZTi4jw5I00x/pt9JsNn+N2H23SWet36CepUTmUr3iJV/3qJuFEhPO4yUzXF3pgun4jn3KdP+P5Y/4lq5q1MVSjpgZiqr69NQegOnLhja/USlEf7yzAOWB0iTlVorYAXe7Uu01N 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)(136003)(39860400002)(376002)(346002)(396003)(36840700001)(46966006)(6666004)(36756003)(6506007)(81166007)(82740400003)(2616005)(336012)(956004)(16526019)(5660300002)(70586007)(186003)(356005)(316002)(6916009)(44832011)(70206006)(8936002)(8676002)(478600001)(36860700001)(26005)(2906002)(6486002)(86362001)(69590400012)(47076005)(82310400003)(6512007)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 08:19:12.1135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4dc63003-b8a2-44fc-cd8e-08d8fe54d1bc 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: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2377 X-Spam-Status: No, score=-13.8 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 08:19:16 -0000 Since commit a509eb117fac1d764b15eba64993f4bdb63d7f3c Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112] the generation counter update is not needed in the failure path. That commit ensures allocation in _dl_add_to_slotinfo happens before the demarcation point in dlopen (it is called twice, first time is for allocation only where dlopen can still be reverted on failure, then second time actual dtv updates are done which then cannot fail). -- v2: - expanded the commit message a bit. --- elf/dl-tls.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 79b93ad91b..24d00c14ef 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -998,16 +998,7 @@ _dl_add_to_slotinfo (struct link_map *l, bool do_add) + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); if (listp == NULL) { - /* We ran out of memory. We will simply fail this - call but don't undo anything we did so far. The - application will crash or be terminated anyway very - soon. */ - - /* We have to do this since some entries in the dtv - slotinfo array might already point to this - generation. */ - ++GL(dl_tls_generation); - + /* We ran out of memory while resizing the dtv slotinfo list. */ _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\ cannot create TLS data structures")); } -- 2.17.1