From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2067.outbound.protection.outlook.com [40.107.22.67]) by sourceware.org (Postfix) with ESMTPS id 4D5033877036 for ; Wed, 4 Nov 2020 12:40:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4D5033877036 Received: from DB6PR0501CA0031.eurprd05.prod.outlook.com (2603:10a6:4:67::17) by VI1PR0801MB1967.eurprd08.prod.outlook.com (2603:10a6:800:8c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.28; Wed, 4 Nov 2020 12:40:37 +0000 Received: from DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:67:cafe::4a) by DB6PR0501CA0031.outlook.office365.com (2603:10a6:4:67::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.22 via Frontend Transport; Wed, 4 Nov 2020 12:40:37 +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 DB5EUR03FT036.mail.protection.outlook.com (10.152.20.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 4 Nov 2020 12:40:37 +0000 Received: ("Tessian outbound d5e343850048:v64"); Wed, 04 Nov 2020 12:40:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 33a88a9585b62ed7 X-CR-MTA-TID: 64aa7808 Received: from c6473ad42242.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7DF864E5-EA13-4E28-BD3D-B3F9E6352B2E.1; Wed, 04 Nov 2020 12:39:59 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c6473ad42242.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 04 Nov 2020 12:39:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFlA2xPi60v4V3fihTQXXa9RuMS2N6xVBT4jQpJfvmGuG0TDCk2EkCarJvI8TpchmWa1OV4g0EHyyk/z5LVzJmOWwwNRXwSJv6mJtooS0rT5LkbfypoG9+ZVzKl9x7kPwUd2Sheuf6hhIcnrFlxHUybT7BsGnZnlwSvTWLeJBmGeccCj5Vskm1xV2y3qx73DzoOBowRNZdJi0j8YwEoHnllmSg6zdWafU/UpAP26R2/eSxWvuT75/8nk0Aa5OsKNfTyqwiWDFNK/SP12+Om9FKcrYY+jDl1yOcl8FodUb+Ykwbg3gP24K6HwFd2FPBppFSS20L/b2Bw2qUmCJwQPwQ== 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=ycItxxENewbT0VGEo1nF0wOpyP6dKes1m+p6fgH3i/o=; b=DrmO8t9eO5Sebyy41YNo75Wy+00uGgWMhlWVE38SIG28IbQZDYpD2gYCgvQ9sHd/uUCZLonOxnQwnkEYjOTyghBN782nSGNW0ZrlpHgdyvw9mxGl9Ux+HSDfMrx/qquAg4FiI2no06CKhnQ0fMGc2dRt3+LvCTMVoaWNA8LwQn3h83NP46Wfko+tuIUv1v0hh1QWG2zRxSg2l4esKLWsRpiIv0cJxAaotk9OOO0BdpiBtA/nx0Qlh0zSPymCR9+DFAkPVuJU9yVKXRMfxLUOP19S4Dth30nab1xEVyBDVxhESLYnBp7VkT97pKB5Jnv8oMc/47T2+ImLc6RIvM4Qmg== 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 PA4PR08MB6223.eurprd08.prod.outlook.com (2603:10a6:102:e8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Wed, 4 Nov 2020 12:39:58 +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.032; Wed, 4 Nov 2020 12:39:57 +0000 From: Szabolcs Nagy To: libc-stable@sourceware.org Subject: [2.31 COMMITTED] aarch64: Fix DT_AARCH64_VARIANT_PCS handling [BZ #26798] Date: Wed, 4 Nov 2020 12:39:46 +0000 Message-Id: <20201104123946.20333-1-szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: SA0PR11CA0005.namprd11.prod.outlook.com (2603:10b6:806:d3::10) 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 SA0PR11CA0005.namprd11.prod.outlook.com (2603:10b6:806:d3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 4 Nov 2020 12:39:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b7d49996-17cb-4fb3-5d5e-08d880bed4e8 X-MS-TrafficTypeDiagnostic: PA4PR08MB6223:|VI1PR0801MB1967: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true Content-Transfer-Encoding: quoted-printable NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1148;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: RSlwuTYTTXKKWVKc5Ew6itWPoGlufxhAVnd1yflBgVwQek4lmKXs5MXUoXadZgkmXpTJCFuDTMFm5eXWK/aJTa1e1OcqD1evL7Sj/AN82pm5gukZ3GX9Tfla2wh4j6zY5YHgh6bV+VAJ5FYKm2lQ3chb0fxvQ7F3Mh0TKre6DW9ziQDGlWYfQnzgvxMIMEfexFFPGYxcCxAFCMja222Pqi2Q9aDkTsCFkJ6y9J0C0GQ+uqXNw9gZVZkoyz16PEMoXLfn647ysEAv7TZEXnXGOfb53o2kKlfnGnrhDKliJGhVmWDQN2bSr7xFe6FPQ717Wrm5aVvZniO5g4sVAI+2b9V59SxBGU+uavpWnFPyYyXjn8sN6AUYBCHyVRagwK5u 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)(366004)(346002)(39860400002)(136003)(376002)(396003)(26005)(316002)(83380400001)(956004)(36756003)(8936002)(2616005)(16526019)(44832011)(69590400008)(186003)(52116002)(86362001)(5660300002)(6916009)(478600001)(66556008)(2906002)(1076003)(6506007)(6512007)(8676002)(6666004)(66476007)(66946007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pQo3VCJLFjJjXrY2arRJQsGEYy8ORJhxhnYyI/SrNPjgYs+yVcHGzGxSeUt/N+IfA/un6r/yZlBKctea2DJCG+hPuW3GfNFQljewbci681jLrzX/rNafMUgVmO8safMrqgx3TILYAa3jhTFVn/Sz7HzugQv3cyvl/n23SUHXpsAMyvBzNn+yRAOmIL0XB0rqzbPXmRdgnONKiRvNgVYBLQpC+fALqx5FJt5p5hpzhBg25ZAc0Qjrn7uqPcap75ZxgrHWXRc587+X0YfH56KVGRv6ppQ6IgSutp7P7T4JhbdkyYyLx8Gmqr4v+WYpF9MXvSo3N1s9ipCxqrnbHAQ0doCCtqgzqetfhmH+t6OE0dK5NuuHWJt+mizV3EVfXww/ahxpV4IbIG0c1ONYAdSJ+gtSQ1+VJ/b6kI7np3TJ4m3syMmNNfX/6dZ9SWzEPiJyiAM8s9L289t/w9ijz2OJfUpAd0lgaoevgr64kcI7acCSwXOGvsJk71HuIQunpgy5In1ciCSaSteO+ImNpCEQbRfwaYlkptnYGviG02bf0RPiA4KRhVg04mq1XiPa3XTXwE5aZ4q2TUrB/RiI725S8VsmsPcE8uh4d6GHx8HgR73cfFzYxseUBD/KV+jx7aQxqzR1TynsTSiSeBOquoUzzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6223 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: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b636b6aa-d027-4670-e38b-08d880bebcee X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /J2oFOSCaevHxTA+66DEPEvp/KwKmx7SsKJJhDpJ/L8u9Fz2A+JEWyUa8RLlMU2wE1M4epvIrwR00ja9sk14FH4cNMi2CWnz8ZwakUJs+0lARJ+HW3DjT4tAih7xXXZ/1vCKjV5ze3YlStfvUbc8yTzgocaIX+IRbhTqBUINt30LH6e4MHmeFA9r/0HM0vpGSaDZKx7qpnP4nzBiE5OCk4nBpIbhGC276Z8Fbjj6tOTiABhbodol7EALCbjGIplem7KezdCFe1ttzj8tmwVQV20KN4rgp51d5l8FmHmb1wztvQnA+TZOGID4YjaDR9rpsCQotz6GnLDo0WmYEQAi9x5lPOg5N5tCZFNVbKZrh3/2fZ3eYubtdAO92IgkW1cTjDZtZ6+iAAhQ2X85Mz6/uOem6WxjI+yMo86+z90BLJeGH/5z1txZ1jEMGW5gYF5s 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)(39860400002)(396003)(346002)(136003)(376002)(46966005)(186003)(6512007)(82310400003)(83380400001)(5660300002)(44832011)(69590400008)(478600001)(2906002)(316002)(2616005)(16526019)(956004)(8676002)(36756003)(26005)(70586007)(70206006)(47076004)(8936002)(81166007)(6666004)(86362001)(6506007)(336012)(1076003)(6916009)(82740400003)(356005)(6486002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2020 12:40:37.6979 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7d49996-17cb-4fb3-5d5e-08d880bed4e8 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: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1967 X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 12:40:44 -0000 The variant PCS support was ineffective because in the common case linkmap->l_mach.plt =3D=3D 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. (cherry picked from commit 558251bd8785760ad40fcbfeaaee5d27fa5b0fe4) --- 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 db3335e5ad..8ffa0d1c51 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -392,13 +392,6 @@ elf_machine_lazy_rel (struct link_map *map, /* Check for unexpected PLT reloc type. */ if (__builtin_expect (r_type =3D=3D AARCH64_R(JUMP_SLOT), 1)) { - if (map->l_mach.plt =3D=3D 0) - { - /* Prelinking. */ - *reloc_addr +=3D l_addr; - return; - } - if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] !=3D NUL= L)) { /* Check the symbol table for variant PCS symbols. */ @@ -422,7 +415,10 @@ elf_machine_lazy_rel (struct link_map *map, } } - *reloc_addr =3D map->l_mach.plt; + if (map->l_mach.plt =3D=3D 0) + *reloc_addr +=3D l_addr; + else + *reloc_addr =3D map->l_mach.plt; } else if (__builtin_expect (r_type =3D=3D AARCH64_R(TLSDESC), 1)) { -- 2.17.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.