From patchwork Wed Jul 1 14:37:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=kWhCU8Mp; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=kWhCU8Mp; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkNd2kwSz9sQt for ; Thu, 2 Jul 2020 00:38:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F2143861031; Wed, 1 Jul 2020 14:38:07 +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-eopbgr70043.outbound.protection.outlook.com [40.107.7.43]) by sourceware.org (Postfix) with ESMTPS id D4D2F3857007 for ; Wed, 1 Jul 2020 14:38:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D4D2F3857007 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=BHLx/io0FZJ2YurE5O/DL90hJy3tVlAxqhrNlqVW1HA=; b=kWhCU8Mp5xZ94afPeaoxq31JiG1ETUDy213tvAqoMAsCBlFXHprjRvG+krwHR++wQV6+Hnn3+0H7LjZZSmAx724G19zXrRXejcG+khKHECxCL+QD0YchVpAvgYfVGLRoCIAA1qeGVTSy70twErOjtjk+zUH9osc1nrvwMZPge78= Received: from MR2P264CA0033.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500::21) by AM6PR08MB3511.eurprd08.prod.outlook.com (2603:10a6:20b:4b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:38:02 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:0:cafe::ea) by MR2P264CA0033.outlook.office365.com (2603:10a6:500::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:02 +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 VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:01 +0000 Received: ("Tessian outbound 114f46c34313:v62"); Wed, 01 Jul 2020 14:38:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fb123768e29c4b7c X-CR-MTA-TID: 64aa7808 Received: from 5877384ae73f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C4B56C76-026E-4121-B881-18DB995B6320.1; Wed, 01 Jul 2020 14:37:55 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5877384ae73f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:37:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXyF2c6DC/UsLDjDAlV9VU9ZJW+S2GtiJfkXVCufg6qiCtiKy1hRI/bifM8aD8tilvC37YlRiis31MoAUNvMHJQ6D8Iwat189gHTwJdNxUuMw98n9Ki8zJ97iO/8wgBTCuIVzpnzq6H0vy4tqGmuP3ASHBxOM8Yyae1nwclKQYMooGvhi/ZOOJUScESEL7u0QrLh+jkNJGIJBjjkqTferQtNj0DzMpQriBR9aKqVY+5kCCG40Pyq0LzLwFWklQBd7rAtE8WX7efzbwEV7UWhR4uqiCpQBINOyctz9zg1gVQv+GyH0IEG83dILupSC922fDFyjPRfIGNWf5cdD4gEyw== 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=BHLx/io0FZJ2YurE5O/DL90hJy3tVlAxqhrNlqVW1HA=; b=iVGYoKBTLkIrNMYWIn8x5BxtlR89/1lS9Xwwhk5ADLhlnxKc84fqJj1GXxNoZPpCrEr2IUGrEqIO6lNvPcDdzPo6IOG7TkX7lOXs1mq8zjarqKjjUX3J/SnDD2NHzlkCw+F42sxUwi/e1D1sNkS/jnle+U8wN2lSb7UbnTr6gccKXBnImNyi7paNzxIBW+jOwNlR5RCzXPlXDcBly7GhcmNtGnzRKn+J4cZ9tryThFxnps48p+j8nNtZFybDP+tKlUzumpd+GrKOxk6y559sw6ns7b27ul9qlXWirhKFaqf3NNwTzjAfPO3VRYuBW0NceV4D7UxK7mF19KslRaAsxA== 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=BHLx/io0FZJ2YurE5O/DL90hJy3tVlAxqhrNlqVW1HA=; b=kWhCU8Mp5xZ94afPeaoxq31JiG1ETUDy213tvAqoMAsCBlFXHprjRvG+krwHR++wQV6+Hnn3+0H7LjZZSmAx724G19zXrRXejcG+khKHECxCL+QD0YchVpAvgYfVGLRoCIAA1qeGVTSy70twErOjtjk+zUH9osc1nrvwMZPge78= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:37:54 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:37:54 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 01/14] Rewrite abi-note.S in C. Date: Wed, 1 Jul 2020 15:37:43 +0100 Message-Id: <896f9afab21b31d0e168e61eb8781d477bf3a7dd.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0501CA0011.namprd05.prod.outlook.com (2603:10b6:803:40::24) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by SN4PR0501CA0011.namprd05.prod.outlook.com (2603:10b6:803:40::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.8 via Frontend Transport; Wed, 1 Jul 2020 14:37:53 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c1842914-cf80-4e4d-0616-08d81dcc5b74 X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|AM6PR08MB3511: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +oGvtbLx/I06G9qW9m10grozRrmvBawoZjL69Tc/EkmoTHM0UWpQw0WbArph5Q7gVXqsOhM7/NDsAIIR1HRJDcWhDTAAHEcWpAHF7jdeNcnrns0yOC9nHC+GS2H6GUmQRBMC4udBCh6d7+C2+w3StfdI3befxkz4qgmlchRA7PvAaH02Bjyvf+la6wcmGV38/P8jKfXLfw6PNsBzSBWmGG8BGmy8d2AV+4337JNe6tNqwwfECd3BpUonbiaHQbc7dVqLKY0TeCVe6zErtlESyMxOK8L0kugnkcOMWDaHHQz+b9TGqO9YR6TyOnBIJIMUOhwKAXPWR2nA9iA70cXy68eqlXfknhKnr4ZU6hXlBExGKxXzY6aLeX8zqPfpXviaZl5pLHiY64iXvVSFt6pZ6HADMT40XSwREsDrC4Qki+g= 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(83380400001)(36756003)(2906002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 97Eg5fJVSFaa8ImMWdi4pxKZwymdUWzdwnmcPOpC53L33Prfk5CKMcZjd6yXFTwEY43tquu+t4uqjYhP8lKV6df69Sm7xKY2AZA7D8hbIbU1N2ZWDoh3yGVzLiwyvhAUMwwOoAOmE18CO4NJHnLuEksf+/I4GUCuTMqPB2mwUg7JAeRSKITUJN36C+rmS/jKAyCiKvg++OFUnqIYhNAq5TfU0aheLYIgzrIrJ7nMYx64+hg/oOTcG6BMQNPNQ6IqGXRCx1WRtOwyITwxEN2lVdAPM02pIGPL0c9NM8kSnHWHeJPSe9nY9bglzxcFkLHObH9RsPaiC8ELE+I2wG4WvMlyGRQBYEmDsLKzMv7k01kVLznLZK/snwHRJ0zuqcNT+aL+pQLa6SGQvIdLncjt8EPbV2TKM0/YW4007NNZlzvo2lzy61vtVxUgEUkffBt0DJUAeSosbyJPrdZ3NPP0OpJXgFKYPHP2DYP7+SwXlhXCBZ32+4rpWN8ym12AHuPC X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: VE1EUR03FT041.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)(47076004)(186003)(16526019)(26005)(82740400003)(6486002)(8936002)(6916009)(478600001)(316002)(6506007)(69590400007)(5660300002)(36756003)(36906005)(8676002)(83380400001)(6666004)(6512007)(956004)(2616005)(81166007)(44832011)(336012)(356005)(70206006)(86362001)(70586007)(2906002)(82310400002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: c79b1e69-8f02-4721-5770-08d81dcc56c0 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hNtdo3zOSGj4G3FK7T8nYiA5hxsMzc3SLFnuVqf5+Shc8P+L/ZynJmWEhP/1uPfmTTELCijSlsWOKI9cS8tmx5Vwza9DNdxj1a99TkpAVysaIa3MGzc0Gf6UGAauFGdUeFpBAZ/bHUvzyz2e1yHcX+vYSnziY/1JBrRCG4JhcGSx3jSn0B97peEPsEbFU8B8qMHU0TdXpKbGEsS5SqqXxjJj0Y2z7pm+jueNdrkTnJZ8Fi7Z/1VpGa5f4LIN/6+c4aElbKM3yFP0QGy2dtQWmI49M2t7KHhzjWC00oALtkygR11RumBUhucwJM7/hh6X5hL8LaH4GZbJbTWFa8VlXsMS0oZfIhgXwgtK3t/dJ1fCbJXA0V4aIFy502sqyh1oOZc54K0v+EDKuAnXigQJMYVhn5dzz3OFNJ3tSI138WrVcFjU6cexhfvnZ58eGoEiRApy6EvPmoB/SGPXUcnENQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:38:01.6530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1842914-cf80-4e4d-0616-08d81dcc5b74 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3511 X-Spam-Status: No, score=-16.3 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} | 23 +++++++++++++---------- sysdeps/arm/abi-note.S | 8 -------- 2 files changed, 13 insertions(+), 18 deletions(-) rename csu/{abi-note.S => abi-note.c} (90%) delete mode 100644 sysdeps/arm/abi-note.S diff --git a/csu/abi-note.S b/csu/abi-note.c similarity index 90% rename from csu/abi-note.S rename to csu/abi-note.c index 2b4b5f8824..db195c7ab7 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.c @@ -53,6 +53,8 @@ offset length contents identify the earliest release of that OS that supports this ABI. See abi-tags (top level) for details. */ +#include +#include #include #include /* OS-specific ABI tag value */ @@ -60,13 +62,14 @@ 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 */ +__attribute__ ((used, aligned (4), section (".note.ABI-tag"))) +static const struct +{ + ElfW(Nhdr) nhdr; + char name[4]; + int32_t desc[4]; +} __abi_tag = { + { .n_namesz = 4, .n_descsz = 16, .n_type = 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 Wed Jul 1 14:38:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=zm717xkN; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=zm717xkN; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkNx5CSMz9sQt for ; Thu, 2 Jul 2020 00:38:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 005A83861039; Wed, 1 Jul 2020 14:38:23 +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-am6eur05on2075.outbound.protection.outlook.com [40.107.22.75]) by sourceware.org (Postfix) with ESMTPS id 0B43A3857007 for ; Wed, 1 Jul 2020 14:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0B43A3857007 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=fEi7LUYSbc6kJcZwWclKwetJ3pn75Ey8g9x1dXZ8Ak8=; b=zm717xkNZEGVht3c/0w0oFpgmHdr264YOJrJTWdU+yLD0bZS86Gfinh/dEUKA21SMhvi5OEQwzvBf/oSLGUFzwd08/H+fN+WeKcbvuPIIGS5N2dIKsW4ilqtd/ei8TWDWgh53RWwOJXzBALuWjDMbO/LaNURMEOwd/DOV/gfDyY= Received: from MRXP264CA0012.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::24) by DB6PR08MB2933.eurprd08.prod.outlook.com (2603:10a6:6:1c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20; Wed, 1 Jul 2020 14:38:16 +0000 Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:15:cafe::2a) by MRXP264CA0012.outlook.office365.com (2603:10a6:500:15::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 14:38:16 +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 VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:16 +0000 Received: ("Tessian outbound a4b10e5b482d:v62"); Wed, 01 Jul 2020 14:38:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bd49524cc8a65216 X-CR-MTA-TID: 64aa7808 Received: from 2fd2c6a51830.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B52F4F6B-835D-4C95-923E-FBDDC0D80FE9.1; Wed, 01 Jul 2020 14:38:10 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2fd2c6a51830.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:38:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=INWmCuGGfhTIF2BfTKc9bRX3pJEi02Wfz6aN+SUI+lBFJ9Po5w36RiQXVXQCrX/RpUVl92TLhAQ1L/iaUerAIc7ak/XMWxQlU6bh1TNX7wbtDZXUgokcYsXYmHdoUg/5SumwgGs11stA1Ju2iNYLqEpCN/RjrlPr3KYuC2e3TIYRNB6B4VfHxxsKzG7Ns6gOrGeQvBsVaC2tfirTTY4NZmPYmBtDyrJidmY19b18DkeyJdZ7LJzNBhjhAXcLwmfM9U1H5lI8jlrEa2ntcFFfaDuB6EfyK/nOPbtE8ndoSMvRf2WWDX74rBuuKlutXVJYXaBu1Phkn+auB8BNrvLi6w== 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=fEi7LUYSbc6kJcZwWclKwetJ3pn75Ey8g9x1dXZ8Ak8=; b=RYCw+L+mxpJbWhIxpv+FYyyqxzwakpO/dlJI7HhZI9H8bbxNZpcOF0+eqltMhs2uJuYfMfo9/2THz67MXKF6MnEMGnRuKBKZXusi1DaWSvJDkZi+spyjRLweEC5dfmDiNok5X+hhWdhG/IE3oVX9omVf/Fk7dPiYfqrsp6RdboGWi7Dh+noZLXcGCk0A1SfJTAlKg1sa+RgeHsk54JNjH2W6qKNUtfMh1cj0K6LxxcnLJtnfu/DgbWPWOTTp2CXiHI1kCd6N1a8d7GfftZNGCDea4+Ldh/IqsLKdTKQxwQLc6zkjQwfgcSaFdf+OCOYeGgBfDSbGQfYnXWWpyeM67g== 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=fEi7LUYSbc6kJcZwWclKwetJ3pn75Ey8g9x1dXZ8Ak8=; b=zm717xkNZEGVht3c/0w0oFpgmHdr264YOJrJTWdU+yLD0bZS86Gfinh/dEUKA21SMhvi5OEQwzvBf/oSLGUFzwd08/H+fN+WeKcbvuPIIGS5N2dIKsW4ilqtd/ei8TWDWgh53RWwOJXzBALuWjDMbO/LaNURMEOwd/DOV/gfDyY= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:38:09 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:38:09 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 02/14] aarch64: configure test for BTI support Date: Wed, 1 Jul 2020 15:38:03 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: CWLP265CA0370.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:5e::22) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by CWLP265CA0370.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:5e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:38:09 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 198890b7-bb12-4503-e8a8-08d81dcc6407 X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|DB6PR08MB2933: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: bqMLS8Zo+4cdWA4CzOBhtnSzRscbpWnt8eeiO/6Lj0L/stC9TdssrbORWLHHgQKLkLw+NMHqAcuVmkbA1jCe30Nt12GgHhVwJBQ3KWcJZPHe/w4dWAbTmd/IyrsVrA6eJqFE8EflKx499e57GzlyfZgo+YohZJPU4GqpaSwjeU9zV7cV+6uePDBRvmNn7EyRarqiF3EdGwTTP+PvM5wPicVUn08qPnpgGHI1m4fuR+4ulZNdAww3uilrusrIm7F3y09urp2gDMfp0NQ/P17FrDq84bjBZRgndVmzU70VwgxfcAqUsS6gSeNZmPkeKEZikA7d9LkmUtatMUe2yHWiaS7G1Yq2DuLY2ROJGPJQBAciunwcmJoIRH2nRhY4DZBwH+h7ygewQRqkwBglbuAtE8X7KuWTSzVAEtkgEFyCTn8= 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(36756003)(2906002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Mva+LVomcNDVsb+GcCzLDo1CSS7jqpo4fd/ofglq7XURC0zhg/EfVcKpjT1iiBUG7k/p+jDDrtolVVdSXtUIHKhsw7F0QdYKtOUv1HydPnl1WcZeVqWIgffRfrhavIOQ1bVgmo1t3AIdSTvceaUdW99QozF2Ng1kaphML1YV0Ri52uVIKHm7+ELnityZQtbmglkK9p223SAVSVdQwppSwT6L9x/x/NIeNNVM1P4g7sbii7AgruExEeTDSf8GTIm6xxHl+C7uSKSHLqQtCsl4cASmHDGmbTWtUyX2lnX9k8uVJh+UXPA4onGzfbK2LHQNHpsCZxfMmQdHzTYIELV5f3IweWxjUECida3D2yxbZAXo8Be63+vUk9aYo1qvyOS9gKpngXQT1p75oEqT2N6Auq+uA9SVP4qh0ncG+QYIf/r/Bo+pIR4P8mQgNnywavj4BYd2Sw0bDa6Dch9ryZU1aA8lAnObW/A938IEoGCqO7utboq/aWiIj9cDv9qkErrS X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: VE1EUR03FT036.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)(39860400002)(396003)(346002)(136003)(46966005)(6916009)(36906005)(2906002)(6486002)(16526019)(8936002)(69590400007)(8676002)(186003)(336012)(478600001)(70206006)(6666004)(70586007)(44832011)(316002)(6506007)(956004)(356005)(86362001)(36756003)(47076004)(82740400003)(2616005)(5660300002)(6512007)(81166007)(26005)(82310400002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ccec68f0-12dd-4587-37e4-08d81dcc5fec X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bVXS0iY0x1C3aAQXBJZUK4NfQiYia4rdr+AXsrRMe8s66bjBYRBoGO6D3/bdjadSS47s64iWy+Vle0fVqxJAM88DHE64c5Mdsx3cwe8cZbNUhj9UmA6WgrOci9Y3gYEx1C4pUdGqwnud4DqoOrinpa5rURjDOtYfO6D1jVDSyIVaUacRpUfpOK5XCwj1NzkqxeDTMu3m4jFERvmW3VYbAJwZ9eWRYDZxDyTsOX7DoV+fOd4HlIXhMfiSs9QnLs/0XAptVUTFncRDkKr5R+LjCtanFOVpJieMCQNUkzfUEBh+IkiJo5BcPtK9VeZWsXUCsyuac50ihkkFKgEqxitmNfVk2R0MwziDYeXHTR8word9Gn92hf+Y7ZX+CVRuuZAXcf/wWLs1B93uLsysIDbu2uQuIHcfadO3k9zp6Hg0/9eF1Zmi8UF6BZ4Mlji8GnIV3v4IVZnUnlV+Q7KVmYpk6A== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:38:16.0575 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 198890b7-bb12-4503-e8a8-08d81dcc6407 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2933 X-Spam-Status: No, score=-16.3 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. Note: passing -mbranch-protection=bti in CFLAGS when building glibc may not be enough to get a glibc that supports BTI because crtbegin* and crtend* provided by the compiler needs to be BTI compatible too. 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 831eca2fe1..67169e5d01 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. */ +#define HAVE_AARCH64_BTI 0 + /* 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: 1320546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=lQiuGrw5; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=lQiuGrw5; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkPB27J1z9sTV for ; Thu, 2 Jul 2020 00:38:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 605B33861802; Wed, 1 Jul 2020 14:38:36 +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-db8eur05on2069.outbound.protection.outlook.com [40.107.20.69]) by sourceware.org (Postfix) with ESMTPS id 132E33857007 for ; Wed, 1 Jul 2020 14:38:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 132E33857007 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=lQiuGrw5hTs85jLjB/jT3f84SpWsLrCrRDeZpAWiZ0cESEHP2CUlgnCqq7b/CITNlChbSNeyfWGq2EhvCtcRFScQANY+lLr5ZY1FrPs26shjBHVOk4APGulcM+PRONN6DxmRtR1t38DtjkhANe2q9kOdWil8S1zolvFJ7Rw3O0E= Received: from AM6P195CA0099.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::40) by HE1PR08MB2649.eurprd08.prod.outlook.com (2603:10a6:7:2b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Wed, 1 Jul 2020 14:38:31 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86::4) by AM6P195CA0099.outlook.office365.com (2603:10a6:209:86::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:31 +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 AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:31 +0000 Received: ("Tessian outbound e44de778b77e:v62"); Wed, 01 Jul 2020 14:38:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e9a5c5b58b9c11d2 X-CR-MTA-TID: 64aa7808 Received: from 547c77bb9c69.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9B8F157-FEE4-4CA9-9E6A-AE195AB3185B.1; Wed, 01 Jul 2020 14:38:25 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 547c77bb9c69.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:38:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDTIuKzy4WdDL0zNUjBZj5E66pDDAAXzQDdTUJOu3i6+wZA4eXcmMsGywkTUloSCX8USSeRrFp7YABW8MQTGC9sUSAoSSsHE/O2xPobwZIevYIeu1ZdZkCSnR/MYIfyvy+wOC/nYwoj5ug7TPwNMU9dZQXcNJw8JPWz9vVXf9Eod+aneJw/J0IorL+jXoEoSxWLsS6qO1QKrC0NfS64Ld967YA8zkAWsFcV6wxUwFEjYdp+Xf9SQsOwJxDuH5gfolQ4icS0KtW1Y3Cjx/PIRnYWsD+nlGDHouzWChNwIzGFJpYc4XKAfX0i4dr9jrHZ+uS5tXA0rQqiQeGlSUln3YA== 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=lo+B45wbZAEfRfZtjx7iB3ECg2FRPt9kYXt9DA9+UWBhzd7UK0OcvXasEcsOo2gFYJbG7NnRKvHGNjwHpXTN++oTlaneBYcP/8fk8XquPXJDyiLXA55y1V1HI/aiyf8WvTBsYSMYd42Kv5YSw37X11YwwcExA2whCVfg2HIRTGmeJxAy1R2ExyFmgisvObwe9OpxOVCyODWLfKd45cZCi81knzqoCEobN+c50bQVJC3TbB6AbSY2c++40QJqge1mC1hTfb3uqRZlYeMvKZPdAhR2DY+52xGkxyYxev7X2MQrk3sjIUpCyDchon285AEvQdeqrfH3OTS3XMEqxx/4mA== 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=lQiuGrw5hTs85jLjB/jT3f84SpWsLrCrRDeZpAWiZ0cESEHP2CUlgnCqq7b/CITNlChbSNeyfWGq2EhvCtcRFScQANY+lLr5ZY1FrPs26shjBHVOk4APGulcM+PRONN6DxmRtR1t38DtjkhANe2q9kOdWil8S1zolvFJ7Rw3O0E= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:38:24 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:38:24 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 03/14] aarch64: Rename place holder .S files to .c Date: Wed, 1 Jul 2020 15:38:18 +0100 Message-Id: <82ada98d0c9b1f15c759b203e95a2550ece31ed3.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0234.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::30) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0234.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Wed, 1 Jul 2020 14:38:24 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 886a5864-0602-41e0-1ac8-08d81dcc6d48 X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|HE1PR08MB2649: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Dihf5iQquMORqBDUqfmJs5mTyTjVlHlrg85k1AvcQ2zqiuMbuYFJ9BkbyJFDSOJRFlcl4drET2u7FxnwQNgw4i5Th5XOFUJnKMBqlKIXDSvoTL4GnZlqZhHHp7TKVj87pA+EpA1vG0cwqwY4scsUj0bpuodyEOKgXWMud04JIeKRgpe4f4jsSCIefipSWCqS5sbNZHDbv8v6+7JPeURSuV+jzFELAUUgYgy8Fuz5auGcXa9JjJUO7d8XQQuvIsf3fl3+jsfBGjDFrIHlDi6+yg2rZzb3VGrBBaan4O0lDiVm1dRWUmrzPBmFTX9R4Ap1AkF88+MygDh8aUb+PG87zsA0CDYhCobttAsA7jeNRNf4qmwVlbCvdDN230NsLT5UmcloCT4JKyBwP5HCkG51dq0LMTYJiMy3GpNxDfeyxZLq+X7je+xHYkttX4vz70ca 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(83380400001)(36756003)(2906002)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vq1Yu3kHJPqurtJF6FaERl/34VdgI3KXTMZztaPiRT8G6pYdzdLtmpByhkhOAcx5FdE8VAjfNHVpIcF7GnvJ6+aWI9CYX0QpfFfttzhHBlDtHhRw432Z+LFEk8tbROw0nPZvlg1I6gzBQJNpfrcMEeDlHsfKf3yJI+4eDojesAOpJqXnE74qBNjzSRVXH6aqLSzm5Qu6p6OoV3+gQgt8We+tZxETbueQ1Acyc1BTH/u3LBq9Cdkx2E/qbMkcD/KAPwFVYeVSoWXi9IEjvM/3cH5OOttBGxHMryWsjHvHbcOVKnBQw67d3Uweg5X5mCjtCAtBFSxRYPM7NE0oVYAwNMAa6MeJ2ldCySFUJ1v4M4Vl40fhD7tvnWxl6/0aLPa0/0HW+64QssG57fgBumKGXdOPrX8YhcvTB5JEIQk9bgmII7yaqlQmFldsO5nlBI+LMBVbpWYDbBWpFGGSgOeFVo5UzrFsr8fzUa42MuEgLB2drjw09fsN0ElXIpxvYlJm X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: AM5EUR03FT013.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)(346002)(376002)(39860400002)(136003)(46966005)(82740400003)(6666004)(356005)(478600001)(36756003)(47076004)(69590400007)(186003)(16526019)(6506007)(82310400002)(70586007)(70206006)(8676002)(5660300002)(86362001)(6512007)(6916009)(36906005)(956004)(6486002)(2616005)(8936002)(81166007)(336012)(44832011)(83380400001)(2906002)(26005)(316002)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0d5d27ab-b40a-484d-7494-08d81dcc68cc X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k6kN7iM3sipO4qh98JAMCemDwgOnJdu4neCdul1XD21C3BToCgU0S/RtdoZJ9qoyY/tXLqA5Tdz1x+OqIrQ4BW0VDBDXHLJbRm8smGmOCvpC6/Lu1kXG3OvGfhs+BTZDWa7LWC4dsPpTinxfC2qLGq3UqlZz2HRIgxF14Zzkfwsxxrg540fJwSNjZL13i+ZuO3kE9XfEzFaviYpXmj+tUMHG7FKe7D1dEtLgikRTtn9L6Ll8Fh8mndd+KQCFusvWmHcAx8bSSsjXtlhFTWLGg///ntdW6cKPf7ZcUjEH+SKv0cCZ+c3/oCNj4lxH9BGB6lGRD2KQcldm8bW9DioPiB9h3c9GENMwPOFc8KfRCzu1/mVHBfse5PvmCsj5fZfvEmfSO1T4vj4SVILZHleqCiOTuc4kwGP5BKuH4dbq621+6z4qW8bErtFcVfMaFkAERJgTNgxEgvmnEnNePEEhaUglRwrO9+LrxxFxCz+2wpVXy3h3G/J3l6wNhB76gqDa X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:38:31.6311 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 886a5864-0602-41e0-1ac8-08d81dcc6d48 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2649 X-Spam-Status: No, score=-16.3 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 Wed Jul 1 14:38:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=ofUeIfsA; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=ofUeIfsA; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkPT6bCZz9sQt for ; Thu, 2 Jul 2020 00:38:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF39F3861812; Wed, 1 Jul 2020 14:38:51 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140055.outbound.protection.outlook.com [40.107.14.55]) by sourceware.org (Postfix) with ESMTPS id 5DD913857007 for ; Wed, 1 Jul 2020 14:38:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5DD913857007 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=udWIBWqCP7In1BA5q84afMPWwqHCmqXW/Cac04rTBGg=; b=ofUeIfsAreV3v2SfDMrMQM+RymNarqmBR02UEyJtG3lgCHCq1sEw0dUJIIWTvtzKH+3Lq5PBfcED6BISKuStuxhp68rfQWx6YaT2fxd4LD7ptcQ5ThjqweHf0pWAkHV7CcZAnkL14XPcLrxTp20Qt22dly9vnNQuT1fEUaqh0Z4= Received: from AM6P195CA0016.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::29) by AM4PR0802MB2225.eurprd08.prod.outlook.com (2603:10a6:200:61::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20; Wed, 1 Jul 2020 14:38:46 +0000 Received: from AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:81:cafe::1e) by AM6P195CA0016.outlook.office365.com (2603:10a6:209:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 14:38:46 +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 AM5EUR03FT046.mail.protection.outlook.com (10.152.16.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:38:46 +0000 Received: ("Tessian outbound b8ad5ab47c8c:v62"); Wed, 01 Jul 2020 14:38:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7079544fdad90299 X-CR-MTA-TID: 64aa7808 Received: from c95468a44173.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8518B6D6-091A-46E7-84F6-CF0915C4D8C6.1; Wed, 01 Jul 2020 14:38:40 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c95468a44173.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:38:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gVffhcCAiePz/V/pjNBr0aESWSx8xg7G5Sd9n2cASYb9vYFmMH+XAqSgOO+F5Z2woCq20dlRhquZqe7WFntxkhpHrXqiBmTgvLpi7puJBfkPIbLLlMM+zkdflD+uEbifYs+i4noNdvGR7ObFUADoWwAxoZZ7rDqpa4eqLEp8yAcLZ8I9Sj9BqLKs0lJr/0XbGRUiaLAcBPwoqSRe5Qx+/iBQoyyKMmHN33ANdmztESxlp4OTMBlHNQJsplxU10en7mnvPSm1VPoq28015Reb8NhiMWzRwRJzSWFqhkkoYoNuL6xa7L8q2/OltmWphItb/zGyf/IZdY0V7UaK4xUxag== 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=udWIBWqCP7In1BA5q84afMPWwqHCmqXW/Cac04rTBGg=; b=DJxxbZjRTOdg/DPCshS6IPvBo7Txg7v6XAW9Y8MBc2fSb5tYS/iIBDpr4QqmDFWaCM2CXRJh358ncxGwPU0l3SxabWJWJHT8BqihqBa3gpkDZTsUTjq4h5lhJYvnz6J85eE0K13XOEBVQBc2p8R/ieBTNBBU7iUZiu/uPZprvpK6JxJO9p3iHn9vECxPO8WzOmFK9JI0UNHE6sxduJmrzBgwpc1g4+nGmWjN+vpwyuGJkqvW7gb8sCNtFZxnfGNnW3fdQjFsZdeqszKLWlUOU1OGX+opZD61QDSyS4qzvtDIZDdcsCxbQ4sTzIAZK8oqfqFJAsmX4eXqOCyYeO+pEQ== 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=udWIBWqCP7In1BA5q84afMPWwqHCmqXW/Cac04rTBGg=; b=ofUeIfsAreV3v2SfDMrMQM+RymNarqmBR02UEyJtG3lgCHCq1sEw0dUJIIWTvtzKH+3Lq5PBfcED6BISKuStuxhp68rfQWx6YaT2fxd4LD7ptcQ5ThjqweHf0pWAkHV7CcZAnkL14XPcLrxTp20Qt22dly9vnNQuT1fEUaqh0Z4= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:38:39 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:38:39 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 04/14] aarch64: Add BTI support to assembly files Date: Wed, 1 Jul 2020 15:38:33 +0100 Message-Id: <538d810c304243abab025415ad4f37c29ac1b4b5.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0066.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::30) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0066.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21 via Frontend Transport; Wed, 1 Jul 2020 14:38:38 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b7034c88-07d8-4701-fdd9-08d81dcc75e8 X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|AM4PR0802MB2225: 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: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: iK/KYAz4s380ve9ZeN4snwinXBjFjGil2JFzavRHnbW4XeKvVbICG50QEzPgcXOofr5B5EHuihluMkUoKx6E1lGR3cedQJvFmygnACV4xh2XEITzufKJRKVViqjR0PWTKPwnThNyFCe37YpuCkNd/AhZI0HTCdHpWKDqtamp3sFpC+XUQipZD7uJ2XBdaw88FRnfpinkdReXQf1qbt1AUCKAnm9q3a4x8ih0Io3xJF6xABziPHfph+IvNcEBoj9o2ecIizaPDcjDG7sa/MfduskZ6mRpE2Ier0nye64RYCY7xZQ8LI6HxgGFnVTNDagcqbcXb2y204vMwWvV+/yA1mCWS9X8i0+K3YflzFnX1mfoFBHAXWq9m+tWqRoTyRQiGDDqglICmbufU0h3pAvrtRnNBXjcLjHlfEnVtad/k7ikchXpYBKuG8WRxW+KxLbup8YrLafBtfHF7MavpPPzfeWGMjfW/3kAuXLoSeXUGlZA3GPbbNSGVh80nHVTlMj+ 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(4326008)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(83380400001)(36756003)(2906002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7PVcS0dhZf40EfFh+0ldF0pwKSKB5S8OHzkM2MKrQV9994FCG5ngJvkYXn6B/Wcl76sDhTAP3vqS6yTaefuHwAoxf83ibLMjgetYK1migBkNMfN+EN8mtZlnSwN5yRrSbQs5O4dUBHjv+1cAXHRh4UVUENwA3MQVel+T5HP/bmp0PXQKfa5axdvuhvoIpeX0oZ5Mqc1/qa8PTKTTKLo+N8VtpQ+vmb9vAiqSM8x25OH3qOl1xfxixJOh+F4+XgxkCDiMFvg2xdOOBU0zYjxqT6D/2TjjZXquMmJ5JpurfOydDidJnOILiRYbAutx2kxtdK9qsYXC2npHSJ2KUU61L+1FfGPSnYTM77yUadT5qqSMxSxDlMwAer/W1vWDMw3VU0BugSfLzXGwZ2BBesqExmxz3UEANBcVyFTvWzjEamh4WXrQtoUVFWygM5R+yQO3cwJlp3asWhir2LqzOkppDUyHzLdCamq2nHh+fTVCdHfYKq5OaurDqQHzIdNiCcCk X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: AM5EUR03FT046.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)(136003)(376002)(46966005)(82310400002)(356005)(8676002)(2616005)(956004)(6486002)(2906002)(70586007)(81166007)(70206006)(36756003)(83380400001)(336012)(26005)(44832011)(8936002)(478600001)(6666004)(6512007)(82740400003)(6506007)(36906005)(47076004)(69590400007)(5660300002)(316002)(4326008)(186003)(6916009)(86362001)(16526019)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 171a1a96-6597-451e-270c-08d81dcc71a4 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TfaBjMH8qJewlnp+I/daGQXJjBks83EjsFnIyORT9UplKeNsBhYD540tG+Wit4IcIT2ve32Ri4Y7Yzn9osmrJrWlSp4hYDuS3fT1axU73rMADJCFlLOrtnGScU+HPI4c1EjJbPZBXruXCy2TbKITo2+lHFmPC5Kg5Y2PxJt/LrMAxYmBXUu8yIESW245HpRRUb+lsrR25O8qbqstG1eqV5NJf7cC5Elzq4nJCQsAIaAZFkrZzMspwdME9a0TW4pcagEKHS4LmcsFqt2uZjmqRHFb2gNMOjk4k7jic6LK7TZUPezTpwn1gHdhTBYC/FtjtPN/8wVZDhnvEvR+KDwdn5EfXbpb/jsr0P2iG/66vsLsgPc9b2kM/Y3y5pIx4fg/hRRcPPpQJI2MjaJrM2QMQ6H3Wqwi5B4EVIn8lwmVQGvkoF0R3vC1WLOlXCsY3evdUkVUMn+cNmMM2tqQ+TUTd6cZ3Y0YzArYd1gpaK6IUTLsAuLpVd0RT3rJTO9oprAUejPfkd4UhUySI6NZjV51rMFAil27C5JD4MxmSSw55Kw= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:38:46.1132 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7034c88-07d8-4701-fdd9-08d81dcc75e8 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2225 X-Spam-Status: No, score=-15.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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/multiarch/memset_emag.S | 2 ++ sysdeps/aarch64/multiarch/memset_falkor.S | 1 + sysdeps/aarch64/multiarch/memset_generic.S | 2 ++ sysdeps/aarch64/multiarch/rtld-memset.S | 2 ++ sysdeps/aarch64/start.S | 1 + sysdeps/aarch64/sysdep.h | 34 +++++++++++++++++++++- 10 files changed, 50 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/multiarch/memset_emag.S b/sysdeps/aarch64/multiarch/memset_emag.S index c4d3533c14..3c2e9d2903 100644 --- a/sysdeps/aarch64/multiarch/memset_emag.S +++ b/sysdeps/aarch64/multiarch/memset_emag.S @@ -17,6 +17,8 @@ License along with the GNU C Library. If not, see . */ +#include + #if IS_IN (libc) # define MEMSET __memset_emag diff --git a/sysdeps/aarch64/multiarch/memset_falkor.S b/sysdeps/aarch64/multiarch/memset_falkor.S index 54fd5abffb..154527398f 100644 --- a/sysdeps/aarch64/multiarch/memset_falkor.S +++ b/sysdeps/aarch64/multiarch/memset_falkor.S @@ -17,6 +17,7 @@ License along with the GNU C Library. If not, see . */ +#include #include /* Reading dczid_el0 is expensive on falkor so move it into the ifunc diff --git a/sysdeps/aarch64/multiarch/memset_generic.S b/sysdeps/aarch64/multiarch/memset_generic.S index 46c5329cdf..d746d1d00c 100644 --- a/sysdeps/aarch64/multiarch/memset_generic.S +++ b/sysdeps/aarch64/multiarch/memset_generic.S @@ -17,6 +17,8 @@ License along with the GNU C Library. If not, see . */ +#include + #if IS_IN (libc) # define MEMSET __memset_generic /* Add a hidden definition for use within libc.so. */ diff --git a/sysdeps/aarch64/multiarch/rtld-memset.S b/sysdeps/aarch64/multiarch/rtld-memset.S index 44bc479411..f9845bdd62 100644 --- a/sysdeps/aarch64/multiarch/rtld-memset.S +++ b/sysdeps/aarch64/multiarch/rtld-memset.S @@ -17,6 +17,8 @@ License along with the GNU C Library. If not, see . */ +#include + #if IS_IN (rtld) # define MEMSET memset # include 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..4664329d3a 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 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 Wed Jul 1 14:38: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: 1320548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=uzL9Hnyp; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=uzL9Hnyp; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkPm46DXz9sTT for ; Thu, 2 Jul 2020 00:39:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 920083851C3C; Wed, 1 Jul 2020 14:39:06 +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-eopbgr70045.outbound.protection.outlook.com [40.107.7.45]) by sourceware.org (Postfix) with ESMTPS id 93E653851C3C for ; Wed, 1 Jul 2020 14:39:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 93E653851C3C 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=uzL9HnypSVqyxDRB403Hbv0qWoQogdJzdeY8NuE9jNbia35lqYuTj0A7CzPffPjqXRKCJqEBgwuWeuQAZwRd544NMTzdTImMQKhQzXHe4Seh1KMYN0W7BYgk+7mLUjuHMoHXjPSlFvGMkK68jDRdGesl8vOujmyjRXtvhVsIDpM= Received: from DB6PR07CA0202.eurprd07.prod.outlook.com (2603:10a6:6:42::32) by DB8PR08MB4009.eurprd08.prod.outlook.com (2603:10a6:10:af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.23; Wed, 1 Jul 2020 14:39:00 +0000 Received: from DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:42:cafe::8f) by DB6PR07CA0202.outlook.office365.com (2603:10a6:6:42::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.12 via Frontend Transport; Wed, 1 Jul 2020 14:39:00 +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 DB5EUR03FT022.mail.protection.outlook.com (10.152.20.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:39:00 +0000 Received: ("Tessian outbound f7489b7e84a7:v62"); Wed, 01 Jul 2020 14:39:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4b5b76072472fe61 X-CR-MTA-TID: 64aa7808 Received: from f162b5fb1c32.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 81237F47-6FB9-433A-8EB1-BEFD2575FCF6.1; Wed, 01 Jul 2020 14:38:55 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f162b5fb1c32.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:38:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DwyVhkORGbsGXNhI5ipRAszdZRh6SbM2VfIyGhDOMpT+HBVZaGisA6xx9ynrCJuNhxJkXTElhPUSL4kiXhELJB9k+V9Xq2mGhHPHMa57yRmYCnbXr18B8YMmQeZkC03Y0Nd+GMbheQYUXN2LpeloDP1FhmyNRlXrhOVW6bjiC1AIn23A9lSg2AjDc286iuoQRlbXrA+wzw8C7EnkfhbHfejhsRQ+Z5DP8O2JFR0L+/Sk6jd0vEf5FblqdJ2kyz1JN2Y3lcthomEuO0tjttPhpncleATBMf/ASj6lR0cYVEsD/A30LtK/yFsT0NV8lzXfSfcOiQDv1VQJemGRIB7KrA== 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=DP5gbdJ3Zllr8AJPRim9QZEicnksTucwCxcI0hwXRaE3WkUE/tf+9mamF7utBkCg6AbaFi/cD6ccCfTAVKDtmx7gvGHdRwPr8StaIXaVnqNgV2UkTh26aWBqHwsV26a0VlPFh5D8FdYaTkjEby2ffi/ST5O+TeBu0iXfTZPdZcakIVLyILTzvZ73rYaDUD/nrZDU4MJmMRloArEDhQyPBuYDpFMirP8Yq3xSdHvblZO8MLQKA3F+d+n1oBn3xG8MXpmHby8XycfX2WLCxxFdbrhNpdgVDyhjE+x0hi4D/2vWOPhlXnHYwof8yxQm4RbDJf0fDgPfkOACm4XSQqdSuA== 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=uzL9HnypSVqyxDRB403Hbv0qWoQogdJzdeY8NuE9jNbia35lqYuTj0A7CzPffPjqXRKCJqEBgwuWeuQAZwRd544NMTzdTImMQKhQzXHe4Seh1KMYN0W7BYgk+7mLUjuHMoHXjPSlFvGMkK68jDRdGesl8vOujmyjRXtvhVsIDpM= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:38:54 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:38:54 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 05/14] aarch64: fix swapcontext for BTI Date: Wed, 1 Jul 2020 15:38:48 +0100 Message-Id: <253856128371cb591893726ad741e6b1a5f88d99.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0362.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::14) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0362.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 14:38:53 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 047fb625-815c-4bbd-c86c-08d81dcc7ea2 X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|DB8PR08MB4009: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6AL52KBsb5uvo7AqelAQqmvii1LJqw5CakyJUz1jxvx9TYS+vBtfw5D6EoMkDBNmGbG3qS2or8hwMhkVI4VVZVXCEgu9ayzwSy7Lpyl79uSq/1oFfRPJEdX2c66+yIGx7Hb6s+4WF35jsvTF2FdDeDC66Hsoc3McDvtL9FxuUlb/5Gmxy0OsROq4wkmeP30A7jROElm2FYpusltun/mzWJiJaXVbs45zYdTySHP/4R6oJPD8MMsjPF3eSSMVFaayNRQXYqCVh1ZH2ESFvgY3gbcq/4wHSp9KsVl1TbvfxqA0KL+BPrIIZek8h9PZrtdQ3QVZcfyZxeBmFDJpFDS6vbhQG8vtzOzWUk/JfBa/nEtdYC2EGBIkvFc1JXxgPvJdsvTECPue2nxIuNdlNL0HwEOHVA9uWfq8vvYgWY8slgY= 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(83380400001)(36756003)(2906002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PfduCPZYWtTzQuL1V2WYz/lb87gMieUyeCsTHfAEU2yGYpt6Tb5x/5nfbMhGKlmCFAZUsbknXxnTDOa/NvaE5RM0rUvlA9t8CLN3cfPYCDkuhq1fFW0mI4OjfTyp67sU3vqw2kgBDqFZiNjcUbEU5ept9++0GuRtO7NRV7MQI7jJ+CPn1qbI37CdeCIlO/tX2a1nOFwzpEI+jnVctnw66fCyMU6tTK5AviBA00zL7rZ8RG70G7yYlbjOphMmMwZOHbRX/paim3MhSakpZlBIPvT9VLw0fRODZIbs1jXneFWfKtfmoXucK8KB94g+S16Ya7bqF9/QL3ESgqU1hyGvvV7Gr3W19cju/MyWpe1ZNqrbjbgY6uZs7ElzeT4JtYcQZ79tKjW7Jo6MBLwV4tI6LLXNJTbNNN/HVw/T6ID+ABGQJOYVQxHjYD/37ZEs2cm0WLma+L5QH7I+UVeFmBRSjTnPL7FFjdbbsBaKgPBdB6C6CUdIBZ7NZ0WsclB8ZQTL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: DB5EUR03FT022.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)(346002)(39860400002)(376002)(46966005)(70206006)(186003)(2616005)(69590400007)(956004)(70586007)(47076004)(6486002)(2906002)(6916009)(86362001)(6506007)(316002)(6512007)(6666004)(81166007)(44832011)(36756003)(356005)(8936002)(336012)(26005)(82310400002)(83380400001)(16526019)(8676002)(5660300002)(82740400003)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 93c364e6-7f71-460c-6d5d-08d81dcc7a77 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LTuWsnQldBIYirAJtHeBiV2Wc9ny4ZV9gGtyiURBWbudBfwKCbHC03/72Hc0+XhAvwoUcHAs6Rns53Oke3daX/KxocjKjlD+29N29R71Xcho4/OUfL3pWq1ftkx3iYCIsSbAI5DuX+H6O1cJ2vgjHgqyt7nj7lCcRClBHsyl7fKmw032Ti0/v1uEUsDdY+TRSg7Y++2kYN5itOhw59taoHnLWaHdI92diD/cNBErMSkstjAfWA5aYMNn/1bIr+C9ncFN66uX5NFmhWBqMaUCibXrm8F22Uu4mDX0xxexKpUr2Oxqkra63Mnbg2kfK66YgpED84hYNTLX8EhOG9P+KsEEJPQyTIqlTeiIZbpOyXcHEQpJk4goqX8b3IyNMMcik8QW88S9S3PKbSkLjwL/QzPJ9Zl6Wz5MShZl3TlulX1c4MWxmmDs9zowm4Om1cjNdfIAjX1coOl+iSHoQmCGpQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:39:00.7986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 047fb625-815c-4bbd-c86c-08d81dcc7ea2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4009 X-Spam-Status: No, score=-15.6 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 Wed Jul 1 14:39:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=WaF35z9z; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=WaF35z9z; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkQ218PHz9sQt for ; Thu, 2 Jul 2020 00:39:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F18B43861821; Wed, 1 Jul 2020 14:39:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00045.outbound.protection.outlook.com [40.107.0.45]) by sourceware.org (Postfix) with ESMTPS id 999B73857007 for ; Wed, 1 Jul 2020 14:39:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 999B73857007 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=WaF35z9zvIFCBPyzIs81Wq01gQqTaDMq5MaqUsCOL/u2geb6R40qQfnEr7FnfGHdogcs8l7GSlYQsykt3QKsHMyHCtNaVrWXGfk5DWSYYBcINZA0nJWMJK7GXzRJVlS3tYPfI1ZRLsyVZ+oP0piYCo49NOT/BJnln2gELn4g7pQ= Received: from DB6P191CA0013.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::23) by HE1PR0802MB2330.eurprd08.prod.outlook.com (2603:10a6:3:c8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:39:16 +0000 Received: from DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:28:cafe::3e) by DB6P191CA0013.outlook.office365.com (2603:10a6:6:28::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 14:39:16 +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 DB5EUR03FT059.mail.protection.outlook.com (10.152.21.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:39:15 +0000 Received: ("Tessian outbound e44de778b77e:v62"); Wed, 01 Jul 2020 14:39:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 93d0f6e57135501d X-CR-MTA-TID: 64aa7808 Received: from 506eb7741eb9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9B0B920F-7FCF-427F-A8B5-1DDDD07ED96E.1; Wed, 01 Jul 2020 14:39:10 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 506eb7741eb9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:39:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OhGFYoCpFa4gCbukrk3eX2r2L3XaZgp58dvkyl81BNcMwTDfnuzFhZVK0Vd3OFHMulTYx+9gqb2cgUHKg6p9pc+6p1p+jV0muoLg2ZPEhaT8sgEUdllvG7dgb83Xb38j2xZaoqPqiP5jn1lAycFM8fjD6ZgY57HLouXflNguMzigvPqQlfhnPeQZSqkH8ho0wnoS63RRzwiTx/SJ9AJrXXtMT34HfXQjW0VPSlpRm/hNlwxJpzLI9FeV6M0JOFWAU/h/xL7+gQ7ETixG7p/j4dulExtLnkiNAhKw9SpzjXyen4PwzjUF69llCdmAlCphP5/HIdregdbZBisSShvhAA== 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=cerk437q0MBQJ7UJTh1hTxOvi7RZ76ko5owSmiI0DstfQPr/y7rxe1L09ceP+reokZue5wS/2ttanfOUKQ17X/Vtt9hVHvv2y1IOB8VH+X5U6c7NOy0N42IE8Vw1b8UCz4NGw5PyDXhLTSSfmAaqCnS/gbLS+Yl3gkwJwL2e5+c1Sa4P782L309FjuPEwik9w4aLPogCd4NCk+0jhR21hGkp3qpGbZl2HD/YH/26r/9LwWsonsmM+0fJXnIWZyu3rFflhcif0m0II7E6Hqv4qrEYNaEkpNNclRZiqhmIU0ewn1Cyj80IrNEZbAgivw17xj4nkDw/YC7UVmKXEa7XPg== 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=WaF35z9zvIFCBPyzIs81Wq01gQqTaDMq5MaqUsCOL/u2geb6R40qQfnEr7FnfGHdogcs8l7GSlYQsykt3QKsHMyHCtNaVrWXGfk5DWSYYBcINZA0nJWMJK7GXzRJVlS3tYPfI1ZRLsyVZ+oP0piYCo49NOT/BJnln2gELn4g7pQ= 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 AM6PR08MB3813.eurprd08.prod.outlook.com (2603:10a6:20b:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:39:09 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:39:08 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 06/14] aarch64: fix RTLD_START for BTI Date: Wed, 1 Jul 2020 15:39:02 +0100 Message-Id: <39dd4282abd042c847dda7dbac8060ca2a7dd856.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0281.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::29) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0281.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21 via Frontend Transport; Wed, 1 Jul 2020 14:39:08 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 77cb1b05-0fe9-4cac-61c8-08d81dcc87ad X-MS-TrafficTypeDiagnostic: AM6PR08MB3813:|HE1PR0802MB2330: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ohhv3WMsnNZKS+f6IjlBIsm6FjQm+XeoKVt7c3QVrEC4ijAtvPRvttzqvzgtrK2VQLVuVUz6YSBKJSZ7NFNsPsilh5Il9V8+OyiDHn2qDX1tYXmBFiMjSjzELn7KnHHrX4mMRgHgwKPYteAFYXIPGUlqgyv7g0WTXLi4gWYMkqlk5fpAoK72xoOImbkjKIFD6nj9UrPcNfV2e9cuP9M4X68Z0kZ3GElkrt8DUuzOC4ZaCJMb9izNXhB/j2OhP3AyvJKrsMiJ4bWLMMKZqDNce7FEBksDB8uvp0DAuoUBRvCi3/e/9clwXbVW4xUOtPafEKrnM1r1zzMjzuBrrjEepysX4EsSFXw7ZN0uAhYxSlqKCm1o0NQ6/ywU0iTgFj0f84sM9XLYi99FY4STMBSVD8ZzKP4AU3xU+m4gytgPoSw= 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)(396003)(136003)(39860400002)(376002)(346002)(366004)(5660300002)(956004)(6512007)(8936002)(69590400007)(66946007)(66556008)(66476007)(6506007)(52116002)(44832011)(478600001)(316002)(6916009)(86362001)(6666004)(26005)(8676002)(2616005)(6486002)(16526019)(186003)(83380400001)(36756003)(2906002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TV/LaRCrKI8ST2TM8UP/wDvwYCz79j4F3ImfJdJzJ4UO8xoy8HT+rCyfEdwR82fJl1OYl1C7ysLbh/rBb5Ds+feWKPiN/Kq1LV7d3cV7+IrVh0V9BnCcQGZuaNhy27vSsbALqdpie7gpmX3ILVdfyGyk0wBMA72LbNbGSVhMKzgBXiOVtlIzaFyiyQXM+M2SlZJdXUpXDZQ2kBW6TkpgcpnhfblxziUf5ByJ6XsSQZSAouk/PgaXFMa63oyAP72kaTj9hzjB/+RDjjDVNxFiSWuky6CRHh8ustpc+kHY5BNHGU6AgpKKKCzK6ehkvRi8ZPwmm7JxPrhYzNoNZnhzH8LY7IcQ61b8XK0eTMFJxZCRxuFN7+eeDn7jJrg3LnDLt+JSsnhMdJLySJ+3f4KDJB7OUaD5zrePqcct02FGXHW0pduSCAOTF6rUWLIw61yx1YaZIv/N21B/tl+kztx5n0X48q3UEi6BOn3vIX3FS3jBTDmbmE/dcgMomIGVreny X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3813 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: DB5EUR03FT059.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)(136003)(346002)(376002)(396003)(46966005)(6512007)(26005)(81166007)(83380400001)(316002)(16526019)(86362001)(6486002)(356005)(47076004)(6916009)(8936002)(478600001)(336012)(82310400002)(82740400003)(36756003)(8676002)(70586007)(70206006)(2616005)(956004)(69590400007)(5660300002)(6506007)(6666004)(2906002)(44832011)(186003)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 587ad626-f3f6-4e79-3d45-08d81dcc835c X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6vDLrlRsB8CaGc+cK05ZlskcBCNYBWqVgCDa+yGLGaEvkmR/Z3YaWQFh551b0liE/rCZfDzvFu/GNkGQpjSr/3IiDW4TildRAuczrEx22gqQKh4EfhkKGNiNiMsoCL17VcUibaqtXvdyrcj4Spv8DoK1OtQisVBdhcopQwdQv4AU4K8Ebc0/5LMl4yjisIOxkg0zHy2Ztrasr+s+21neVDZLmhDeJ5wsp3De8fs8BZRbxjJrIbj4wqxPLc0fcOKjwztOq//DFBDoZNsa5qluMGgDU3XUsqBipeWLMjMgohg8hxjhI1ucMAAaEASjwmnQVX6C+GY7/odyS0xbz9rMnG8oxyGpmvCNgXlUUDNjmcHeCDw2kAijKTcabnSTTg//w0Vi053Uq6HB33M6tjXGilx5f0O/+bl8pbYUtmuhSzuy5ugMMyBitAwaSmWtAAIpDe+zec2lhftxmoyRu6HE4w== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:39:15.9676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77cb1b05-0fe9-4cac-61c8-08d81dcc87ad X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2330 X-Spam-Status: No, score=-16.3 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 Wed Jul 1 14:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=gW0tzTV/; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=gW0tzTV/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkQN5y7fz9sTT for ; Thu, 2 Jul 2020 00:39:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E7FE3861841; Wed, 1 Jul 2020 14:39: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-eopbgr80041.outbound.protection.outlook.com [40.107.8.41]) by sourceware.org (Postfix) with ESMTPS id A14423857007 for ; Wed, 1 Jul 2020 14:39:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A14423857007 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=Ytsbhac+T0/gheTIVc0Pl4c+suCeuSoAt5XRkWYlbZo=; b=gW0tzTV/acUn3syXgUu6OhRtthI9pnDp3HlgUJaJka8MLFyNc8z9FFhEGbcBSBAZ2vmS2qlBbUjWy6y3VykFY8optn2C28/ODaM1SfWIKswEJNPtvilbUhulP4d1voIqxLWaNyLleoUfoCqccEgSfQdGyZyN2rOUxPQSH0Gpm5w= Received: from DB8PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:10:be::19) by AM6PR08MB3927.eurprd08.prod.outlook.com (2603:10a6:20b:a1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Wed, 1 Jul 2020 14:39:31 +0000 Received: from DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:be:cafe::fb) by DB8PR03CA0006.outlook.office365.com (2603:10a6:10:be::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Wed, 1 Jul 2020 14:39:30 +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 DB5EUR03FT051.mail.protection.outlook.com (10.152.21.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:39:30 +0000 Received: ("Tessian outbound a4b10e5b482d:v62"); Wed, 01 Jul 2020 14:39:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 159f866b3c349364 X-CR-MTA-TID: 64aa7808 Received: from f317234e8b6c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6EBE48CC-19F4-4C59-B803-FA94F9E746ED.1; Wed, 01 Jul 2020 14:39:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f317234e8b6c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:39:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JFQfSG6AWnjnR+yB3MSmAu9h6x28T5AdYF5TMHy6M1h7D6etodABfXprf5XQtcgscZ0qRuEh9JpwOq4CbPsGLItG/ad7uv5yjfMLYrS/9gpACJNGvvGcwQRQ42PS33wVoTTc68VB8Ar/3rAlRw7aeU/gef18mlUL2Nz5186pD0zh45kGkGwda8xFEaeaQyTMqaYdgVRO0PWAiX5ViNgLOV6ZqET/pJ9xXrJmM3Leikm9/idaEtkVZFrsQdtPyJPt7QKhSyxYcdhTpge5b5ydD9MJzFxKWon4BE2DlDE2w+++aK17/61KZ/svmcXC8Gu3onzCYas80lIcUmcj49y6BQ== 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=Ytsbhac+T0/gheTIVc0Pl4c+suCeuSoAt5XRkWYlbZo=; b=CoTGBM6OBWnmUnsfw29eJyjF++uS/G4nsf6KHEA96WP+B2yD7qwjjvve61zAPuqSTskn/i6D52Z3/tPcphXyoKpEVwFd2hdeWUxOookjwySGY1WJQ5DZ+GECMay5TSdwK0WK6eMRF3FivW3Cj0r4BAKxSOiRJX93lk0PIEwga+DZbE1zl8s9h3NGsKscFoHtbkJVg9yAaBpoX4kUluJSAOwF/ljktzKVCaJS+OvVbfa3GhGzrVk8Vt4nPRxaLrTZRKeDIGjyT3/+0iAmvB6MLkd7QCghJXbLM2UeJ1Qoq4E73VSM/eWx0LchBMgZJNRZZ3hOTub31OWMviME6gybcQ== 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=Ytsbhac+T0/gheTIVc0Pl4c+suCeuSoAt5XRkWYlbZo=; b=gW0tzTV/acUn3syXgUu6OhRtthI9pnDp3HlgUJaJka8MLFyNc8z9FFhEGbcBSBAZ2vmS2qlBbUjWy6y3VykFY8optn2C28/ODaM1SfWIKswEJNPtvilbUhulP4d1voIqxLWaNyLleoUfoCqccEgSfQdGyZyN2rOUxPQSH0Gpm5w= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:39:23 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:39:23 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 07/14] rtld: Clean up PT_NOTE and add PT_GNU_PROPERTY handling Date: Wed, 1 Jul 2020 15:39:17 +0100 Message-Id: <54251326567d18776646ce23d9d9489c6a35f410.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0286.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::34) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0286.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Wed, 1 Jul 2020 14:39:23 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bfa943eb-832a-4318-e5c8-08d81dcc9073 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|AM6PR08MB3927: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: HZN4G81axqjIPFJefUx3HUJ/E/G9tAQzA5FLZE8GzrewMAH4cOr44BeWOladmqyVlRVcvcaEVJaK0PSVgAy0cNlgOognt9sFrXX3TYWNhufcZPOtoKLTA1GrF3jV4dlQEZBkdZs4MPL0WUrhiZ+VQCFAug78xObQrYbL6Fdy57aDPhjLbLrjQHaqmu1cT7J1DqCLpCkHjQw6xgsq07OSz2t4N9ij5gZK2ygb9sUn1vg44yOAJP+TmKjdI60h5Y/o/SZvw/DeIQCYzmKoF7vsLnW/IxAFGeKO9Nl50INZIHt8GJjJSRicQ+KnpnkuAjYmua4+azaEoyh6GdhnqhBfzNth5c6aF1PjR+iMpZ2d6emzQE7NZaeQul5NvOTvWSiHmR53+dksrR4A7TWsgZTyZoFyRLGMAPGtCPwMW2X3LdE= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uoUgN/q5GRkMvZnUW3/0NCnFJTX/ZXK7jZaKS9lNZ3Oq2fxlasCl3HLI6PZKvx5rP60IXUm03qfcauVnLKTi0f4OV3xd05AfvrWqlH8yCU0lDPZ5cwrhe0Jx6gVafYiGtPEqds4nG6is8x1XbXUKd4FMAOjI27LtfPzZlCEjQrJsV0oisywEyx1Gwu0EYHv5t5nQnf7ffZjFo4jN6ApQ9mCZxqUxWzQ1nF8dAl0NlcEv6NXxr10jpJEA4puYDY9fepOxFtliHGpGQeOmdQZg8gGRmzN5pMN73jNwkSBxUEyOoVP9LZBrPW8PGfOk9TwT5mILslKcnN+NpT1z/ls5MJY2+CWtGODpQEJzu3kQh3GjHCetu2/d8GpJtphAfKVvYJVXYwbUIdWQljJzYGNcnGfzqO7MxuxCx2JRgmeU4Yt+krIx0c5pIt69MB7ibl0jR580ror38f5Hwfh6zPW3o8jTmNCVVDcly47JjCiVqno7OmgqfedAsg0GBfuLgsoc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT051.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)(376002)(396003)(136003)(46966005)(81166007)(69590400007)(6506007)(82740400003)(356005)(316002)(8936002)(6486002)(47076004)(478600001)(6512007)(26005)(186003)(2906002)(70586007)(6916009)(16526019)(44832011)(86362001)(70206006)(5660300002)(6666004)(956004)(83380400001)(2616005)(8676002)(36756003)(336012)(82310400002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: d9c0399d-ee12-490a-e067-08d81dcc8c17 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3eSCB7m/TPw4w0FpFxrXbNtihsaTvkT4EHVAqMr9OO8FRa44/wXewIxPAPqwcaojBPtcIvVpoaIS3QK8XjA0RnM49troO7VEhUwV/FtyyMXPqhSRE646c3cbjhVdWtGw83CLLGFr8LYLb3bL6SvYE1Y8+sclWaO/InJO4oNl/Wzh3fZefpUWlaphVD4vG7eSU5j04KC4zTERT6VlXM0Kl5J8jp/Xj0Zrt8l+2NPlHAfygXQO0/asSk8SpaEhNfxa5Mow+ODgLdasIk7LKRAGqTGTsJI823imP4g0Hh3mVeyiq1nb38NVdlbu+MC0jhiCLJRf3/Ft0DFmDz6886/CkCGG44TvStWtvxIMC10H+kzLFNyHIGRCzq7n0fhz4SObEW0aJlqFxgSN8lE0nXzoIiXnNTsaWz8XgUyD9Xch0VG/1e1Ijw41dZK6pVx2Rmvk0IlqYIjImv8PKW50ED2nqg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:39:30.6893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfa943eb-832a-4318-e5c8-08d81dcc9073 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3927 X-Spam-Status: No, score=-16.3 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" Add generic code to handle PT_GNU_PROPERTY notes. Invalid content is ignored, _dl_process_pt_gnu_property is always called after PT_LOAD segments are mapped and it has no failure modes. Currently only one NT_GNU_PROPERTY_TYPE_0 note is handled, which contains target specific properties: the _dl_process_gnu_property hook is called for each property. The old _dl_process_pt_note and _rtld_process_pt_note differ in how the program header is read. The old _dl_process_pt_note is called before PT_LOAD segments are mapped and _rtld_process_pt_note is called after PT_LOAD segments are mapped. The old _rtld_process_pt_note is removed and _dl_process_pt_note is always called after PT_LOAD segments are mapped and now it has no failure modes. The program headers are scanned backwards so that PT_NOTE can be skipped if PT_GNU_PROPERTY exists. Co-Authored-By: H.J. Lu Reviewed-by: Adhemerval Zanella --- elf/dl-load.c | 94 ++++++++++++++++++++++++++++++++++---- elf/rtld.c | 14 ++++-- sysdeps/generic/dl-prop.h | 23 +++++----- sysdeps/generic/ldsodefs.h | 4 ++ sysdeps/x86/dl-prop.h | 47 +++---------------- 5 files changed, 118 insertions(+), 64 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index 06f2ba7264..32c74f79ef 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -853,6 +853,77 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, } +/* Process PT_GNU_PROPERTY program header PH in module L after + PT_LOAD segments are mapped. Only one NT_GNU_PROPERTY_TYPE_0 + note is handled which contains processor specific properties. */ + +void +_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); + const ElfW(Addr) size = ph->p_memsz; + const ElfW(Addr) align = ph->p_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 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; + + /* Target specific property processing. */ + if (_dl_process_gnu_property(l, type, datasz, ptr) == 0) + return; + + /* Check the next property item. */ + ptr += ALIGN_UP (datasz, sizeof (ElfW(Addr))); + } + while ((ptr_end - ptr) >= 8); + + /* Only handle one NT_GNU_PROPERTY_TYPE_0. */ + return; + } + + note = ((const void *) note + + ELF_NOTE_NEXT_OFFSET (note->n_namesz, note->n_descsz, + align)); + } +} + + /* Map in the shared object NAME, actually located in REALNAME, and already opened on FD. */ @@ -1145,14 +1216,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, l->l_relro_addr = ph->p_vaddr; l->l_relro_size = ph->p_memsz; break; - - case PT_NOTE: - if (_dl_process_pt_note (l, ph, fd, fbp)) - { - errstring = N_("cannot process note segment"); - goto call_lose; - } - break; } if (__glibc_unlikely (nloadcmds == 0)) @@ -1188,6 +1251,21 @@ _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 in + case processing requires accessing those segments. Scan program + headers backward so that PT_NOTE can be skipped if PT_GNU_PROPERTY + exits. */ + for (ph = &phdr[l->l_phnum]; ph != phdr; --ph) + switch (ph[-1].p_type) + { + case PT_NOTE: + _dl_process_pt_note (l, &ph[-1]); + break; + case PT_GNU_PROPERTY: + _dl_process_pt_gnu_property (l, &ph[-1]); + break; + } } if (l->l_ld == 0) diff --git a/elf/rtld.c b/elf/rtld.c index 882b070cc0..f4c2602d65 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1507,11 +1507,17 @@ of this helper program; chances are you did not intend to run this program.\n\ main_map->l_relro_addr = ph->p_vaddr; main_map->l_relro_size = ph->p_memsz; break; - + } + /* Process program headers again, but scan them backwards so + that PT_NOTE can be skipped if PT_GNU_PROPERTY exits. */ + for (ph = &phdr[phnum]; ph != phdr; --ph) + switch (ph[-1].p_type) + { case PT_NOTE: - if (_rtld_process_pt_note (main_map, ph)) - _dl_error_printf ("\ -ERROR: '%s': cannot process note segment.\n", _dl_argv[0]); + _dl_process_pt_note (main_map, &ph[-1]); + break; + case PT_GNU_PROPERTY: + _dl_process_pt_gnu_property (main_map, &ph[-1]); break; } diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h index 6b0f2aa95a..f1cf576fe3 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) @@ -36,17 +36,16 @@ _dl_open_check (struct link_map *m) { } -#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) +static inline void __attribute__ ((always_inline)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) { - return 0; } -#endif +/* Called for each property in the NT_GNU_PROPERTY_TYPE_0 note of L, + processing of the properties continues until this returns 0. */ static inline int __attribute__ ((always_inline)) -_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, + void *data) { return 0; } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index d08b97a5ef..c525ffa12c 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -910,6 +910,10 @@ extern void _dl_setup_hash (struct link_map *map) attribute_hidden; extern void _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting); +/* Process PT_GNU_PROPERTY program header PH in module L after + PT_LOAD segments are mapped. */ +void _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph); + /* Search loaded objects' symbol tables for a definition of the symbol referred to by UNDEF. *SYM is the symbol table entry containing the diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h index 516f88ea80..89911e19e2 100644 --- a/sysdeps/x86/dl-prop.h +++ b/sysdeps/x86/dl-prop.h @@ -19,8 +19,6 @@ #ifndef _DL_PROP_H #define _DL_PROP_H -#include - extern void _dl_cet_check (struct link_map *, const char *) attribute_hidden; extern void _dl_cet_open_check (struct link_map *) @@ -146,48 +144,17 @@ _dl_process_cet_property_note (struct link_map *l, #endif } -#ifdef FILEBUF_SIZE -static inline int __attribute__ ((unused)) -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph, - int fd, struct filebuf *fbp) +static inline void __attribute__ ((unused)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) { -# if CET_ENABLED - const ElfW(Nhdr) *note; - ElfW(Nhdr) *note_malloced = NULL; - ElfW(Addr) size = ph->p_filesz; - - if (ph->p_offset + size <= (size_t) fbp->len) - note = (const void *) (fbp->buf + ph->p_offset); - else - { - if (size < __MAX_ALLOCA_CUTOFF) - note = alloca (size); - else - { - note_malloced = malloc (size); - note = note_malloced; - } - if (__pread64_nocancel (fd, (void *) note, size, ph->p_offset) != size) - { - if (note_malloced) - free (note_malloced); - return -1; - } - } - - _dl_process_cet_property_note (l, note, size, ph->p_align); - if (note_malloced) - free (note_malloced); -# endif - return 0; + const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); + _dl_process_cet_property_note (l, note, ph->p_memsz, ph->p_align); } -#endif -static inline int __attribute__ ((unused)) -_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +static inline int __attribute__ ((always_inline)) +_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, + void *data) { - const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); - _dl_process_cet_property_note (l, note, ph->p_memsz, ph->p_align); return 0; } From patchwork Wed Jul 1 14:39:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=nquZO9Ru; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=nquZO9Ru; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkQk2262z9sTT for ; Thu, 2 Jul 2020 00:39:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 310D5386184F; Wed, 1 Jul 2020 14:39:56 +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-eopbgr10056.outbound.protection.outlook.com [40.107.1.56]) by sourceware.org (Postfix) with ESMTPS id 6E8213857007 for ; Wed, 1 Jul 2020 14:39:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6E8213857007 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=iYgn7j8nOcVKzNfjwSz/8jsWOtsZnZBHqMEDfi+iKLs=; b=nquZO9Ru9hvbGx56pbwG4FkhQWk8/EgVK6/Ew/KL4m5GGKp/d2L7Q6rSTr+iVM4QnMCxey1HssF6F5GmALLgfGlhjLKzr6TSqSVqo+psx6AcahTe6F8FSGBABDCH1qZxkHV+qOmxglmx4Z4xT1n7UAbTORBXF4EhvvK+iWBjuJY= Received: from DB8PR03CA0019.eurprd03.prod.outlook.com (2603:10a6:10:be::32) by DB6PR0802MB2264.eurprd08.prod.outlook.com (2603:10a6:4:85::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:39:49 +0000 Received: from DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:be:cafe::cb) by DB8PR03CA0019.outlook.office365.com (2603:10a6:10:be::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:39:49 +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 DB5EUR03FT051.mail.protection.outlook.com (10.152.21.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:39:49 +0000 Received: ("Tessian outbound 4e683f4039d5:v62"); Wed, 01 Jul 2020 14:39:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ce107bd1c748112a X-CR-MTA-TID: 64aa7808 Received: from 574d6e514545.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D9BA8230-3120-4A0C-AAC3-91245CA41512.1; Wed, 01 Jul 2020 14:39:44 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 574d6e514545.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:39:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NfR6WIDvr9sfQACNYiwDhn8jW0d7DIas5OMafBYxswxEiO4F1K5/cKFR+86+M/wV519m/JUCQ5sv3Kwa0r+H4v4wC8pvNv+MSMglo/NRqYWh7D1nT1/eSFpG9FEni97Evu0WVtKqhbFH3zN9Q2eN9eXi7/c2QNxHEs8tM7rL6KJFm6AbtdMXUGaOY55sMMFc4MkueL9hRnPs2WxjVJcN6o0VDHg5rfiM9FVcvV24I+0/Tk/FLIYJJcHxO8fKJW2PsPAexngn2+wiJ+nSttCKsFhgCaLdIAO5HIKsMGkAyMKnkkyC2jkaIOBJviQh76+SpHEu4s7lSsyj1sJTRCLE7A== 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=iYgn7j8nOcVKzNfjwSz/8jsWOtsZnZBHqMEDfi+iKLs=; b=lsT6EPOpbif7/JhibAjPu/avq2VhDTMmIRHk+SdRxtfnFqgoKZKE9uCoqD7wGw7gzyw6ZasA+q9FLWV2bn6jz9oIaWgIX5L84qyr2rZyYOvM0dq6JYJPv9wsc++YPYw5AB1+WK8Gf0GJG1BcG1GVtIgtSxs0bOYOObedkoDPaVTOfRpSD1C9MXuBGx/nAJYUSkgjU0NHzBeI5UdwtPtDySxKLS4IYWoD7krxIKY1XE/04oAQz0fb3rzU5MbMG26DFkHjVrPJoFZNNTwTL3uUePEpmagLHKgN3dBp/6VNY5/hqTSSycnxAdZasGf6uN2J6/Y8SNEILa/cRsK27UfrWA== 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=iYgn7j8nOcVKzNfjwSz/8jsWOtsZnZBHqMEDfi+iKLs=; b=nquZO9Ru9hvbGx56pbwG4FkhQWk8/EgVK6/Ew/KL4m5GGKp/d2L7Q6rSTr+iVM4QnMCxey1HssF6F5GmALLgfGlhjLKzr6TSqSVqo+psx6AcahTe6F8FSGBABDCH1qZxkHV+qOmxglmx4Z4xT1n7UAbTORBXF4EhvvK+iWBjuJY= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:39:43 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:39:43 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 08/14] aarch64: enable BTI at runtime Date: Wed, 1 Jul 2020 15:39:32 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0501CA0113.namprd05.prod.outlook.com (2603:10b6:803:42::30) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by SN4PR0501CA0113.namprd05.prod.outlook.com (2603:10b6:803:42::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.12 via Frontend Transport; Wed, 1 Jul 2020 14:39:41 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 58072a01-fb8f-4641-04b2-08d81dcc9be8 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|DB6PR0802MB2264: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GfuncmYYfARL8ORtvrlYPv7/J10qBJmnwhqOMNl9Hmcr2lDgkHQowAaKUa30hqdpwJMH6b52rgF1iA6TlRaB3BSzbeJlmpfDAik29q5pkVMlhSIDVxXgIzK217onScszw7WSSo8wbMIoD7tPwWe+MkQDA8kcjxE8qlStxQW5sRrgjmx4DJ2biGWZzXDZrX0hFLevAGUMEg3HcYdM/fTSpB4hVRMN14R18GWcbFnDXBjO5/ODPzpVAw6hHng5/WtH41Wy/ZwvXXl5WhqfKtARE1JFEdiK1/7DGPcj+Kb8mDRVj2SYaal8lEPTAi7uxFKdlvUe4VsrEHsLqmDa58O1orGJbFVeUxyIqc8WX1EN9RMVL8uleqmYlC1zTyGHtMXs0ZtfBHkWP/RriZPbaaiMKZ8S1VCPPdH+kvHfwLTiIPVWvV51b5xul/PrOg+9IrqCn7OX7ABnPlUykZsQt5Vq5xRl8sQ+IEcysNKGqWrDCC3CMjD1z1/Evh56eWlQFUD3rBCqhbC2fSJP/X6blx2Owg== 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(4326008)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lkF9uTyHCqznFWl4qWMexPtykGSpwRg1kV/V2ottZYLJIgHOc7dt+/QyS50KR1D6wOH+K3NdG0SIX2oyFufJ9d+LMvq4aeP8cqTMEJAwDA8yNrTUK0HXL0tTFVdF24qldm2M7inEAOYoKUtGJK74V0XtESWWqrGn3B4PDcr3uwfiQfEQnIn8N6y7ILD2DCMnpzRG7TYQnR6U952v1QrdFb2/dhlD+ipaL3EW+VHbXxsNC88mFCX44WCg0nTzYhnVQ1Oj/eS9eBSCqoCUXxtMRWE088bz8cjwR5mKsBjNJAjZTYnAvZZHtXHFWbaU/6OthhJzbtu5KtU1q9yDbmpZar0XKHEB+u8zKGyYw9rZ+hC1Tr0/bfkURtL56RUJgN/af7ZgrofoXX8JtVvHB7yOUBjiJoy/W2pQATPDWJdPzhAQ+dEVJgHlhYGkREP4k+B8ORbL6rFOoTVFQiDyZ8PPbnHeQ1o4atay6VRWRdcicb6/uI+f8g/4BJik5NErysdF X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT051.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)(46966005)(69590400007)(70206006)(956004)(6506007)(44832011)(70586007)(6512007)(2616005)(336012)(4326008)(86362001)(6486002)(16526019)(8936002)(2906002)(82310400002)(6916009)(186003)(498600001)(26005)(6666004)(81166007)(36756003)(8676002)(47076004)(5660300002)(356005)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ecf0a2f8-2257-4398-332f-08d81dcc9784 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DwtkriqYGeBCC+vVVkPI9RFi2lsEecVzoVb2IdmZKWJAKIbN62jw2T1ncaY3EphSx7LeNZ8/9PYi3rVVHLg0eno6v/gioZkvf7wpu0vIApc1uMxxE0H8kW0WjXeEw2SkZir+JC+r28R4Du2nmAeebK7XAGZMi1lkJqvVhR3VnEt0HYe9YXudxOOQkbarOLlRk5RRoi6ONcbIC5K2S4I3Q9T3WiI7rffthSOwDX9UrrJqfY38Px+jzEKuIWGyT423Dbu1d0aRsvmt8wYxJ+yC4b5K3ctI/au/sZuFsnTlDN41bqW3LVNhwoJ/27jrV1Gmm385xRRwcS27haPbCBU64A1+NDHq1KkWYlOmWZmfw4YvzXN3qVegQmv2IjyEK/YI6i4UheQpFy1Q0ZXnyzzJY/SBVFJ7t4Lp0lkJfiYnQxyqrepLFzrxX7ZeRT9rz9ECiQlvR39xDpJ1G3q+IQwIsEuby5e5hhGRCGp7YHEuLA7iEuJSGgwGfvpC9Jm1dx33OTaQKIRb2uJOnoRNQ4IlGrh3cV5UPd81us3QYS4Wa4IsQe0tKH6mCjoevo6EcsW2 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:39:49.9043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58072a01-fb8f-4641-04b2-08d81dcc9be8 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2264 X-Spam-Status: No, score=-16.3 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). 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 not yet in a linux release but in v5.8-rc1 so scheduled to be in Linux 5.8. Co-authored-by: Szabolcs Nagy Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/Makefile | 4 ++ sysdeps/aarch64/dl-bti.c | 54 ++++++++++++++++ sysdeps/aarch64/dl-prop.h | 63 +++++++++++++++++++ sysdeps/aarch64/linkmap.h | 3 + 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 + 8 files changed, 161 insertions(+) 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/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..3c92377cc8 --- /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 (errno, 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..b0785bda83 --- /dev/null +++ b/sysdeps/aarch64/dl-prop.h @@ -0,0 +1,63 @@ +/* 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 + +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__ ((always_inline)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +{ +} + +static inline int +_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, + void *data) +{ + if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* Stop if the property note is ill-formed. */ + if (datasz != 4) + return 0; + + unsigned int feature_1 = *(unsigned int *) data; + if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) + l->l_mach.bti = true; + + /* Stop if we processed the property note. */ + return 0; + } + /* Continue. */ + return 1; +} + +#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/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 */ From patchwork Wed Jul 1 14:39: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: 1320552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=68BPbdGZ; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=68BPbdGZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkR20RZ2z9sTT for ; Thu, 2 Jul 2020 00:40:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B030C3861862; Wed, 1 Jul 2020 14:40:11 +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-eopbgr10067.outbound.protection.outlook.com [40.107.1.67]) by sourceware.org (Postfix) with ESMTPS id 8FDCB3857007 for ; Wed, 1 Jul 2020 14:40:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8FDCB3857007 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=X+yIFGeQMIOxAMrIuSPt8b4zXvfXhhUFgdoXr7xPkf8=; b=68BPbdGZloDjQPBBncejk5IObeto8r6AQ8bZuj43++GVoYCwxR4D5PGzAzLL3Z6/ysI0hummekVYPuRFJMaX/L9T0a4+fBgyic230mHvxgmkDZ6hmjWia6STLVPVIUP7LZFd+xrpE9NMGEDdn+swcLdBewz12IOlAMEELW6/XQg= Received: from MRXP264CA0032.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::20) by AM5PR0801MB1873.eurprd08.prod.outlook.com (2603:10a6:203:4b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20; Wed, 1 Jul 2020 14:40:06 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:14:cafe::e6) by MRXP264CA0032.outlook.office365.com (2603:10a6:500:14::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Wed, 1 Jul 2020 14:40:06 +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 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:40:06 +0000 Received: ("Tessian outbound f7489b7e84a7:v62"); Wed, 01 Jul 2020 14:40:05 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9dc1309c0525b9a7 X-CR-MTA-TID: 64aa7808 Received: from 2926d023355c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 68148287-AA35-49E2-A4CB-AD028BA7FAF6.1; Wed, 01 Jul 2020 14:39:59 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2926d023355c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:39:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kbq8+hYPBUNLFQlyMLFOgwe4ZFH1MS+SdJBb+qkEbEKdIMMQWXc0vC7uWnzdrg2SSqHnb0lQps1E9hl0wUSLTy5o2Yy8KlXSAa325s2ozSPIhzavoba8tkxsvr2Eoki8EeoJocNaWfNUcItKyuuJZaILDUbiRNWH4UHfCXgGWK7l+jj2dgEjQu2mDRC/bC3kYxfJb4L6iXTc5TnSBIlsFJ6t1s8XC6Qe8o/NMTRLxzQS94EKSJQbcK7N0ccTVaZjP0N78Nta6zxae2ZvHQ8VU32Tug3I0BmZtVJxOGrr8xI2vT9PP15LM98r0RwzHbPK6svRKIMkM8OT2M/TA02pQA== 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=X+yIFGeQMIOxAMrIuSPt8b4zXvfXhhUFgdoXr7xPkf8=; b=RPUUnh9cCa9QIj4i0KjOGYs2R4+VsPfZBxsHCqqpFDeQ8HilitIWj2cMzqOklS7k+V/bEijRtg616tsG8I/OB6bRMzwgaS/2D9rdVx9cFFcplSszfkbK7PcEoMEY13MIzWW3PUBPmJUR0BvINaS2FNQQcONR4XyT73J0tYp6K+OaPnwhbo9KKKANvY0K+00dJ8fW9r5SN78Z47/nJKO8JDi00tUVZe6G32OEVY5N+iGpWpSu80rrlppd/cbz9qGHd8loFdyPOvxZcoVDuECKHh3MNHhHK7oRKrwjVsgR/6u1V0BIE0H7CjOw5/LFc4Me46wf/fvrSzzwOvrMwMLKUw== 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=X+yIFGeQMIOxAMrIuSPt8b4zXvfXhhUFgdoXr7xPkf8=; b=68BPbdGZloDjQPBBncejk5IObeto8r6AQ8bZuj43++GVoYCwxR4D5PGzAzLL3Z6/ysI0hummekVYPuRFJMaX/L9T0a4+fBgyic230mHvxgmkDZ6hmjWia6STLVPVIUP7LZFd+xrpE9NMGEDdn+swcLdBewz12IOlAMEELW6/XQg= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:39:58 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:39:58 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 09/14] aarch64: ensure objects are BTI compatible Date: Wed, 1 Jul 2020 15:39:52 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: CWLP123CA0149.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:88::17) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by CWLP123CA0149.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:88::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 14:39:57 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f6bebc4f-1314-48ae-e539-08d81dcca59a X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|AM5PR0801MB1873: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: X6/wMuAtQymgIjls6ARq1mzv7COnzudfi4qAlyfi3kEJspVZ02Cz2CNHx0nGcqaXDUBSoclpLvqOTJnojMWabq2Vt/DtmS5jLRhPT7HRF/ovEvjyMnUFeg28LRch/edzbNmRhkXayNHwJ5Zd3P+FAQ9h4lVh4/9aPSULcXwN273gjeOrKbQpdFULvDSlIXnF5eOWvOeJMHpyxH+N+hFH6FdfmZJTCyRJJlNsw7dw1n30zewBT7rPV5ZE+k5/fHnjS1I1P0cSmld9KIxWOIqBDG5ZRwo1g23IUOdcDJYWJ7fVLXlrtLdB+RHpSX6OsMef1Dt+KJ7GNj+xhziSYH+5zsf3i4N2nQuV8RTMe2Aj83y+l9L8kQIMy4vg2E7Cq+l7VvAt/dV7rOZmoOkD9BcZC/bTt1uEA3KXi4h+BbFSKc0= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LaXGTgIktVuedFuyp3Whp+WSdnkAzHaiOMbbFtoWCDAz10l2HeI23/bgiszpx7n4aj7fHlNpSDVxue8JdzM7sREasRv+GrhSpK1gq50tf/RDhujfJZVaEuqLUEtYhT41clyMFvZSNI7g0hjs7XxXkTd6C8JIJQZykGECPrx3pTnP2kxKnYJRXDrMlAb4U4HrE5D6zqBHQsfFt0yrX2XHQA/6WxB7s6KqqRARTX1CW7SwS4g8+1nvS6EIr+SJND3/xfpkdqNp90dHagP5V4EWme9DLCvzul97rxPeuRvVJ5ibg6xwVW/Blk6LiKHzLkFj6ad0Z2Vx7u+iUeAJZQ+jmyxdR3kvFRdAywkUVZ3V0uMhO/Yg36fgPYIMNuksJ4yDFoi3lhQXVbaT2gqcZkzJOtgghg7iPy1UfqveLOSAzmYpWbNzzhf3ppQooUWnH4rmfgAYeGLIoqb7lVrNp+lQLYfQ7a26xGwlbCv6WSeHJ+SVl/6bvFLvWA4z9XY/J1Ta X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: VE1EUR03FT032.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)(136003)(376002)(396003)(39860400002)(46966005)(83380400001)(8676002)(44832011)(5660300002)(6486002)(2906002)(36906005)(82310400002)(8936002)(316002)(86362001)(81166007)(47076004)(70206006)(6506007)(186003)(956004)(336012)(356005)(2616005)(82740400003)(70586007)(36756003)(6916009)(6666004)(69590400007)(26005)(6512007)(16526019)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: b684629a-47a1-4536-7f19-08d81dcca0bd X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UW4I9iQ/cUDSFqQekXNOkJKqeDCwxwH/ppd9EqtgSArpfaP8SBq4i/dC426qIFabLh9mS+J8m++C1PHQ/U3Owb55ziUlmKijN4Nt9+kqcT6Nke+0UTkC58z+piiZ43CbE3zZ7MDgg1YGU+3UveKOGct7pxt8s+S1ED0rJ3c2l0uO9P264cQq/ooKIjQ7muxbNyC3x3kkGkfq4ZQDtT6fhRXZbTUmWpajXklGCrSaE1Ms9XHrRlaIz48/qKV40fvTHkHOm66JYh0666sv/wcd4xyvd7YNDuTMdikdW8UShNRWrv+9dFWxpkLlfauB660HszTBDi57sbU1uV7atenGArTRLX6Znv+hNCXYiUKp8jhhi+uznARkyzE3bx+jBLWiHm9qRcqkySV+0hUJ7n9OUjZvDJYQVkHjmCEqM9+hmLmNED0fNRhPvdv7ykXLNDMTtU6CWBOGo05JYKbJCYbuFA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:40:06.0721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6bebc4f-1314-48ae-e539-08d81dcca59a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1873 X-Spam-Status: No, score=-16.3 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" When glibc is built with branch protection (i.e. with a gcc configured with --enable-standard-branch-protection), all glibc binaries should be BTI compatible and marked as such. It is easy to link BTI incompatible objects by accident and this is silent currently which is usually not the expectation, so this is changed into a link error. (There is no linker flag for failing on BTI incompatible inputs so all warnings are turned into fatal errors outside the test system when building glibc with branch protection.) Unfortunately, outlined atomic functions are not BTI compatible in libgcc (PR libgcc/96001), so to build glibc with current gcc use 'CC=gcc -mno-outline-atomics', this should be fixed in libgcc soon and then glibc can be built and tested without such workarounds. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/Makefile | 8 ++++++++ sysdeps/aarch64/configure | 2 ++ sysdeps/aarch64/configure.ac | 1 + 3 files changed, 11 insertions(+) diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 5ae8b082b0..7f82fc055e 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,13 @@ long-double-fcts = yes +ifeq (yes,$(aarch64-bti)) +# Mark linker output BTI compatible, it warns on non-BTI inputs. +sysdep-LDFLAGS += -Wl,-z,force-bti +# Make warnings fatal outside the test system. +LDFLAGS-lib.so += -Wl,--fatal-warnings +LDFLAGS-rtld += -Wl,-z,force-bti,--fatal-warnings +endif + ifeq ($(subdir),elf) sysdep-dl-routines += dl-bti endif diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 70477a7fa5..c637540436 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -210,6 +210,8 @@ EOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_bti" >&5 $as_echo "$libc_cv_aarch64_bti" >&6; } +config_vars="$config_vars +aarch64-bti = $libc_cv_aarch64_bti" if test $libc_cv_aarch64_bti = yes; then $as_echo "#define HAVE_AARCH64_BTI 1" >>confdefs.h diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 798f494740..2c2817514d 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -36,6 +36,7 @@ EOF libc_cv_aarch64_bti=yes fi rm -rf conftest.*]) +LIBC_CONFIG_VAR([aarch64-bti], [$libc_cv_aarch64_bti]) if test $libc_cv_aarch64_bti = yes; then AC_DEFINE(HAVE_AARCH64_BTI) fi From patchwork Wed Jul 1 14:40:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=9bD+YvgJ; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=9bD+YvgJ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkRH38Scz9sQt for ; Thu, 2 Jul 2020 00:40:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7DADB3861870; Wed, 1 Jul 2020 14:40:25 +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-eopbgr80040.outbound.protection.outlook.com [40.107.8.40]) by sourceware.org (Postfix) with ESMTPS id 18026386186A for ; Wed, 1 Jul 2020 14:40:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 18026386186A 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=8v7sJxWvUa6D/3QYiFKUMbVS2pVuHK7KRe6W/votENI=; b=9bD+YvgJQWH/uqGG078T+1jWr0V27a3vqMC8tft2FD1N0RAu+I/HHWErLF74pDMS0i8NzDUWbx8YmH5Tzj/rTi5WPSQ5ENPO1mllkR7aCmjuKZ/rwDFqOmp4lmcTm6aPxuIoAJRIBRvQ9g0i0v+N5WbfpoektvBVPcoGkMjDsBo= Received: from AM6P195CA0096.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::37) by AM6PR08MB4788.eurprd08.prod.outlook.com (2603:10a6:20b:c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.23; Wed, 1 Jul 2020 14:40:20 +0000 Received: from VE1EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86:cafe::73) by AM6P195CA0096.outlook.office365.com (2603:10a6:209:86::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:40:20 +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 VE1EUR03FT023.mail.protection.outlook.com (10.152.18.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:40:19 +0000 Received: ("Tessian outbound 2dd9eeca983c:v62"); Wed, 01 Jul 2020 14:40:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d810ea14bc52b1f4 X-CR-MTA-TID: 64aa7808 Received: from 294259509533.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 06874060-07A7-4902-89F8-F1DEA5426AF6.1; Wed, 01 Jul 2020 14:40:14 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 294259509533.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:40:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dRVx0UkZdQJgD/uDCxonRkVggP430hqzn2y/MUxYbbO6jgOlAZDpJhcEFE0Ob7N9xliq8X7XuLs73uwXBIopfaHtC546icJ2bp7pf6kvSbkt/wMti24hS7ZeTPq6LVYUS+kHD39C5gld+3ubGG0c+/FmADwuZtJHB1HBWrF4kLFmi2wkaVKPotzEQbBKAg8YLzZyYuEXTI6iWuH7k/An3FnBcYZ7WA7kafC3NfcrTIcCmWoPpcIPVjaen6xWSw8gwpcK5RkU3788TkakIST7fntP7CwKtspnD+OFQHTAtUcLkYuoudB8ngUDPP1jLHU39RQZZCZE24MV0ihrtw1k/g== 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=8v7sJxWvUa6D/3QYiFKUMbVS2pVuHK7KRe6W/votENI=; b=Yl249jM05lIhRF5sGGJKBMmOiCa7jj/RpH5W+lfIuwcCzP4ycAjdYWEO4ZEyF1h+gm7hi494SQyd0pO9e5QAogbVa3IJH2OFWU8Lia8yl3Y3NsX3RWDqrOdUBDVQmGx3mLv61lZit3UlxsjJOIxa36Ofa8n8C8f/RdW9JavxLyN5uPuyi+sB7SNd1nXaTB+8QEw+SAfWRpraE3hSVKZs8f4F+9IrV87Xz7+i6frmAkHbMhfTZAKC5XohEKnspv5CzOfRedQmI1l15Ev4cS7mdNKCfYu6j08gYyU0nPk3iMoIywE21hCE2XIZafnPMpmhY1JUFSYcAxnpQabnntbqUA== 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=8v7sJxWvUa6D/3QYiFKUMbVS2pVuHK7KRe6W/votENI=; b=9bD+YvgJQWH/uqGG078T+1jWr0V27a3vqMC8tft2FD1N0RAu+I/HHWErLF74pDMS0i8NzDUWbx8YmH5Tzj/rTi5WPSQ5ENPO1mllkR7aCmjuKZ/rwDFqOmp4lmcTm6aPxuIoAJRIBRvQ9g0i0v+N5WbfpoektvBVPcoGkMjDsBo= 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 AM6PR08MB3832.eurprd08.prod.outlook.com (2603:10a6:20b:89::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 14:40:13 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:40:13 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 10/14] aarch64: configure check for pac-ret code generation Date: Wed, 1 Jul 2020 15:40:07 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0476.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::32) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0476.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21 via Frontend Transport; Wed, 1 Jul 2020 14:40:12 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 167d3a07-9c0d-458e-666a-08d81dccade4 X-MS-TrafficTypeDiagnostic: AM6PR08MB3832:|AM6PR08MB4788: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3276;OLM:3276; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: a1bnmg2mvWfmA64Vr2uIfyUbA/NtlaRuIJeHh1tg9VjTuqSR68XVYpzN86zmmdgWobvlY5jxzyBXiQggcVl2Dr93fZZ+/zoR6LSiwSHUF8PvV9j1ShGz6FNp3bBR2vy6U5jSOZPWUUH7OwxLcT1BxppZEQ/k8e4QCr345KWOMvaOHcRXEOEaiZVABwwYPI/x7Awl4nRx7dErnkTuekSEMK4Qh6OuR8IZTdhNZT/EGbyMD/QVusW5NQPhRcqWAHyeJo14y5Q2zts+2b0hrPVlnWHR36AJwty8Tf9yhiD5fHVDkttZk9KD42EGHS7WUx4sGW9dM/Bms3P23flFgPI/zXUIQrilcpY8UiZMgRjkFJUf4oNNmrqW8TS81ra8Z+YVH3ZHmdrMicTB5FzEbkhsE5Q6cq9HD+QV4x9xGCc1yM4= 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)(396003)(366004)(346002)(136003)(376002)(39860400002)(6916009)(44832011)(83380400001)(6512007)(6666004)(66946007)(66556008)(66476007)(52116002)(36756003)(6486002)(956004)(2616005)(8936002)(69590400007)(186003)(26005)(8676002)(2906002)(86362001)(316002)(6506007)(5660300002)(16526019)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: et4zQaWkESXZUV6wdDhPtkO/5Vr3U/FyiM/6VhOK2qx4PVVS/xbwEwY5zccCVQdmzfRymiMBWcQdRGqz7sjbl0Wv/kzWvG6zFw1qzI500AXOj5ye8h1/nmtUgbydSKuKTppTdHGQL+6oVQwTVd+EPuUzAp5vcCgTrZ+Tn7AA47Lw1lb+cz9+q8jcdm1+bSRYKTXbIPPUfWRC1ElLGSIWl6B1VKCM+fI5upIaNMSylG8cVCcSxhnS2w/mV4cgd0KI3UyMG+RjrAGu1p0udrWuSHqBzvPIXG3xZg4VCpBzb8UZZlq4B6SZc8AcZ/ytamGfN3ZkFsz5YHopNlVGmql/22DYoe82P8ycwmKISft9dtiGK/I6rlSFYRYzpxKTmGE1cEfMBK3lx8/c48u1AE2g+i71fGJrR3MCJIJqe7FyI5zhzSPJBgeoKVpjSnkwx3ueb8pWVewdHAgesDLBoK3Kq/N+ZzlxwsejQYbu01sdwzI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3832 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: VE1EUR03FT023.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)(396003)(39860400002)(136003)(46966005)(956004)(16526019)(186003)(336012)(6512007)(8936002)(82740400003)(44832011)(36756003)(6916009)(5660300002)(86362001)(70206006)(6486002)(70586007)(2616005)(36906005)(8676002)(316002)(69590400007)(2906002)(83380400001)(26005)(81166007)(356005)(6666004)(82310400002)(478600001)(47076004)(6506007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0a88a140-3537-4af0-f941-08d81dcca993 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CZsQPdUVabkfBL8SnNAgqsKpwbWKsqaz5dY9BLRkxxWOEmgRpl+6sDooYjkHBhAb8V4O7mj4VZE7VXzeNCIgezWe82WtnkuDnV2zBWNMAE2xMVuYYaupxbzr4SvO7K2r5YwFTTnA1EGyLHRnJ3SAV3SZdOCMOeUuWgOHZatqPxEwHxptJmqtRr4qI+FrUX12f/Ajb4vOjt3lbCf75PVNV7B0ijW6dH4MET3c3PEMoggqRCXTCKooTvJHYPZUvV//ex9Ye7v2oMUtQI+6sXl5dHxjAniIRbEbhD6NwWi3dgFkzr6+Vt9HW19NWM7/sF73PKlb+OhcWUONjN+DbDXYf/KpeYQNLI5FH00OlknuArw2PXP5SQfWjEMZS9pu9dsBMEtPhJLHG+/SIaKqjRACFefbIK8jpeiFX3C4rTp1SR39Dlnfg7zr1Dy96BLE39bxkiXv81RgmlujAbmSu0+L7g== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:40:19.9466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 167d3a07-9c0d-458e-666a-08d81dccade4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4788 X-Spam-Status: No, score=-16.3 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 67169e5d01..7921917ad2 100644 --- a/config.h.in +++ b/config.h.in @@ -112,6 +112,9 @@ /* AArch64 BTI support enabled. */ #define HAVE_AARCH64_BTI 0 +/* AArch64 PAC-RET code generation is enabled. */ +#define HAVE_AARCH64_PAC_RET 0 + /* C-SKY ABI version. */ #undef CSKYABI diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index c637540436..ac3cf6fd36 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -216,3 +216,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 2c2817514d..8b042d6d05 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -40,3 +40,24 @@ LIBC_CONFIG_VAR([aarch64-bti], [$libc_cv_aarch64_bti]) 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: 1320554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=lfNlOeXY; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=lfNlOeXY; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkRY54Jsz9sQt for ; Thu, 2 Jul 2020 00:40:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 20CD7386188A; Wed, 1 Jul 2020 14:40:39 +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-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by sourceware.org (Postfix) with ESMTPS id 7BD353857007 for ; Wed, 1 Jul 2020 14:40:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7BD353857007 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=nUtjZ8MxE/HoT2ciyvCRhauxY1gID6XJ0NF2gGk+He8=; b=lfNlOeXY70v457SkLHOAJYGZreNEuiokf1EfOuTpZngYV4zQnKTWApZszvWt6ms0fcQ/v8HR2trPG0OmH/ZF2PBps8fK+ukRoxVzsRk2s+uR/agq9LgkLRSCzsq61EuZcT2muAHbXkoKq7UKEgJTNQp24BgfZ5mulCuXvdAwcic= Received: from DB6PR07CA0013.eurprd07.prod.outlook.com (2603:10a6:6:2d::23) by DB7PR08MB3852.eurprd08.prod.outlook.com (2603:10a6:10:7f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21; Wed, 1 Jul 2020 14:40:34 +0000 Received: from DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2d:cafe::c) by DB6PR07CA0013.outlook.office365.com (2603:10a6:6:2d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.10 via Frontend Transport; Wed, 1 Jul 2020 14:40:34 +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 DB5EUR03FT008.mail.protection.outlook.com (10.152.20.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Wed, 1 Jul 2020 14:40:34 +0000 Received: ("Tessian outbound e44de778b77e:v62"); Wed, 01 Jul 2020 14:40:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c6b44b415fbead13 X-CR-MTA-TID: 64aa7808 Received: from d940d0b0b32c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9A7A718-FAA8-4A62-9ACA-995A402198C2.1; Wed, 01 Jul 2020 14:40:28 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d940d0b0b32c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:40:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jf5YRFOZND7F0fHwvXGmo8FJjPsEbShGbe3kxRWHpk2pCuGj+exInqp0Gvr7WeMkw3Dt5zrrIfwz1X4a0Vq9mJoYr9bdLg7jLG8EnYJJr0SGeT109md1BkqIKz6qgLqCbfcHndtF98725//R5xHYTDgUuSxWf5hy1nJ/p0cnlwrtT+7YZZK+aRsdFiPE30pDQpEWqZjKt8xxUoWkFxSIXsb7Unik1s3Tgch9NSEHvcctgJzdOQ5gy+YQUKfHY7axCTdGQP8aB9KQBKTTfFLWbzdPZl6BaS3eMfLF/b3Ss4WmXYBEEDQygHiaLXh2VKzDED3p7Sz8dc5rIrXU9sygRQ== 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=nUtjZ8MxE/HoT2ciyvCRhauxY1gID6XJ0NF2gGk+He8=; b=K7gPtqw0mH1JylRMi1Go9RebPggwOOl44lUpw2L32HdwhiNOXNs3yv89t+KzpiOH1mxrfq60R+9+4FmXtlSVwsIO5IqfChPKQhMlrBUrluZ5U6s/Znin9V4Uypifyl/DlCAwR5oo26K5zeSUlx4KGL8WglTbDPoVuR9YF6pmF6phNXaVYiPcwWuVhG0v6PH+BZ6Pu/vhwD7hDt02PeVEkRK9VasVmwbV6iSFwSevtmoM9X67SV8nNh0XwTC1AiHK5FzG64N4f66FpEeXdy4+sMG4Qc5ULneAkbQcziVjTCdxYhiq/0zruaQYaIigiydeZ31udpO7l2VxbCbd+q1RIA== 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=nUtjZ8MxE/HoT2ciyvCRhauxY1gID6XJ0NF2gGk+He8=; b=lfNlOeXY70v457SkLHOAJYGZreNEuiokf1EfOuTpZngYV4zQnKTWApZszvWt6ms0fcQ/v8HR2trPG0OmH/ZF2PBps8fK+ukRoxVzsRk2s+uR/agq9LgkLRSCzsq61EuZcT2muAHbXkoKq7UKEgJTNQp24BgfZ5mulCuXvdAwcic= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:40:27 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:40:27 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 11/14] aarch64: Add pac-ret support to assembly files Date: Wed, 1 Jul 2020 15:40:21 +0100 Message-Id: <1b0ad642e8d7b6aeb4481c834e857cbe0d4a5934.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0265.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::13) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0265.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:40:27 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f075879a-a1de-413d-7e11-08d81dccb68a X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|DB7PR08MB3852: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: vv5i7L0gUCNbUGvQZunsjThktu95FHBCsTvjD4P0UA2PUymAOtGc7RpO6P1JoVXh7mWW0uHdks9E/m1qX1Z8rsCKXZPBH1PKodhQKVqS6cyDZOptzRcJrYv/A3yVp6i2RwhnmyVvArGvv+uOliJp3xaFz9YSpFkM3o88vPaVV2hX2EQJMn6nyAKAjAN3kzT1SVv6uFihRpK6nTvweeMmLfDX2rZVu3Zrrl5l0+FGp+1S4b/tK7OiIhDzmHY+HY62gtU0ql1YSL7aMXO1vrrCZ1EQuHuCHiVuBkha8dnXJQVi1qMgFB3pEGDCtOZ5HGbt1DNFpxl1iGXR8UGvukw2J/QY2FXIi+NpKtl7MQfTSCUnqAeNZ2fxlO9mcJ48qe0dOJkPIYHTW85/0jVVx+BPnmD+cDuJR5vQ5Op8xjlYMvs= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vRStoAcAMtvVyph5u7HPDH1vm40hJo2N9TBdQGKb55w4sdXv1wVctj6MiJj/MXH2Mvocf+OBN/kqLhXuXwskyQknlgQR4okb2pGLodLFAzXbUPZs58fIm5IspeOzy4onaxNm3rsdIlN6ifoeWHskXPFpurS5BZmZ4/XNEpythlV4hajA46IW9YqmzdSpDkkMlOTbRewFAlqlqAK1YPpAz/sCC5luevdKs1b/h6AMSLLTYGdxeNqzrrtMc1z/mixaqZ1+f0KcxiDGG8vmYYrm3XpLSQ0CINJCvA8v773gYHbrWD7nXSkahLKb76Cgk75nZBpBwPmHiHDC3v/TgyunR3mijVSBWDiS8RTELv+I+szwPVLB0USYLZC6C5J/M9Xym5CvtbZtyAwx4PyO7h0KpiKjeLoeCw15/rKzubW4A4pZjUAwiMRoMYvmXg8jDeavmBzxLENOA5cxXgksmmdM4jdo8TG5jkilWyD10IdaS/Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT008.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)(396003)(39860400002)(136003)(46966005)(16526019)(6506007)(81166007)(82310400002)(83380400001)(8936002)(86362001)(82740400003)(47076004)(8676002)(478600001)(69590400007)(356005)(316002)(6512007)(2906002)(6916009)(26005)(186003)(36756003)(6486002)(336012)(2616005)(6666004)(956004)(70586007)(44832011)(70206006)(5660300002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a286c353-85bf-4951-6c69-08d81dccb253 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /udCl027Ot7Xkkp7m2+Vk2aQOQQbSl4PSjGQth2oJGbg+tm4YGcXXQ+1wQloFaiiZ9MSaTbVqAQJq73x8GQ4bh7HZ1DQtKEfhcIM2oGQsejIjJpcATzsvbOmkO9xYpCnFWd9w2nVnE19E3BlJ7Gko3xRGcGWlXn+HhKiz1RiIj7iArHEWh6nQu8nyuaH+oLmy+tUtdqSNXXsevbK2lIyhIh5/pc0tO3PSuwRa99k681+asViaZxjyJGZzCuO9xB6sndV33JYHKTjrpKKCPHwKnBPwYNo+c3fgWYiXBGMCdXaIdaYwlya+EJ24QJ1YlWslpTwZE2tSM0t++rxnfgEMjy17fTBaHYW1QFZfJXNBffaq9Ca1ENkxYx5IrBwxz81CKcVaXZdPFqctJWRXXkolj+FGZG3WVj2ILAwR82vBfG/wpXSlumyt2weehr2stfLP+nIRr5qdkkgqWx46axkLQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:40:34.5928 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f075879a-a1de-413d-7e11-08d81dccb68a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3852 X-Spam-Status: No, score=-16.3 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..c486e9ca44 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,7 +75,11 @@ call_weak_fn: .hidden _init .type _init, %function _init: +#if 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: +#if 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..d21c21c203 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -41,8 +41,14 @@ .section .init,"ax",%progbits ldp x29, x30, [sp], 16 +#if HAVE_AARCH64_PAC_RET + AUTIASP +#endif RET .section .fini,"ax",%progbits ldp x29, x30, [sp], 16 +#if HAVE_AARCH64_PAC_RET + AUTIASP +#endif RET diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 9d96c8632a..db8a064322 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. */ +# if 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) +# if 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..794876fffa 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: +# if 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) +# if 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) +# if 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 4664329d3a..500c272745 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 HAVE_AARCH64_BTI +#if HAVE_AARCH64_BTI && HAVE_AARCH64_PAC_RET +GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) +#elif HAVE_AARCH64_BTI GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) #endif From patchwork Wed Jul 1 14:40:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=x1urL5qp; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=x1urL5qp; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkS00cmJz9sQt for ; Thu, 2 Jul 2020 00:41:04 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D38238618C0; Wed, 1 Jul 2020 14:40:59 +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-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) by sourceware.org (Postfix) with ESMTPS id 2AD6D38618C0 for ; Wed, 1 Jul 2020 14:40:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2AD6D38618C0 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=M64pUNzJjcK8D+TvA5MCOPT0fEr/+F/yH2pckFj+PRw=; b=x1urL5qpkklF7iY1wY4tGvZQ/S2HP0uSO5qmmmYE4WaCQJGtGge0ptx8cngH6Uawj7LjJy/0zybzGlqBxUsN/zuHiiMURYr5f3QaOsnqh+ROvLBKnilpMno1f8zdhThdbF1na38iGMIZ3+VHk1C8tsYi5KoZcA8b6kYr9CgQbTo= Received: from AM6PR01CA0066.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::43) by DB8PR08MB4057.eurprd08.prod.outlook.com (2603:10a6:10:a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.23; Wed, 1 Jul 2020 14:40:54 +0000 Received: from AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::25) by AM6PR01CA0066.outlook.office365.com (2603:10a6:20b:e0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.28 via Frontend Transport; Wed, 1 Jul 2020 14:40:54 +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 AM5EUR03FT029.mail.protection.outlook.com (10.152.16.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:40:54 +0000 Received: ("Tessian outbound 8239f48e56bd:v62"); Wed, 01 Jul 2020 14:40:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2a509d73cf907769 X-CR-MTA-TID: 64aa7808 Received: from edff83bcf7fa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9A4F4689-3015-46CC-A417-A770FDBF220E.1; Wed, 01 Jul 2020 14:40:48 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id edff83bcf7fa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:40:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ToO9beHa0L2Sc3QHz+qR7d9MBcykjyI3/B/hd3vFWl9quEFJlnEOrfZswXVGpmcIBG0roqP2qEQ8DXJgm8A8zY+J2pRhESMi5dcEp5s+imX7kzh2Z8yHxFS1qWO0Y+2Mu/CgPcn2RfQyPD90tgrGRlBH02OStzgJAJUpUvP4n2v/Ph3GQR6/yII/dTcap8G1Oxdw4vGxhkFCjgP+B/tMaYXxJDMr41FSRfnwjMDCQkEMffgo2D5KJ0hnsFO+TMCeEbR9tb5h/KmvYtWSgsEnzglT8AOB4BfiSvuMvkV4eSavLlO6QCJB7ZPu9pM1g19LBSy/Q3Xmkv6HfjTBsX5OcQ== 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=M64pUNzJjcK8D+TvA5MCOPT0fEr/+F/yH2pckFj+PRw=; b=Af3jhb4euPOMPMUjACIJHdemQKIV2ElOdL+PSduGm95Sj+awFbqrZCQl72jWItSjxAWbjJIYk9Xp+jtSFIAgpDDG2zkKuAT6S8hzW2ufRtGZAW4lmlovdSNFy/Mw/mBBFOw3I8CFoqI2lJbIATnOaVhb2xpv6CMsrIN5BcsVl97fvSgjuRyLxr8mgX7vGnYstNgRgexkUVTt60IYYTnnbNBo5szBhJ0noFPV1j2BtkkJzfU/Y5RR+gW3JbGSH+cjOojDWDX3uBpMvY1CualftgsEIpQ8FVdEKDtZPVQ263O0YYtb5O3ISyeaGCbTULQeFggO7l+xEKWCA3nJMKjk4Q== 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=M64pUNzJjcK8D+TvA5MCOPT0fEr/+F/yH2pckFj+PRw=; b=x1urL5qpkklF7iY1wY4tGvZQ/S2HP0uSO5qmmmYE4WaCQJGtGge0ptx8cngH6Uawj7LjJy/0zybzGlqBxUsN/zuHiiMURYr5f3QaOsnqh+ROvLBKnilpMno1f8zdhThdbF1na38iGMIZ3+VHk1C8tsYi5KoZcA8b6kYr9CgQbTo= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:40:47 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:40:47 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 12/14] aarch64: fix pac-ret support in _mcount Date: Wed, 1 Jul 2020 15:40:36 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0201CA0024.namprd02.prod.outlook.com (2603:10b6:803:2b::34) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by SN4PR0201CA0024.namprd02.prod.outlook.com (2603:10b6:803:2b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:40:46 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bb02dc24-9737-4274-c55d-08d81dccc232 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|DB8PR08MB4057: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kfS/eQXKBh0yIvL0mANIbUPTVPr2gS1oI98BPB5zDUE0kEIPVgN64kdLogpSWFLCPCzl1XcDBMPPs6ZRab86Tvy3c0X/2pq6jmbVLbzxx80w6UI7n9z+eEQr6XRP1xXaaLImlakecZ4GgWq1P+Evy9YsTOcfoOi8RdM2di0B7FAHYbYyqEE1x9HnOTijJ9yEgTIi8qKDygLSEAVkUrRCvA3UpY0hErkvOd+z5DBqTe6eLmN/dBrNh7qMUjvr2Wrf/7n/poOqA5UnHS++xglOWay/FvcSgLJi340jgZNb3PeDQBypN2HtA0IDMYFCfp3N32zny6nuHlDbbKFP/ufEd0jfJFEqm81gQn9FrUmLhvOK44HJkrkvPXyqkolPc0ln7Rm60R4Fwkqa+sUYMgLSNIrjicg0BxVw56Dh/Agc8lE= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Yfox/aCliEHxZxmFks1CaLBco0BPm1eUjokMVYFTmeHsZpwBqkoiqHAtE+OaVsQPJB+sv4SE+RHuU9UN7LnVYeGXrQitWBeWwjT4AJ1ICP2pgrhZErOF2C/JAES6Gq4Xk0cuh3mlFWKpkO6RNkVCZmCq6VsifmSfug4c1yBYmOsAowOso+iPjCURG50d36qjAhyOS8mUbUgCF00kracCyaKD/LlWonhGVFSAXRUiPRN2/ENgtQZzV/JT9lvEtixITg0mZBgADgDrnB2hxzewYMebz7c424+5xaSurUza+GfvpGbOnkPrawvqt/Ib1KRvBAM7x3B6VS6Etf/CoQyaqr1LGeo9LIiiSRGVIxskhSIcLM7+yzYnQM0z5WGSXdI3jVdA3hqqB8W3mNNO6Or2pU8n1haDoxfztNJGPsCaYUcZ0W+/OhBQPlMtjuIYnJYXNdNcJUS7jZSXHTttilRMDDqGX/coVyDt3Z4TF8JVYmI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(376002)(396003)(136003)(346002)(39860400002)(46966005)(6506007)(186003)(70206006)(70586007)(36756003)(69590400007)(47076004)(5660300002)(83380400001)(82740400003)(86362001)(81166007)(356005)(316002)(82310400002)(6486002)(6512007)(36906005)(26005)(6666004)(8676002)(44832011)(956004)(2616005)(2906002)(336012)(16526019)(6916009)(8936002)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 59c8c2ad-d698-44e3-9f16-08d81dccbe13 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSReK400jWbyJ+TYnYgcxNlerhLJ39KTXvqkxpyOxguVkkSd6+YL7LnPx2lIW43N/L/G34RXxVyrYNjB/jZAMYO9w+Dw85Is7LMeKfF/2ZQ8m6LMKA3vakOp+iHqwuTRIqrtbhCnfk8hw+a0k3TNkGqqArbRqeyu+Taj8+GV9jkEm1d9tL1dMVffKiHCahmFZa/S/gp97pSLN78OF6gTMCYO0wZUKZ89bmTzVmJrVS26kD6AN2hmTjllChUvJPcSmQgFsj3KRhtyNdyOrfG4BfaUTHH+WuEEKpgEXYSQLJ5N2eq8Z/TFizfXJA89hJZI6v8ST1oiB5CO+mRLQq1c6+GRvZxghxeASICiMdMc6DXjRosx/Eka6YyA9ZhT9cu2HT8UxFeg5mPolgD+96NcmHIVt3+Gtt6DJdUPrETXdOymigSiXiCqLJZXfHA+/DiRHdxszaxgVvMR7UTYgmnJWQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:40:54.0976 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb02dc24-9737-4274-c55d-08d81dccc232 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4057 X-Spam-Status: No, score=-16.3 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" Currently gcc -pg -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 gcc PR target/94791: signed pointers should not escape and get passed across extern call boundaries, since that's an ABI break, but because existing gcc has this issue we work it around in glibc until that is resolved. This is compatible with a fixed gcc and it is a nop on systems without PAuth support. The bug was introduced in gcc-7 with -msign-return-address=non-leaf|all support which in gcc-9 got renamed to -mbranch-protection=pac-ret|pac-ret+leaf|standard. strip_pac uses inline asm instead of __builtin_aarch64_xpaclri since that is not a documented api and not available in all supported gccs. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/machine-gmon.h | 3 ++- sysdeps/aarch64/sysdep.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/machine-gmon.h b/sysdeps/aarch64/machine-gmon.h index 730a23b781..a687298b1c 100644 --- a/sysdeps/aarch64/machine-gmon.h +++ b/sysdeps/aarch64/machine-gmon.h @@ -27,8 +27,9 @@ static void mcount_internal (u_long frompc, u_long selfpc); #define _MCOUNT_DECL(frompc, selfpc) \ static inline void mcount_internal (u_long frompc, u_long selfpc) +/* Note: strip_pac is needed for frompc because of gcc PR target/94791. */ #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)); \ } diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 500c272745..2879aeaa5c 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -35,6 +35,17 @@ #define PTR_SIZE (1< X-Patchwork-Id: 1320556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Uu01FXhs; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Uu01FXhs; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkSD4M4dz9sTT for ; Thu, 2 Jul 2020 00:41:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C88938618B6; Wed, 1 Jul 2020 14:41:14 +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-eopbgr60080.outbound.protection.outlook.com [40.107.6.80]) by sourceware.org (Postfix) with ESMTPS id 1DBEC3861896 for ; Wed, 1 Jul 2020 14:41:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DBEC3861896 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=Uu01FXhs5t9jwuSG28sli+wX/b96cFBkGZCyZMxI+43ZreWKwULv70EvYKtT2nucAPEeL4rwlY9y02cdSCrinxJ2rWtL9YbQF4Lh7mBVAOsKl9BtOh5+kWlxdPx+cmgkSxaAOVtyGfiA2VrPweO9JqNisKsgTpKN4DYELm95GLw= Received: from DB6PR0202CA0039.eurprd02.prod.outlook.com (2603:10a6:4:a5::25) by AM0PR08MB5012.eurprd08.prod.outlook.com (2603:10a6:208:15b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:41:10 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::87) by DB6PR0202CA0039.outlook.office365.com (2603:10a6:4:a5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:41:10 +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 DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:41:10 +0000 Received: ("Tessian outbound 4e683f4039d5:v62"); Wed, 01 Jul 2020 14:41:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 48afbd4f4caf6c8a X-CR-MTA-TID: 64aa7808 Received: from cf7fb48b47ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4DFCE2DC-7777-4F50-A40A-4F9969D083B8.1; Wed, 01 Jul 2020 14:41:04 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cf7fb48b47ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:41:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jq/FfWNu8qIPKuFmcKH/MNOvnhbysH58UzyyH+UCAacyAUdqSmwDZHTi03me9Hov2sBbILBfclvb3P6ko7HEEJCs8dzsLeas/P5DtQ6/Oc0xS4qdrQfCq55eSq+77yZLK0Bl32dRXotKueSxKWtcxcQVSwH94FyNgBZz4KBGvMf8INYNvA5jx44C5EpEk9IoxCCS/IFXkoz/cYXHPc8pe3bS6wXpzoI5VF8/c3l9TUAgcyVGtWNr74IDmc+mHj7mWMObGZgbxaFVGIXh+Sl6a/jPHpxwUEpXzAcmDMimn92Wt2m5educIW2xA6LkC4Q5iL1+KUE8Rk95bz0fLHq5eg== 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=NB3yJ5OSkBgOpgHfAYZ0EIqyaOKCf2FsTmsSyfTLJlnxaYd9szw1lE3QcU1NnEXo5Iew9lQduriYlRIvHwg60l5FUmdBX1XqPbH4nkugTswDtYjiudGQUDmS0+hK1wU1eYcUsGrQeXb0SiXCNziMv/SNfSZ+C4mokx1bXMZtEVpNRnsWkgZjFPR887bCNhXY786Y9KHao5HCGr4egpmUY4G5kgEEB5D5zxXcMImRe0IXOjzkMMHS6QdWkZS8h5NKzuy4OTMynpn/KQA+XZLgHfCkDfSk68xUugVhITRr6q5uV7NYL4MPScgdxNl93JMHGONlkGcETW95ThArXJtkVQ== 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=Uu01FXhs5t9jwuSG28sli+wX/b96cFBkGZCyZMxI+43ZreWKwULv70EvYKtT2nucAPEeL4rwlY9y02cdSCrinxJ2rWtL9YbQF4Lh7mBVAOsKl9BtOh5+kWlxdPx+cmgkSxaAOVtyGfiA2VrPweO9JqNisKsgTpKN4DYELm95GLw= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:41:03 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:41:03 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 13/14] aarch64: redefine RETURN_ADDRESS to strip PAC Date: Wed, 1 Jul 2020 15:40:56 +0100 Message-Id: <61ed62f8934fab4c73c2b6d871a5363eeb2f3c91.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Wed, 1 Jul 2020 14:41:02 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f3e77c06-0a6d-4c05-2789-08d81dcccbe0 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|AM0PR08MB5012: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Bfi/1lX7IrhGr+PefVHSip/glzVSD917a6miLFuN2Jhy+4e5hA2CVZbBU7yIWumKAA16yJ7UzNiTQgjCwdDLQ7+vCHYr8v56VbMmV513nVOpwwi9JznhTedTNsA0VGncQiZA5IIBXPSdcWe7UOT44/wHcZyJk/TJv8zLJhZEeTs4+1SqfkfFki8qyaG9iHkUiOBNivjU72SL0z9l+xyRIoFfG72xRvwnDYYAwoJ8t7k7fem36gAWsdacfOmPhQ69rcKP8dx05Bm8f8vKyKaebEQl+e2f2LkgkwsUk3Y0XyHIGRo+Ug9HavkrN41hr3sI3Jyyrst8GVSwQFGWjCDm7yvqd3yUNIvhhLpGOoobOfN3eCW+ZKcCOJg6Z2fNbtVy71WD5OyDb0a/SzoIoCeIHFg3uS848gKUVBJlPLXasqs= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yU7exD/Bj6bcu3BeJtOVpvrlm/C91ASiw6OYDPrJTPZw5ADSaJXna94ReSa0ZLVX+kNXHU95Le3qhRJ5fs2iOdLYHbTIPIX1Qrscq1XSuDLCnEOXF+5spu5GdrBzjAHrauk0/1CwQYUxd7Oxe1cyazzJdBMNQTXeqx0y4CJdOypYZfps1q+Zgf7C0GKm9CEPDOJJMbxpLizGv49dfCvF4g0PoMjYCp2AfOvPNhlani0jaeDnH5AD8MOUEu2ZUu31Tp4N8/Xzsf85+h1zSVj7L3H04SIyHi8jemNA0ft3PMkcguFx2D2t/3ERZ3OG8ueT42x8S2eKOgZH9HyEBCT5Pfhj/eTdqcXJaqR+2bVA6+28aTjBKgxZ2viBfO/01EMH/N7A3teCs9fRSZ7kI9QzwY4HdTIoPr7C1uvULpvegegG95mUrCjMC2JLHM5CnVtW0e4b+J0d5mq8MZxLoHsM2XkDd9lRMcMFJEdmauezG0U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT044.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)(136003)(376002)(46966005)(2906002)(16526019)(69590400007)(44832011)(8936002)(186003)(8676002)(36756003)(83380400001)(5660300002)(478600001)(6506007)(316002)(6486002)(356005)(6666004)(81166007)(2616005)(70206006)(26005)(70586007)(956004)(6916009)(86362001)(47076004)(82740400003)(82310400002)(336012)(6512007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a6711e9b-e4a3-4de1-5a5b-08d81dccc761 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZqrVO0y5DT3bo7nrEc6PYJnsFKJ3a8AjQ1tgtfL1Ev6aNTu81H1gUoIozEjkaqBLhjg9sjeh+ECGukeS0A8REH2J0XzaBExMHttv3XUu2jHyA7geDL2qUzc2lfKZKmdB243JWVOlQzyqMhxDEMFY+qwoooSqCRjVH3OKpnAiz7rE0xKzIYSlxf5s8Y83loWlcFm0Lb2yzT5ltplbJflq7MWV9+Z6KHrWq8g/vSWYn7JyqsyzLDYONnwTXmv5Z4vHde9pG6aX2/dwJi0JgiZqBki3acAToMiOx1aUoj6Uj60qJf1es7BV0vCSkDg0gfugXUMCkSgQM0hvLo9g+Nd+odLYdpOuc8GCeRXbU5V+06sf/SxjgMd1negqvVQmRkIqlDNREwPp+Sj3jV7jV6CMpg1ZtEcXVHMcwu9X2BhoU74vz3asbpsyEGEwHlQppCVmS+A1VIGaXJMZwkZsng4HaA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:41:10.3684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3e77c06-0a6d-4c05-2789-08d81dcccbe0 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5012 X-Spam-Status: No, score=-16.3 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 is used at several places in glibc to mean a valid code address of the call site, but with pac-ret it may contain a pointer authentication code (PAC), so its definition is adjusted. This is gcc PR target/94891: __builtin_return_address should not expose signed pointers to user code where it can cause ABI issues. In glibc RETURN_ADDRESS is only changed if it is built with pac-ret. There is no detection for the specific gcc issue because it is hard to test and the additional xpac does not cause problems. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/sysdep.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 2879aeaa5c..48fa8e9e90 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -44,6 +44,13 @@ strip_pac (void *p) asm ("hint 7 // xpaclri" : "+r"(ra)); return ra; } + +/* This is needed when glibc is built with -mbranch-protection=pac-ret + with a gcc that is affected by PR target/94891. */ +# if HAVE_AARCH64_PAC_RET +# undef RETURN_ADDRESS +# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) +# endif #endif #ifdef __ASSEMBLER__ From patchwork Wed Jul 1 14:41:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1320557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=rP+IN8ib; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=rP+IN8ib; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkSh1zJ9z9sTV for ; Thu, 2 Jul 2020 00:41:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 10BE63860C3D; Wed, 1 Jul 2020 14:41:38 +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-am6eur05on2068.outbound.protection.outlook.com [40.107.22.68]) by sourceware.org (Postfix) with ESMTPS id 9C3583857007 for ; Wed, 1 Jul 2020 14:41:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9C3583857007 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=yq0v/b67DAmzT3wW9nqHkM+lyXkY1c4Qgq/9O62XasU=; b=rP+IN8ibG3XBQjlEwfwg9u3g+SQnBR+5B6dT56CptfakKGPyEMBL4EsKMyiYjCcFaHVu46bz3IqXKv8COKFD07lQauSLD9WrJkzs0u4XkEP2ZG32MZ6c0umZzOB8ER6l9dgyT3G8DOEG5ZghLNVdsIlnG2JjhW/wUW/bL0fioKk= Received: from DB6PR0202CA0033.eurprd02.prod.outlook.com (2603:10a6:4:a5::19) by VE1PR08MB5152.eurprd08.prod.outlook.com (2603:10a6:803:109::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Wed, 1 Jul 2020 14:41:30 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::e1) by DB6PR0202CA0033.outlook.office365.com (2603:10a6:4:a5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Wed, 1 Jul 2020 14:41:30 +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 DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:41:30 +0000 Received: ("Tessian outbound 4e683f4039d5:v62"); Wed, 01 Jul 2020 14:41:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 56f962702a4ecfcc X-CR-MTA-TID: 64aa7808 Received: from d24c9e65ae9a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7655F9EA-F5C9-4C5E-A445-74272A36A3E5.1; Wed, 01 Jul 2020 14:41:24 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d24c9e65ae9a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:41:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xc86BkXTx6jY0SIc+94vhLvVe/r/okUdnD7Z2dxfNAINnjliZUXFendsqsL2dKGx03J0QcL7TCpR2Xsj1T7MF0ZYPwS8Ep2HqUU+ejmHtHt0MnaNZikhiQR8LDGY2PuFGgXdXaoxCgGPwg9Pbnb1zeu/yle4bkV7rLKxKWCSCi3kk4WCZCCw5hxjY8QBgvqQq+BQvAk5xupPm1K5KTkT1Oyyt02ZX7LXaH4j1EmCbmWn7x+Kqj1r2aaMCbrKERiH+L2Ka1HgR4BUqHo2xY1sJx1UbPhVYIKPgi7+Fown4JSOVwsy+AIyG/BnOopfE0Z8VKquqvkQjoXeCYTYKq8WTw== 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=yq0v/b67DAmzT3wW9nqHkM+lyXkY1c4Qgq/9O62XasU=; b=SjTdbyvPIALz2gCnaXe5LTYDX6O7tyOnctJEJ/sSHcuFeCaycznTdYNO/FXla6FHDdTncjsyEPLtymYXSGsPEKPP/monfZ5bygDRZw/jRgyatCKSBqT6dsGyJNl8gG+Y+iP0Km9ekxC5cO/5dK3p01GMNjX1GE0fMU/qGvjZAofejMNUHti9xkSbICgEnL8sqzxl2g4qzTNzahyEd4h6vkopG+YAbo69mBTTZK6VWcm+3+okGPpoRZM/wEur2E6cMSjXVMCFj8OmxpZHc2GoMadU+w1rlgOZdMER6tg1ZWgOve8DIf2Rn+rC0+KHa0ChLMu1KJFocPwScaTqBEuL7A== 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=yq0v/b67DAmzT3wW9nqHkM+lyXkY1c4Qgq/9O62XasU=; b=rP+IN8ibG3XBQjlEwfwg9u3g+SQnBR+5B6dT56CptfakKGPyEMBL4EsKMyiYjCcFaHVu46bz3IqXKv8COKFD07lQauSLD9WrJkzs0u4XkEP2ZG32MZ6c0umZzOB8ER6l9dgyT3G8DOEG5ZghLNVdsIlnG2JjhW/wUW/bL0fioKk= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:41:23 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:41:23 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v6 14/14] aarch64: add NEWS entry about branch protection support Date: Wed, 1 Jul 2020 15:41:11 +0100 Message-Id: <62a4294111ba2d06fdc1772fee65960e1cc02e5d.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR04CA0089.namprd04.prod.outlook.com (2603:10b6:805:f2::30) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by SN6PR04CA0089.namprd04.prod.outlook.com (2603:10b6:805:f2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.23 via Frontend Transport; Wed, 1 Jul 2020 14:41:21 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 775bf7c1-f65f-463c-5482-08d81dccd798 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|VE1PR08MB5152: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LhPYkJ7gszT5RSkKJpiC9IEAjsai29LfbIQPxQ8s8Uebk+grHw13xKT2wTf1AReqL8pguQzp5MP7n7VmoV3EEeMQJxgX1iGtlS5LTlSDroDEDItp0OBnvqrl8Ho3MzxBRpST1iuI3bADOu7wOUssoVWAvNkQDg2VvhiVCbGtKJ6cOVqJH41J1diSkgcVZmZmzkFLCeVWYExeUzeS5ygKWzMJTda6haRNlp2CB1DzMM5dqqJ6sXLv1/p3f8RlVFLmcRvfDOTA456VyqCCnQpSr0Ib5HMoEKeu79yEqqtJIriyqLAcedp4QCFMTVaoNVlyZFr3L3h4ro+m15nzdgGqQel1MPAH/mmzk6fjB9KUt5P2ueq/mb48SNkfbe1c4elttE63WA8JR6vZUcEP0uqiXriLkY3qsKFDuN+0cPc6QcM= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sw9GIUgXRgQL5I91CoRXFFKUsGhTcLkes3JS5bIf0IIFV7FFpir0DrwkVdlTBl6TuNw88P2kWHuAJVGZvJI+TkYcj8dnxHB9R41JDAkBp6TXjfrgz2Vtbmarthwf13agofsyAzfHSG8pbRuuNM7/SGHUfc7woPwNymGlBg0zokgw9wHx3ffpkiuhp5R0QRU1wCZUh6gowVoxzui7gMMYUETTg0N6LxKdUgizB+nJfBRxB/emIl8QAzi0y76xPlG7e9dq6xC2OZgKxFLzfHpcJLmHTAlD2mETZIwuGAjGB23UC+Z046f0nmMv2jTon18yZrmIQ10r1vbBnJ+aaq7nonSChf255X3QcEDyfpZCfOmautdBpuBzQ8eq+3lhO+bcxHKj34E9DxEKiW6bUxoE/yl9x7FW2Wx7+aNW9eL4Guc2VYkcJ5M6+Eu7lgxeG6vOQruCCxz1qjDyIUfcvcuvJgSAr+mlilkqs9AGx5kXFME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT044.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)(136003)(376002)(346002)(46966005)(69590400007)(8676002)(70586007)(47076004)(6916009)(356005)(186003)(82740400003)(2616005)(6506007)(2906002)(6666004)(16526019)(956004)(316002)(26005)(81166007)(44832011)(36756003)(8936002)(478600001)(70206006)(86362001)(5660300002)(336012)(82310400002)(6486002)(83380400001)(6512007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 2c0b9cf1-403c-4d7e-47e3-08d81dccd31d X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BUC2xnSylVcFxGd+AJID2dFkdglRuVhl4OlbrvhaK+crUDeWDB3vnkU+L4OcVfKyRRwCurm9y0DcPEAr/HJrz7bfYun+1ZkVxng5FuglgzILbD+ZL0FFA+6f6SZPylzTMxP+9ldp8EpX3RaiBViOl1zMW/hWZMEx4Rdj4KYnzISv2ywXyZ+V3V8yL79BwR5bvHibqX6YmDx04qbja4t4glGBSRDjyfEsxSlbZzLnSE01n3t+BtNOvhrw2XX0H89dT/PGXl9Sv6A5pyQE8FPhBcy5Q0qIxP1X0eT0V2KekdNTcMFqIW5qjjae79nDSLB0y56HKyJXARA04ayy+JJFsVgvfAKEfiktQAj0etkcYOFNh7Zfuylgxy1IM7rG0KFlZwhQ6zGzYgElhGKqYDFIVo/2/UffQERXOWd2O+jyg6TlUoG5Ad4I5MUPkHjoqUvm8sEXlRK+CakMpOUsYdCs4g== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:41:30.0393 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 775bf7c1-f65f-463c-5482-08d81dccd798 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5152 X-Spam-Status: No, score=-16.3 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 is a new security feature that relies on architecture extensions and needs glibc to be built with a gcc configured with branch protection. --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index a660fc59a8..7d0ca3f520 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,18 @@ Major new features: pthread_attr_getsigmask_np have been added. They allow applications to specify the signal mask of a thread created with pthread_create. +* AArch64 now supports standard branch protection security hardening + in glibc when it is built with a GCC that is configured with + --enable-standard-branch-protection. This includes branch target + identification (BTI) and pointer authentication for return addresses + (PAC-RET). They require armv8.5-a and armv8.3-a architecture + extensions respectively for the protection to be effective, + otherwise the used instructions are nops. User code can use PAC-RET + without libc support, but BTI requires a libc that is built with BTI + support, otherwise runtime objects linked into user code will not be + BTI compatible. It is recommended to use GCC 10 or newer when + building glibc with branch protection. + Deprecated and removed features, and other changes affecting compatibility: * The deprecated header and the sysctl function have been