From patchwork Tue Apr 12 12:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 52813 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 3B2A4385801E for ; Tue, 12 Apr 2022 12:56:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B2A4385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649768200; bh=Tv6vrk4t0pFVT+906oL+or0qsSiwfNCO8vCRfPBu948=; 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=PIV8IcZeM3i4sDTqN5hfbi75a0+Ot+m4UpN+1htQpdbqwY5tiU+z2Ia9JInqAz/fd ESdcVayuENZ7yCiucmccM9SdkK5CDd4rbCIFy3ZAw74sWpdL+Gzl7/+Yv6UxoV6o5r DTFjUi4y0N73T1BnwGC5Ad5AZo1Hm8tNz0CQxL5E= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20075.outbound.protection.outlook.com [40.107.2.75]) by sourceware.org (Postfix) with ESMTPS id 889753858D37 for ; Tue, 12 Apr 2022 12:55:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 889753858D37 Received: from DB6PR07CA0055.eurprd07.prod.outlook.com (2603:10a6:6:2a::17) by VI1PR08MB4320.eurprd08.prod.outlook.com (2603:10a6:803:100::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:30 +0000 Received: from DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2a:cafe::3f) by DB6PR07CA0055.outlook.office365.com (2603:10a6:6:2a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Tue, 12 Apr 2022 12:55:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 DB5EUR03FT010.mail.protection.outlook.com (10.152.20.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:30 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Tue, 12 Apr 2022 12:55:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d7559a4d6b603fbb X-CR-MTA-TID: 64aa7808 Received: from c0c90e66d799.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 066BA564-8A0E-4D68-8A49-03B474A57B74.1; Tue, 12 Apr 2022 12:55:23 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c0c90e66d799.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 Apr 2022 12:55:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mzIDieRXBMV9vLCzfbbs3mn8MbEJ7nlQu09Td+BJZXy3nmQ3DJQjt/XgdKi1lsj+/LA86zVFvUYDu4xBZ9rlMMKvEGG/1goKVTzvupe3xIz80rBMDYWHpw37PQrVBGzq25v1XPr/f8GJoKLG1YKSTLS1rvQknTlPPJUnLqLRbvtft0oF4NX+5f2ZqkIyXj6n+Rhs+HlzOHGmXslORKZYU0ZSxxUtqVOtH6Kg6G0amZBOqXQueLGkUZqbcEBqQzu3NKapQGLnhrxAKDKgTlnt/ql4WaMfOmwqbdRdc23x33eARJyDQym5H+fNmFvgsLGtplP1F6iSRyA1i0l8w7P0tg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Tv6vrk4t0pFVT+906oL+or0qsSiwfNCO8vCRfPBu948=; b=lB37vXwqmRC9iKcEv0CwO859+y9XvBb3XUZS2YKq3m5sE2ZaXDkSAtDGtFU8V6cPUf4c5/U18VBVmgKQej7jj2yAzb8/LJDxRzCqXXdxoy8gP2e6cgsfvtV3pp6o1SJsPvAgB/PiPkw3CbnoRo0r+wrhLzIDc1QC9Pt51eofAw9G2C4yGMOBUwnKDiZazDGrEYzK7y4TJiz2KXrlQYE/VNFIDCCkVcnUqtkm/aAgwn/UKrK7N48fjpuZZ85FuJuOMCsQE/t/vhNIsaE/Erj0TgiWITZOBDhb6YXT/NF7oGOabN1IrHqPVkfVwEtx9qBA7xkZI/9lCjZqNOT5XTJyBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS8PR07CA0011.eurprd07.prod.outlook.com (2603:10a6:20b:451::29) by HE1PR0802MB2571.eurprd08.prod.outlook.com (2603:10a6:3:e2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:22 +0000 Received: from AM5EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:451:cafe::9f) by AS8PR07CA0011.outlook.office365.com (2603:10a6:20b:451::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Tue, 12 Apr 2022 12:55:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT003.mail.protection.outlook.com (10.152.16.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:21 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 12 Apr 2022 12:55:27 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Tue, 12 Apr 2022 12:55:27 +0000 To: Subject: [PATCH 1/3] Remove _dl_skip_args_internal declaration Date: Tue, 12 Apr 2022 13:55:19 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 002bd145-c922-4eb7-f184-08da1c83b97d X-MS-TrafficTypeDiagnostic: HE1PR0802MB2571:EE_|DB5EUR03FT010:EE_|VI1PR08MB4320:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7WW/B6VwiMwNpbbWigrifcfa77COsU2vSjtvtGYipKb0R+U65dOWrF+k2PxNZ6cdZyODHGnIy0sd66G5wcK6rjMe/GYW4VAVgjNF0Fks++b8Nm/efCCOrjDrHFxWHZVpcelIvPRmq4QG7fvzIc+xGWxeUXG/7PgUoWYtzRq+5RrIypsNKN0aRIFO2bQYI0Um6vN/wi4DiK+BZM4QKU+KRKmO6cbRxHj0fB1aoGlc8KgBv6pwOMpdGk68rnOsLSiCWzzVqMD1i1V2ZWq3wMEh42jE179k5n4x/naLzb4w/EIuWa2MgntudjA/ONkgA/YyVh/GrBoUYB34GJK7WfSPP1xwALz68RP26NUzfFx7OMx7UPBhDXYRwfrSEoaZxnGYSbXo85/rUXQGUvuQUaCfU63tz6WJ4J9FO7vFdFMXtZ46wXm1t5HLzaOdHCKNYt6ntYwsUlJ4IcKfVWZkECcVvNjC81QU5r0bUEuMZkoZRDRvve2SCEERwr3Afnxx1QNkL9PcXuPtjhbeSxeJkw+kdHLK1tAMd8fIbSzY6NcqjS0zl4oKdxXX2SwynhJGMmByeypLh1UtSck0kLTxoZBkMmstbvtLlAXRz6UN6zJd/1u79eOGcpbymI3u0H9PzTt7FIjELx7kof6hchstjZtMmaJxoc35SZLT7ScG725ny3o6nEAkwPQ1wCn4uRhj7ArlJuLMnqoo0tMe1lTyK7SScg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(2616005)(6666004)(40460700003)(7696005)(426003)(86362001)(70586007)(70206006)(6916009)(47076005)(81166007)(356005)(44832011)(4744005)(316002)(8676002)(82310400005)(36860700001)(8936002)(336012)(36756003)(5660300002)(508600001)(26005)(186003)(2906002)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2571 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ce3d5068-3b70-4d64-cf11-08da1c83b463 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MnbJ60RTshNqhHWkLZA7wu8xaxs0Hz0D27dM45hXxQHG0F6Y8gawChQm4rGCh/JWSonj/ErU5+AQ48lPkhi9BV+EtDz7zqAi8S3cWibI+PpEUt6jbRAiUh0qRC0BaAxGyLdgXF877h3nCKxaT754v4MH7u/9RfCt3v88XFmCF3+UFDJkapQUzMHAeu5qEkb2WOd9CE9lef0zlXMpGth6n939fawtAbgLNe+9BuXu1SVJ6LaJLqK0/uVBJGmF1RTZpRtpZXsbpGGG8BEbJflD/q+KE9VmP/SUoto/q8an3Bsbta3pd52wASOlgU51N/nkdbyDiTDVu0w9rXb4HMjnqJ231S5SJ/lK3A1cTDflrNgws3EkrK5VzcHh83PTNL6pGvAJN741ykx1sOKhc+PWVETi/uVXY3sUepz/viWj04gahAEHq2PjlvgNF+GEQ6OUdRGxTvvJnIPsHVE7pcwz0+M3cffiCBix6Fra+ekc4ZzwCsvuFtiMWumWItxjuisUm3QWiyURIEQ6EuQeQJK2VM4tg8eLT/g4bVHgsT4hrExnx7nGaUoMaonB7e+Iq0ryStlugqUcB90b9OpYtsWqdAu6nZbMfspoivwub7lnAdWJ7MtShiJB/vnuPOTaJB+jd7AJY3tXDEHBGmjdU5XELilzBd7UY9SA930e9uwevB1gAo3wfEonTL390GnbsEg7 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(86362001)(82310400005)(36860700001)(2906002)(508600001)(426003)(2616005)(47076005)(336012)(26005)(186003)(6666004)(83380400001)(70206006)(70586007)(7696005)(36756003)(8936002)(40460700003)(4744005)(316002)(5660300002)(44832011)(6916009)(81166007)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2022 12:55:30.4678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 002bd145-c922-4eb7-f184-08da1c83b97d 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: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4320 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" It does not seem to be used. Reviewed-by: Florian Weimer --- sysdeps/generic/ldsodefs.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 44750461a9..29f005499b 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -781,11 +781,6 @@ extern char **_dl_argv rtld_hidden_proto (_dl_argv) #if IS_IN (rtld) extern unsigned int _dl_skip_args attribute_hidden -# ifndef DL_ARGV_NOT_RELRO - attribute_relro -# endif - ; -extern unsigned int _dl_skip_args_internal attribute_hidden # ifndef DL_ARGV_NOT_RELRO attribute_relro # endif From patchwork Tue Apr 12 12:55:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 52814 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 61AEC3858C54 for ; Tue, 12 Apr 2022 12:57:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61AEC3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649768244; bh=oXnOjws84/Q6FIvcI7qtGKHbQKwrX3m8ZyysvdqRxvo=; 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=dEyp1sp+I3q75S9jjNV1XQiuxfHvSsVklpxP/VE5Vx3u8RVa1Dlm+kQJd3a6GsiHh lGovjazB1L0P0PXUPBTMq+U3XTs4CFem93qzn2LvWeRx+Gu8XcnJYJ6VndcYGC5aC4 PTVjIoVEmR44kDOsYe7ecW1NHtRORWE3FGBXx2bA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by sourceware.org (Postfix) with ESMTPS id 5C6AD385840C for ; Tue, 12 Apr 2022 12:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C6AD385840C Received: from DB7PR03CA0094.eurprd03.prod.outlook.com (2603:10a6:10:72::35) by AM0PR08MB3041.eurprd08.prod.outlook.com (2603:10a6:208:5c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:40 +0000 Received: from DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::a7) by DB7PR03CA0094.outlook.office365.com (2603:10a6:10:72::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.30 via Frontend Transport; Tue, 12 Apr 2022 12:55:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 DB5EUR03FT048.mail.protection.outlook.com (10.152.21.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:40 +0000 Received: ("Tessian outbound 62985e3c34b6:v118"); Tue, 12 Apr 2022 12:55:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ec63c289e146ce8d X-CR-MTA-TID: 64aa7808 Received: from 5a8927dae34b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id ADE11093-49E3-4F44-B7F5-6A433D96B433.1; Tue, 12 Apr 2022 12:55:33 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5a8927dae34b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 Apr 2022 12:55:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=agRnum7FYwCST9dqXZVNrabP2m2JrjbAkh99hN+AyG1skoZXux6OhWDfhqh9wLsrgqjNNrAGwjAzWHr2/5ZgMu1kAl78dAYT30M+sDYbrVvkE6GR2yxVtHvOZ9/O0iT/kJKzqYEEs+ylYr2RtD0BREkdA+CX8tcZhx5ewR/ecDJga86Fwk1HgWBNQx+xVgc/Z7fnB3ZYLNoUCi+4sx4mjGNLF8aRTJtRifdUspxginokMg9IFQNhMekDKEgzxTKPXZRepXpREoeuuWv6tUY2n9mDjOig1DsOGhVA57DjRVguNxPiZpR8gbV/sDwvLu2moDR54n/tiW+j4m7iCHboTg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oXnOjws84/Q6FIvcI7qtGKHbQKwrX3m8ZyysvdqRxvo=; b=fHyQGw9LHdIMkfLC74tO62VWBBNhhnknFInVDL3qFZ4ci21zymBxhz+A6chtzq14y/31iBdpZ48LQ62Q+LL7NEh4JoR7rz213WRxcb6mPYm0f6M9Ai9ELB0Xd5z3y7C63no8hsgIxSQVJs5cPFnLB6N36DPKkv8Av95TVCnVUH7prqlN9YgX+6YW8MaotlyQaA60dCisUmsF9l4XTauhxL6QIcFLG9M1Fy6aYeI6E7IwPSbW58adixYSY5inFQ1YU0bg43w3r1WDP4B3zkSdOyvtpTxaEN3JrWFlMWU5uVIMiT3GDjYV3sXN+cJvMdkoGJ7WHCAlivKaUZ7ZOprilg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS8PR04CA0190.eurprd04.prod.outlook.com (2603:10a6:20b:2f3::15) by AM6PR08MB5080.eurprd08.prod.outlook.com (2603:10a6:20b:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:32 +0000 Received: from AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f3:cafe::be) by AS8PR04CA0190.outlook.office365.com (2603:10a6:20b:2f3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Tue, 12 Apr 2022 12:55:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT050.mail.protection.outlook.com (10.152.17.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:31 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Tue, 12 Apr 2022 12:55:38 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Tue, 12 Apr 2022 12:55:30 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Tue, 12 Apr 2022 12:55:38 +0000 To: Subject: [PATCH 2/3] aarch64: Use generic argv adjustment in ld.so [BZ #23293] Date: Tue, 12 Apr 2022 13:55:30 +0100 Message-ID: <6b8ed2f8c240e8d2ee4386e423a4765c39aa56ef.1649767418.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 67955505-de28-4d63-45f4-08da1c83bf88 X-MS-TrafficTypeDiagnostic: AM6PR08MB5080:EE_|DB5EUR03FT048:EE_|AM0PR08MB3041:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jmwbzFA1cnzoCb9dguoymkO2eWxTpguINUHDBwht02jBG+g9/U8hidPnxBy+hfZOe0bXxqu2hH5tdB43R20xWUJw+aXBJy05Rw5kH5hbjMPuzQQsdkLNqq3buY2xIPq4Fo8K9BzD6KkGJSiQy4VoVG/4onss7HgLNN6z4SWIblCUKCWFjpVc8HUKpz8Vo1k2huFPT3g9+A984WrntrGSIn/G12kTjj2fmuMQ7bpm1pfDqM5stbuOBkeEb2GIrnpBrwIZgwojSfAej+vUsW3YBUFAQDIbC8CqAr/P5pG/n1/y152Kp95OqxeiL2mF+rAZazTSkCpTzgL5eSu2aKOsNCX3UsG9xm3hdk0Li7fKUYrt2zNHRD/1YAHElwUKks8H3SV+HPqsauMYOeAMT/qCrz4YXtnvdY6FYdXwYJGffBkqvO8XWo2oFZdza5UzGjAcemIwz1wCNGp+zVg4TaVg+DwSdNmH3bMglfic8d/F7blavLuo71yXh8xrDP5q6HbH+0YCsRJQsod4dESrKujCf1w+OLiDznAvY2G/L/gbwu6M3ZXVcOisGEMd7HEWQAZylJ2SM8fd2iFSTpLugNasL4XHpVUQkVme/jqJvdFvresP91hVq4ggjGdtuSPT51R5pj1fOAmv/h0mlUE6IdG18x0GGA/oRX7QeSEzd6L5q7eIdFkSYYnsEBbuCVVPOHt433VVR0D2b04+EzVO3RB46gqeh9X66xybzCjbl5msYq4= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(426003)(2906002)(26005)(186003)(6666004)(86362001)(336012)(44832011)(5660300002)(47076005)(316002)(82310400005)(36860700001)(2616005)(70586007)(70206006)(8676002)(8936002)(7696005)(356005)(36756003)(81166007)(40460700003)(83380400001)(508600001)(6916009)(41533002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5080 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d793595d-5c9c-4ada-fcd0-08da1c83ba45 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ATlv49K3bGi4SlMPgf6TIgXBrTLldmgmF6kqEvN1VBtDEFFDw1TLwGdeEX/ulCWkFrX+J9BLXJI7p4W8TuSS/yc9aLdmpUoZ3kbW46Nf1iLqwS3s7uQ5LbDfXVXIcocRkrxhzHoukkTMEcDIzsc5xyBvmbOHus6TyrQcuS+nkeGpNzX9sPtTJGsbJOGlqEV5yhTbqBdk2nPwLwd5vAKuAYBI3Dv7o+0p27DVSYkrndw9UM6/gzf/8SZtwHkisyYW/51z1jjSjJnWbd9V1ZWTfylIfrFGca5qr0Sv0+vqGh6RS73jlO+FNpT8/l7OOASahX5eIQtuuioEa0conq09VHAVk6OUHi49JgbKs4AjRJqoVlC/Fp2/L7WYBRyqx2BXT+v1baucCQUdbVX80a0jm9uXzfzmcBoEXQq08k1N9ziLW6FuKJ9dimHttwMsFSxDkCWQvtfFbY0k76aZof6V7LCRqdIl4YFl0aceLFHlDHhG/s+hoWoPqF+kthyWkqgE1yCZOgnRL/JSFy4iyGCdyuZsHdE5slYFVrFcrJ12HulPDm/tOjIHFbJ/7cQxaE6NMegqyTW85Zrw2fevfVZYqHl43kHOQiqSx381JtGTNf+ynXuuToc5dmcholZaUpsEzYON6hu/svuA52gl2C9boa9ZzOrm3tlEvg3bOhUObWztpKQuAq9lxeRYG/LCfathXdqNw6pFg0eDwg5c7DpiNQ== 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(44832011)(47076005)(336012)(186003)(26005)(8936002)(70586007)(2616005)(6916009)(83380400001)(5660300002)(8676002)(36860700001)(6666004)(316002)(426003)(86362001)(70206006)(2906002)(82310400005)(40460700003)(508600001)(81166007)(36756003)(7696005)(41533002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2022 12:55:40.5862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67955505-de28-4d63-45f4-08da1c83bf88 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: DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3041 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" When an executable is invoked as ./ld.so [ld.so-args] ./exe [exe-args] then the argv is adujusted in ld.so before calling the entry point of the executable so ld.so args are not visible to it. On most targets this requires moving argv, env and auxv on the stack to ensure correct stack alignment at the entry point. This had several issues: - The code for this adjustment on the stack is written in asm as part of the target specific ld.so _start code which is hard to maintain. - The adjustment is done after _dl_start returns, where it's too late to update GLRO(dl_auxv), as it is already readonly, so it points to memory that was clobbered by the adjustment. This is bug 23293. - _environ is also wrong in ld.so after the adjustment, but it is likely not used after _dl_start returns so this is not user visible. - _dl_argv was updated, but for this it was moved out of relro, which changes security properties across targets unnecessarily. This patch introduces a generic _dl_start_args_adjust function that handles the argument adjustments after ld.so processed its own args and before relro protection is applied. It sets _dl_skip_args to 0 so the existing adjustment in asm is not invoked. Each target has to opt-in to use this new adjustment since some targets don't need it. Once all targets are updated, _dl_argv declaration can be simplified. A new _dl_start_argptr was introduced because the original sp is not passed to dl_main which now has to do the adjustments. A seemingly simpler approach is to deal with unaligned sp in crt1.o, i.e. align sp in the entry point of the exe before __libc_start_main and pass unaligned sp from ld.so after updating argc (like it is done on x86), however this is not a backward compatible solution, new ld.so would not work with old exe on targets where old crt1 does not align. --- elf/rtld.c | 56 +++++++++++++++++++++++++++++ sysdeps/aarch64/dl-sysdep.h | 2 +- sysdeps/generic/ldsodefs.h | 3 ++ sysdeps/unix/sysv/linux/dl-sysdep.c | 10 ++++++ 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/elf/rtld.c b/elf/rtld.c index 19e328f89e..c08f7ed9e2 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1311,6 +1311,58 @@ rtld_setup_main_map (struct link_map *main_map) return has_interp; } +#ifdef DL_NEED_START_ARGS_ADJUST +static void +_dl_start_args_adjust (void) +{ + void **sp; + void **p; + long argc; + char **argv; + ElfW(auxv_t) *auxv; + + if (_dl_skip_args == 0) + return; + + sp = _dl_start_argptr; + + /* Adjust argc on stack. */ + argc = (long) sp[0] - _dl_skip_args; + sp[0] = (void *) argc; + + argv = (char **) (sp + 1); /* Necessary aliasing violation. */ + p = sp + _dl_skip_args; + /* Shuffle argv down. */ + do + *++sp = *++p; + while (*p); + + /* Shuffle envp down. */ + do + *++sp = *++p; + while (*p); + + auxv = (ElfW(auxv_t) *) (sp + 1); /* Necessary aliasing violation. */ + /* Shuffle auxv down. */ + void *a, *b; /* Use a pair of pointers for an auxv entry. */ + do + { + a = *++p; + b = *++p; + *++sp = a; + *++sp = b; + } + while (a); + + /* Update globals in rtld. */ + _dl_argv = argv; + _environ = argv + argc + 1; + GLRO(dl_auxv) = auxv; + /* No longer need to skip args. */ + _dl_skip_args = 0; +} +#endif + static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, @@ -1615,6 +1667,10 @@ dl_main (const ElfW(Phdr) *phdr, /* Set the argv[0] string now that we've processed the executable. */ if (argv0 != NULL) _dl_argv[0] = argv0; +#ifdef DL_NEED_START_ARGS_ADJUST + /* Adjust arguments for the application entry point. */ + _dl_start_args_adjust (); +#endif } else { diff --git a/sysdeps/aarch64/dl-sysdep.h b/sysdeps/aarch64/dl-sysdep.h index 667786671c..1df4c2c528 100644 --- a/sysdeps/aarch64/dl-sysdep.h +++ b/sysdeps/aarch64/dl-sysdep.h @@ -20,6 +20,6 @@ /* _dl_argv cannot be attribute_relro, because _dl_start_user might write into it after _dl_start returns. */ -#define DL_ARGV_NOT_RELRO 1 +#define DL_NEED_START_ARGS_ADJUST 1 #define DL_EXTERN_PROTECTED_DATA diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 29f005499b..f322d36570 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -785,6 +785,9 @@ extern unsigned int _dl_skip_args attribute_hidden attribute_relro # endif ; +# ifdef DL_NEED_START_ARGS_ADJUST +extern void **_dl_start_argptr attribute_hidden attribute_relro; +# endif #endif #define rtld_progname _dl_argv[0] diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index c90f109b11..66f003e2a3 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -58,6 +58,12 @@ void *__libc_stack_end attribute_relro = NULL; rtld_hidden_data_def(__libc_stack_end) void *_dl_random attribute_relro = NULL; +#ifdef DL_NEED_START_ARGS_ADJUST +/* Original sp at ELF entry, used when rtld is executed explicitly + and needs to adjust arg components for the actual application. */ +void **_dl_start_argptr attribute_hidden attribute_relro = NULL; +#endif + #ifndef DL_STACK_END # define DL_STACK_END(cookie) ((void *) (cookie)) #endif @@ -114,6 +120,10 @@ _dl_sysdep_start (void **start_argptr, __brk (0); /* Initialize the break. */ +#ifdef DL_NEED_START_ARGS_ADJUST + _dl_start_argptr = start_argptr; +#endif + #ifdef DL_PLATFORM_INIT DL_PLATFORM_INIT; #endif From patchwork Tue Apr 12 12:55:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 52815 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 7FEB8385801E for ; Tue, 12 Apr 2022 12:58:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FEB8385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649768293; bh=bq5qW/aLOG1Qum+kJPjWFU2Dmy0sMVODTBQ12tKs64g=; 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=odtmhqTqhKKMaTYvfp0aYB+yrJ/x38LQLOGNKH8OE21VJCuYvXrLzAsgRmSZpa5AK PDwunFZ7XMlo+6sqpGJHtLIfnC4LOu4jGYvRvFZ5RfPipyZYfen728coDRtmBA03LW qHaR3hB/5r2MjlJtY6Sfgu0AX6Khf/awBCsXFPQI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80073.outbound.protection.outlook.com [40.107.8.73]) by sourceware.org (Postfix) with ESMTPS id DDC87385737E for ; Tue, 12 Apr 2022 12:56:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DDC87385737E Received: from AM0PR10CA0124.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::41) by AM5PR0801MB1922.eurprd08.prod.outlook.com (2603:10a6:203:4b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:57 +0000 Received: from VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:e6:cafe::11) by AM0PR10CA0124.outlook.office365.com (2603:10a6:208:e6::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Tue, 12 Apr 2022 12:55:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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 VE1EUR03FT045.mail.protection.outlook.com (10.152.19.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:57 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Tue, 12 Apr 2022 12:55:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 62b142eabf069e1d X-CR-MTA-TID: 64aa7808 Received: from db646b44a990.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 47C70BF8-6D9C-45F8-AFA0-06D824F5A7F0.1; Tue, 12 Apr 2022 12:55:50 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id db646b44a990.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 Apr 2022 12:55:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHlpmgqBn5LQMEMFqnc+zatvaSEERQTBauCWunVBBjwTnPw0/s6+wJFGM0n4FLtHYgebdK9gPukXUMZiStuq06CqlAAzXQ5tMH9LnJkOtzW7BMcgFgTiQMANe0PpCywGngRMiuTUHhCNGjiFRaWgz6OCOdFNyV6TolUo5Em6LtyerczOLb1AFM/ME+RirkIvT6pKScvCPrb70bEMTnNi8DGZiejQAvtYMbJveyQaYBTQD3mutfpYrh8CHHf9WsgwkD69QoPgizs5sezKVbuRoaKxBpATpO7xZNIodcpwY64NqUbreYnQ+b9uw/7p6X470c8++n9iSBzLzNoTiFZlCw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bq5qW/aLOG1Qum+kJPjWFU2Dmy0sMVODTBQ12tKs64g=; b=A4qWmnCzKry4IlWCR9+kCOVpxdzsHkpd25JdOgImaHuwNvaVnHaOI5gGwYF8RtBpRHvCtUlPhjHVCmoUo6BsiEvLo/uchgX+S17zErQzsRLT3UnPkaGPYReGPD3k0MKivQn7XARiXipDq7EI9SW+jUBCLZ3rihBk+zTl9I6VTFFgHmMBdQCTvlNXLO1fsQ1Ax9F6W0m22ZWnYSJWmkLAoiLyuiZ4CwW8CMLk0oUjyR7pS+4FernNRflReoTH4Rdeuup8IrHGrE+LDL1bU/rf+3wHBJuqmy4mEQYkgAlaKluTDQu//my5LQuq9b28KItApiriNgu70pK26RvZjn/f7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR04CA0071.eurprd04.prod.outlook.com (2603:10a6:20b:48b::20) by PR3PR08MB5707.eurprd08.prod.outlook.com (2603:10a6:102:8b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 12:55:43 +0000 Received: from AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48b:cafe::27) by AS9PR04CA0071.outlook.office365.com (2603:10a6:20b:48b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.30 via Frontend Transport; Tue, 12 Apr 2022 12:55:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT010.mail.protection.outlook.com (10.152.16.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5144.21 via Frontend Transport; Tue, 12 Apr 2022 12:55:42 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 12 Apr 2022 12:55:49 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Tue, 12 Apr 2022 12:55:49 +0000 To: Subject: [PATCH 3/3] aarch64: Move ld.so _start to separate file Date: Tue, 12 Apr 2022 13:55:41 +0100 Message-ID: <7c3f84f8367155706d76ad71c4b060fe3f1c0bff.1649767418.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: d13fd371-5583-43fc-ade7-08da1c83c96e X-MS-TrafficTypeDiagnostic: PR3PR08MB5707:EE_|VE1EUR03FT045:EE_|AM5PR0801MB1922:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: w5e3Uo4w5QZ9xMS/qJRM2A0u+g0PJnABnyntiAADdwGz9g+XgNa7+3wxXA5CO8/t3Vv7m2J+r1Cg8N/xE9GaqEZVJsUwU4Pxb2jaL+aMZRBy6Np6ItRnm/xswdTuFOp0jCTS9KepAu3+cI5GZUZlQYG2BJ8CUSCp+sHQuS1hnM8RMGmY4LYcku0pddeUHqwo5pOkDF5IF6y668b6QNjQWe4Gue8p4ZZTr9HOYaB7HnwokF7AZUYvzEi8FJ+KgDR+WhkjMW+dq6kjKfecKg4f82qnMyaxe+JZ3Tkg8M+fm6fUiU8m+M2mcQwJYfgp08bjwRO4L4oWMjbmfQ+mmokG0u93yM3BI9CJbyCeTuLlktfasEqGeNi15FIo1JhSDMF0+MmgN30vuWozFYqxm92+io/SDhL6W2ctrfryfBZMT4Hlojk6+Jb1RhTwUcp+zQGHUjz+0UIj7oAW4Xcv+ope/oERuD9sD0g2pEMKbu8a9ic9xz1/K735IzgRH5yT1tCwFKbOXhdZpeJLaYRRKJfPVSKGU3R2gIRwRVbO7Vrs/71vwkNu7CXrBC/OPLFyCimpnQ8HBe9Kg6OQHT23s6aX7kiXCCtJKrk04zn5oswh/IN65RWRnTyT+t/YjtNtNsFqACt0DPhm8twxnWJukz83xZaLTz3blKfzKsTb4X5mWEzHlfpVItWl6kyrmTCrMG9GwSVdZ1D2sIcFoP38VKc47IxuF+QE2CiFj/NFtDcTiZ5EGUHKhI1d1w7cszQ70vSgHZAIeDaS+zaqvJrdFb04S2AdBqMNYIVWuhJdKjP4KTV9CWDegnTKmj1/UezhYu77 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(36860700001)(44832011)(81166007)(2906002)(86362001)(82310400005)(6666004)(356005)(5660300002)(83380400001)(8936002)(47076005)(40460700003)(7696005)(508600001)(70586007)(70206006)(36756003)(186003)(426003)(336012)(26005)(6916009)(316002)(8676002)(2616005)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5707 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 32db5596-5498-4c2d-03f2-08da1c83c0ba X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dmul8A9DVga6Na6Cn9nEoF4Cwf/2IIqZ1F90Ks8lHQD68lKUvjbx3azf/rxwjSrjwO1B4ApcGFmny2jo5sKe9Q3Y8NiNgD2r4iwUtoZnJV6aCxCW+b837ARIDdTrEGQSbFDsPqUcedkkK5dYEm0f4ftUyxMDzUZHHoul8qwMH1X3S92UxkdLcgcYOebuE9jwMwX/SWaJmxMejK7v77fYGA0L9iJ66qbLwdefuiv+CSkc08pw+hsFm+2uxVWisqfXcHnReUE5vIay5ilGuowlXxJD6Sajp834wkoyU8yVXwu6ACLAqxirx19jqyDOSijcdWHR4PETo0hsqxSyGojNE+rTH81hhFDh5xssqAsRibmb7rkgIsBJ3OyV/BJ+CeZfNyCTA7RA0kGFcGgggTl+Dq/gwhogIU2XNIac3KBXn2zs0Nd7FH61NB7+TPoyJilKUD4CzP0gJeJg83Xr/tuXLJmb8hGPalN4UqISGptVonvkT/4KTz53QwqZG++n3gK4wbtCu5MdWUm4LTylUZMnj7PE+zqQ9A7mAbD2uy5uFfXEPjqEdVgP8YB32Zn6aAHdFb4i++Bujmxfr0Y0ENQnHZcp71zfVvS7+geAcaUzyejD8OhihXosyauP+/W9n96hLbk/qONv9cjdLT4vN4SntAwprYIZ7hmKdtYvCxwXHAnGYb/68g0eu51QkK6q+9C0ZMG83a/FyVi8HFX0NVKmelZUGKnTBk+tb0O1q912nGlnd5tfs3YDx0LYrhs3hJhrfE7kLOcxrJD2+36zxoLk8Q== 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(2906002)(426003)(26005)(186003)(6666004)(336012)(86362001)(82310400005)(5660300002)(44832011)(47076005)(316002)(2616005)(36860700001)(70586007)(70206006)(8676002)(8936002)(7696005)(81166007)(36756003)(83380400001)(40460700003)(508600001)(6916009)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2022 12:55:57.1010 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d13fd371-5583-43fc-ade7-08da1c83c96e 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: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1922 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" A separate asm file is easier to maintain than a macro that expands to inline asm. The RTLD_START macro is only needed now becase _dl_start is local in rtld.c, but _start has to call it, if _dl_start was made hidden then it could be empty. --- sysdeps/aarch64/Makefile | 1 + sysdeps/aarch64/dl-machine.h | 77 +----------------------------------- sysdeps/aarch64/dl-start.S | 53 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 75 deletions(-) create mode 100644 sysdeps/aarch64/dl-start.S diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 7183895d04..17fb1c5b72 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -33,6 +33,7 @@ tst-audit27-ENV = LD_AUDIT=$(objpfx)tst-auditmod27.so endif ifeq ($(subdir),elf) +sysdep-rtld-routines += dl-start sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index b40050a981..fe120bb507 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -105,81 +105,8 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], return lazy; } -/* Initial entry point for the dynamic linker. The C function - _dl_start is the real entry point, its return value is the user - program's entry point */ -#ifdef __LP64__ -# define RTLD_START RTLD_START_1 ("x", "3", "sp") -#else -# define RTLD_START RTLD_START_1 ("w", "2", "wsp") -#endif - - -#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\ -.text \n\ -.globl _start \n\ -.type _start, %function \n\ -.globl _dl_start_user \n\ -.type _dl_start_user, %function \n\ -_start: \n\ - // bti c \n\ - hint 34 \n\ - mov " PTR "0, " PTR_SP " \n\ - bl _dl_start \n\ - // returns user entry point in x0 \n\ - mov x21, x0 \n\ -_dl_start_user: \n\ - // get the original arg count \n\ - ldr " PTR "1, [sp] \n\ - // get the argv address \n\ - add " PTR "2, " PTR_SP ", #(1<<" PTR_SIZE_LOG ") \n\ - // get _dl_skip_args to see if we were \n\ - // invoked as an executable \n\ - adrp x4, _dl_skip_args \n\ - ldr w4, [x4, #:lo12:_dl_skip_args] \n\ - // do we need to adjust argc/argv \n\ - cmp w4, 0 \n\ - beq .L_done_stack_adjust \n\ - // subtract _dl_skip_args from original arg count \n\ - sub " PTR "1, " PTR "1, " PTR "4 \n\ - // store adjusted argc back to stack \n\ - str " PTR "1, [sp] \n\ - // find the first unskipped argument \n\ - mov " PTR "3, " PTR "2 \n\ - add " PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG " \n\ - // shuffle argv down \n\ -1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\ - str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "5, #0 \n\ - bne 1b \n\ - // shuffle envp down \n\ -1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\ - str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "5, #0 \n\ - bne 1b \n\ - // shuffle auxv down \n\ -1: ldp " PTR "0, " PTR "5, [x4, #(2<<" PTR_SIZE_LOG ")]! \n\ - stp " PTR "0, " PTR "5, [x3], #(2<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "0, #0 \n\ - bne 1b \n\ - // Update _dl_argv \n\ - adrp x3, __GI__dl_argv \n\ - str " PTR "2, [x3, #:lo12:__GI__dl_argv] \n\ -.L_done_stack_adjust: \n\ - // compute envp \n\ - add " PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG " \n\ - add " PTR "3, " PTR "3, #(1<<" PTR_SIZE_LOG ") \n\ - adrp x16, _rtld_local \n\ - add " PTR "16, " PTR "16, #:lo12:_rtld_local \n\ - ldr " PTR "0, [x16] \n\ - bl _dl_init \n\ - // load the finalizer function \n\ - adrp x0, _dl_fini \n\ - add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ - // jump to the user_s entry point \n\ - mov x16, x21 \n\ - br x16 \n\ -"); +/* In elf/rtld.c _dl_start should be global so dl-start.S can reference it. */ +#define RTLD_START asm (".globl _dl_start"); #define elf_machine_type_class(type) \ ((((type) == AARCH64_R(JUMP_SLOT) \ diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S new file mode 100644 index 0000000000..a3a57bd5a1 --- /dev/null +++ b/sysdeps/aarch64/dl-start.S @@ -0,0 +1,53 @@ +/* ld.so _start code. + Copyright (C) 2022 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 + +ENTRY (_start) + /* Create an initial frame with 0 LR and FP */ + cfi_undefined (x30) + mov x29, #0 + mov x30, #0 + + mov x0, sp + PTR_ARG (0) + bl _dl_start + /* Returns user entry point in x0. */ + mov PTR_REG (21), PTR_REG (0) +.globl _dl_start_user +.type _dl_start_user, %function +_dl_start_user: + /* Get argc. */ + ldr PTR_REG (1), [sp] + /* Get argv. */ + add x2, sp, PTR_SIZE + /* Compute envp. */ + add PTR_REG (3), PTR_REG (2), PTR_REG (1), lsl PTR_LOG_SIZE + add PTR_REG (3), PTR_REG (3), PTR_SIZE + adrp x16, _rtld_local + add PTR_REG (16), PTR_REG (16), :lo12:_rtld_local + ldr PTR_REG (0), [x16] + bl _dl_init + /* Load the finalizer function. */ + adrp x0, _dl_fini + add PTR_REG (0), PTR_REG (0), :lo12:_dl_fini + /* Jump to the user's entry point. */ + mov x16, x21 + br x16 +END (_start)