From patchwork Thu Oct 29 08:39:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 40913 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 34D25385EC58; Thu, 29 Oct 2020 08:39:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34D25385EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603960785; bh=HlUeCHPeuJT3VZ4UWmpIReJh7LExjJvzAcCGeo2qSM4=; 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=U2Ktoaf4uXe6MMxnS7uJJJs9ManOyEB+JlHHoxDcdvUPEFd6VazuZgU6nX9ATgk9g VM+1ZyjTCVTxGdCuuLE4FzUzs9BZHqqqba/QaLV4Q4ef7Qza2sKkurWn3Hf2Aas5V5 AkTkip6432L5O9vg2MQESTf62v0cftJLpEP35Du0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2084.outbound.protection.outlook.com [40.107.21.84]) by sourceware.org (Postfix) with ESMTPS id 1DBAA3951C10 for ; Thu, 29 Oct 2020 08:39:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DBAA3951C10 Received: from AM5P194CA0014.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::24) by VE1PR08MB5280.eurprd08.prod.outlook.com (2603:10a6:803:10d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Thu, 29 Oct 2020 08:39:38 +0000 Received: from VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:8f:cafe::31) by AM5P194CA0014.outlook.office365.com (2603:10a6:203:8f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 08:39:38 +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 VE1EUR03FT005.mail.protection.outlook.com (10.152.18.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Thu, 29 Oct 2020 08:39:37 +0000 Received: ("Tessian outbound 7c188528bfe0:v64"); Thu, 29 Oct 2020 08:39:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 839dc5c16b44b4ad X-CR-MTA-TID: 64aa7808 Received: from c25168078383.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A1BDC28F-C23D-473D-8A2A-733023F796A0.1; Thu, 29 Oct 2020 08:39:31 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c25168078383.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 29 Oct 2020 08:39:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HuIVnVc8UGBXuCxNrs1uovF1ZgVJrNAyqG3eEwuwB8/m9zHojNFrLzMWX302dcGBgoN357H1NyrrOIoG0eIWy61wgsLrBqF46wmlaHqAiZOws/enTOaKzHCH35YKalWWILPoYCu85hSwObPe28npKgIEVRRK8+mdUIheahRgyK2m2muvcW6VCmx9YoRLnA8MB4KFG8MB3HmGgtZzKz1iIjbo6tvi/sPbzx/oKNrGlioJCaSg1dH0cDgdEW1V7sDrhGygDgZ/MH7lrQGml6uewpWmx5HKWYVxYSMtH7OteHPA9U9y/eBHTzfdX2Vxczy82xy99gmureR8fMNQjvKZGA== 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=HlUeCHPeuJT3VZ4UWmpIReJh7LExjJvzAcCGeo2qSM4=; b=N8JkFYktmQAYMJzouq/LHDJkZdep9MRieWevXis6+VvSPtSw1NH+G09ihLzcJSm3HncXDkPMt7bWD0PE+MiGFdwrDbNOKSrEkHVdtjcZdvbM6/mCX4Z/BtaGYrhZcZXUS05AZP6xBNQfYKLFu0wNroVajmPXbcYCa4ZvfNeTNXYxm+4Bels7xfufIgrg7GSguxhxsyzRyscnzEBuZ1J7acIi5y8dN93ZhpbnT1GB1PneJ2FX6ENorEpFPbf8To0MwQJKiPcnb8C1i7VS0LO76EHW2gybJNm7VT6Q80crFa65EZ46VaM9NrI09QmovJKu1zlYRshTZKYEmoiz4d4fTw== 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 PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PR3PR08MB5611.eurprd08.prod.outlook.com (2603:10a6:102:85::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19; Thu, 29 Oct 2020 08:39:30 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792%3]) with mapi id 15.20.3499.024; Thu, 29 Oct 2020 08:39:30 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 1/2] aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798] Date: Thu, 29 Oct 2020 08:39:22 +0000 Message-Id: <4524a344b42edc9df4f732d3d3f4f09878d3c6a1.1603909005.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P265CA0090.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::30) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.54) by LO2P265CA0090.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 08:39:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4e263cbf-698d-4329-68ad-08d87be62bc4 X-MS-TrafficTypeDiagnostic: PR3PR08MB5611:|VE1PR08MB5280: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: fO0LdWBsXSdZU+FKKkV+8PFM4Z0Rz1ZbApKNkXNJGDNOnMiNU0Oavn03b68qMkylZQ4hoa7WR67yrU/ADGrcGtsY8Tl2QoO970LIllr5YIzU7tPrzqpNiT72r1LBFf/Xw2ReMji8Sc6p9T891GdVJQMqSjpPZjCDZ9k/2pNna9u9aYlgmNiX9GWgVcs4qlHwkjqJ1ukz5yFdJzRDyddVl3fxshOUd+G6XKaQP0POyYw7OC+JPGddmCdzal8UqCvez+3ejANYsD41zdFXjlDStwsiPBBx7eDxb0iFqrfooE61yGp9hKVTdxiAYGWY4xtP6QSPE/2yMOiZ0ON5BSpGCmvc7bq+pyxxKME0G0+825EKN37ODLyBRBz9NaSm9o0F X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(6916009)(6666004)(316002)(2906002)(83380400001)(5660300002)(86362001)(6512007)(36756003)(478600001)(44832011)(8676002)(66946007)(66556008)(66476007)(8936002)(6486002)(956004)(2616005)(52116002)(186003)(6506007)(69590400008)(26005)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: a4XyBsOfOfqlAjEs6GyzaCp/3MVGaZ5+rOvrvPgFGuBmK3XgA8BpZz5fEjP50Izsc5/Be6JayDpdCr6NbJqU+F8kINDFGIbMe2wMw3k3v652+/dQ72W7rdBh0+pcvedNrF8vok7i50oAfG+obrFjftPi9kjCOVkg5wC/6TjtYxB89iYmh23HHMGqixYUFw7Pz6IuJM5EDM8K+cvk+8FCdtMkRbVW7ALMcmU4thQg7W9o4Q1rW9gpcbUUfhDtAKTqPmiIQPgTCnxgGPK/FIrQApfLNcN8BA9FGiFY+pfL8zRgx7WC3gfMT8BQRpVGSkCV3Wxnv2i8586d74+hoOdbps80wpMR3vzg7r01zgSAHoMja+0Qm/88Ja8TFArFZF5Rmj3Jy00I38W4R8atsuzIR3F2RbWpFgglqJbiM2VHp9hkwG26/nwWlsSjZrUCZ3cRAA1+t9DkM3CHBBfI54RWDAJrbxHVLUG3dUkDJ81FUTEFVc+PkjO6qBw/7MjsxYwRwv7YqFTit+2zHAr5JLtjfSecuGc9VHttlj5wm5urhqPnHzuyE4AOmeYmZdIyG2Q0SYRKYvxamir3V1B7Q1NYYWuYKaBOP+VX3pZwQmCk9enPYsk6JLEoepRpiKf9W4GpdV+VRpCnKxtOewKNS3DO1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5611 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 6068370a-cb83-48de-b226-08d87be62742 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NA0BBMZXdB1pv9FWafvWcMH5ci1MHUDkmHmF082R+dwvK/mDcFLHoDSE+d/kXbGzJv/GWVoh50bqjvENuerDOVMbejOe5lMi9hFOycVVC4QiJ3tVtw1nZ6tvSmkUzorn7/NsYdqiPuZq3BFDIp1i3RhmaLKVLLV6IRvnrSOlYaM49xhraHdhKE1YMEXIO0eP7gkNH/zs2Q6w5hl0IGr10vRjouqEYPZZ9kIZRAZX0qeMrVuaERhfUNmdVbdd4VNWHh1UbDW8Zx/CzWrE+4+xD5hQr3xoi0aT2TG03lQ5J/Oem49sRLdxV1hChFUr0e5/VWp7zP5lvAvHJkkVc8gT66NxPl7zya5oPmq+XofE1DYtVNipq9m07dMv6ZU4A3CmUTnmYXJkybjAelttvoKShDXfUE9YmzhesrvFuxdcPM7pS+uCmTZMx/krvnlepGGe 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)(346002)(396003)(376002)(46966005)(8936002)(16526019)(44832011)(956004)(8676002)(2616005)(6512007)(36756003)(316002)(26005)(82740400003)(356005)(81166007)(82310400003)(336012)(47076004)(186003)(83380400001)(69590400008)(6486002)(478600001)(6666004)(2906002)(5660300002)(86362001)(36906005)(6506007)(70206006)(70586007)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 08:39:37.8802 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e263cbf-698d-4329-68ad-08d87be62bc4 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5280 X-Spam-Status: No, score=-14.5 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-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 variant PCS support was ineffective because in the common case linkmap->l_mach.plt == 0 but then the symbol table flags were ignored and normal lazy binding was used instead of resolving the relocs early. (This was a misunderstanding about how GOT[1] is setup by the linker.) In practice this mainly affects SVE calls when the vector length is more than 128 bits, then the top bits of the argument registers get clobbered during lazy binding. Fixes bug 26798. --- sysdeps/aarch64/dl-machine.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 70b9ed3925..fde7cfd9e2 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -395,13 +395,6 @@ elf_machine_lazy_rel (struct link_map *map, /* Check for unexpected PLT reloc type. */ if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1)) { - if (map->l_mach.plt == 0) - { - /* Prelinking. */ - *reloc_addr += l_addr; - return; - } - if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] != NULL)) { /* Check the symbol table for variant PCS symbols. */ @@ -425,7 +418,10 @@ elf_machine_lazy_rel (struct link_map *map, } } - *reloc_addr = map->l_mach.plt; + if (map->l_mach.plt == 0) + *reloc_addr += l_addr; + else + *reloc_addr = map->l_mach.plt; } else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1)) {