From patchwork Fri May 15 14:40:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39264 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 8973B3985C08; Fri, 15 May 2020 14:41:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2050.outbound.protection.outlook.com [40.107.20.50]) by sourceware.org (Postfix) with ESMTPS id C23133985817 for ; Fri, 15 May 2020 14:41:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C23133985817 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=sWJ5vL2xW0xPYJtIyC0QbZYF+Ts1pzZ8oqZDM9eqNZ8=; b=BdoJ5mLLEb5jJApLJ/Laqv/NLdq2L/b+T3J/MYzAhA810j64Ltis41pOJX4qxyLqTJUp3uFEN1uUGu+q2uHgCZa00lULRp+CkwzQpa455sBQmSNr+KZymo0jYUWJjKObe3qBr6v3uSu8U8RY1E51jww+Q25/rBBXCAK4rxaKC3Q= Received: from AM6P193CA0072.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::49) by VI1PR08MB4301.eurprd08.prod.outlook.com (2603:10a6:803:f7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:11 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::db) by AM6P193CA0072.outlook.office365.com (2603:10a6:209:8e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:11 +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 AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Fri, 15 May 2020 14:41:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 702fcc67155b7dc9 X-CR-MTA-TID: 64aa7808 Received: from d8c8fe1eabb3.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C3AC0069-FE5B-4799-BCA1-8F79CF1FDD2D.1; Fri, 15 May 2020 14:41:04 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d8c8fe1eabb3.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3iiIGKANX03TQwueoJctdOGwFR3S2oIGqJs3iOJ9++jNwfn1OWBJg8+NEELgKIYHhu8vqcVsVSjVpotsyeHmg6Bwrtq6oFiA5hzLVZKUNxo+wAyY/O6eNtdarub6JWaJpBuCIKBFxB3mfIrVaIbNFgHKLLR/uiMbqVLOthJgMkA49Y1pyUyiDrck2WpR265CRSIFHVGDwl0HymyNVtcgnqgUobrI5DjZSUKduMgE3Px2eCx8IkZ89ivVNvzR8fzDsvXC2Z122Sjp+hw7qVRIVJgTSx6ZkoCKh2bNIyWiJR4D+hFzvIpY8HcT4Tsw4RhxulAwE29VT8xTFodSVnrUg== 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=sWJ5vL2xW0xPYJtIyC0QbZYF+Ts1pzZ8oqZDM9eqNZ8=; b=WTBjulhKarq8HEShf4BN+Epyeu5NFRykKW2blk9nSkrZPQJWX5AYekz6lvl2IFklwGNcMjFgfGu6qubr3B3hrYUXXzN8qwCvVqStChV/8bh/kUctKnzdAuO945HngYzvTDAdzvXDJkXPNXix96/Fz3wBfiv3LKFxmMV/maXcVGZBjo18iaAqRVGPUurWcTuQYe71ecFb3gNNtRNkA64tlOyb9tywhYwvD6dfqVyTLhLvSNK3YhWNiOBgXmy1vAzNTUevsOeRJhbpLtbj77G6xemtKS1pGWVdsvdeb8wfIa7eeTE9T3mQT2sjBqBc6q8YBW+taJf9I/de/OseuNu69g== 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=sWJ5vL2xW0xPYJtIyC0QbZYF+Ts1pzZ8oqZDM9eqNZ8=; b=BdoJ5mLLEb5jJApLJ/Laqv/NLdq2L/b+T3J/MYzAhA810j64Ltis41pOJX4qxyLqTJUp3uFEN1uUGu+q2uHgCZa00lULRp+CkwzQpa455sBQmSNr+KZymo0jYUWJjKObe3qBr6v3uSu8U8RY1E51jww+Q25/rBBXCAK4rxaKC3Q= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:03 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:03 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 01/13] elf.h: Add PT_GNU_PROPERTY Date: Fri, 15 May 2020 15:40:45 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:03 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 71509865-c7bb-4304-4efd-08d7f8de02ec X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|VI1PR08MB4301: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1388;OLM:1388; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0+fcdKtQSZnmYZKeKmHrqHbq99DuNO/Cs/2+pObm0YrCRFKyr3JS7kBkAcyTyc0WTvr87e1NXS9gtnHNU2/BUZey4SVtY//n5WrcJlsvSQC00bYeyW9TJ4dslF6NmmcQIUpcLZQdDzySNxWdJcyWsY/OLyG4Zn9J4Dra3LVGMCZ5sGrhF/5bpUSdZijeVhaQMLcFLvNqW9fLm6GlCmS6RxvlK1/xVqiTUUx/TPhj3thilZqaXWuuy0ghoXrNVt0adC8bwa4cFojxiimDyvg7rwK+7/B8Xw4NdjFEKQDKgB+SUBbcq7K3+gSE8QQNCYSNi9iwuP4NA5Pxu01N0NQrda6UQad+z4DD/cZwMzqF2LcNsKmXykK3VvVYZE4kKzd1tQlfu727bNlzzr384evrCO4M9y0Xcw28wECoaWZ+df9o6XeteAazHZLKwYSxKphU9fWl5mKkKMEWU9fQUbgj/KcT95SMr4vMRPWMGzGBE09xjnlwR/M4tVHHMpzscqM92H6FHt9gs/gP0B8Ai9dUEME/AbJGe2OUpCH4zZiiUdY= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(4744005)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S1O8bwET8aD8IRBNOZni6uAB89AIoxyuvtObj1KJebid4D+SAv/tg+nAb8SZnD97AMLrjwgRSfyKrJk5IqfoWg5MYvahL7m/DYE0faggv9a0vc9OffSo71DTqAvAFPIOlFZpa/JIKHMXeEjNE9OIZRvWuap9xiAsBbJ3gUQJN6Lm4PwE7Zg7JClcJCX9VLQdUg6fUn8UHl22PcbQH69O3+GVmxLkqWMom2qtLkNE75VokEBz2ikX5QkXpAdSfTq/LacKcsY2DSnfX9WlAPnOxS/W5KsFl9llKZTNGDkoxXKfQkdE+TQoSdE01PoVOB7GxY/dw3frJBlwDe62Zy40skHm7OJq8ZswP4UkekyAAm+f71GKn7EbMNXLoJDaDSSxIxnTXV5gT0zZpdSD34B7BwHuQ+C9TCxPM5xVuh3r4BN/5YpL5Mq2O+5qZCmLKaQf+ythYwDqQmlQUctERbg5+vyEAW9E6uIf4oxpAvvMmaiDKsR3EHTlGsbIMTC3BCuC X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT015.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)(396003)(376002)(39860400002)(136003)(346002)(46966005)(6916009)(16526019)(316002)(70206006)(70586007)(6486002)(5660300002)(44832011)(4744005)(8676002)(36756003)(86362001)(336012)(8936002)(6512007)(478600001)(81166007)(69590400007)(47076004)(956004)(36906005)(26005)(6666004)(2906002)(186003)(356005)(6506007)(2616005)(82740400003)(82310400002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a3cd887a-5054-4300-4a1f-08d7f8ddfe44 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xEx0+my4+ftsc5hnKvQv2WTbCritwB/cgAZ6ZD9eILicSq1eM9ffi3WVaqu+p6xVQl3KfpPigzkZl5rTsiKn1enc5Eun2lLJaUu0gYbqFpclINdjMRA9kzPnZsNii1cs5BOZTm9yVDX/t1CQkpmkIdAFTWupF+nF8cUV1hgqgqMMC1BV0TlG2afbr46XzptVuGRzHfq7u0peo3d3E0J8qP1uWUQWxBqyuhzWoLQd9FPo58URPFEkRKdNC8wqOtMnN1VrrodQUla0ZcVOCfKh9I2okK2fmUGlzeprJNAwitXgc+4o1JryQd9LHxu/GRsnYX7D+r8FBOhphTyTXrwv8vUqdcHO/Uwhwpl0ARdkvjFOZ+TdCJQbpkVMyfjpCdizajHqfPJsdj1R5uAQFWeKtYW1+j/JDUTX0unegfuIjG+OZfMC33pq1hRuqM+nOmVrr8taBjbYQ+1/nZNWaP/8o0dSyqKdHL/sHYKRXA1ffFznovxzlO89w3rMpDShsZv5huPP65a4jSsB17zJ/vKmHWdAE5tj5TlJ2dDcKXz8NQg6mvd+Yc36ThxEx+vM/hcB562mktfL3kZtDIkklunbDg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:11.0820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71509865-c7bb-4304-4efd-08d7f8de02ec 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: VI1PR08MB4301 X-Spam-Status: No, score=-19.6 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-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" This program header type is already used in binaries on x86 and aarch64 targets. Reviewed-by: Adhemerval Zanella --- elf/elf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/elf/elf.h b/elf/elf.h index 51e9968405..5b5ce37d9e 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -721,6 +721,7 @@ typedef struct #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ +#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ From patchwork Fri May 15 14:40:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39258 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 E7DEB3985453; Fri, 15 May 2020 14:41:23 +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-eopbgr60077.outbound.protection.outlook.com [40.107.6.77]) by sourceware.org (Postfix) with ESMTPS id 4EBEB383E808 for ; Fri, 15 May 2020 14:41:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4EBEB383E808 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=0iMYtXA25Ruk30C3cThZitJJerGPScZhj5soCKPRcwM=; b=Ja8KsJab3B2ImK8kZQEXhne1quoc5+poOZ0EvAtJJsPT+xU/uk1a23Bwrc0oqQEPMxFSZf/BzKsDaX4kW5QATVNnAG5FDpn+Eu1s9NCATyQDnnwZ2ImKzcs05g1Ti3N4OwT/MTVyfORUSnLdvanNDzdwchdYHm6tB6G4PAExh+8= Received: from AM0PR01CA0129.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::34) by AM0PR08MB5457.eurprd08.prod.outlook.com (2603:10a6:208:180::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:11 +0000 Received: from AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:168:cafe::cb) by AM0PR01CA0129.outlook.office365.com (2603:10a6:208:168::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 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 AM5EUR03FT052.mail.protection.outlook.com (10.152.17.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:10 +0000 Received: ("Tessian outbound 567b75aed2b9:v54"); Fri, 15 May 2020 14:41:10 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 114d02894d068bc2 X-CR-MTA-TID: 64aa7808 Received: from 3df973c5f92a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 67A820F7-7E12-4244-8F69-462A0828206E.1; Fri, 15 May 2020 14:41:04 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3df973c5f92a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P/RmMVJsWrUSzucNjGmsurTQLCc65VkZCn2TiVUOCn4d1ej74Sp0Dk4elOja65uDfaqv8iCqE1LGfAYaGmTL60ub1nvqV8yNd3+gJzYAQ0ahvWACSQP4xJ9jvPuWyok2n83pUtdC2ZolYvNRbvOFGyGVRneYjF62scIA0yp/QoB0ng/Pg7BKyBXO4wEbBmpJen+s/HRcS/p4WqC2XPFz8CuCYcbppGoiuQSZKeTjwwBnxQMwX2LM8nTgn38F2xjuK+zzpPrV+Sm7Wp6KnhZWr9Vycwssbn6P7wLYMPyzljbXUSvEMmC8eby1x8GkZmcjq3OXdmzbbqc65rh+yOGhwQ== 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=0iMYtXA25Ruk30C3cThZitJJerGPScZhj5soCKPRcwM=; b=BcwbFIpNG9ZouwbEhj9Q6gJvZAaxcAZTqvr9nmioLZMb7w55USmeamEkWXQaS3bG+HMM0mUfeO8mBNH3O+/wnOJIvbqdRNccL4M9exRMLJsVTHAor2+7ypp2V7BQEQU70M7B+/Eu6B0dC8bR2zyRwhx38aaqROkX4ZIz6cVHN5RHt2yqYmCFVcNXcByVB8KZM2j2qnxs6imzzz/m1TcmX6WFqnB3CPGgiSV7j1j55q1KDwPqjI6S9NMchzQHufVaIF+sd5jvB8rQsqz6y1BAMoW2tY+noWVEStvg76ABr/o1RGY+mF5r/5SFc+ZdeoQwnDG4viAFyDymDR1/Kvi7dg== 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=0iMYtXA25Ruk30C3cThZitJJerGPScZhj5soCKPRcwM=; b=Ja8KsJab3B2ImK8kZQEXhne1quoc5+poOZ0EvAtJJsPT+xU/uk1a23Bwrc0oqQEPMxFSZf/BzKsDaX4kW5QATVNnAG5FDpn+Eu1s9NCATyQDnnwZ2ImKzcs05g1Ti3N4OwT/MTVyfORUSnLdvanNDzdwchdYHm6tB6G4PAExh+8= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:04 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:04 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 02/13] elf.h: add aarch64 property definitions Date: Fri, 15 May 2020 15:40:46 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:03 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9190478f-76a8-4622-9960-08d7f8de02b4 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM0PR08MB5457: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5797;OLM:5797; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jQPfkt3ksFG9ZgT92KhmB7E4uohagpPcny11ZzbEbOHEhy1IMU4CZCfIW7S/9bxgFxDIEQboJWye2/AB0zJWQgrwtcXlWPc2iDdYGnUlYg4mUW1icISguMeZ0fjNdCxdoZk8DaIXtBS3/mQFQLXmhg8umRNVGui+h1h4Fi+XxEuH05Bevo4wxW/2vCUqo2Bhj+JwDhq8fqvMzi5t781+fqlz6IZqxIXgzyMp7HT+JH5b4iC+VEVejmOowJ+/srNpQzWvzAWPpN9RfX+ql9gd5nrdOFZYB9IeamDj2cdHcVolwNwACjLZ0mMrMgWlUaHCSKBa19ewc7o+KkvfC9ngmv2rtUd4ULKOH+l0+i943DbBrCsb5T0yPU0EZcooE/M6dSIOmycDgCAt6nSXQnmK1812rrcMOsPNRKnOvBN/eYQ2Yx4oHPl26alzJ2l3JyktMuoldLmYMCH95Ja/F6YMpN0bcUkNuq8JGnn6CpnpAl2oM1Vu4kmqMHvspm8/qagATV2NJNBhAB5Cvj95Xtoy6rVrXfgX9QfS52av6hA8qJY= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(4744005)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1JjkKYNCXG5HYFH2Xg9wTdeLDPaEQD73CaPsRh8IRuTPuqgkT+69fSuvM44EZP17k0GYqiz5y+m0G9O666e8b4NGGeKL+7JONwFagManDzOocCeHZgF0XnNEohJlEUya4MuUHn3fg8XlTvn6DYolTyTKBgjX/4vVQyW4jIoPm6oFqWcV6q9FbhphVsWYIABCSeQb1LxEO2C5cmPyS4KiBr3jdVlM2khFQNrrKIGTZYhMEGvHIZIlbVOYACJSRJb8cJLtMMozzQCzndDBP8xxjUdNqZ/i0QAO8itA7fO24KYKXb5mKUD5xxAbfbkGtzUarSpXupVyTVo81VNeoCzoIoWoIMzxvWYdxXmt2CFMNnLhyR6Ieysp19744oI2X/2NPm+P43DUF6mdzKcjvuKzxbf1wQ7Z+Y852+bwHkpABPl9EXFbC6kt/I81ns+H1Nb4Fp2VBk2zCTzPUdlrjloykVHANuzvBYYFr4j6MOPyx3+RqCbgEPMuVGgCmG2UNqHM X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT052.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)(39860400002)(376002)(346002)(136003)(396003)(46966005)(47076004)(81166007)(82740400003)(69590400007)(82310400002)(6512007)(6666004)(86362001)(2906002)(6486002)(356005)(6916009)(8676002)(478600001)(6506007)(8936002)(5660300002)(2616005)(26005)(956004)(4744005)(70206006)(36906005)(316002)(336012)(36756003)(16526019)(186003)(44832011)(70586007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: fa8a2f5b-b84b-4181-08dd-08d7f8ddfe84 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qSyN9jxWgEboUk7T8K3zw7sjrXVkvez9NblkPC/MpnLMDPy+Dde0ddERSINrpy4EkfhHzFsUbPv8fFxgQas0K2QCghsjSVoT00JjyZFmrH/KmndYAusIRfzT5Mgw59Qiadnisbub2exTT0MDRIAObEu0BJWNKjYmBBD5BRPRxiBk0lfJy/l24wv3bo32KkWFVzHt9CY3f9Z186vVSdn4PW1IK1WZVhtaE5qNh8om1B2HhQINy6YUlo+m4r/p84o1dQLqslxDjV7MIb7bUm0zhDSP8U0CQmrXRcVGUT3IKBIzGCgbbmPj+RPRVGTepCggzLKOrmQ+tWX4HSkpXwnPtiCk9cOIkvKGhr1wPqvtcVKyvO5sKBQVqvskI0MvxIbp2Sykki7cQFj76Kdu1JV27s8ITKj4mUGarNlc4AbEMtny7Wqn6OrGEBYj/YiyhZeK+teKODT7WVZ/DeMUEoLjtt6yqmYcRkmLGcMsONosrdcBom3pg+XCmOziOYfOdvINyAg5mb5aCBWc/Gk5td0eedN4jYJuUVtWBsr1Sjgi71rCaHTBbJDhIitaPV+ikQJnifnUykYw8OHN7+Qg1z5lZQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:10.7423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9190478f-76a8-4622-9960-08d7f8de02b4 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: AM0PR08MB5457 X-Spam-Status: No, score=-19.6 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-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" These property values are specified by the AArch64 ELF ABI and binutils can create binaries marked with them. Reviewed-by: Adhemerval Zanella --- elf/elf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elf/elf.h b/elf/elf.h index 5b5ce37d9e..197b557d15 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -1319,6 +1319,12 @@ typedef struct /* Application-specific semantics, hi */ #define GNU_PROPERTY_HIUSER 0xffffffff +/* AArch64 specific GNU properties. */ +#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 + +#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) +#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) + /* The x86 instruction sets indicated by the corresponding bits are used in program. Their support in the hardware is optional. */ #define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 From patchwork Fri May 15 14:40:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39259 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 4B3A8398583F; Fri, 15 May 2020 14:41:24 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70058.outbound.protection.outlook.com [40.107.7.58]) by sourceware.org (Postfix) with ESMTPS id 8D84D3984048 for ; Fri, 15 May 2020 14:41:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8D84D3984048 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=CG53rVHwL+ctx7M8HbkgG4gtY2fbxU7d7vLu1lWvgEY=; b=DBE16i+dKUeMz7qVsSi/ZOL7jDzGDx7korVhkyob57G1dpLc8jPKTLyFl2Mq5s/B8O09L0g4gcCgfM3ICw22+iBPRqVgtQ4JrM8dgX6pML5UJ/Y572mi9CxS92YDeVNruSwKrlmBFU/+mhv+fohqyibqJUJjS5xEuu/VZqzDJuk= Received: from DB6PR0501CA0023.eurprd05.prod.outlook.com (2603:10a6:4:8f::33) by DB7PR08MB3449.eurprd08.prod.outlook.com (2603:10a6:10:42::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Fri, 15 May 2020 14:41:10 +0000 Received: from DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::26) by DB6PR0501CA0023.outlook.office365.com (2603:10a6:4:8f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:10 +0000 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 DB5EUR03FT037.mail.protection.outlook.com (10.152.20.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:10 +0000 Received: ("Tessian outbound e88319d7ccd0:v54"); Fri, 15 May 2020 14:41:10 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 87d99df0964b9d24 X-CR-MTA-TID: 64aa7808 Received: from 8bf6242b898d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FE589C84-BD1F-4F19-900C-2BAD839CA454.1; Fri, 15 May 2020 14:41:05 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8bf6242b898d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bACX8aS5wGr9txzHvBPkjWzgWDeppQLaydsdWrJZxRdDGGRVaDpegOJWJLcj/xvWUItg5rxTRneX1cEuFus2s7zBr+kvnayTgiJ3Q7bdld6ARoKvDM0g72mmoVJQMYYyB5+Jm9mw2yAqMs6gVf5KqeeYjfbXkzjdv6wqLz8ij4znGdtSx9EArNaJL0y3PFfBalkjVnRhSkXuYB5ZNdXlxgioVLpECY7qexMA6aHtXGA+rhyYHJqIu3IGqYJXn5+acW6oAerNGhpaM3UXnlM7WKlcOJGK1ubww4/Ic0vZczlucjFNhm9oduF1MGYhRNL5FwKHCmzt/LK8wxgu676/rw== 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=CG53rVHwL+ctx7M8HbkgG4gtY2fbxU7d7vLu1lWvgEY=; b=SufNI37vQvzzxadV0VNHZDvO+c9nAFQyCSPCLz/G/XvEtSvswTt7dsUdfLUTG45gT8AQIKAbEFArNuWblVfqzpz1Bv2p2EAMLigoTcJPDFy2nhlMESIr/ML4863RkzD7F1TWVu/DE4wbBZHlvuQafLZcViHlMk34x2iqyvOnJiP/UArGE8qoK/PteBd4ffUBpBZLVPaFIWRXFZ0piDdM9641a6gvWTPGYHTHveWkPNi4eA5cls/bBwDJ+W+Nf74KSNfK/Ow9/VwhRW7WnVtE9GYUex4DLk0r4/0a6lri51TXvQq87EW10ua9d9BKPs2zLAmQw79DqxGXz56jLF0vdA== 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=CG53rVHwL+ctx7M8HbkgG4gtY2fbxU7d7vLu1lWvgEY=; b=DBE16i+dKUeMz7qVsSi/ZOL7jDzGDx7korVhkyob57G1dpLc8jPKTLyFl2Mq5s/B8O09L0g4gcCgfM3ICw22+iBPRqVgtQ4JrM8dgX6pML5UJ/Y572mi9CxS92YDeVNruSwKrlmBFU/+mhv+fohqyibqJUJjS5xEuu/VZqzDJuk= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:04 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:04 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 03/13] Rewrite abi-note.S in C. Date: Fri, 15 May 2020 15:40:47 +0100 Message-Id: <6fbbbbbca662497f180ea5356d50a4f16a3b5716.1589552054.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:04 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b18c1321-ca72-4f9d-8935-08d7f8de02b3 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|DB7PR08MB3449: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: wFkG5Do+FzwzyTLG0XOuy6sE0GCGV++oC04w2chIDBX45mdl4MKgOrVnXRfEuoQI626S//bvj6pm2UDxoaaM31KN8HKpZHOKv21ZcqzDlgrA0jJId+9xfP/7EAm42PbhYE5/j2wL8SoUy7ChjYPllk6ccKvszZ1DDtl4YD2QJt8RsBrT15tRFsL6sFM9YFl7+gpqEDRuLbN9uu8iPCq6F9LmSdotpZjRdm5Q+Y+JVHKNgJiGA6NKy2PnN4bc5DBLcRRvsEHJSkHdkU68x3jyeCK84FIi/gPXz+FLN4GgDGRL6entTLJ4xiIvRb27dsN2DrVSiy6NJjmOkuO6wdd3uOFhSOvjTsirZHzDylirq/MsFHJO99395BP+tXa/cuv1Zm1C/eAUAZkzPqV8ZQ9R/3H41gDrfjh4hmski2+nYJIKIRGHkUqnfFIWxrD1Ft0ZDmmnYumLWoIcK43+T4sMFqytJEgDx9jpv6ddvp7hhES+i94rLE8eNsFxisPJmn8IImOD4nxnFGU3PFLBn786mBuS2nPDdAW98CnzsJBiRVg= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bFYX3uDras0Vd6oMnpoISNpUACbAhlGfmyIetbpDY2PANB7FgbfOV9xxLl7HMpV1Ao/0NHKu23Z42OFxXenFAS11Hfek9oZjXr+d3BVnTrqFJVUXxImk+nPNYKXwBC+LfQEvesFfsi1F385mBZCNVfwru3fpAUaLooI1q2nzoDWBDjrRfSElcegIcrOl7jXxErf9R344FXvWTD7CValyZ3qQW1lS0h6AzGZWqd3w3TE6/nIOPFGUU3Paeh/Odf6ANRa5VyYtMi8qZsVOp3r4j1b7EUxIOExqO2IDGC8hMa7ClT7LtCrEVdF06C6Qda1duxKk3jyPKDny7QfTirmLcOgXePved3SkiDHhW6tkOfTNdAALG+/cpVUntsgoqMX723QKFx4ZI54L2abi/O17g972BF1NX4pTNkgzNHSKmfdCify8CFQ7rRHTznrnNjCGutNHRpQw6pbkBw9BET8WjjBuMm5LtAIuKN9KHuVh6RC66tajRFNzmmY3590SGWbk X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT037.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)(396003)(136003)(376002)(346002)(39860400002)(46966005)(6486002)(478600001)(2906002)(44832011)(356005)(186003)(16526019)(86362001)(26005)(6666004)(36756003)(8676002)(6916009)(6506007)(5660300002)(69590400007)(47076004)(8936002)(82310400002)(70206006)(82740400003)(70586007)(81166007)(336012)(316002)(6512007)(956004)(2616005)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8c485dbf-40fd-4a6e-5b70-08d7f8ddfebf X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kUJSenISbHGyxsJ2ZT6z0W6ZElskqIDXDQg2GSMHZKgNmJaZTheFc8wHbQ/8zCmcvsP/tQOs8RdBfOzkWU76ekRe33jQPmuAQAmO+vk7+vm4gjgL/pn/tmcwClH2XoIRyXkgHeiFohOvOb9xMadNR6mDwBKUCLX3Y4JAAP0/DvBOrgZoi823PSsQPC2n4daVznCpEmZ256ooClGu/GyugTbIP2a7RDce7Xew1V92B3qsXh8BijYn5pw91RarNMTgKcHungLNzODVT3PZrJRO/krcMgZSGUP7lbW3LA6ewRuG0ygqga8jwbZWv2rR4toysIfXkzyCHrcbSuTpbvaJ/C0cWHdfe2rVQ0viq7PpQPCYQsYpilP70ubyW2qV/4i2MvdUc/LlfKyxvBztyWNyP4ytM6+GNJcfBWhGKQGnOqqudhs/MFg9bYn6nCsnCnevFeeZZT/HUExq4EYc7IJD3sremfX4Hr1BCvCg8DqscmxrNAf1BgPa6/6Q2V6mmGOdUY28UuBFiNmubUuQ7faQn3NWoJfjbtZyn5kM/HPDUdH2oojhh1nvsDTGLV2xKsK8uDi6MO1hWCVPkx3lwzZeBg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:10.7903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b18c1321-ca72-4f9d-8935-08d7f8de02b3 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: DB7PR08MB3449 X-Spam-Status: No, score=-19.6 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-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" Using C code allows the compiler to add target specific object file markings based on CFLAGS. The arm specific abi-note.S is removed and similar object file fix up will be avoided on AArch64 with standard branch-prtection. --- csu/{abi-note.S => abi-note.c} | 28 ++++++++++++++++++---------- sysdeps/arm/abi-note.S | 8 -------- 2 files changed, 18 insertions(+), 18 deletions(-) rename csu/{abi-note.S => abi-note.c} (88%) delete mode 100644 sysdeps/arm/abi-note.S diff --git a/csu/abi-note.S b/csu/abi-note.c similarity index 88% rename from csu/abi-note.S rename to csu/abi-note.c index 2b4b5f8824..cd45f17345 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.c @@ -53,6 +53,7 @@ offset length contents identify the earliest release of that OS that supports this ABI. See abi-tags (top level) for details. */ +#include #include #include /* OS-specific ABI tag value */ @@ -60,13 +61,20 @@ offset length contents name begins with `.note' and creates a PT_NOTE program header entry pointing at it. */ - .section ".note.ABI-tag", "a" - .p2align 2 - .long 1f - 0f /* name length */ - .long 3f - 2f /* data length */ - .long 1 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: .p2align 2 -2: .long __ABI_TAG_OS /* note data: the ABI tag */ - .long __ABI_TAG_VERSION -3: .p2align 2 /* pad out section */ +/* Note: Custom type is used as ElfW(Nhdr) is wrong on 64 bit targets. */ + +__attribute__ ((used, aligned (4), section (".note.ABI-tag"))) +static const struct +{ + int32_t namesz; + int32_t descsz; + int32_t type; + char name[4]; + int32_t desc[4]; +} __abi_tag = { + 4, + 16, + 1, + "GNU", + { __ABI_TAG_OS, __ABI_TAG_VERSION } +}; diff --git a/sysdeps/arm/abi-note.S b/sysdeps/arm/abi-note.S deleted file mode 100644 index 07bd4c4619..0000000000 --- a/sysdeps/arm/abi-note.S +++ /dev/null @@ -1,8 +0,0 @@ -/* Tag_ABI_align8_preserved: This code preserves 8-byte - alignment in any callee. */ - .eabi_attribute 25, 1 -/* Tag_ABI_align8_needed: This code may require 8-byte alignment from - the caller. */ - .eabi_attribute 24, 1 - -#include From patchwork Fri May 15 14:40: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: 39261 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 6CF2639858B3; Fri, 15 May 2020 14:41:27 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70]) by sourceware.org (Postfix) with ESMTPS id 0D0D3398404F for ; Fri, 15 May 2020 14:41:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0D0D3398404F 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=iZh5KL8Go1oj+k9t8KzDO6b+0S5YUJTizL+ZLniEr7k=; b=nT4mUA8T7dc/2fuqUiVikOGTrn3Eh14DP2HKvrYwou4awjGpaS3PP0bFQSEdoXxALci0KS1YSGvAJWw8H/leCIh9SNLZfQOMJaF5NoTIhqlAtZrwIK5xmL+lh9Mcx7x4rKbs7NUYgHb9DA8CVAsnIYempScsWknhWfMUtrEhfZ0= Received: from DB6PR0601CA0001.eurprd06.prod.outlook.com (2603:10a6:4:7b::11) by VI1PR0801MB2125.eurprd08.prod.outlook.com (2603:10a6:800:5b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:11 +0000 Received: from DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:7b:cafe::2c) by DB6PR0601CA0001.outlook.office365.com (2603:10a6:4:7b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 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 DB5EUR03FT043.mail.protection.outlook.com (10.152.20.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 Received: ("Tessian outbound 567b75aed2b9:v54"); Fri, 15 May 2020 14:41:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5b272e464954e71a X-CR-MTA-TID: 64aa7808 Received: from 273b603f9dba.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F24D3700-04C4-4BD5-AD4F-6200A079A45C.1; Fri, 15 May 2020 14:41:05 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 273b603f9dba.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ydzzf9J7EZWYMpDXA/Svbhnlu7LCf4eSWiYbpyQCYyXIx+qjxxCDRUHo7XlqJ3MzwuxNADYd+UF405bstnrJS6WdPMUfZsca0R8KNNrvn5m34hnHYmmtQHYGGIAUwSdVUHpNZenVB0mU1pFIguOChtWTMm8UcChq1As86hrAy3TWvw0wjeGPkjJ4+UyoqxEy/99UmGXJt18u2wxxVpiBs90/zH1QCI5cw4PEIXSsLGInUP9QIXScaKmNh6yLoTG2CzeIRsQzsGMYQ0K5JmtiwY4dTmDbKtsHA2MHpT/7ORyf2LeURaWQoo5ydecp7Js/xvfc6te0cwgtWW9XXIBJ5g== 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=iZh5KL8Go1oj+k9t8KzDO6b+0S5YUJTizL+ZLniEr7k=; b=Ppyn9cAbTcoKBa3Ag2FLrBmcHto8WEN3oxjFpzTjtStXUwshcQ/F1X53eYMIoFou7iTLAxu0MURKLlCD39CeB58sZaKbbvamKnAwB9vsfMY2Y696UJIRPDB488zMCZS/nVhO3Q573mAyw88rmiXZZvTclPH/DGmBjg4/AX5VZpvpCdZlWvXSS+tB2JHs+Zt1xYeHDxMdgM/NOYuVjHxaKXWdykLE1X4CwwMqw7uoJptau/+U2tlzx0gW7icHt9k4q2KaI69QcORv9nmhT69wBkcjesU0XW2dVimLM7LMMsP4LHLC6mcLM4esw904jfMfokstKr8ScBYGViHGrIbC8A== 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=iZh5KL8Go1oj+k9t8KzDO6b+0S5YUJTizL+ZLniEr7k=; b=nT4mUA8T7dc/2fuqUiVikOGTrn3Eh14DP2HKvrYwou4awjGpaS3PP0bFQSEdoXxALci0KS1YSGvAJWw8H/leCIh9SNLZfQOMJaF5NoTIhqlAtZrwIK5xmL+lh9Mcx7x4rKbs7NUYgHb9DA8CVAsnIYempScsWknhWfMUtrEhfZ0= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:04 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:04 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 04/13] aarch64: configure test for BTI support Date: Fri, 15 May 2020 15:40:48 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:04 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c25e1f24-9727-4ecd-9f15-08d7f8de0301 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|VI1PR0801MB2125: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: vruBVW2P6kDoS1rYLNBUxHZ03q2yQ0FPPVYS6GplZDu0jD3taor331jY8XR1bAzGjO9FoJ12qAIOGFJ2pmhB7dDgyO/sHMnHh6sspaQeftMJH8qVgqT7gBnd1745YiwIumJnrbvrgavz203hm9ZXliBYL9tiWXoInQvbx2ziTc7yz2i7i+qgO7ozAwWDzZELMQldz7saeEs4p3/rJvsvxR1k3WCTmuKynrBlKNzEOcIPCZO/ZaP+uf9g9XueBUehSncAEOrSFrYQh+QAmIYPO/A6AXzvoVftncVzU8Ty8TLvzgH9fmCzxHzZ69m9v49sqkNvvHmzth4WZ6kaGjFdHEf9+0ulUzs//3Wco+1PjbJxlCk87a6gh8EWpIZoNWjfylTLjTnWESgdLyU2Vcd/qoht7T6gVvOEpsL3zNZ2nBdkHg9yoHXSplrwhWdDRhNuXlF0sVdW696lkC90B3wy1E55w8Eb1D3p88dcBbYb2JQiYJa5vYaq+WI2i/+KZHUgtPKdPaMlRgGHYQDPe7YcPadSbDgMKNCd8To8mbcadCQ= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: beuHMQOKGxY2qgVz+RziSSsxYbpma/lyUMA6ENML2V/BMp56ln57RiTWgoV90ZhDRSYkJRYyhePFACExFuinGX4XQ0jYEFt8zmLqIaVMDpbiNVQVCpmDTISiV4dz4wCM1uGCXORAuAwDyUXfXwNjsvs0/ni7qol6bJ19EFPGP6LBiDu0akigu+aY1CwI7fO5TuAfHjv4cwqCOFKauZ/uWDtxJqVPV4rrWGNAgsvXzfd0n+/CBorbsfgRSEVJY9vuaNG7uEyTYOK8r41V29stREIs5QVhPQf/THs5nxchV2f3n5VPC0qv0HxB7t+/aIkkN2D9/lbpJJRekZlZp8Vld8EZV7c8DR/JojSQbsNsq1NOQtjV9K323Q+DUYdO28c8bws2nlJrc1JeUyeb2Y95FjjlKsdCzezTsVUK9DvoliPRUmOr4/6W89yiLWGzLz2SUuchYCFPuJr95S0EZXYFUAX8q9pyvmUdsYbURW3Q30uUjvsQ/6e9Q6dFwh4WWEHR X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT043.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)(346002)(39860400002)(136003)(396003)(376002)(46966005)(956004)(2616005)(8936002)(336012)(47076004)(82740400003)(81166007)(6486002)(6512007)(316002)(44832011)(6916009)(478600001)(69590400007)(86362001)(8676002)(70586007)(36756003)(70206006)(82310400002)(6666004)(2906002)(26005)(356005)(186003)(16526019)(6506007)(5660300002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 429088f3-f7e8-40c1-5b6d-08d7f8ddfefc X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rMyMtyX1dyWnNN9VGAN/Bkr70PYKKvu9QFkcojXqpEB3jELoAUsQF5Wwy5dA9ukqVn9S5m5+1fYhaQ1FA22Y+91Nnf1FIIdkODp5vD4Qo0md/Q+TI5N1tK4KCkKu2XDoERaUrmsC3JNgQ6arkYvgrBiOxN1+Fd6LbtQJr1qCge6OkWryLHAKbTieRHQMWeocgaKKmvVE89mmSOWgOQF4f58wirTh/UMKXHiJIpyPXKO2vqBJCLT0S0uNoHMDhAVbqHhZOw5XL1IbPxVdlcEoNAbq2iKHEmxKyETLq1TZUSb8wLBGTT6rY3qkMyihO/k/hvi+f4wfOcJtt5X/GB4FHcsxTAsMev7MffaXoPJJQSqWakBTXRNOM+bIFw/yU9Llz4wbwEj/bFupOEhzW75QqcaMRF+KTD/NnxbhnW4K4qrTJuDPlneCqXe9HQTsERXiicu43CdhrqmXcOeRXvqNgbB9Au72aN3p74/KXad5OBvkwUTUQ9PYAW8ZUvrmDu3+HmkPCm+LIeAkSdECDPQvzThQn5LFY5I11paZiD9g8eS3CJB0rEIe7nrBTnZyKAzQ0OH8KmqMNB8CVr67ZSw2cQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:11.3010 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c25e1f24-9727-4ecd-9f15-08d7f8de0301 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: VI1PR0801MB2125 X-Spam-Status: No, score=-19.6 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-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" Check BTI support in the compiler and linker. The check also requires READELF that understands the BTI GNU property note. It is expected to succeed with gcc >=gcc-9 configured with --enable-standard-branch-protection and binutils >=binutils-2.33. Reviewed-by: Adhemerval Zanella --- config.h.in | 3 +++ sysdeps/aarch64/configure | 42 ++++++++++++++++++++++++++++++++++++ sysdeps/aarch64/configure.ac | 19 ++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/config.h.in b/config.h.in index dea43df438..506b0c416c 100644 --- a/config.h.in +++ b/config.h.in @@ -109,6 +109,9 @@ /* AArch64 big endian ABI */ #undef HAVE_AARCH64_BE +/* AArch64 BTI support enabled. */ +#undef HAVE_AARCH64_BTI + /* C-SKY ABI version. */ #undef CSKYABI diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 5bd355a691..70477a7fa5 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -172,3 +172,45 @@ else config_vars="$config_vars default-abi = lp64" fi + +# Only consider BTI supported if -mbranch-protection=bti is +# on by default in the compiler and the linker produces +# binaries with GNU property notes in PT_GNU_PROPERTY segment. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BTI support" >&5 +$as_echo_n "checking for BTI support... " >&6; } +if ${libc_cv_aarch64_bti+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && { ac_try='$READELF -lW conftest.so | grep -q GNU_PROPERTY' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && { ac_try='$READELF -nW conftest.so | grep -q "NT_GNU_PROPERTY_TYPE_0.*AArch64 feature:.* BTI"' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_bti=yes + fi + rm -rf conftest.* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_bti" >&5 +$as_echo "$libc_cv_aarch64_bti" >&6; } +if test $libc_cv_aarch64_bti = yes; then + $as_echo "#define HAVE_AARCH64_BTI 1" >>confdefs.h + +fi diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 7851dd4dac..798f494740 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -20,3 +20,22 @@ if test $libc_cv_aarch64_be = yes; then else LIBC_CONFIG_VAR([default-abi], [lp64]) fi + +# Only consider BTI supported if -mbranch-protection=bti is +# on by default in the compiler and the linker produces +# binaries with GNU property notes in PT_GNU_PROPERTY segment. +AC_CACHE_CHECK([for BTI support], [libc_cv_aarch64_bti], [dnl + cat > conftest.c < X-Patchwork-Id: 39265 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 53AEE398582C; Fri, 15 May 2020 14:41:34 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by sourceware.org (Postfix) with ESMTPS id DDC1E398580B for ; Fri, 15 May 2020 14:41:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDC1E398580B 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=zP0gITlhrgTe2JtXUSwYKQypQfWlgnGWZA2iFY5Hbgs=; b=2B40qFVYo/1s07Z5FAETGTtl2bnTx8ANUgont0MuLl4LLBZSEontU3HRGJgjJvKqybGUF1i19E4N/wkdhbSl/goHIdHzpktj5Maj5ei9WRcSiSMGHQ31tKPzmafKIqa0MevofOJ96/2PTY7OBD/2wQy2ZnNnDuNLJpSXRTTH4Kg= Received: from DB6P193CA0021.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::31) by DBBPR08MB5548.eurprd08.prod.outlook.com (2603:10a6:10:c1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Fri, 15 May 2020 14:41:12 +0000 Received: from DB5EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::91) by DB6P193CA0021.outlook.office365.com (2603:10a6:6:29::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Fri, 15 May 2020 14:41:11 +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 DB5EUR03FT056.mail.protection.outlook.com (10.152.21.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Fri, 15 May 2020 14:41:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 98000d0552f80a64 X-CR-MTA-TID: 64aa7808 Received: from fdf193f3d1eb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 630E041B-634A-4383-A79F-1216F959249D.1; Fri, 15 May 2020 14:41:06 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fdf193f3d1eb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZguSxKBXg+31Fzc1b2jf6fDM1MCkvGUf7f+qRuC+t9Le68OyCRxcxvutov9aNmRLom7gPbJV13kil06f2MpdCM2JPMGEN94qmr30eqvq+Sl7WEVX1+ILS7kjM/gQeRZMMITkLsc3ZBsTd4o5KCAqiPhGiev/M9PfqqZ/jaWXEyuvQm1tiSfHQX91Q/4hiAn5MBMa5VTZWpJ+HpEjhdDCwo4kw+6ZqxDeohlWrBT8qBvtyZkaRIsUWawxHRLf6tpsTBsIl8Ej2+tHPouZfbSeU64hyiV7FapSJSlPSNACxRMqL7o46yCWeAC7bmI+Kueu6q1kj44f9/vAchqmG+ih+A== 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=zP0gITlhrgTe2JtXUSwYKQypQfWlgnGWZA2iFY5Hbgs=; b=CbPKgeYn4oKswtUjkImiq20aHeAuVKSLQy8XxGfSbA8aIQTrFkdMy0wJ2W7CYSIQhYKSrIHan4V/zN6/fIuDFXA4NHwgYpb2Eo7Jw+PZoBFPuHG1sxFsP6s5Ztl2rHniukWqyRgX9LSV8WW28H46gSEbGO/hcax/PbqOnuTZMBrd0HSNY0ZNYU++Pl5IPuxf9qM+94XEaAfkEPvyzNwgXL+NvQkFwOSDhc1QTK76wlrfAk43V8XWXM1CkCbicDRAIkEc+LiaqA9lqhWwehXyD5DBhxIpoiAeuQSGLjRDwQP/ZcQMA3yem8hmdHqpTWgR+SoxR3XUBhBM+Kb9cGqysg== 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=zP0gITlhrgTe2JtXUSwYKQypQfWlgnGWZA2iFY5Hbgs=; b=2B40qFVYo/1s07Z5FAETGTtl2bnTx8ANUgont0MuLl4LLBZSEontU3HRGJgjJvKqybGUF1i19E4N/wkdhbSl/goHIdHzpktj5Maj5ei9WRcSiSMGHQ31tKPzmafKIqa0MevofOJ96/2PTY7OBD/2wQy2ZnNnDuNLJpSXRTTH4Kg= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:05 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:05 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 05/13] aarch64: Add BTI support to assembly files Date: Fri, 15 May 2020 15:40:49 +0100 Message-Id: <64e9a422a1ef370334b90a591229f7f4e293bf8c.1589552054.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:04 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c2666207-c4ef-4f24-7cec-08d7f8de036b X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM6PR08MB3528:|DBBPR08MB5548: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pY9kw2EkTXFARZUSkrBmE3ERkYhjI9cuoBlIHPiJOwKsOfy+N6Y8ZqiN5KJ7vQsBiD6Uz778chGdFkZQgsI0KAlkh5VLSGHvT84dx0y2W9BPi5Ql+7QPXMBKYmatssA7wA0FxRj7kiuuoVDCT4Sv//SBfodyqNiL2GdPxd8i/w+zCulr2FKWRD6oNXLFmYM6Fx8+BFQl4vOrI5h7mXHFXe9CWVH2SFeEXjS9VRfXzGCSzgbLIjn3jSh7LkOOAjhMfrOx6DrRaFsddjkfU0X7FA+v4eTomJcAWwh/4vdg/9IWI241Elqnre+mtL6Qaq2t4KEPTzfq6TIYDaBPqH46nllXrCJF05CIohE8KLOK6rzSg+E8ozJ/7BZ3kgNoGnQ6bGFbdtZFexEtD2cMLC+4ZAkamZyZAiG9Diw3PXR+87X46pvzp31y7N54a9noF0/YepP+XMqBCEzN+DXzLQBDu2y8XdWUUlKATPcBQ/OKQUPsm8IhLAQCkS7wnNbbB4T5nbhXE0lzEYCXS5VfIBGRicUeVv0Px2244QyZMG5hCkM= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(4326008)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: F5tQWL37qi+13pZyO3UJdW8c7ne3ec4PbqTO7ei+GQrhyDqoWyIKwAymlotjmTI9QFrlXCC4NLkEXhy2rAxuiAwM6VW11LUqkKzEMIg+eCvk1s5JRgCx6TE/QSo9BN3PSOpsnOrdh3qCTK4ggT+z0CTJUKvyGcm9xY53YV/9JC47Hbftvdtj6gi0hO+g+ZMXeoqZgwqnsz1FUXkktkN7YXjjFgdq7iqtVqZvhJ3UNXa2oEdQpOhbEeFH3YIiZTCFO7efsePdlBbVEKRAZFNZAVxSxd7ydkcJ8+vMfVhXWPAfPpQ55tz3WIPg6Lf/QInPTwle7GAR+jrgzdUzBvO49Zn+3mDcX1Usn/7aJy+5WKyaL5ritqkOtx3srO88buUqkafPKcE9ZyeoVF6vw4dmJdvyoZooIHYjndK85NyhzBa47NcISCCfn1tUf2aG6unp3lrlzVoHU+vKmMVQ6iVwTTJReMQy4u41bZbGCK2m558Bdw4fPu7tZ5E5h2PJpgai X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT056.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)(346002)(376002)(136003)(39860400002)(396003)(46966005)(956004)(6916009)(8676002)(8936002)(6666004)(47076004)(81166007)(69590400007)(478600001)(336012)(316002)(356005)(36756003)(82310400002)(82740400003)(86362001)(16526019)(6506007)(2616005)(70586007)(5660300002)(70206006)(6486002)(4326008)(6512007)(44832011)(26005)(2906002)(186003)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: df60ef3b-cf2c-40c2-3d63-08d7f8ddff35 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ORMrtvAUio3Z7iYHH1I21117wXZxnWBu5q7Y9a+KpE3kahq7W3J3XcyQw7ThRP/RFlDnKOLGZLHseraQsP+Z63zTcWRXSwC0sYREEISY6ninNo1TUm9iqle7vglWdezv+EAXaUenYUFjwUXI6puyDjGywUSkmAUsj5MjXWpqsTjnxouduBM0KEP6j3IXwTlJ0MPpjgMnZNaeg3JfYwyyFOEsGsCkKBaQfBCRAuxQkdbZR3XKqhiKT0RCktr5Czellam3vKMXeBioQgzZxmPv9xsZpwJ73RfcFOxquRCUrquh6ATnzYkOzro+ElIv5l9b8XXSqruoJwGNZ5ZULrkVfqNYhinb8uM7Pp8CQCc4OLWi6SD+DUAwqWSRG838L+jypHTQlrd7CQuMKLKZx0DIenNqzd3gIR49J+jNQgW5tJQIee9cXp2xQTvW37x2AdclQSqO21LEIeBzK1IW0j1AJbmBVlIIopproXgtNJ6PSZcSApE2GdZo7Cea9fE+7+5a4SQPIEY5okQQVETEQo91lcHZOt0XyPPxguCcRl30p7B/UETwhmxU40Uuk796xjp7BmGwpmanIer0OHEvQJlZtg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:11.9938 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2666207-c4ef-4f24-7cec-08d7f8de036b 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: DBBPR08MB5548 X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_STOCKGEN, 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: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Sudakshina Das To enable building glibc with branch protection, assembly code needs BTI landing pads and ELF object file markings in the form of a GNU property note. The landing pads are unconditionally added to all functions that may be indirectly called. When the code segment is not mapped with PROT_BTI these instructions are nops. They are kept in the code when BTI is not supported so that the layout of performance critical code is unchanged across configurations. The GNU property notes are only added when there is support for BTI in the toolchain, because old binutils does not handle the notes right. (Does not know how to merge them nor to put them in PT_GNU_PROPERTY segment instead of PT_NOTE, and some versions of binutils emit warnings about the unknown GNU property. In such cases the produced libc binaries would not have valid ELF marking so BTI would not be enabled.) Note: functions using ENTRY or ENTRY_ALIGN now start with an additional BTI c, so alignment of the following code changes, but ENTRY_ALIGN_AND_PAD was fixed so there is no change to the existing code layout. Some string functions may need to be tuned for optimal performance after this commit. Co-authored-by: Szabolcs Nagy Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/crti.S | 2 ++ sysdeps/aarch64/crtn.S | 2 ++ sysdeps/aarch64/dl-tlsdesc.S | 3 +++ sysdeps/aarch64/dl-trampoline.S | 2 ++ sysdeps/aarch64/start.S | 1 + sysdeps/aarch64/sysdep.h | 34 ++++++++++++++++++++++++++++++++- 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index 1728eac37a..c346bcad72 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,6 +75,7 @@ call_weak_fn: .hidden _init .type _init, %function _init: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -89,5 +90,6 @@ _init: .hidden _fini .type _fini, %function _fini: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S index c3e97cc449..0c1ef112c2 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -37,6 +37,8 @@ /* crtn.S puts function epilogues in the .init and .fini sections corresponding to the prologues in crti.S. */ +#include + .section .init,"ax",%progbits ldp x29, x30, [sp], 16 RET diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 557ad1d505..9d96c8632a 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -74,6 +74,7 @@ cfi_startproc .align 2 _dl_tlsdesc_return: + BTI_C DELOUSE (0) ldr PTR_REG (0), [x0, #PTR_SIZE] RET @@ -95,6 +96,7 @@ _dl_tlsdesc_return: cfi_startproc .align 2 _dl_tlsdesc_undefweak: + BTI_C str x1, [sp, #-16]! cfi_adjust_cfa_offset (16) DELOUSE (0) @@ -142,6 +144,7 @@ _dl_tlsdesc_undefweak: cfi_startproc .align 2 _dl_tlsdesc_dynamic: + BTI_C DELOUSE (0) /* Save just enough registers to support fast path, if we fall diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 94e965c096..2cbfa81434 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -35,6 +35,7 @@ cfi_startproc .align 2 _dl_runtime_resolve: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -126,6 +127,7 @@ _dl_runtime_resolve: cfi_startproc .align 2 _dl_runtime_profile: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index d96cf57e2d..75393e1c18 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -46,6 +46,7 @@ .globl _start .type _start,#function _start: + BTI_C /* Create an initial frame with 0 LR and FP */ mov x29, #0 mov x30, #0 diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 604c489170..086fc84b53 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -41,12 +41,42 @@ #define ASM_SIZE_DIRECTIVE(name) .size name,.-name +/* Branch Target Identitication support. */ +#define BTI_C hint 34 +#define BTI_J hint 36 + +/* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ +#define FEATURE_1_AND 0xc0000000 +#define FEATURE_1_BTI 1 +#define FEATURE_1_PAC 2 + +/* Add a NT_GNU_PROPERTY_TYPE_0 note. */ +#define GNU_PROPERTY(type, value) \ + .section .note.gnu.property, "a"; \ + .p2align 3; \ + .word 4; \ + .word 16; \ + .word 5; \ + .asciz "GNU"; \ + .word type; \ + .word 4; \ + .word value; \ + .word 0; \ + .text + +/* Add GNU property note with the supported features to all asm code + where sysdep.h is included. */ +#if defined HAVE_AARCH64_BTI +GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) +#endif + /* Define an entry point visible from C. */ #define ENTRY(name) \ .globl C_SYMBOL_NAME(name); \ .type C_SYMBOL_NAME(name),%function; \ .align 4; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT @@ -56,6 +86,7 @@ .type C_SYMBOL_NAME(name),%function; \ .p2align align; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT @@ -68,10 +99,11 @@ .globl C_SYMBOL_NAME(name); \ .type C_SYMBOL_NAME(name),%function; \ .p2align align; \ - .rep padding; \ + .rep padding - 1; /* -1 for bti c. */ \ nop; \ .endr; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT From patchwork Fri May 15 14:40:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39260 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 A298D3985892; Fri, 15 May 2020 14:41:24 +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-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by sourceware.org (Postfix) with ESMTPS id E3009398580C for ; Fri, 15 May 2020 14:41:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3009398580C 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=eLWElF3mAZy1E7ngrHBqKVIH9XhWqMLOAuLRud8Zgog=; b=cOE0A4t6oznAdRaL+CnNJSOQSUPSwkr8vy0h3Bsomy+axHMW0p/KtKkNQIQEXoH/TTaDkyKDGbKTOH3y9I8g9EKmQsiTdowJMZW/V/4g6kesFHVGGeGRxkv8Vu7LnOPgqxEQuzZEN+iO37XR7jokwmGlcaeb0IBARbKZKyxPOeU= Received: from AM0PR06CA0099.eurprd06.prod.outlook.com (2603:10a6:208:fa::40) by AM0PR08MB3075.eurprd08.prod.outlook.com (2603:10a6:208:5a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:12 +0000 Received: from AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:fa:cafe::25) by AM0PR06CA0099.outlook.office365.com (2603:10a6:208:fa::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:12 +0000 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 AM5EUR03FT060.mail.protection.outlook.com (10.152.16.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:11 +0000 Received: ("Tessian outbound 11763d234d54:v54"); Fri, 15 May 2020 14:41:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a8f9b4003b5b2b89 X-CR-MTA-TID: 64aa7808 Received: from 2956e9438a4b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 760C76E8-9437-41C8-B727-B11E7E838ECC.1; Fri, 15 May 2020 14:41:06 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2956e9438a4b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WOUDWOG/Bisr0lE2wS+gK6BY9KM/Bt1r4Kgk3c+nAkhH4QcjDb7s/hqY8SHmA4FPydiy91ACs7pvOIulKxL7QBaGoIqFOey5SMs/AFMBWA2zmbvFIRqh3KwyaPp2rv15lE+f40Mj6JW4XszS0bH6kWXr2Q2IGy+p5NCQ1jBE9Zxpz98nPP47qSNv0tllRWQWwYs+a2Ji9QzXM5PS82/SZ+JwhSht+/IFBMSjYaIex46NpfsD5qd9UpBHJWGaWQ7yHVz6mV99nQTGN8xwfOi4MLVJjM6vug4B/ip4JKTL7tmau9twg1qFKeda6ogrXTrGrqQ/B+lurmrcAjt4nEwpkQ== 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=eLWElF3mAZy1E7ngrHBqKVIH9XhWqMLOAuLRud8Zgog=; b=OG2tP9MBsENNw6wud6sbZgINmTJ4N6dyQ+19n2gcf3czgm3v9vyojBy7ExKgqtYAL/DOIrQ4MKcNMLuBTjWtDu+OtAhtuswzI5d8+vDN7+nzWUpCe9yVOvpOxhLmGG0YdgkVtvP7EFJ4cp96U0lmCpQZj/c0DHKeY9vYHYDQFbGqZTAqB2HMf2lsLSELbyxCVeQ4W2W4Z9sK75FfowE8JEEVSB85oD4ADJllt1D5LH+MQFIFz42EMfX0m5RacmG+a15OIAHvt3HwukGshHmlfb93kZZgHzn8RiOdY3fHY4n+uCmoW4Xq4EMbFcoZVjvqJQP/MH5egt2nPljoUh9o0Q== 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=eLWElF3mAZy1E7ngrHBqKVIH9XhWqMLOAuLRud8Zgog=; b=cOE0A4t6oznAdRaL+CnNJSOQSUPSwkr8vy0h3Bsomy+axHMW0p/KtKkNQIQEXoH/TTaDkyKDGbKTOH3y9I8g9EKmQsiTdowJMZW/V/4g6kesFHVGGeGRxkv8Vu7LnOPgqxEQuzZEN+iO37XR7jokwmGlcaeb0IBARbKZKyxPOeU= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:05 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:05 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 06/13] aarch64: Rename place holder .S files to .c Date: Fri, 15 May 2020 15:40:50 +0100 Message-Id: <46ea30ed49a7ea6e14ba97ee82efe939035c7944.1589552054.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:05 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5ac07b1e-b77d-4e25-845a-08d7f8de0371 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM0PR08MB3075: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +Ty3LVAqRZIzV5tCSyQB5fB8YE5px1Z+de2m1JPzHpqP680xvvx23XOBIHdqoe0AAX3VWSudLjpyIcj16T8IhcGRsx6BGgo85xBczcB8fNTS1iDV416ihTd2tScNXun0yxIGPd9il1AaBlldLXe2P8tQOJqvmM4ZFXMd+DnJGSbpKLPdfm/UxLUKHLNAx965X1DZ5DHA1QLURX6mXSuuB+NmBpw5RoBO9fQVE6vuAtQK4EcVyVo8xNiXLA5ukVSv12wFE8Agc+uOwhpi0SZmCoBjOi81qPjfBf5KeWhMUDOLzWJvs0nhtq371TeU0JE/AMmcWZ6+y4b+s0T1/F69hzmh+VvekQzBj0KaIV9d3jemraJfv9Ym8JCKaYO5dcFrT+ODIZF+J+tS6Dlfs2NCQDqaXrwNHI4gAD1xm9wAzNyRt0GKNbfqi5SH34/KWZY55ozXg7AZ3M57phnrCy18BGMYUnbs1DwZMAuMnQMIW1egq05qNGZwCuMDAcy3l5AgrQvfpSiFmTEoQHNvfVNNl1OGVoXY0rYvTcqCIAhad/4jAD+JX8vESPcZ189skIAp 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dNqu3Xok+uqKC+6FyhibxvLXL7lRCBSaXxpQ1zneVMPDAUtCeAP5z4H8t2WYP1iVoJ7rrMujC84LQ42Jmn/PE0tkGEQV3JWgESPgIg7Q6giO9oBxhiFcAsi8ta1LYgXihWCsW1oJcy0L31bpeVf3ha6vwgERv7vdvrJQatiyRZXDrsy0IG188/V70jk6rpE84SCc9tQVKZIA+TlHNkR0rzM8qjl7pQvnOJLJodfPvfhDbmPxLaR++3s27cnXm6xZp91xp3jzQRUOMYVwvHuin9bWBJnf1oGI+W2ocGf6A8y3buV8uStDhAglg4WNrVGnbMAGWIpPfslUrarqCWhI9X5+Cb8nb+zy5n35JvL/Mg9KUEOmsb229BGC2Rt5qjkvSvj0d4cT6vrcvQ961hmWb7XBkifCf67S+g9WPTqv96loNsh9sQtEm3/YaYuberEngmkhXJs9M3+rx5iOpGX6OZlIclCC0lIG3jvSvYrpw44ahJclZwO81WIlKCxDtR/T X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT060.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)(39860400002)(346002)(136003)(376002)(396003)(46966005)(47076004)(6512007)(69590400007)(478600001)(6486002)(8936002)(86362001)(82310400002)(16526019)(36906005)(316002)(2906002)(186003)(8676002)(6666004)(70586007)(36756003)(70206006)(44832011)(26005)(82740400003)(5660300002)(2616005)(956004)(356005)(81166007)(6506007)(6916009)(336012)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 5b9329e6-5193-4d82-4660-08d7f8ddff6e X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xJOZ4DKbR/wiPgCYdJS24BfBmzS/yl18gf8WhNPQ2S3b2mDY37lMF2aWLi0fTyd4m9cJTupndaUq7lO1SKodd3bHPOOZVcL/fbwwY04olAe2RRxJ4z3e3W/atl8Pz8AyUgF2hDXiB6jQ97F7P/YWSp872z8D8N3k11fDZT1cAJtd2sHL4WrWfjx4lJ0yuUqzAlMLhGXhJqrtld6PhiILu99H1AHXPB46fg60QJfctQl8LTSjFMPzWrVB/nZgNlMMyiGEEz7r4MJ5dpGaEQn4uFcW+9rN/TtDYL9KxRpWC/PKwqEsj869BAVShbDxvlXVg8IabY5w1a2D1QziWgD4fqEFWj0pq4TActh7AMkG4MFJsDzj4QXt8UYxRT3MbnRY2gxobuSNtHz+lQLStrXxVXbi+Db6qt2xWyGRDlwi+uiyQr3etoVC1szE6dOVXwmNrCBXTTnEcaznAU9RxqHAX8FZZy0uNMKyGra2lEZsWskja0JTbXZ5cKD8Pr3kZOhoU3GKXiRNh8E3/9A1v1AKobVEQFk5Gxr/zJxFQOGUtA9BKRHmGYAmjEVJPP07ofzD9jQt8TRX2DT09XMrLu3a9v+rhOOqDohH3xaanx34Ye0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:11.9834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ac07b1e-b77d-4e25-845a-08d7f8de0371 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: AM0PR08MB3075 X-Spam-Status: No, score=-19.6 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-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" The compiler can add required elf markings based on CFLAGS but the assembler cannot, so using C code for empty files creates less of a maintenance problem. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} | 0 sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} | 0 sysdeps/aarch64/{memmove.S => memmove.c} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} (100%) rename sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} (100%) rename sysdeps/aarch64/{memmove.S => memmove.c} (100%) diff --git a/sysdeps/aarch64/bsd-_setjmp.S b/sysdeps/aarch64/bsd-_setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-_setjmp.S rename to sysdeps/aarch64/bsd-_setjmp.c diff --git a/sysdeps/aarch64/bsd-setjmp.S b/sysdeps/aarch64/bsd-setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-setjmp.S rename to sysdeps/aarch64/bsd-setjmp.c diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.c similarity index 100% rename from sysdeps/aarch64/memmove.S rename to sysdeps/aarch64/memmove.c From patchwork Fri May 15 14:40:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39263 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 2C3AE3985834; Fri, 15 May 2020 14:41:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10042.outbound.protection.outlook.com [40.107.1.42]) by sourceware.org (Postfix) with ESMTPS id E8A91398580E for ; Fri, 15 May 2020 14:41:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E8A91398580E 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=1B/jWlnGw6SE/g7p1Ew3WX2EXXdb7IFvovtKhBA1zHE=; b=9BO6fUHiOVWioWgdjH7pfoyxLeEoTDcZoJWNwyMIKrT5CnYT1/PwG7wHBix7WVMU8Ja/vAXyzGCJ5oCJPwMKibNeLtIatvGjY5B/8B8941LiT3CbwrJ6XEIi54CvTOqIO2w9h8eyWai1jSzMYA3XD5QAi1CQJQxa05690iNaf54= Received: from DB6PR0601CA0009.eurprd06.prod.outlook.com (2603:10a6:4:7b::19) by AM5PR0802MB2481.eurprd08.prod.outlook.com (2603:10a6:203:a0::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Fri, 15 May 2020 14:41:12 +0000 Received: from DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:7b:cafe::d) by DB6PR0601CA0009.outlook.office365.com (2603:10a6:4:7b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:12 +0000 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 DB5EUR03FT043.mail.protection.outlook.com (10.152.20.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:12 +0000 Received: ("Tessian outbound 567b75aed2b9:v54"); Fri, 15 May 2020 14:41:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 930e51733ab58232 X-CR-MTA-TID: 64aa7808 Received: from ceb467c05350.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9C39871-DB8C-4846-B1F1-F6C6A74763F6.1; Fri, 15 May 2020 14:41:06 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ceb467c05350.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lk9R5FgYBCVJYsXJtApmb+BPU/WBdLmAQxs5nCPOzLnN6XC9cEEdORsQ4AqlJHKvZCps4BqOpKJ/poDjy4xQE2dSjLwGQyazGVspu3gi2AfQCs/NlCVmxXwOKKeNFKJlyigOuFdxeQohlIlcyqGlgtrku6e21tNTryvcQRDLzxeoe3SXi82kGtLVnWc32A1WaF5Dm40cRdhMZFJP+2gOylF4ua1VYBmYsFbIX6lJR+zD8TW71vlCPw49D4hIKY01+rySmwpXN6mf6tBmiVrIxMkqQsxGkzuogKP1WCkO79zxw6sOBLQGPrXiTEHlGrc72GKS9DbfcLy+A1QjYq9oPg== 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=1B/jWlnGw6SE/g7p1Ew3WX2EXXdb7IFvovtKhBA1zHE=; b=ZUHLObRjvOxudPkhCF/TVNGsAwMQDs9I9DY7iM74mO3elsyY3T6SeEmJ6AdOy9YVErsKhvuG35Y5tEwRFzt+cYFipy80icq0fjJo3ELHHX0YfMKLgeCj5nVBAk0iQssVh2dRJdgeI3rggniWtt4Ye/ZfyV3U4HrD0dPatVAJ4Lf7SOilGBldZSVMI+8682Jx1Y+RqBcMQGcG635FccCSIdoKt0zfXh+faUR56QWjVbWNcJgFT91ytTRk3ilnbIaKK7wX/B8ns9K46Sa/aOKOsdcTJJf6+1RwG8L9G4iFYpWkDJd2NT6LtlNO+lbHbADiYqAYJPnt6OLD0DiNlupewQ== 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=1B/jWlnGw6SE/g7p1Ew3WX2EXXdb7IFvovtKhBA1zHE=; b=9BO6fUHiOVWioWgdjH7pfoyxLeEoTDcZoJWNwyMIKrT5CnYT1/PwG7wHBix7WVMU8Ja/vAXyzGCJ5oCJPwMKibNeLtIatvGjY5B/8B8941LiT3CbwrJ6XEIi54CvTOqIO2w9h8eyWai1jSzMYA3XD5QAi1CQJQxa05690iNaf54= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:06 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:06 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 07/13] aarch64: fix swapcontext for BTI Date: Fri, 15 May 2020 15:40:51 +0100 Message-Id: <219501f1211e6956aa579911eb1f49c969c9bdd0.1589552054.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:05 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 617f13ca-1176-487f-fbea-08d7f8de0399 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM5PR0802MB2481: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: F9ig+2A/6JRRFCVd1H4uEq1yBO2WAMhjem85EGop+CIxGzc2PQJ2+QKTBE/KwEb7OuzEG+nALN/2fLTknYvzTiwYpFCTEuGz1FSz+Sj7JHo4AF5YkclkKVrVUmOJ01RIkGap7ThKs8QiNui7kH2F2HzyFOBYvqec4j9gmIHVuoRctFm1tfDVXTJ1TBanl/R1zw1F838bEEa6YoIlu38NR5DwhI5ldMvblaeKv2eKy7lIRHQEZerdDpYT8v4lRIcoFv+fmAPyO33iW2X2dPWvHFpj9qeeIM94B5sAwqvDrfLcEjMyecVnHedC+VMZJdxV2ICUeX/9CCrD/lN5y1SZOVaBn7JOdQe4BvdRBvbUQyM5UKL1+hqBvMTEabScHVqMsNt8d+6wfnXA0HfTNvQt7nuGyHsA/i9llzTvciDbJBrWW/SZYizdp00m1JjYEc3Gll2oHriG4QRgBiYbSQHdarmXumN9sIdw4qOFPlXGwCafye8UvHJyIftSmI+a9NVOu9QDBOKnSuQUormNlr2hFb04EqS/8YUOoyPksxNY/hM= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dLx90xIVPhErYPM/Kxdk8ShdOeOJRjuG35dNy9YHGK1gDb3E7FZyUzS4CZXqf25OVRMMYK81PQyFC/xxMcBAVLLopDZzuHDer7p/CJ/fljQxF7nVnL42NDEeNMWUdd9Rd9EH7V+622hFUgTM4e/Eygo0C+7TQIujpMDB+2E0Cv0jzyr0HDakf0MaGLcaipkuB+1nbp19gNMbG/87oaTMz2CxvwgoLzpBwt/qudLDk815SRBUgGQv1Zm+HTaDpX1/Rb/XDdZXiS46JzdDRjFDvY8r0rneLR9qiuOPiPkqTvRWcN7t9gGK+0K26UTIrsS+2BO952fCFx/FoXgKzfjG0JcT+yhaVVFZF12U7W5eLuEoDWcOTjPCyQ10mZJMNuzBkNA6p+95CMrnJu9RFcT9SRmIR7IFO9g6DT05NwEUOs4J2mMXMFvUJVyRtpFOh+S8zFkHyl2KCOy3rz8w0yNYrfmtclGb9wv5kqdEUpOxnq4zFt4CSM6Ll6EP2YwLD/f6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT043.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)(136003)(39860400002)(396003)(346002)(376002)(46966005)(86362001)(6916009)(6486002)(69590400007)(47076004)(2906002)(36756003)(8936002)(356005)(82310400002)(70586007)(316002)(82740400003)(70206006)(81166007)(8676002)(956004)(44832011)(26005)(186003)(478600001)(336012)(16526019)(6506007)(5660300002)(6666004)(6512007)(2616005)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a35e10c8-97ec-46b4-5f57-08d7f8ddffba X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XO+mByfW7473fIFLEhU2NQQhkiDw/cJs8ISG5G3NQZVb7bRTXIVuE3fE/jA9InHSW1R8+GaPdrNno43apEHIrGb/KNh5GB79VFKhlZlM5hqYdr4yiFNlE9W7l9zOVrKZhEaG/6RKluKifOzOEvpTArJYjm4mRdjzYn1xUAg2tdtAohIXGAIdfifExYxULYVY9emjtQPs1hzrxriCiikW/l//N8jAiT0WZh6cu3nm2wNxM0z+JsyLLEMH6NR8qdqrfLMt2VsmkDO55ApwMQNgzj4K9PDK0WScai52JUejZmkwi2S2aLLDXPArcqqlSVkYZAP5B9hAfHSLq3dwfrs1iz3KwT0HvAuLWevzi12ytC2DcpUhH5eaVoa3ZJ1Q7KrgCua8bjRtVu27isGjU6DsMeXa9htwlX0sJ0Y2haec1s53LiS2TJy5u/POCFubweg2SOqhf/LGeq6LJXbysk2VRhD1PwD9+o/Ak+oZzdpvDDJri5ccA6KVpV+q1TU2DNdnciysLyAyDT0z4Eok34AImZCTqOY7ZO7WnrNKIuOyWbxHTP1yBgwCObZCNWFgpOhNtLtrPbhBs6pjEhN4IHKzOg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:12.3005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 617f13ca-1176-487f-fbea-08d7f8de0399 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: AM5PR0802MB2481 X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_STOCKGEN, 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" setcontext returns to the specified context via an indirect jump, so there should be a BTI j. In case of getcontext (and all other returns_twice functions) the compiler adds BTI j at the call site, but swapcontext is a normal c call that is currently not handled specially by the compiler. So we change swapcontext such that the saved context returns to a local address that has BTI j and then swapcontext returns to the caller via a normal RET. For this we save the original return address in the slot for x1 of the context because x1 need not be preserved by swapcontext but it is restored when the context saved by swapcontext is resumed. The alternative fix (which is done on x86) would make swapcontext special in the compiler so BTI j is emitted at call sites, on x86 there is an indirect_return attribute for this, on AArch64 we would have to use returns_twice. It was decided against because such fix may need user code updates: the attribute has to be added when swapcontext is called via a function pointer and it breaks always_inline functions with swapcontext. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S index d30c543e6f..f8c66f0ef0 100644 --- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S @@ -28,8 +28,12 @@ .text ENTRY(__swapcontext) DELOUSE (0) - /* Set the value returned when swapcontext() returns in this context. */ - str xzr, [x0, oX0 + 0 * SZREG] + /* Set the value returned when swapcontext() returns in this context. + And set up x1 to become the return address of the caller, so we + can return there with a normal RET instead of an indirect jump. */ + stp xzr, x30, [x0, oX0 + 0 * SZREG] + /* Arrange the oucp context to return to 2f. */ + adr x30, 2f stp x18, x19, [x0, oX0 + 18 * SZREG] stp x20, x21, [x0, oX0 + 20 * SZREG] @@ -97,5 +101,11 @@ ENTRY(__swapcontext) 1: b C_SYMBOL_NAME(__syscall_error) +2: + /* The oucp context is restored here via an indirect branch, + x1 must be restored too which has the real return address. */ + BTI_J + mov x30, x1 + RET PSEUDO_END (__swapcontext) weak_alias (__swapcontext, swapcontext) From patchwork Fri May 15 14:40:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39266 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 1991539858B0; Fri, 15 May 2020 14:41:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by sourceware.org (Postfix) with ESMTPS id 1FBA03985818 for ; Fri, 15 May 2020 14:41:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1FBA03985818 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=hMUbR1pzTNWbwLET+nZjJ1ztbakhvWSimZHzWVWcv82GW28h1/38ShT6m77SpIN4xn39IiDg4pgqHQpu863HhN9IRZxLC1VQi9xClXlP/NPToWZFYU6Iv22nzVX5XSK7AAC4/PyGYNUMFtvIUcpV8fs3UNidVexgg/XCZKoNvEo= Received: from AM6P193CA0042.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::19) by AM5PR0801MB1713.eurprd08.prod.outlook.com (2603:10a6:203:34::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:13 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::2a) by AM6P193CA0042.outlook.office365.com (2603:10a6:209:8e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:13 +0000 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 AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:12 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Fri, 15 May 2020 14:41:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0bc0928531d3b398 X-CR-MTA-TID: 64aa7808 Received: from bbeb8491f7ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EEA04E24-5A14-4AD8-BEFC-7781B44F460A.1; Fri, 15 May 2020 14:41:07 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bbeb8491f7ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mlq/m8wrWsntFJom2DhPDmSN+RkkIF3LXvdICAtxqiWM9ZORrbBWaSSAXPQeHuffXGXVYkcrvPKlTAyr/cmdbWsRzjU/FGxUgUjOj33TgwfjKSSnyl9+VCul7nznTb/qDy6B/9mfxAqOdWIlZ2GUdH7uc+Fib8gK0t2hxEC1CYogyExg2ozEGImGpAfefWCeSOQnAEjCIuyfx1OyGliMrKbbO6CUMOF+KQ7bYLYx68WXwmGlnQ9kiwG27mkf8eyUGpbyQ+k/S+yFj6NznA5rht0UFYU+QyXEkfhlIXCZSuxevicmdQU0rQJFwn1LFCvdLD8eyTl/IXbnabY2vTTkfw== 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=SL6RVotQ1AVA1RAwz+vz9OWa+ZzP0VE7+J5HLfyVN3WSvukOpnnYfrlQQ5H0APf7/PxsQg0/ll+3U84NrlRr4N+nlrYrze5yB8ae0lLUM1LhpiyUpTjas/1k+8yf81FPMAhi57REiYhIHHS8SGFH052V+3QvCJFAVtukEQ/dwRp5X/iTNHlmaX7+PfRq2UqnUpMyflseIE+Kx1TA8lXRjoOV/a1+SPrlVQkNe3tkQ0MPqGDqKZ3zn2WqRZgqdm7F99nQNEqwbPfJ0i3gOdI8WLuYrKkXsp6otWFdLrtzFV8VH1MvC0HzSLY3CNHscKXQ30w+Fo3oYbsd+YnqRTs6cw== 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=hMUbR1pzTNWbwLET+nZjJ1ztbakhvWSimZHzWVWcv82GW28h1/38ShT6m77SpIN4xn39IiDg4pgqHQpu863HhN9IRZxLC1VQi9xClXlP/NPToWZFYU6Iv22nzVX5XSK7AAC4/PyGYNUMFtvIUcpV8fs3UNidVexgg/XCZKoNvEo= 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 AM6PR08MB4454.eurprd08.prod.outlook.com (2603:10a6:20b:bf::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.26; Fri, 15 May 2020 14:41:06 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:06 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 08/13] aarch64: fix RTLD_START for BTI Date: Fri, 15 May 2020 15:40:52 +0100 Message-Id: <907a683ba82f7b14e24ff38dfa5c74f056275d3f.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:06 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 932b9dc6-4bac-49af-ce6d-08d7f8de040b X-MS-TrafficTypeDiagnostic: AM6PR08MB4454:|AM5PR0801MB1713: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8gjI3RYRMa0dAva9Qhtu+SDKcaznx9MmsqxYhQLTqfmb+3CIc7vfudukscXL48fpOYaL3hWKpzaKCLK5oeP65f8faKVScvFk1aKO5F/ie1vfyQSmAKBOVHeRsmx/cjklnBC8WQqYUTYzWdIhCxaKXJybP6eWHo9LQLK46/uJVRYcen40J8WbyVWrcHLJKt0ixL4rHsgy7E7FAdM9K69K63q3x/KpTPjPeeBXtX7gsTf+nIN7j5MLynpztXQk8E4t4uf1/htOOLxyLBvNI63L9wSejG33x+91j/ccLllwLw1hjtSleIP2RQ/Cnt1DJu/JSQQb7v0WQgb8MYkorLzbn8oGnUuscG2Sty6rS7c8BuV7fp71MQTFc224pazswmssVp/38O2g4Rni8yUu3iP26lEEyOl2KlM4VpHXt1RTpOgnkoiKQYnK4are/XcmsiwpDkBD4V7bfrHXRCIgSff8uf15FwtxeeawA+DRXVkQoSMnOQsGPHPiAHD3lTCQHRcwR2zAnsKgvKi7yAnO3jm8imySm+F0ycr5rb1wRgT+arQ= 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)(366004)(376002)(136003)(39860400002)(396003)(52116002)(6486002)(36756003)(8676002)(8936002)(6916009)(478600001)(6666004)(86362001)(6512007)(316002)(26005)(5660300002)(16526019)(186003)(6506007)(2906002)(2616005)(956004)(66556008)(66946007)(69590400007)(44832011)(66476007)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 87e8YfT8oMgesizIRcARVH1ShcKv76IqA0jgnHqdpMzDQ2LRAjW0XTvNo1x6eAXa1gTweQg8johaSpG3u3Oj+Ow6d8wHZcmzfYWH7Z3ln1KBewM+V7OwpPoeZCrZGt3ZspOVr1PEWxRjBySoq6CV1bXI4PfH7EDre2DLmUuFhOuj2UhvgWfP0x8KpozbkBvTSEa0BaOkTVlSX8ubIKYs0xioWnPlDTPntR55HqWO4NlXmWwUflpNmAdXhZiU07ByewjDmnXl8ePQechFy75qCKKdNHc85tlRZsro8BhfX4Aw++nYDbjaG+AuVfuQc4JXKFgu5JoRx9JhMNDbVtO87m87L/YIfGRLWxoPrE6UrkEMrM8F6JiwtnP1opibukhLC5nCsDS0DNxhQ4h/9gNMLeW2jgGOdYyNrDcWIR9JDBSRJWssflf4YCyfp1r3QN0IWIYVl0hqhmGgQmxgJ3Q0Ic/kPRFCJ2THsI0XH/X8+sMtfX7o6mAGmZ+w9rOPJjji X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4454 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: AM5EUR03FT015.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)(39860400002)(346002)(136003)(376002)(396003)(46966005)(6486002)(36906005)(8936002)(2906002)(6506007)(316002)(82740400003)(16526019)(69590400007)(8676002)(6916009)(2616005)(956004)(186003)(86362001)(336012)(26005)(44832011)(6512007)(70586007)(356005)(82310400002)(36756003)(5660300002)(47076004)(81166007)(70206006)(478600001)(6666004)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0a480374-8670-4ebc-1145-08d7f8ddfff7 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gfMUjLuHrr+aGhWKmGc6jZNDCJNWg5dcr++JUo3ibVUlXS/8d8gCTfaNT66L1OHzb2cNSZvfLkt5WC60BzPNVmsA56DuyZTjUvZqdcd+x79eFKfz8BbEU3rC/2UPkhpbQ8FxnkCC28X/kyGColKe+myCfv23TGXjpOLbt5UraG515hzWuORqqNxs/HP7vG96Ad5tRA/D369QcoXLfSViy3BovcdY/TSYdnd1BQU8qH3oGLQV2+cMEQtyG+6/x+nUcRBtR5zvCCKIQbwtvQmxIqWDoSMundkZ6DvwjPJegyBMVnPuv6m7MwvbRPvDuNuT0Krd2ZhDjIQLLBvuitZ3nRT5mwJh1WhXk7gWPrRBXRRFU6+eujVGKsEaKs6MlVP6e/iJgfjOjjG0LUKfTEnS5Tk7APH2tyng3JpKeJnkkg2C2AHGyhxoW63xBizWGT7NDQ6INIg/W2uhNR3ms+pAp0T/RBDyBj6y7aiRF80GoAnZ4lXsziqLZw1neWYiDBEnZxkhDRpJ3EhLlR9RbYdOIN3uvwauw6LzYtmY7s4YlmaqTTAExuzwlnTCGbiXW+DCYlCM+Z6HC9kTnW2Eh2QYVA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:12.9881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 932b9dc6-4bac-49af-ce6d-08d7f8de040b 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: AM5PR0801MB1713 X-Spam-Status: No, score=-19.5 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-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" Tailcalls must use x16 or x17 for the indirect branch instruction to be compatible with code that uses BTI c at function entries. (Other forms of indirect branches can only land on BTI j.) Also added a BTI c at the ELF entry point of rtld, this is not strictly necessary since the kernel does not use indirect branch to get there, but it seems safest once building glibc itself with BTI is supported. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/dl-machine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index db3335e5ad..70b9ed3925 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) .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\ @@ -178,7 +180,8 @@ _dl_start_user: \n\ adrp x0, _dl_fini \n\ add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ // jump to the user_s entry point \n\ - br x21 \n\ + mov x16, x21 \n\ + br x16 \n\ "); #define elf_machine_type_class(type) \ From patchwork Fri May 15 14:40:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39268 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 C9EC83985C16; Fri, 15 May 2020 14:41:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2069.outbound.protection.outlook.com [40.107.21.69]) by sourceware.org (Postfix) with ESMTPS id 1F917398581D for ; Fri, 15 May 2020 14:41:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1F917398581D 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=+ip+h94gbaJvtEYAHbaf0ZF+WqTSm8HjAWlE7w8ppuw=; b=30gZpDgwGFARx8AVRD2hldtngjLiIPJAhA+z6YJkd5v4v5UGc1amOg19M7rCbpZQkaL3l39132FOfyzQBArYBndMVtSkpUX0Te9sP6KtuLkHDzSaIOCqo24LbxoyffZCgtqwNa9m3lUJckqAApolaQiR0LzI6yV/LOkw8+n/ASY= Received: from AM6P192CA0042.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::19) by DB6PR0801MB2069.eurprd08.prod.outlook.com (2603:10a6:4:7a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24; Fri, 15 May 2020 14:41:14 +0000 Received: from AM5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:82:cafe::ca) by AM6P192CA0042.outlook.office365.com (2603:10a6:209:82::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:13 +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 AM5EUR03FT022.mail.protection.outlook.com (10.152.16.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:13 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Fri, 15 May 2020 14:41:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4c1728d0ce0a2c9c X-CR-MTA-TID: 64aa7808 Received: from bb6e9e998296.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FC700F7A-7405-4558-942B-213C829ED7E5.1; Fri, 15 May 2020 14:41:07 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bb6e9e998296.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XYkvhUYQj3Uv5dG81yiteAkCEfryhGCT83EENAkE8jMK20l370zpSN3d2549levxXi+aSbnoZlxcaKd+lI3AROFwVEOYf3tXeiCNOJPS+Nn5+gIEBPuj9cCsFM5C3zJpO2mGMawbeStU1HsVINgIV4+wI09ZCTVLD9UdJr2E1TTyY7slGpu4Ll+dEp/QTctcut0MQuOWIpMTTngHjYTOqQBVRKVVrBD4BSZ47/ZBxLZ50Ia5oGBkVWVX9DX+dbNzHaItWLZYjGxbUP8vVKtWnkkIoL8AuN/JkO1OqwMIyNajOgVNwsPKVdWrSejF/zdGMhNn20UBtZguK24xXVgA/Q== 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=+ip+h94gbaJvtEYAHbaf0ZF+WqTSm8HjAWlE7w8ppuw=; b=kmv0ewzv/IPqe85Ag5jJOOrRjIRsE1wHeceYE9A0zbGvypjjr2h93e92vKHQ7tEKnY5pbm/wL0jfmbBTURPewz7l7F4xMVGTJHetHLje31Kr7NPoNzw2/aLq/WgAoQ9hm6WSOvCB/fOGaJQm9K09CI2XMR7HPLGOREKafaxgNtDXskQPtFEplULa293SVFOB4IPhISnj/7NmnJQ6BRH8/MKRkZfhtDtoPs1u010SrH+KT7oEphnjL/eRbsCfriG/QKhrZsZLLxojnVVQgfKNTqAB92+iT/q/Wc2REw9/OP+d374MzHfbBSLUKk02239S6Kajcmlbh+7wFLB2apWsdQ== 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=+ip+h94gbaJvtEYAHbaf0ZF+WqTSm8HjAWlE7w8ppuw=; b=30gZpDgwGFARx8AVRD2hldtngjLiIPJAhA+z6YJkd5v4v5UGc1amOg19M7rCbpZQkaL3l39132FOfyzQBArYBndMVtSkpUX0Te9sP6KtuLkHDzSaIOCqo24LbxoyffZCgtqwNa9m3lUJckqAApolaQiR0LzI6yV/LOkw8+n/ASY= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:06 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:06 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 09/13] aarch64: enable BTI at runtime Date: Fri, 15 May 2020 15:40:53 +0100 Message-Id: <7b32d3a81141aad6c52187d959ecf82d125a513c.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:06 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 407ad41d-82b8-4f48-fcd9-08d7f8de0447 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM6PR08MB3528:|DB6PR0801MB2069: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2887;OLM:2887; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pYDbU3LF+dQo1hoThK0wM66u4m7kfHAPeykGM6l4vXa+JiaTauMCvEoHw/1f8ci9giXvdtfLAh+GJH0PiOy3M5qknmgMNaxXAQ3TGXsUbQoXQhY49j13EyVyuM82QNexDAau6/tBv2gnv9untaZ+ctQ2qH/8j85SBTR8mFS1x0DRFduWY7q7KbhqVHUuhGt6iz8nHJe6hH0PrIm2Je+La5clFOJaboW1ZTYcguGX/gV7b/7TNLpGo3RqMy/Yoktl/SXiDtQWbl5lOL4FIS4Utev7+KrAq00MLFmKTl6XqmgqplH3iR1g134xkHWHOPUC0PbTT1HU1+S4fr6UL61vE4vGqc2ON3e3VoR9Wgcw576OymjWtquFTkG19JGttQr2R98o4XPjYPJttthsmLmdDh/fEwG6TC8rkFVxvOqiiPnkQrhJrHZIvR7ilr6Hx6Hxft1nx1UllVqSYc/qlEN441IXw24SEvIF37LvvJAiGppW9iBfyGt79ZmUUjepaQIQ81UHs2fazF/OsK786rYHXXT76BUJHwRRMXY3sWjp3ZdtCsqhrKJ0CJbbacvSv3On2UXBi+dcKbpVcZErExIgBaaUPzNlkTWkTFWXyeeOd4GbU4egKkUGEGYS+JRUZ68W 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(4326008)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(30864003)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zxMlT51YcpByFMHDHzgUeCn++9u6wbBDGW6/x0IRA78OwK1siN3fDuJrgOxDpOOyhxVBgs6HaoEP8OlP/KEdum5BT8jqYkix8IcrnwEmy3hTFgu19I4+BrDJyjXdLHhxGTUNAlQWue1DKRHZGlfc8cf45KAvBRJpgNVIug3tKc9Wi8Jmq+LefmXjZ4kbrzYY3JGSi8qdEQRDWe+ikOTAiCPmx/ow34+MFLTnGU/K1O0dsISXWFyuJ32gJPwuAVeIYFgQjbQkcMeEQw2EUiZMNclZjA2ar568pNA4ZTmC+yE1SvMhfd+7fYvWGTtTUaKOIlG/w93PKgdbR6qnCGE2P26EAkoqEujRG7I/5mFFttkNd120RHBf6PS6Q+wEDXxpfJEG/xLtQpnQiciH+07d4LEE/5WZWLm4vCNxjvWmnGWTEkyr9MZqANIu43Bw8dJnahQWZ8VwjiZqE11KGGWcCpGNvq4/kH7qKLTTA7uTrcF9RqpRWhRdK7s9aLFHLqhp X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT022.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)(346002)(396003)(39860400002)(136003)(46966005)(6486002)(336012)(6506007)(70586007)(2616005)(8936002)(8676002)(186003)(70206006)(478600001)(16526019)(44832011)(86362001)(6512007)(956004)(26005)(30864003)(6916009)(36756003)(4326008)(6666004)(69590400007)(47076004)(2906002)(81166007)(82740400003)(5660300002)(356005)(36906005)(82310400002)(316002)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 868ee555-558d-4341-ea42-08d7f8de0033 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KRRplDO+gjt5OzbEBjN3ADL+739Lam8fQem0yG+oRqnA6d66T2qgMAFDOLe9o9LGbKAgMD43iFc1fNYPCvfG1y8imLLIqKoVADs54J/DN/PPC+zz2KuK3DxoC1qieFKuKuUB3ZodUGnLb7y6JolwnHXlB4JOcuXbZREhcR7OtkQwPObpwZ8+kbDnRmt2P8aZgvNbza3wrs7YUcKHVWcYanFuBzbYr/IsNJ8moQ0YIwKaQRopcDL3uwfuRms+upZU2bJXIfue5N5rpOs+U7IY+kNZlXJF2RPyx224nikBKFmIk0f1uD+Ew3NNqLM6csfCzVz5CMIb8H89Y0xeV7ySUCY6iU/6yyDTUB1zO4wQ+zsroB9cpqr1pO6p4jZVwIpxZmHJmJ/QTVRAMY2UFVmREIFtdXziTKLJ9OJhd4y6R4MT//przshDWrRCgpTUbFgdOWpngvxM2Ul0xnBn6JypBersumCan+V2HoZgFmbcMUF4oRmNKjybE+Cyyu8Mt67Ok7VLtsLoklYTxxCgzKIjnJly6uDDtgt4tZ7/9GzFdK3GVq5uBSFTGAiqn8Y2Tmu5OSBXhfjVG6YCj5ZsqmnB1W+VVKJLgZIlWtgosy+wxutabKeTHbZJ/NQc+sIfGDK2RcxvyIrYERBiC1TO3KDMVeJ0n4MF+7fYTktDJI+XiXuy8aHU+n5lTfcHFC0qTOa1 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:13.3709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 407ad41d-82b8-4f48-fcd9-08d7f8de0447 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: DB6PR0801MB2069 X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Sudakshina Das Binaries can opt-in to using BTI via an ELF object file marking. The dynamic linker has to then mprotect the executable segments with PROT_BTI. In case of static linked executables or in case of the dynamic linker itself, PROT_BTI protection is done by the operating system. On AArch64 glibc uses PT_GNU_PROPERTY instead of PT_NOTE to check the properties of a binary because PT_NOTE can be unreliable with old linkers (old linkers just append the notes of input objects together and add them to the output without checking them for consistency which means multiple incompatible GNU property notes can be present in PT_NOTE). A new _dl_process_pt_gnu_property hook is introduced in dl-prop.h and to keep it maintainable the rtld and dlopen code paths use the same function (if the main map needs special treatment, that should be inferred by the hook from the link map). Unlike the _dt_process_pt_note hook this one is called after segments are mapped to avoid unbounded allocation and additional read syscall. Otherwise the AArch64 logic follows the x86 logic for handling GNU properties (but the code is not shared because x86 needs to manage internal CET state and look out for multiple property notes). BTI property is handled in the loader even if glibc is not built with BTI support, so in theory user code can be BTI protected independently of glibc. In practice though user binaries are not marked with the BTI property if glibc has no support because the static linked libc objects (crt files, libc_nonshared.a) are unmarked. This patch relies on Linux userspace API that is scheduled to be merged in Linux 5.8 and now it is in the for-next/bti-user branch of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git. Co-authored-by: Szabolcs Nagy Reviewed-by: Adhemerval Zanella --- elf/dl-load.c | 13 ++ elf/rtld.c | 6 + sysdeps/aarch64/Makefile | 4 + sysdeps/aarch64/dl-bti.c | 54 +++++++ sysdeps/aarch64/dl-prop.h | 145 ++++++++++++++++++ sysdeps/aarch64/linkmap.h | 3 + sysdeps/generic/dl-prop.h | 16 +- sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h | 1 + sysdeps/unix/sysv/linux/aarch64/bits/mman.h | 31 ++++ .../unix/sysv/linux/aarch64/cpu-features.c | 3 + .../unix/sysv/linux/aarch64/cpu-features.h | 2 + sysdeps/x86/dl-prop.h | 6 + 12 files changed, 279 insertions(+), 5 deletions(-) create mode 100644 sysdeps/aarch64/dl-bti.c create mode 100644 sysdeps/aarch64/dl-prop.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/mman.h diff --git a/elf/dl-load.c b/elf/dl-load.c index 06f2ba7264..9c37ec1098 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1188,6 +1188,19 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, maplength, has_holes, loader); if (__glibc_unlikely (errstring != NULL)) goto call_lose; + + /* Process program headers again after load segments are mapped. */ + for (ph = phdr; ph < &phdr[l->l_phnum]; ++ph) + switch (ph->p_type) + { + case PT_GNU_PROPERTY: + if (_dl_process_pt_gnu_property (l, ph)) + { + errstring = N_("cannot process GNU property segment"); + goto call_lose; + } + break; + } } if (l->l_ld == 0) diff --git a/elf/rtld.c b/elf/rtld.c index 5ccc3c2dbb..97a0bbf4dc 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1506,6 +1506,12 @@ of this helper program; chances are you did not intend to run this program.\n\ main_map->l_relro_size = ph->p_memsz; break; + case PT_GNU_PROPERTY: + if (_dl_process_pt_gnu_property (main_map, ph)) + _dl_error_printf ( +"ERROR: '%s': cannot process GNU property segment.\n", _dl_argv[0]); + break; + case PT_NOTE: if (_rtld_process_pt_note (main_map, ph)) _dl_error_printf ("\ diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 9cb141004d..5ae8b082b0 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,9 @@ long-double-fcts = yes +ifeq ($(subdir),elf) +sysdep-dl-routines += dl-bti +endif + ifeq ($(subdir),elf) sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c new file mode 100644 index 0000000000..6003686601 --- /dev/null +++ b/sysdeps/aarch64/dl-bti.c @@ -0,0 +1,54 @@ +/* AArch64 BTI functions. + Copyright (C) 2020 Free Software Foundation, Inc. + + 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 +#include +#include +#include + +static int +enable_bti (struct link_map *map, const char *program) +{ + const ElfW(Phdr) *phdr; + unsigned prot = PROT_READ | PROT_EXEC | PROT_BTI; + + for (phdr = map->l_phdr; phdr < &map->l_phdr[map->l_phnum]; ++phdr) + if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X)) + { + ElfW(Addr) start = phdr->p_vaddr + map->l_addr; + ElfW(Addr) len = phdr->p_memsz; + if (__mprotect ((void *) start, len, prot) < 0) + { + if (program) + _dl_fatal_printf ("%s: mprotect failed to turn on BTI\n", + map->l_name); + else + _dl_signal_error (EINVAL, map->l_name, "dlopen", + N_("mprotect failed to turn on BTI")); + } + } + return 0; +} + +/* Enable BTI for L if required. */ + +void +_dl_bti_check (struct link_map *l, const char *program) +{ + if (GLRO(dl_aarch64_cpu_features).bti && l->l_mach.bti) + enable_bti (l, program); +} diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h new file mode 100644 index 0000000000..b6f8a88667 --- /dev/null +++ b/sysdeps/aarch64/dl-prop.h @@ -0,0 +1,145 @@ +/* Support for GNU properties. AArch64 version. + Copyright (C) 2018-2020 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 + . */ + +#ifndef _DL_PROP_H +#define _DL_PROP_H + +#include + +extern void _dl_bti_check (struct link_map *, const char *) + attribute_hidden; + +static inline void __attribute__ ((always_inline)) +_rtld_main_check (struct link_map *m, const char *program) +{ + _dl_bti_check (m, program); +} + +static inline void __attribute__ ((always_inline)) +_dl_open_check (struct link_map *m) +{ + _dl_bti_check (m, NULL); +} + +static inline void __attribute__ ((unused)) +_dl_process_aarch64_property (struct link_map *l, + const ElfW(Nhdr) *note, + const ElfW(Addr) size, + const ElfW(Addr) align) +{ + /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes in + 32-bit objects and to 8 bytes in 64-bit objects. Skip notes + with incorrect alignment. */ + if (align != (__ELF_NATIVE_CLASS / 8)) + return; + + const ElfW(Addr) start = (ElfW(Addr)) note; + + unsigned int feature_1 = 0; + unsigned int last_type = 0; + + while ((ElfW(Addr)) (note + 1) - start < size) + { + /* Find the NT_GNU_PROPERTY_TYPE_0 note. */ + if (note->n_namesz == 4 + && note->n_type == NT_GNU_PROPERTY_TYPE_0 + && memcmp (note + 1, "GNU", 4) == 0) + { + /* Check for invalid property. */ + if (note->n_descsz < 8 + || (note->n_descsz % sizeof (ElfW(Addr))) != 0) + return; + + /* Start and end of property array. */ + unsigned char *ptr = (unsigned char *) (note + 1) + 4; + unsigned char *ptr_end = ptr + note->n_descsz; + + do + { + unsigned int type = *(unsigned int *) ptr; + unsigned int datasz = *(unsigned int *) (ptr + 4); + + /* Property type must be in ascending order. */ + if (type < last_type) + return; + + ptr += 8; + if ((ptr + datasz) > ptr_end) + return; + + last_type = type; + + if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* The size of GNU_PROPERTY_AARCH64_FEATURE_1_AND is 4 + bytes. When seeing GNU_PROPERTY_AARCH64_FEATURE_1_AND, + we stop the search regardless if its size is correct + or not. There is no point to continue if this note + is ill-formed. */ + if (datasz != 4) + return; + + feature_1 = *(unsigned int *) ptr; + if ((feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) + l->l_mach.bti = true; + + /* Stop if we found the property note. */ + return; + } + else if (type > GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* Stop since property type is in ascending order. */ + return; + } + + /* Check the next property item. */ + ptr += ALIGN_UP (datasz, sizeof (ElfW(Addr))); + } + while ((ptr_end - ptr) >= 8); + } + + note = ((const void *) note + + ELF_NOTE_NEXT_OFFSET (note->n_namesz, note->n_descsz, + align)); + } +} + +#ifdef FILEBUF_SIZE +static inline int __attribute__ ((always_inline)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph, + int fd, struct filebuf *fbp) +{ + return 0; +} +#endif + +static inline int __attribute__ ((always_inline)) +_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + +static inline int +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); + _dl_process_aarch64_property (l, note, ph->p_memsz, ph->p_align); + return 0; +} + +#endif /* _DL_PROP_H */ diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h index 943a9ee9e4..847a03ace2 100644 --- a/sysdeps/aarch64/linkmap.h +++ b/sysdeps/aarch64/linkmap.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ +#include + struct link_map_machine { ElfW(Addr) plt; /* Address of .plt */ void *tlsdesc_table; /* Address of TLS descriptor hash table. */ + bool bti; /* Branch Target Identification is enabled. */ }; diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h index 6b0f2aa95a..4192049739 100644 --- a/sysdeps/generic/dl-prop.h +++ b/sysdeps/generic/dl-prop.h @@ -20,11 +20,11 @@ #define _DL_PROP_H /* The following functions are used by the dynamic loader and the - dlopen machinery to process PT_NOTE entries in the binary or - shared object. The notes can be used to change the behaviour of - the loader, and as such offer a flexible mechanism for hooking in - various checks related to ABI tags or implementing "flag day" ABI - transitions. */ + dlopen machinery to process PT_NOTE and PT_GNU_PROPERTY entries in + the binary or shared object. The notes can be used to change the + behaviour of the loader, and as such offer a flexible mechanism + for hooking in various checks related to ABI tags or implementing + "flag day" ABI transitions. */ static inline void __attribute__ ((always_inline)) _rtld_main_check (struct link_map *m, const char *program) @@ -51,4 +51,10 @@ _rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) return 0; } +static inline int __attribute__ ((always_inline)) +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + #endif /* _DL_PROP_H */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h index 4ee14b4208..af90d8a626 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h @@ -72,3 +72,4 @@ #define HWCAP2_BF16 (1 << 14) #define HWCAP2_DGH (1 << 15) #define HWCAP2_RNG (1 << 16) +#define HWCAP2_BTI (1 << 17) diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/mman.h b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h new file mode 100644 index 0000000000..ecae046344 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h @@ -0,0 +1,31 @@ +/* Definitions for POSIX memory map interface. Linux/AArch64 version. + Copyright (C) 2020 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 + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* AArch64 specific definitions, should be in sync with + arch/arm64/include/uapi/asm/mman.h. */ + +#define PROT_BTI 0x10 + +#include + +/* Include generic Linux declarations. */ +#include diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 896c588fee..b9ab827aca 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -83,4 +83,7 @@ init_cpu_features (struct cpu_features *cpu_features) if ((dczid & DCZID_DZP_MASK) == 0) cpu_features->zva_size = 4 << (dczid & DCZID_BS_MASK); + + /* Check if BTI is supported. */ + cpu_features->bti = GLRO (dl_hwcap2) & HWCAP2_BTI; } diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h index 1389cea1b3..a81f186ec2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h @@ -20,6 +20,7 @@ #define _CPU_FEATURES_AARCH64_H #include +#include #define MIDR_PARTNUM_SHIFT 4 #define MIDR_PARTNUM_MASK (0xfff << MIDR_PARTNUM_SHIFT) @@ -64,6 +65,7 @@ struct cpu_features { uint64_t midr_el1; unsigned zva_size; + bool bti; }; #endif /* _CPU_FEATURES_AARCH64_H */ diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h index 516f88ea80..8649314f9d 100644 --- a/sysdeps/x86/dl-prop.h +++ b/sysdeps/x86/dl-prop.h @@ -191,4 +191,10 @@ _rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) return 0; } +static inline int __attribute__ ((always_inline)) +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + #endif /* _DL_PROP_H */ From patchwork Fri May 15 14:40:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39270 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 83EA03986015; Fri, 15 May 2020 14:41:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130081.outbound.protection.outlook.com [40.107.13.81]) by sourceware.org (Postfix) with ESMTPS id 3B9AB3985824 for ; Fri, 15 May 2020 14:41:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B9AB3985824 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=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=FycQLdX8hKUR3h3ThScYhAeHYCy5NPVcG6HWnWpGvA47WksrzzChl9GoehMuWEvKrYogL7TYHmfHDhb/onnVtfnKdA3NIdQsiw15uOg86WDWuA9o2QMiwd+EyuWFTDSfTPXiMng/99MdS2defzhAcIPGS+v+9Q6P9b9QI2WqwUw= Received: from AM6P193CA0071.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::48) by AM0PR08MB3058.eurprd08.prod.outlook.com (2603:10a6:208:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.35; Fri, 15 May 2020 14:41:14 +0000 Received: from AM5EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::b9) by AM6P193CA0071.outlook.office365.com (2603:10a6:209:8e::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Fri, 15 May 2020 14:41:14 +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 AM5EUR03FT028.mail.protection.outlook.com (10.152.16.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:13 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Fri, 15 May 2020 14:41:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 30d3fe097f58b110 X-CR-MTA-TID: 64aa7808 Received: from eafecf9d9489.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CCC52C13-7AAF-457F-AEBC-639360ABDCB5.1; Fri, 15 May 2020 14:41:08 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id eafecf9d9489.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H1aIhm6doRWZwtN8/8HzWgn5xgtsvl1/lFrL1oZRMfu3MFKNKLO40gzi1Ijl/KZI2irgwTaVoV9mQAJhmZQ5wCXsI1UjGHw6c9oDB+yndyZ+l+4gq13763yzAZVWHreIxwPTWiA+yzShngXAY5gFzlXwWrccQzAvuyfvYqZd7FjTYzBVYYC8Ii6T83xbdOfq+2Yw9OEDfQXKmbWm2z+Aeyxd86mXvRll9mg/Eb823K+naOrWpJZjU3xIzELamF+Z82pWiezr3L1aYkp1JOwSTfOVhNjk6LEi6QtNBwA6adU+OyFV85RjkXSvkZamrh/Bio/3awVSx4ChQH5mJY66Qg== 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=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=VBwSDPh5QvoyGAXnSV8U/wJY6VhWuiVQKxvxFspgTQkmFNkZaS/K+scqCIHgcXLzK246HJrqFo29DkDHTqlWJ6J684PCb0DaVVwXSHyBU7DuX7GFYzn0OmZz9r+S+ehvTD52M4/T0S/f29B/6jMeZo+cAsH8rdv/wt3eRPVtCBqJHIekrNVoV+JMHk7AX3pE7hGALe+9s8KHHyHf73J3eZNZHFDXa6HHOnDxJTCkTzfaiPk0OY6r1E5HcIeRCsZwEKyC1YM+OaoP6RuN+VKEjq2n0RBJoHQZ/cPnesQGL9qPemzdTNf3qYHLAWIGndWuRqDUrm/4gDdl+pptweCg0g== 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=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=FycQLdX8hKUR3h3ThScYhAeHYCy5NPVcG6HWnWpGvA47WksrzzChl9GoehMuWEvKrYogL7TYHmfHDhb/onnVtfnKdA3NIdQsiw15uOg86WDWuA9o2QMiwd+EyuWFTDSfTPXiMng/99MdS2defzhAcIPGS+v+9Q6P9b9QI2WqwUw= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:07 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:07 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 10/13] aarch64: configure check for pac-ret code generation Date: Fri, 15 May 2020 15:40:54 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:07 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a588d87b-e607-4bbc-f145-08d7f8de047a X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|AM0PR08MB3058: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3276;OLM:3276; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: oCsEM6aeQxPSb3zV8KlRfXYiJcZWgONixOXQ2SWlrfs/3+NxbVaI8nR0RISKgTDDo9GekIu7jdvowHZIy2gUmxiaTXvTydHDWu9IzDOd7qhQOjUZ0tcOxYABQHw8H3ZDQ4uMr+U+tE6f2ZDBnjR0aiqfPFe/g34Cv8F9mSR7FZg478GscCUFXMpAsUQ/k7Zy+XdcZ7S2IISsHDbXHKHI5PeInFBy66YgGr/yFoXrXgVmGU4HzwyLsn0xSLEHQklfN4BbZ2j9Vu6ctXYyOjeSbIblH5jTgNyxR+TPPnL7jIlQpKotvZSiwzJ4FDW5HoIOBSIn+2JlwBg3DOiCn1tdLMg53GZhmql92faZXex8XSgMSztIY1ukZDkdUoxun+C8rCruRz4kKIwtv/XPxCSlng18PTP70b4AJsd1YsNCpBi8+kQrHJSTitGgHj5eP+5wDj+LK+RRWM1w0SGMYAk0yWou+gEEupNqCClMi7XRf9iZkCnkKckeM8e4ThKzKyljd0uYvw8nCr8HeRPVbTFeQuq6TffYFtfQ3Ea4EX6kYHE= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VgvRR2QSzyawjw1q3MYXSUQ9SQUr5umwWp3fX14mjs0xPC0DX2vnsWDdHNu0erh2Zk6F2bPEQ3UxpyQebiPLRgk6+r37kKHX0oWWtbusJVY9FEu0AHrSXbJ8YL3asrqak6ynnspyyoglSxLAWKOYJSo1EVsiS3Kq6u6wD6XsPjFmbU2vSON4hAviT++YDGOXRnDDFPxCHAytZPcD3bU52wT+igzfubI558PPegduhyiPHtAsxZsVq2z08AaIABpkuuBO6MATpJejaZ1kgoQ1e6IOQzLEDw3BTlRcyaDiuf9bLi0fHFXfPKIoTIExZ2l14/NH2SpsGx6YVsNLIUg28BFXXoiWpMe/RTwI5Md+TFybd9Q/4MF8N5xlThAGSVkObf7JszUG1pnYhoQxxZQ7F/5xLfrkLpg11blXR7zRr3UrrnDY48Ic2E36SIK3FQY86GVug9/JQ3hGMhAoVMj2jkhGdZlFmvdoR9GVZe/bLqs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT028.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)(136003)(39860400002)(346002)(396003)(46966005)(956004)(2616005)(336012)(16526019)(82740400003)(316002)(6506007)(6486002)(81166007)(26005)(5660300002)(82310400002)(186003)(44832011)(36756003)(47076004)(2906002)(8936002)(36906005)(86362001)(6916009)(478600001)(356005)(8676002)(70206006)(6666004)(6512007)(70586007)(69590400007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ace79884-ad77-4de2-5a47-08d7f8de007c X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /pQHtttTjSgDVkS1u30O0wigm2A9sVJnYXk5f/8EPrfHn4AGABWJcVUnxzsXR8s07WRg/jIlt7U5UxNUaed1ACKn9pI7ENihP5EC1q1DzIQw+iLcjpU9K2foj1SxEqyqCA2DgBaZQwtY+6S6yJtQsrs+yVN3m0a36HiPSsxecttNsfFaWxboUOx2sacevgZKOawPtrqcHd+rkF13vCRCfS2FxLrvUfx3kbJvOzPa52NgbomxQJ9xqeoVmUCdUAwerIKiVSvmrAsD1UG/lWZBVZYBRHm44ppX6Kun7JfocHQfK4I/w/SvFfrW9Tln+xhEJAlmqFM5DQhx8ITfFMV9gik4uPxQSKdtNDSR6IPYTPDq7qI9B7ia86nzQDCIIv+B8zAmwfEPW0iBS2qMmlwXBBdAy+8xQ2LPKvZEx96FgESJ898jdmV2I/RMnxEEb6+zbxqFAq45ohZlZhAOLuGgTLv/t1hAmnQuVUSvNGsJSNTPPEeL7MGNA/StskzIE3BkVbMLl0BZzUM7y9RgcaUeqtp1HKErhk09/03NLS16pX3gCZlFPdXh12xCHLkiBp4vOFcmw4MLEIl1bv8LhZ++mw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:13.7189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a588d87b-e607-4bbc-f145-08d7f8de047a 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: AM0PR08MB3058 X-Spam-Status: No, score=-19.5 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-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" Return address signing requires unwinder support, which is present in libgcc since >=gcc-7, however due to bugs the support may be broken in --- config.h.in | 3 +++ sysdeps/aarch64/configure | 39 ++++++++++++++++++++++++++++++++++++ sysdeps/aarch64/configure.ac | 21 +++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/config.h.in b/config.h.in index 506b0c416c..f441470385 100644 --- a/config.h.in +++ b/config.h.in @@ -112,6 +112,9 @@ /* AArch64 BTI support enabled. */ #undef HAVE_AARCH64_BTI +/* AArch64 PAC-RET code generation is enabled. */ +#undef HAVE_AARCH64_PAC_RET + /* C-SKY ABI version. */ #undef CSKYABI diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 70477a7fa5..5f1cdf5d9b 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -214,3 +214,42 @@ if test $libc_cv_aarch64_bti = yes; then $as_echo "#define HAVE_AARCH64_BTI 1" >>confdefs.h fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pac-ret is enabled" >&5 +$as_echo_n "checking if pac-ret is enabled... " >&6; } +if ${libc_cv_aarch64_pac_ret+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && { ac_try='grep -q -E '\''(hint( | )+25|paciasp)'\'' conftest.s' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_pac_ret=yes + fi + rm -rf conftest.* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_pac_ret" >&5 +$as_echo "$libc_cv_aarch64_pac_ret" >&6; } +if test $libc_cv_aarch64_pac_ret = yes; then + $as_echo "#define HAVE_AARCH64_PAC_RET 1" >>confdefs.h + +fi diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 798f494740..8248ecf2ed 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -39,3 +39,24 @@ EOF if test $libc_cv_aarch64_bti = yes; then AC_DEFINE(HAVE_AARCH64_BTI) fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +AC_CACHE_CHECK([if pac-ret is enabled], [libc_cv_aarch64_pac_ret], [dnl + cat > conftest.c < X-Patchwork-Id: 39267 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 738AC3985C2E; Fri, 15 May 2020 14:41:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120087.outbound.protection.outlook.com [40.107.12.87]) by sourceware.org (Postfix) with ESMTPS id B51F2398582C for ; Fri, 15 May 2020 14:41:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B51F2398582C 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=ceDMrw0x+/h7N55nCBLeHJa9UyRADlyr6KTY3OOW8Co=; b=s8+qRBYhSEyspuE8UqCNvtBlxvWtxSJEKSDg9REkw8uolkdef/IAw5/q42TESCrXHqTR+jNRrzLJ7Ehbk/prQfFrfPAw1euewPNUaJaIP6Y3Vk+KzRZTwk0JJFsg1eYAoqrW+GVF5PNk86LPXIKzlxs4Ufdk6Wb4nfQULG87YMU= Received: from DBBPR09CA0017.eurprd09.prod.outlook.com (2603:10a6:10:c0::29) by PR2PR08MB4684.eurprd08.prod.outlook.com (2603:10a6:101:22::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.33; Fri, 15 May 2020 14:41:14 +0000 Received: from DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::ea) by DBBPR09CA0017.outlook.office365.com (2603:10a6:10:c0::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:14 +0000 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 DB5EUR03FT027.mail.protection.outlook.com (10.152.20.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:13 +0000 Received: ("Tessian outbound ff098c684b24:v54"); Fri, 15 May 2020 14:41:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ecd6f6f607434c33 X-CR-MTA-TID: 64aa7808 Received: from 1ddb15158a9d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2EE40992-E3E9-4074-8A52-F8DE75F6E147.1; Fri, 15 May 2020 14:41:08 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1ddb15158a9d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SD+fq+r5SdAS1OS18xfpp5DlF9JBnYcXPoqr+kHqhOfcNvNGBvjV8AhTTs+AsQSm4HztBg/uEoZJY5IXBvPP07hIgCLX35B4zqCiP1OHHa002k+bVpMymWiyXHI5jkDccNiO7KuCW8KFZFp5sPWA737Du2dEnikEB4fUDlxeFxOkTJ5jr0sK3CBa2y5jK1ASwobtKzbBDIeCkNb6Vdh2QDhrRqJ7LobgJB7FkIN95VVvE1kp0zmKzT/shCOWltKmQ/oeUOzpdSFVT7oCHmnOgGh1QQ21vUMf6gU4XRFbf8wBvT2ztEInNFpgAkk66OeOqZpyG/67vcluazHwDMTKNw== 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=ceDMrw0x+/h7N55nCBLeHJa9UyRADlyr6KTY3OOW8Co=; b=jRQkfiEQCoznWvA40t98IMOAwUv7bJ+E6h6NcOCNpuJ96xYITzqAjanEpRkCfsaC3eyYqPTiNJKKvWRs6uPY06kdJYJEUeLMUnSSomtx5M6pq2uIzEjWaM9prTaWgKjV1JDY9dffJQWm4HeSz+Zczj+D0O0Pi5sFA8u/zfT71y127a1RK9XILy3ZD71jr9zImPAZBNA5n/EoZR3Z2Fk5ABTyvA3825SgqfVjcK2gqdxgBT2TN09roINuvY9+wDgVhxVNFI8E3CCI9UqBHygNc4lWMHcxJxNstuEVM4m2M5hvsjq98aaqHu05rjMGNXXRfmso5y/iujjbjtNriKhIQA== 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=ceDMrw0x+/h7N55nCBLeHJa9UyRADlyr6KTY3OOW8Co=; b=s8+qRBYhSEyspuE8UqCNvtBlxvWtxSJEKSDg9REkw8uolkdef/IAw5/q42TESCrXHqTR+jNRrzLJ7Ehbk/prQfFrfPAw1euewPNUaJaIP6Y3Vk+KzRZTwk0JJFsg1eYAoqrW+GVF5PNk86LPXIKzlxs4Ufdk6Wb4nfQULG87YMU= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:07 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:07 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 11/13] aarch64: Add pac-ret support to assembly files Date: Fri, 15 May 2020 15:40:55 +0100 Message-Id: <55c2f030bcb0c66c855e823b60bbd624d7d5bff9.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:07 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9528cb1a-aa01-4a31-ab9b-08d7f8de0491 X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|PR2PR08MB4684: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dFBO5gfHkljHaOJgGBnC9JwOZUkk0Yf7blVK5XHuRu3l6O+AseITR5vkzQkdc4qAhrOnt4g8xrECnI2WqiqleArw5VIFHUv2/BSaK//Vr0kKE/hVtc0j3QGITax1T90Wy92HmboeIEwFcGNQRQyocEWTCymLCcNfJlPuMHQqvXKi0tC6vvFajLmvYZKvte09qpGsSNrNVqHY74cbokak2kk/p7NdY7uVk9ONrQ9FVWAg6oCkKXsVxFhl592nUQU7D1R3A/invQr+IhskgtFx/3LUuC96nJqHIDnPA0X0PXLkpqwnC/Kj+Vq6WU/1wXZ9ymE9V/l2dVuxg0KXFrIdVvXM56sMCte35CDNTTyJJvH50X2vKS+YFhHlTOrsYEj/V752vYP/PVcefm+wnMTuL9JbUJ/g9t7PO/mztcr50yfJdoA5uKsAULKJybEHb1EEEUXju1//kg1CootBADRFdCVegQS6LNtuTYXdAemnDU1aRG9gFkLjx6ZxCFWHxkFuVMaVpodTPz1B4xbhhOT+dFM1lCf9/REyMG++RQsuwds= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8oQqO2IOXnpbpRhFhscdX16ag7y3UIF/7fLouufohaKbth3xq8oQrewC0Oipl2dtDDj4GYiNhmBtCOkOZac99zkkxfgg1Y1tJGmT69mcFjRfvpW61Pl8bTvR94E8LR6sLdp7sLOq4IeO0b9pp+XyJWnQVoG3J7iDwP+VqAyrq9CFRrt1w2JCYkP4pcVVoL0ta0/NIwmAIaAzL0klD0ZxGFR7yeskAAI8P+NaiHNPfAYJZYtD83xwVBSnwoab+C60Jzx5mwr6TLKgp+J8igvexO1RxEV+HSHM4yN/RrXADhN3SX8uDZ9LhlAXnpdWAjEjgEr7bld+Pcx5HsRZSkXzcyD4SJbtmhQVUKQPPThI5ok5tVbfm6NCwlx8OaVNEmyAt6qX7iQmyM2/QHDtV2/7CmXqPKUgKhvVZPQLB89aplrG8jRPFoZSHw07BUMP4sXfkNtC2iphoqzIQ8ho73GaMlonE8eq2SyZM/mLCxyfuuI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT027.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)(39860400002)(396003)(136003)(376002)(346002)(46966005)(8676002)(6512007)(8936002)(44832011)(16526019)(69590400007)(6506007)(86362001)(5660300002)(336012)(26005)(2906002)(2616005)(47076004)(956004)(316002)(186003)(36756003)(356005)(6486002)(81166007)(6916009)(70586007)(70206006)(6666004)(82740400003)(82310400002)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f816a17-4acc-4281-2ec3-08d7f8de00bb X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Il8LL7Wjb0Kh9zB4G1bdfOut4fI/7DYNNNh/qI87Hee35L9kHka2tppgAL5cbv+mI8BY3UijoWAkjPUhUGoPdVV0lSEq9WlzNRk3uP6q+g3HO/G8VJYl4XVMtj4bBDw628P6aaGsnzGa9DV8CgcX9CGtG1XDhoofwyn/qBrH9NeLm9j4mNAK1bDU8WfOEL+POC7RptlUdQnTNcsZliv2UhJrkW76MnzczMTAZwvQ2q4egk+kBpttFVY9Pl6qvi28ZyGDz7dgWQjRgFDuu3s91NKeIM/JX7xdhJeHrhtxkE2ueJGzq/nZPGqiDkKs6q6U++22ALizcD+arbA0A7f1A2ZobiT2OUuRzEdYgf3fBDPwwdIsMhF3TKTySogoEgCZFelKyhi3E/mQxYEFjkzxlxLjUhZ4KLSWfyGUTA+P3mALhkJmlw1jtojYTWcjYtw/gwjA7x6ARuiv5Hvqd+eLhE3Tz6gQp9SNB31sJ3zEQur0o24Nmn6INBTAU7jRGvxgCS1qaaeWLbfdhJ6uwduF9R9VHctDh2eognbl0wmuTAqYz2ljaHipte9cD/3Wr89R/aeKPognZ5ke7pg6ZIbFNg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:13.9228 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9528cb1a-aa01-4a31-ab9b-08d7f8de0491 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: PR2PR08MB4684 X-Spam-Status: No, score=-19.5 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-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" Use return address signing in assembly files for functions that save LR when pac-ret is enabled in the compiler. The GNU property note for PAC-RET is not meaningful to the dynamic linker so it is not strictly required, but it may be used to track the security property of binaries. (The PAC-RET property is only set if BTI is set too because BTI implies working GNU property support.) Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/crti.S | 8 ++++++++ sysdeps/aarch64/crtn.S | 6 ++++++ sysdeps/aarch64/dl-tlsdesc.S | 8 ++++++++ sysdeps/aarch64/dl-trampoline.S | 18 ++++++++++++++++++ sysdeps/aarch64/sysdep.h | 8 +++++++- 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index c346bcad72..02ec7d015e 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,7 +75,11 @@ call_weak_fn: .hidden _init .type _init, %function _init: +#ifdef HAVE_AARCH64_PAC_RET + PACIASP +#else BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -90,6 +94,10 @@ _init: .hidden _fini .type _fini, %function _fini: +#ifdef HAVE_AARCH64_PAC_RET + PACIASP +#else BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S index 0c1ef112c2..4b93b90411 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -41,8 +41,14 @@ .section .init,"ax",%progbits ldp x29, x30, [sp], 16 +#ifdef HAVE_AARCH64_PAC_RET + AUTIASP +#endif RET .section .fini,"ax",%progbits ldp x29, x30, [sp], 16 +#ifdef HAVE_AARCH64_PAC_RET + AUTIASP +#endif RET diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 9d96c8632a..3746dbec17 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -183,6 +183,10 @@ _dl_tlsdesc_dynamic: callee will trash. */ /* Save the remaining registers that we must treat as caller save. */ +# ifdef HAVE_AARCH64_PAC_RET + PACIASP + cfi_window_save +# endif # define NSAVEXREGPAIRS 8 stp x29, x30, [sp,#-16*NSAVEXREGPAIRS]! cfi_adjust_cfa_offset (16*NSAVEXREGPAIRS) @@ -233,6 +237,10 @@ _dl_tlsdesc_dynamic: cfi_adjust_cfa_offset (-16*NSAVEXREGPAIRS) cfi_restore (x29) cfi_restore (x30) +# ifdef HAVE_AARCH64_PAC_RET + AUTIASP + cfi_window_save +# endif b 1b cfi_endproc .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 2cbfa81434..53f92d68bf 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -127,7 +127,12 @@ _dl_runtime_resolve: cfi_startproc .align 2 _dl_runtime_profile: +# ifdef HAVE_AARCH64_PAC_RET + PACIASP + cfi_window_save +# else BTI_C +# endif /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -239,8 +244,17 @@ _dl_runtime_profile: cfi_restore(x29) cfi_restore(x30) +# ifdef HAVE_AARCH64_PAC_RET + add sp, sp, SF_SIZE + cfi_adjust_cfa_offset (-SF_SIZE) + AUTIASP + cfi_window_save + add sp, sp, 16 + cfi_adjust_cfa_offset (-16) +# else add sp, sp, SF_SIZE + 16 cfi_adjust_cfa_offset (- SF_SIZE - 16) +# endif /* Jump to the newly found address. */ br ip0 @@ -287,6 +301,10 @@ _dl_runtime_profile: /* LR from within La_aarch64_reg */ ldr lr, [x29, #OFFSET_RG + DL_OFFSET_RG_LR] cfi_restore(lr) +# ifdef HAVE_AARCH64_PAC_RET + /* Note: LR restored from La_aarch64_reg has no PAC. */ + cfi_window_save +# endif mov sp, x29 cfi_def_cfa_register (sp) ldr x29, [x29, #0] diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 086fc84b53..c51572a690 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -45,6 +45,10 @@ #define BTI_C hint 34 #define BTI_J hint 36 +/* Return address signing support (pac-ret). */ +#define PACIASP hint 25 +#define AUTIASP hint 29 + /* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ #define FEATURE_1_AND 0xc0000000 #define FEATURE_1_BTI 1 @@ -66,7 +70,9 @@ /* Add GNU property note with the supported features to all asm code where sysdep.h is included. */ -#if defined HAVE_AARCH64_BTI +#if defined HAVE_AARCH64_BTI && defined HAVE_AARCH64_PAC_RET +GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) +#elif defined HAVE_AARCH64_BTI GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) #endif From patchwork Fri May 15 14:40:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39269 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 2C6B3398600E; Fri, 15 May 2020 14:41:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80082.outbound.protection.outlook.com [40.107.8.82]) by sourceware.org (Postfix) with ESMTPS id D65B93985830 for ; Fri, 15 May 2020 14:41:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D65B93985830 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=lzWHS6DnogbMcOCjVaiRlRk8FYN3VjXA+n3Ze8B8xbM=; b=XjVHEFTsx6TodIvLKLJNUSe93saFCxlVIzR94kB4vq3fTjCIXrXuIzKUu/VxHGxhTR76VnNONjkBCanTE5xCx5Ch++Q3HhZXIpWRC3g8oR9VwHhZsFyFP6gH5WyzJYdrSfXzMLPygRprvT9T7CPpuPnJJV3J0UZd9l4ijQVlWLQ= Received: from AM6P191CA0018.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::31) by DB7PR08MB3785.eurprd08.prod.outlook.com (2603:10a6:10:32::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:14 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::a2) by AM6P191CA0018.outlook.office365.com (2603:10a6:209:8b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25 via Frontend Transport; Fri, 15 May 2020 14:41:14 +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 AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:14 +0000 Received: ("Tessian outbound ff098c684b24:v54"); Fri, 15 May 2020 14:41:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 50997078280f8a36 X-CR-MTA-TID: 64aa7808 Received: from 49b6e27cf6d5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 774A30B3-F03D-4620-BFD4-EF419AACDB42.1; Fri, 15 May 2020 14:41:08 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 49b6e27cf6d5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iaGdOEmQsDUbiUMewN7v2Qg6/i3rT4jJsMKeN06+Ta6/KHXQDKZ+8w0Tw1+Mf7H9g1D0cGLKO1qAYryr0YrFwG1BNHwoBaFUcmdtn97omG8dOeNQ5uubveOQbuMIo02LFfYN+vm7UvLklkvahhk7qVOpSXN3B8mniFjMGQlt7Azbfae1W3Zkqt0i9mzWvGgenp32RBd3DmawXEcJBS1b+oNgmvwD6KI/g7GC2NU5NBw4ZECQwIleBcHACI0lQKJeGFc/lQtabcmXZjnWztELVNLc8u3Uu/aBHCNJNU/gcL7ej8cXQkJV96K9aMGkR0eLyGI4arS8Njdv2FrXHB/j3Q== 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=lzWHS6DnogbMcOCjVaiRlRk8FYN3VjXA+n3Ze8B8xbM=; b=NeurzTpTTcJiOhTU3M0vCjNN33tNfUndDwrIw5/4GOf3UJrRUvnW6Gwk5leFxooAUxuurkGvCI2EXEGptP9ZsSl89HVFSxKrqfTQSUWctBLMkLSNvrymeSsxzJy6xGvn5FEpbNHjVmUXYIK+me+2KlHvGSJ7Fa566DDTVXPwrJKjTcFozqayQr9N6UsDv+e2Wa52aFdLFqeYYmQEMkdR8zph53lu0eXlWhsQoRqwfXdCCBiMCEmy7rGXZnw3ap/INXgVXsQC8ENxDVDSV6+g0viQVBvl2CFz7GPIQkuZX6XIW6i07LO4XJDy3cIxK3HaOOx5qntZvMmAdmKEvgiyoQ== 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=lzWHS6DnogbMcOCjVaiRlRk8FYN3VjXA+n3Ze8B8xbM=; b=XjVHEFTsx6TodIvLKLJNUSe93saFCxlVIzR94kB4vq3fTjCIXrXuIzKUu/VxHGxhTR76VnNONjkBCanTE5xCx5Ch++Q3HhZXIpWRC3g8oR9VwHhZsFyFP6gH5WyzJYdrSfXzMLPygRprvT9T7CPpuPnJJV3J0UZd9l4ijQVlWLQ= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:08 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:08 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 12/13] aarch64: redefine RETURN_ADDRESS to strip PAC Date: Fri, 15 May 2020 15:40:56 +0100 Message-Id: <07c221c020bfa0e03566e06e036ff5a923d6a324.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:07 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 89f5fea7-c9ab-4aeb-f3c7-08d7f8de04cb X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|DB7PR08MB3785: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: RUzaLWg/gqFqZp4OcFBcin/nziP5Z4wKMbhcZIFOXKeEXkHdWrqZCsMAUblVjJ5d9u2B1uBXO+b/kD821CdeHUulW3qIQMbC8oUiQslDmYhuBwBrPr40BowoxXRf1yt+lnxK4/CHEFyNTOiD48+o4+QUGVSAKwTRS7eJi6P3BGKVqN3/I6J9zzmI2udLQERrRIBmq+EqGZvLf18N8RUEUKkuBsjp1OUNT3nkJVnYw69y9CkRvN6tfXjprhoqBypr6yP4214JrXRHzVbHMri8i59eO5mmD+JqDX/V5iqeMtrJW2YopqT1IEnG1syyR34C2qFHB1jnyJU4Hg87HQIwbYz/FU0rWi9wEa4tUtc4kP9Ou6acMs943RKmzTD/3IseVTxV/M8T2VBB3hWphf0NBXUQJy+95FUJdfPdE84H2FUhYaS6QvU4LQ0O4qFLqJX46edcVhbBSYbexwWLQXNBD3d20ZtgRERhTQpoMAHJIx+ZWu9HyQuWw2vIeP3P3flYN3C7RpGU0FEc2Qh82qvpa9nhC2eH4nGs6pacpnv8PCBvoGB7REP+zZHEagOMoCNGFa9X6hfE5BFKjiTYpy3Vaaa32XxRGCviBLn6KOa49jwIz3GzcZiD7J/IainZq1tg 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(966005)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BC+cYFxbvpdBpoVOV5Nlc2aCC+PDOkYZXHOQ4wpOIs63bTQusW0tIN6xXVn+310jWdPxPCbLhScmI42JgdsXOMptxF1VzmNTBZq8fjplCf7fVA5lxadfzxDZdsDfRC8r9wpJPBqM1IqxwdqEetur/QWbLELYeaFjhTVFxZDYUaxgzkpbbL/3h1xAK5e/IuOPLnzaeF+ye2BV9RtoDqHcYIJNNKpIcHFC76XMeqjYsc9Iu55B+Gxjze9UaJi8jwhJuSTOluEejU3m0iAovLGUuCtN4R0kvdkSrznZCraoJ3V+r3Hu36TWaMcmVHVCu5PIrhFFV2LUnNf7uwPgqdFPuZrA5QZJX7pjeO6Otak136FvmMSHAPk3puAkXI49rHSlHHEv7ym0a24lP9TJ4V8TSkB+g2WSeKKZriy4N6ySqxRXt/aq9vUsYe/+Vm8XJAIf41b96spXWR3P3DbixGLdTBT5hRLaIRgAvEDSSltckWM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: AM5EUR03FT043.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)(396003)(39860400002)(346002)(376002)(136003)(46966005)(6512007)(47076004)(36756003)(6486002)(82740400003)(356005)(86362001)(81166007)(8676002)(8936002)(69590400007)(5660300002)(82310400002)(70206006)(6666004)(6916009)(966005)(478600001)(6506007)(186003)(70586007)(2616005)(36906005)(336012)(956004)(16526019)(26005)(2906002)(316002)(44832011)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: b6d334e1-c271-49a3-d349-08d7f8de00fd X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ik3FP3bzQJ7jdryGO+O0TUHt5ObyNY0p/Om5e4nbd9yh5fSTTpdyz7+tnlPrsLRkbHAoyz17prYoQjasXtInsATSO21iSgmOIz5sFu9z24PeMboaHIQoXE8PuIFSDqwhFP7buQPWyQibs2Xdfx0aYtSMzF/yK7Eo8/L6bO2mo41RW55GOf8P0mqWd+GtYdhV0NvnXWbu4G1Clf8eCl69MA/z9Pbrwm2tzKpronxqQ7Je86yd+M+bnT10xtC4m4Cm5QdxAtQgpz5qK0IXGhkOcew0BURVRicTWPSwzWONwiOKtyJH/WItbFFje+i+11al2R65IpxaB62g3W6N12Ivy6Y5qUZjarnaQT8iDK7EKP+6lotWxvgT5qx2bolCUuXuBzjskdYrxARXLamiWxaSmDtAb4xYiu6UDmL+2Jn9ocIHJsheqMgh9a9FWXW+aYcSSz4yQF1q2b28yX3vRGcgadpzNhITPAbU/TjKYrnUXmYuVP9C0aNwPxOGM5mM337wxw4kSDl5PO9oMPILseFPfRwgIyJBqLlhSRGsLM6WHacB50jrTiYIMUi+lMfKPJR809vzttKcraRVcBYZ7qwjGKX9tdt6NuDL9Leigmihnvd4CIv+2Fjp6LV5rRNAmHp4MhyB45sJIuDJPf3w4XUmkoZmvLCypcB+OQesxO/ad4A= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:14.2324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89f5fea7-c9ab-4aeb-f3c7-08d7f8de04cb 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: DB7PR08MB3785 X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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" RETURN_ADDRESS is used at several places in glibc to mean a valid code address of the call site, but with pac-ret it has a pointer authentication code (PAC), so its definition is adjusted. strip_pac is omitted if glibc is bulit without pac-ret, but it could be added unconditionally (that's just unnecessary operations). Inline asm is used instead of __builtin_aarch64_xpaclri since that is an undocumented builtin and not available in all supported gccs. Note: such change indicates a problem in the pac-ret design: it can break code that uses __builtin_return_address and the breakage is only visible at runtime on a system with pac-ret enabled. It is not ideal that users need target specific inline asm to fix this up. For now we can recommend disabling pac-ret where this is a problem, but gcc might need improvements in this are to make pac-ret usable. TODO: __builtin_return_address handling with pac-ret: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94891 Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/sysdep.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index c51572a690..7a70cf7a2b 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -35,6 +35,23 @@ #define PTR_SIZE (1< X-Patchwork-Id: 39271 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 DB03E3986020; Fri, 15 May 2020 14:41:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2069.outbound.protection.outlook.com [40.107.21.69]) by sourceware.org (Postfix) with ESMTPS id 288163985818 for ; Fri, 15 May 2020 14:41:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 288163985818 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=RmtY0NhwqbPGT826SOq+Hl+U3xYruAwcSkyz8TOWg2M=; b=PSE2bxPmb3zWkd6UmL6VZbP01OMHXjxgaBJ0ImrtYbkUFOYA1EDN3BnyWrsmQcEgnn+y8OcifDdMb0izRvKcBPmRzyRJffFhxDkW3tV0U0EvXWvkctKLsLFDiaeO6vlCeFZIp3XO1kSsj8ubGZgbpE9WXHFPuO1oF86EbdaFy6s= Received: from DB6PR0501CA0020.eurprd05.prod.outlook.com (2603:10a6:4:8f::30) by DB6PR0801MB2069.eurprd08.prod.outlook.com (2603:10a6:4:7a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24; Fri, 15 May 2020 14:41:14 +0000 Received: from DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::d9) by DB6PR0501CA0020.outlook.office365.com (2603:10a6:4:8f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41:14 +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 DB5EUR03FT037.mail.protection.outlook.com (10.152.20.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:14 +0000 Received: ("Tessian outbound e88319d7ccd0:v54"); Fri, 15 May 2020 14:41:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: be91da385cd56d5a X-CR-MTA-TID: 64aa7808 Received: from 939156a5856d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 747CAEDB-449B-46FE-BC3B-E701403EAD58.1; Fri, 15 May 2020 14:41:09 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 939156a5856d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FMZ1oB+QFWoRMh78GvfLKX8yJHeut4FFDyHhuQNonVpOYjrAUIWSxwCKS1wmxPh4jtz1/IeehOPrdVJbBI3Eo4VcZXvmIYMrdt3Q15PUv2qzoelYTDxeZXzCgQ/DoC4WwcHd4TMqbPGNI4EmH2nwbXqCIdl0htJprpPFdQfD9h0JUyzIBXEmysAprq5LMnlygQnVwW0OI1Ddk36C/+v/FzErNLYLZ7tBvnQ7JbxEvWPbhkNHw32P75kA56Zg6ugxV/vCFyYg1yVfMmsQEhBvkjNj+19CsYjSfHuC9vouA8DqWSLJlDZ6rC3mVdS/WNn07/dXutIJz+4J0n+XrBZyuA== 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=RmtY0NhwqbPGT826SOq+Hl+U3xYruAwcSkyz8TOWg2M=; b=M++iPsKSt2roQiRciKeXVXTjGXLyEuyrflcL+KCyqKt/2l9DRUvIRZtaDV8BNX21cTEp6k//mJ+7jTyEhOI7WCULGkbWDw+BiLJ4as9mJgdsrG00+ALwg3qN4AExGjLQCev0tPOwKLCifUXvliMQGExQ+wMOIFKk3pSob6pL3JUQnG7WwC9WZqAt2Y7ERcL1bxH1ZS0mzxUbtddWcQwvqvQisNUN6l5QLmryb7f/acdf65JzM4Y7FWiehCxAZwX4ba7AYyb6b/l6FxjG+GVzijetkJpi8AUAOOgH9b+0hrT2IFertvvfF9Bq+71Pk2Y98YemfAivAjxReg5+Q3etkA== 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=RmtY0NhwqbPGT826SOq+Hl+U3xYruAwcSkyz8TOWg2M=; b=PSE2bxPmb3zWkd6UmL6VZbP01OMHXjxgaBJ0ImrtYbkUFOYA1EDN3BnyWrsmQcEgnn+y8OcifDdMb0izRvKcBPmRzyRJffFhxDkW3tV0U0EvXWvkctKLsLFDiaeO6vlCeFZIp3XO1kSsj8ubGZgbpE9WXHFPuO1oF86EbdaFy6s= 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 AM6PR08MB3528.eurprd08.prod.outlook.com (2603:10a6:20b:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Fri, 15 May 2020 14:41:08 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 14:41:08 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 13/13] aarch64: fix _mcount for pac-ret Date: Fri, 15 May 2020 15:40:57 +0100 Message-Id: <3d422103bcd42547829b53fa07d3891e5bfabba3.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) 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.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:08 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c95020c6-2d1e-4621-b24c-08d7f8de051b X-MS-TrafficTypeDiagnostic: AM6PR08MB3528:|DB6PR0801MB2069: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4941;OLM:4941; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: qF3DCpgyKWEqzaEDsHr4fn3iGcq81Bm4DyNgjs7QVdiLdYyqUENtKCMT5mnDHXevkhc0x0fXCnbPj5lRV5dmr7xCp2FQYspxHTMddJmMMOVpxEtFYQUJjRMkF/JxZZp1crbrhIk3AgEibAfSmjsOLFvLaU+JIoTVnUtCsY54MAsIlwHY8KlNNu8n3yHuAJlBO0GeRMnZzUGDJsp+JfoKVDzjIyKAQ7WxFQbQviGUpwJZVJj2WKXXNND5CAmw2cmCp2zmvSflN0mU3CKetgxwefqNVzlBY+9xr8hGqL2grPrE9vFwOgjGPPZ7Jmpia4y3XOD4by6QSquCtXWKeObkFB+5cL/lGQsSKNR02VIMlN/4wj9w/DUKmhAg9gZEhwCU1rYFifM4/x50PEc1lTljkuuUsYJtdUkH/36cS49rCPE01/V5sPSQz6VZSUMcv7ZHbRwin61/T/yJWC10y6Bo1LWMwT762Dx45w4mjFjM8R4cMPg9jMbeqDboa2hlU+78TjbQ9wI58pmmMsjfbv7tctMg1yYuFSdxvuueLKcXPwp43biPAD0P0LDcUaC3F1NUINS+uPQYCp2JPkBm/OZqcbPBeSnty4RPXveVjYThSQg= 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)(136003)(376002)(39860400002)(346002)(366004)(396003)(86362001)(6506007)(69590400007)(52116002)(478600001)(966005)(316002)(6666004)(6916009)(6486002)(66556008)(44832011)(6512007)(5660300002)(2906002)(956004)(66476007)(8936002)(66946007)(36756003)(4744005)(186003)(26005)(2616005)(8676002)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ga/nUKkyWbxGmRpBESVCN2JowqW/3Jsi3o0fFoRFFEQ/nF0rQFxd8cSLsNyGT3UHnnYR8/g1jixahiLR7ET0yD8AtoM5BjhHO3Szn7YjdoXMEV6H2D6HXvF/hMMNP/A/EMfMcBOblx7Y/zBBK4f1xfuTWNEwi3OdgyuijB+Q+ufHdg6l063J8Evycsxt5VZe9QMOPcOv3Kpfx1oQ/R0odqMXfNlflOLPsGG/J5zMfSJ+k6Refu6mUNknAjNa1aW7812C1idyeOUedt/eeJbE4aMlcuL7UPZlKj08SJ4BmvKU/tGzCmvEXbU342X/0JcpzSLwtmlbWUto0bu775BFSfPBjKpB7GMhAjOIDunKnBcXlXxUHzBpbx19CNr7nraa79cdBOwl6ze4HiZ0UJDmOmVBiyXBZt361AUC5S7Wl5ZQXIwhgX2YvgfS+VCTLESJ644Y0H2pmTSvL92MyU55XzLLkD0MER1Vylog3oxrnmI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3528 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: DB5EUR03FT037.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)(346002)(396003)(39860400002)(136003)(46966005)(6486002)(336012)(966005)(6506007)(70586007)(2616005)(8936002)(8676002)(186003)(70206006)(478600001)(16526019)(44832011)(86362001)(6512007)(956004)(26005)(6916009)(36756003)(6666004)(69590400007)(4744005)(47076004)(2906002)(81166007)(82740400003)(5660300002)(356005)(82310400002)(316002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: d0827742-42b5-4be7-f67b-08d7f8de0133 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Eg6kDFZ5ZQTmXvb23s5O55uEvIJEWIaoPnJErW1i0IdIRc3n4mrnFnqbkP1iuY6hAwxM1uqrFaiacIcVHxH+XTjwKHKRAtNn0O72BN2odkgZ6X44IJgrOBmFliZjKD0rrW1LxZCQx4DgArJqVQ71KHJD3gMK5rhudQGAOXWkZiCx1xcVK7BUAU4PGsddG0MXXPhiSEbN7bjq5Zo2sowYEo2NHsO6q0xmuo/+iG03Sq0joO1aZbO0UVGNcA0RJ3v8CSTlGP/VwWNZ8ZFKfzjLDH1sDtgG6GhcNOc61coicoKT6D7/jXvjRc8e1AIW/YB09n/gtNczxNal7ShcGEKGs6xMCn63s1XDyfIapn7QmUypxxaauODntNqV9hvrJ0LhXzGQSoZw7sMhPwaaZtod0LO4b5zzu+obpAoupfuzEhMbBcWymsGNvk0m7+yKFkgKcINYoQ/hNn1+o9jkplqJ0TPoKHBbhl+rRxK/HI2NLbEdAChdfxV1XFlMoqMzw+u+leiqU21CU9vKdWDxPfiog4Z6EDNJ8/NAdF5oyeB1Jn7OZAed69u0InnREYa2dlr8TZEhA0/VmejHIIDxgzuF1+DS4QqxbCsxA+Np+BGziDN9XEyvrHsW220LD/r9aep6V+npy6kxm4jpbmUnr3ZDsc9QMciy7o2OlZ/mnPinYtE= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:14.8283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c95020c6-2d1e-4621-b24c-08d7f8de051b 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: DB6PR0801MB2069 X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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" gcc -pg with -mbranch-protection=pac-ret passes signed return address to _mcount, so _mcount now has to always strip pac from the frompc since that's from user code that may be built with pac-ret. This is a backward incompatible _mcount abi change introduced by return address signing support in gcc-7. TODO: fix -pg on the gcc side? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94791 Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/machine-gmon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/aarch64/machine-gmon.h b/sysdeps/aarch64/machine-gmon.h index 730a23b781..328cbdda16 100644 --- a/sysdeps/aarch64/machine-gmon.h +++ b/sysdeps/aarch64/machine-gmon.h @@ -30,5 +30,5 @@ static inline void mcount_internal (u_long frompc, u_long selfpc) #define MCOUNT \ void __mcount (void *frompc) \ { \ - mcount_internal ((u_long) frompc, (u_long) RETURN_ADDRESS (0)); \ + mcount_internal ((u_long) strip_pac (frompc), (u_long) RETURN_ADDRESS (0)); \ }