From patchwork Mon Jun 22 16:20:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39763 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 CC91B383E802; Mon, 22 Jun 2020 16:21:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60052.outbound.protection.outlook.com [40.107.6.52]) by sourceware.org (Postfix) with ESMTPS id C6C22387084D for ; Mon, 22 Jun 2020 16:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C6C22387084D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fn7ViqaCTW7wCGf7jPvSwneadKpVdTB+6M+SsTasmGk=; b=U3OQJe+J7T4DyTnS6h9Gv6CS+NdMm5W3Xad+J3tKltLtJwyT1O39m7dVIzPwSdOnCqLcLEZcHGUmGXlV1otIdLRB1ySsbtnBkbZXRPGtLBhKwhX5yQ11sJvyZtkkSfON/ItVx8F9XzGgqY38Jy4gd/6oReW35IZUaNMJXNGE+yc= Received: from DB6P18901CA0007.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::17) by AM0PR08MB4243.eurprd08.prod.outlook.com (2603:10a6:208:138::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Mon, 22 Jun 2020 16:21:01 +0000 Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:16:cafe::a7) by DB6P18901CA0007.outlook.office365.com (2603:10a6:4:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Mon, 22 Jun 2020 16:21:01 +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=bestguesspass 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 DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Mon, 22 Jun 2020 16:21:01 +0000 Received: ("Tessian outbound 2ba684f51d22:v59"); Mon, 22 Jun 2020 16:21:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 382cd7935d04eb84 X-CR-MTA-TID: 64aa7808 Received: from fcc5a3bde45f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 909EF30B-11E0-49D5-B911-DB3E51A1C131.1; Mon, 22 Jun 2020 16:20:55 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fcc5a3bde45f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 22 Jun 2020 16:20:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZ19DHGCYi4+L6yLThz1z7jsOSUPEycP4RD8GgiDKyvmijKCEcD/tpLwHnwVKYGlVyJGY6fTUzWIlbrP3TMbAo5/0Nlb8EyPdY8aryymgF7y+5DyrdGmE6WNwcd8/FoKEKNTN5Qt58uiEQuYi0/YsUo9cc5r9gTxypFKLrFURPviBPRmQfNOeXiQxcReFrBb2ZVMsZH/6cMPljE+nLXRLeV/yINSGYR3QvzvAfJ8H6M9QDgFKToBcP0miSzvm7apfbR7oablZX+CbWr3O4Ku8WbdHDHOm+HGRKGjlU5v5G39ve2HVvUWIyCOAerKXZsMdNlpJ0FMAN2t1YlFaM6XOA== 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=fn7ViqaCTW7wCGf7jPvSwneadKpVdTB+6M+SsTasmGk=; b=hPDbJQSinHXv+j/x9nOMtBAMA8f29waeId+M6ch4kBQbxAxsQdRpm3kd4C8s0m8CsdvtcfdYNif761n7Ufo7dSc7E1UDaW5hSvPnByC2DctuAMuHQjoCdHn9D/YqnfNSJwp6IvRXcbxFmwj3AODmNbde3cS6IL2MSzetir9LZMc6u+r7sFL4c7g6HWDcYJX4AFJRHDwJxfGLFAVc+cg3rj/sCkHXr7BaoJgKpEEPm4Z/axPneALddXG2wcxagrv3NWXQRnr3+mxMPFBAjwPNCfpdkgqMkB4jLQe4xzayeSe/tsh02XLXSFepETW4JSYyC5UjV/ADQdTF2D6Zzt2q5A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fn7ViqaCTW7wCGf7jPvSwneadKpVdTB+6M+SsTasmGk=; b=U3OQJe+J7T4DyTnS6h9Gv6CS+NdMm5W3Xad+J3tKltLtJwyT1O39m7dVIzPwSdOnCqLcLEZcHGUmGXlV1otIdLRB1ySsbtnBkbZXRPGtLBhKwhX5yQ11sJvyZtkkSfON/ItVx8F9XzGgqY38Jy4gd/6oReW35IZUaNMJXNGE+yc= 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 AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM6PR08MB5239.eurprd08.prod.outlook.com (2603:10a6:20b:e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21; Mon, 22 Jun 2020 16:20:54 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3109.027; Mon, 22 Jun 2020 16:20:54 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v5 0/2] Improve surplus TLS accounting Date: Mon, 22 Jun 2020 17:20:48 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: LO2P265CA0322.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::22) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0322.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21 via Frontend Transport; Mon, 22 Jun 2020 16:20:54 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9ef551b1-296b-4d53-206e-08d816c840e8 X-MS-TrafficTypeDiagnostic: AM6PR08MB5239:|AM0PR08MB4243: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 0442E569BC X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: tdF+nanPB5IE62g/tQ0MDr95/FkC6Y4myXDzA5NN/J3gMIfy8xE1nqCIiu0gHhd2oGZir0cgpQD6q14wNCPc0aH7wgLn7vgjA/gOhqDWghvy8ldZK9NZy2w6TIVZ8N7oAzXNfmIgp430GTTR97ZCb0ZsfvmJIP4XYt+gmNGBcPr8VIZQeCyGncVvKZU3xQ/34NS6rbeQeA2k2ZjW+GkF+FtKGAR5ClHxIIsHuGSAuOQ7rSpI2SwCeYnk1e7WzvoIxg7LuDjI/Bjq9A8yqy1Jw3OmPmI5oRpXXj+6opilFalyebLSskG8nC1Sfh8Yj/A2a+yA9Ptr+kaUvMDWSXvCDc2BCMw/b2zQBEPa7fwluamKbP6XgWcsEurNkxhLAOf8P/HWWmlhLE7CxzR3NVKjbIDqcYkiCq/RQph1U3RvJ6Q= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(136003)(39860400002)(366004)(396003)(52116002)(2906002)(44832011)(6486002)(36756003)(316002)(86362001)(83380400001)(2616005)(478600001)(6666004)(6506007)(8936002)(6512007)(956004)(69590400007)(186003)(16526019)(66476007)(66946007)(8676002)(15650500001)(66556008)(5660300002)(6916009)(26005)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fC+Q8T1ASKMxKaa7Y6YTO4XM1/WAtxHOjVf782HDQbUGknB5FJw1UWzUaNH6SMqdUzKHvzaeMUTbhCkZ8orEWmwpOgIdxWUa6mqvPaNIFokskZfifn+uBT+LjXrlfVoX09sMp1+MHdI87kQUGzjktZmDgVLfAP52DPDpKdmUp/wG082+kHW7L91oqGRHgfW+LRznoChwuXWVOqryqwUlZebG80VKgGaSKxmCLfTmuFeyn4UApH7nnVin1c0FUzbPQSyLHYwnGrcQxh0+NpgjIxnOsfnjrATJaeNWndY0/KnZ9HMd8kfDwjMi7I7frobjmeFxErdW46+aLotd65C1ko16Zvi5aulMtFG6XnCCP9JbPvedaDHCNXfbJysTTNmh++Valcy4yqsjMw4aNXtP3vNhzwGKRJxwrSZTdVEvHdId0KCwRzyLkpw6TxcC/ICkolYICnWhS9ea14jA9l3EXSCrRXQ9a4f2eC8Iv0s8T3sslvZbpR54VoCpwjfDE80O X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5239 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: DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com 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; SFTY:; SFS:(4636009)(376002)(396003)(39860400002)(136003)(346002)(46966005)(478600001)(6506007)(316002)(16526019)(26005)(47076004)(186003)(69590400007)(356005)(82310400002)(2616005)(81166007)(8936002)(5660300002)(6916009)(70206006)(44832011)(2906002)(82740400003)(6512007)(70586007)(336012)(6666004)(15650500001)(6486002)(86362001)(83380400001)(36756003)(8676002)(956004)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: b2eaa0f5-5466-482d-5623-08d816c83cbe X-Forefront-PRVS: 0442E569BC X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: blpQzFiFbVFZL+oL0o7lk8/jLUD2Lu0o5Rm3Rfa8ROSwvsZKT94lfe/KFJNiR1heY+fEtfe56XaT7uz22a6/mD+k9BG/rcyhYlYVp5h7yy/lu0SRS2wV6E7RIVaOcE+BNOrpVhFWGZJprBCa6IxRWiSUU93l2BZVwe6eMrDFhSL+WY3bIam1Wg6odDpBbfQ4K9ncecRKb8QQANIRQjh+a6C11G6A+jaYE7VXr+FCtfceG2xx7sUCFDe6h6RY3Nu7yDV+ZsIz6qRy6vScbcwNGXmOtCL9EmfteaR6bN6BET+N+JP0vp9yNNb+5fphrmm7tme+a5pBqQPA86QzLiWKvnyKRbsqFTKX8MfBwLCKil1hJ2FWj5x5tAj7A0FnNVRgkJi4S3OA3f3YWZtkSKITzypQ/bQLysiS3kkJJ4ZnTG/IN3d4rvpXAcsxbd9bFFbB4ALLXsbci6wtLv6y07bE2Q== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2020 16:21:01.1079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ef551b1-296b-4d53-206e-08d816c840e8 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4243 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Addressed the review comments, the tricky static TLS accounting bits are unchanged. These are still outstanding: > Subsequent followup after committing this: > - We need to fix tst-manyaudit. > - We should be able to count how many spaces we need based on LD_AUDIT > or DT_AUDIT and enable up to that amount. Reran the tests on aarch64 and x86. Szabolcs Nagy (2): rtld: Add rtld.nns tunable for the number of supported namespaces rtld: Avoid using up static TLS surplus for optimizations [BZ #25051] csu/libc-tls.c | 31 +++++----- elf/Makefile | 29 +++++++++- elf/dl-reloc.c | 37 +++++++++--- elf/dl-tls.c | 56 ++++++++++++++++-- elf/dl-tunables.list | 14 +++++ elf/dynamic-link.h | 5 +- elf/rtld.c | 3 + elf/tst-tls-ie-dlmopen.c | 114 +++++++++++++++++++++++++++++++++++++ elf/tst-tls-ie-mod.h | 40 +++++++++++++ elf/tst-tls-ie-mod0.c | 4 ++ elf/tst-tls-ie-mod1.c | 4 ++ elf/tst-tls-ie-mod2.c | 4 ++ elf/tst-tls-ie-mod3.c | 4 ++ elf/tst-tls-ie-mod4.c | 4 ++ elf/tst-tls-ie-mod5.c | 4 ++ elf/tst-tls-ie-mod6.c | 4 ++ elf/tst-tls-ie.c | 113 ++++++++++++++++++++++++++++++++++++ manual/tunables.texi | 38 +++++++++++++ sysdeps/generic/ldsodefs.h | 11 ++++ 19 files changed, 487 insertions(+), 32 deletions(-) create mode 100644 elf/tst-tls-ie-dlmopen.c create mode 100644 elf/tst-tls-ie-mod.h create mode 100644 elf/tst-tls-ie-mod0.c create mode 100644 elf/tst-tls-ie-mod1.c create mode 100644 elf/tst-tls-ie-mod2.c create mode 100644 elf/tst-tls-ie-mod3.c create mode 100644 elf/tst-tls-ie-mod4.c create mode 100644 elf/tst-tls-ie-mod5.c create mode 100644 elf/tst-tls-ie-mod6.c create mode 100644 elf/tst-tls-ie.c