From patchwork Fri Jun 12 13:29:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39572 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A64E9395ACD2; Fri, 12 Jun 2020 13:29:54 +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-eopbgr10060.outbound.protection.outlook.com [40.107.1.60]) by sourceware.org (Postfix) with ESMTPS id BC121395A825 for ; Fri, 12 Jun 2020 13:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC121395A825 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=1eCCy4K0ZwckRZa6CL8WWLwGepdAnId5Ao552RsUuGAcT7Kux3GGznnZmx5WikaEs2nfwA8uq2YkVdL/rn+bQOJF7/H5KEZEY0jeVER/d2pDRb+eaQnw4rsrmybD4P78fkrDeWlhpDvdC/R2nhiLgcmx+m9jHV4p8LqQRmjinvU= Received: from AM0P190CA0001.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::11) by AM6PR08MB3160.eurprd08.prod.outlook.com (2603:10a6:209:45::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20; Fri, 12 Jun 2020 13:29:50 +0000 Received: from AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:190:cafe::37) by AM0P190CA0001.outlook.office365.com (2603:10a6:208:190::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:50 +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 AM5EUR03FT031.mail.protection.outlook.com (10.152.16.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:49 +0000 Received: ("Tessian outbound 39cdd740f5cb:v59"); Fri, 12 Jun 2020 13:29:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5a24575f06e94c3d X-CR-MTA-TID: 64aa7808 Received: from d167b7339461.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1A1A4C13-61D4-44CB-A3DE-8EBE5575E99D.1; Fri, 12 Jun 2020 13:29:44 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d167b7339461.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTudcKNMsiWdDS6K6JvTtWbBqYrQ+h9nLLBnu19tHvJxaKDCKePDnSSBI6F9FPF7A57WlzWzHDT9OuBv0+SWttNfgZRTVFtSWtMGF180QNUkH30ie950qYLpK7yUqCCQoWMW0NbOD3SvLBSXANoS0+nOXr2Ziu89EHhEW3Oshn0b8rpz47Fr+rMYjM70dPV/u/FtnUKFlT/8DK/lVu+PV7IQrL8xUfyUdVTqWM6sw3N/jgIWRtuLUzBs5dHrAMsOG7wRoJfD06RAKFxvmELYHweLmDHdDYhcNYoccXx/e9X49bpEE556q9JpwinbcCd1u0SYG29o3RDRxD4FwWlnfQ== 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=J/umnHuzroO9p1Nt5t36b74MTM7y66AoA0OhDK9uKPl00GzG+Unth6RzYQil1CzO+vab2eiX6gNA1Jnwl4SXT7Q3aPZsze4zpo60OXtDtDydRnPfrsVPrWAB64Ud4Ob8jr7zm0dj0SzLyu5TeT0rQCkcnPMF7j/W964ma7Cu9xu30KT0BeKxc9hfi2z577QtQXbmNbJao3UuPQfy2QENl0ppUN4J5dCda6laf+wTLuH9Eoey5IHpaQ1lUoT4E4JXU9PqBhp6e87V7r+U2qqhTHOwv9J5b8InHGRkNiYtWbijuZiZJ+EvCh2Cqf2pT50wW+EiXnrvq1kJye1/Kvc+tA== 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=1eCCy4K0ZwckRZa6CL8WWLwGepdAnId5Ao552RsUuGAcT7Kux3GGznnZmx5WikaEs2nfwA8uq2YkVdL/rn+bQOJF7/H5KEZEY0jeVER/d2pDRb+eaQnw4rsrmybD4P78fkrDeWlhpDvdC/R2nhiLgcmx+m9jHV4p8LqQRmjinvU= 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 AM6PR08MB4183.eurprd08.prod.outlook.com (2603:10a6:20b:a1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.23; Fri, 12 Jun 2020 13:29: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.3088.022; Fri, 12 Jun 2020 13:29:43 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 01/12] Rewrite abi-note.S in C. Date: Fri, 12 Jun 2020 14:29:19 +0100 Message-Id: <3120eb8a4280eb19a87af2d0243cbde54db99930.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:42 +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: 8ac54461-aef0-481e-7bb4-08d80ed4aebd X-MS-TrafficTypeDiagnostic: AM6PR08MB4183:|AM6PR08MB3160: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: osSbaG7OuOvf7rREVk1VFHPoItPOR6ixxjWJvrjBmfJ+CZ6/PHsT5mHxM3T8ggyD5gpTpOE00TRbuWRh1/h6Ep3iI5V+f99d8Jzb7j19zXwwF7rs5Tx6QNCA7X/CTjE8RC6oFnOTts/5e6NCJKcbl6Ep9QSJvGCB4MYFO3wtLY4F8ncY8GrFJnVtNc+gFZdWjB5/RyRUCWjOPev2j0oHhYFKnBb3fZRZJcb81DEBNADg3QfK9wIufhMNNdbyDjVTk+4cvDgnIw9OPPsIOVUEniYh7ko2gBEN3hWksWrNP6O3b14GS8+q97yojVkutKec+RRgq1LZy4uwnIg3TzixzJg7ZH9P80Mp805ZZMpFY3DtSuZoQNRllNH1hS2t5Bj1yG7dtgkEbgYjsKZTtKiGG/S/5UqYXp9LLZd+cMiA/gs= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(39860400002)(376002)(136003)(396003)(366004)(36756003)(8936002)(956004)(8676002)(26005)(44832011)(5660300002)(2906002)(66476007)(316002)(66556008)(186003)(2616005)(16526019)(66946007)(69590400007)(6666004)(83380400001)(6506007)(52116002)(6512007)(478600001)(6486002)(6916009)(86362001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Tjx7BSYQc3UIi7vgNWX8nhU7Sf41TdHYXFEeKjYKiUFyUjL9xmYcKS+OGxCg4xiXRR94KN1EAlFES/8L5HXCD7wYKH3IUK1mG3OygH1xwN3aeZmxpox2rw8KDLY9rYaBOOAqRP92DrklQt6DlgjY3RzGpXB0p/nXh9g9gWfHwGtXocpvwQrS+VqjBHBX+vpVSK582/he7RPWCqjyRBAXmA7p7Xvy6Q9ZOquHpOp+mW4SzwrDxKz3fz9/GLpaIGUKoFFEJTSEb8QGCL2Vjj4ONQN8biLoOFNlv5h6YOQIAOkr2msrk5UUWlcfPwUOuNXwEsGgLUJ9U9lmlXVUsu7Cxu7VzWQuQK7ViS329ZEr+xIhieCsMmaKVBCZ5HoGm9f76hrnKE8B5dKxvcO4Mo1UD6QZRCi6TFZTFjBmxlXkwTkkOI4D7MWaF+lAj6Rc/Vm1y63jJe07/ojXOWSMIl01CnbbMmrkJKFhVE/DaU/5Sxw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4183 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: AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966005)(8936002)(5660300002)(186003)(6916009)(316002)(8676002)(16526019)(82740400003)(36906005)(26005)(478600001)(44832011)(70586007)(356005)(336012)(2906002)(83380400001)(6512007)(70206006)(956004)(47076004)(82310400002)(6666004)(81166007)(2616005)(36756003)(86362001)(69590400007)(6486002)(6506007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 6b6e234e-fd7c-4930-8ac5-08d80ed4aa6e X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 524w4ETDqDidc2Usod0uaKn3C16hgOCMniwf5msD/HawOnprQdvLzK3iZs0NAR6EVDjKauoD++585pjWYL9HsSVjeRypDFWGsC/R+cLWjNOkAZgcpHbelFnhOwTVOVCVTsTe4LDM6/ng+fUraTJzRd1YaabmD9wSM+pnKEjK5Em1WUfCqieo8duXW0PDJRHipd3gFwkD/0KRqyDRSv6BVJen9trQoJmdfIrVe/h8ocBaW5FJtSa6eiGhKKXtBVcjkNPwLoqfFhqtn7vDTY1lvOC2cnSOggnMw4WsTtOulKOKcmGSfDUS1aH/+ZwWCccYAjWvxshvRhRTw/u74vtNH3qDuhB0S8CfX9ZN2w60Vghpefz3bAaQHKA9kMtrbq+dLF/tWQzYAJTh4oL6XoHtsuPlzzIYOKZA2ZYpXxexEPvMEKUMWtaw6+fvLrFfbujqwMBoxVotvOVGjdhenJtEcA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:49.9844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ac54461-aef0-481e-7bb4-08d80ed4aebd X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3160 X-Spam-Status: No, score=-17.4 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 Fri Jun 12 13:29:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39574 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DC115395B045; Fri, 12 Jun 2020 13:29:57 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30082.outbound.protection.outlook.com [40.107.3.82]) by sourceware.org (Postfix) with ESMTPS id 75896395A831 for ; Fri, 12 Jun 2020 13:29:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 75896395A831 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=YooEMRt3UcNDQDm0HxBjVFPVefbO54CzE1NeYmx3rSIskldpuUC1OC1gfeBNlxKmBgvoCxY2N5OoPs8bRqzkHiKqPM0gCSlqjP14gLOYPjFEEHhM9og8Piq9UDkvRBoMiy91/KfbSb9VMO0fH4HevfrMsRrVM1dl8zQNBJkCklo= Received: from AM5PR04CA0014.eurprd04.prod.outlook.com (2603:10a6:206:1::27) by HE1PR0801MB1737.eurprd08.prod.outlook.com (2603:10a6:3:81::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Fri, 12 Jun 2020 13:29:51 +0000 Received: from AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::ee) by AM5PR04CA0014.outlook.office365.com (2603:10a6:206:1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:51 +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 AM5EUR03FT062.mail.protection.outlook.com (10.152.17.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:51 +0000 Received: ("Tessian outbound 1145f7a293ca:v59"); Fri, 12 Jun 2020 13:29:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: aa842ac9c1c68abf X-CR-MTA-TID: 64aa7808 Received: from f222e7764416.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F79F5542-0F42-4BB7-8A33-10C46F851328.1; Fri, 12 Jun 2020 13:29:45 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f222e7764416.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B3F6Yt0TlFDr34qm45zQpHiV8SEfkAiWlHu6Nf5wJF4hmGZaceiWXWSbmwyS4K7WXTU1OIE7dQ6JJNqNODwfuW3dEw68192qi/EQj9xMlTyyUaoTH36tx3MqMVQ/aVxCB7C7XzwAjgRawO+pC3MmMkO2n4JBF6NDWAHsHSZ5PkrZPe2ZeCNU2axpuwmhBsn/j7rDUz5pNffK9PXj+4/TtgJWZqSbArp4WLYrtCiS3k1bxX26Ji6S7/V13C5tLebYpYX0NGC+dAcVRebpjSImxQPHnIqZh02CXvNqcLYgi5HWmAGw5JmtFt6mvj2lsQq3hNZSHzSR7J0kcykj3TGqoQ== 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=D/nDf87svi9uiFNxpuV7dE7HPtyh564KIt3djoiI5VKyA/SY8unLFNmC9CrFWRNMZjlMwQ1R4C0SaYRMqRSrlcdpv0/2qoPfE+/yVTudiQcS7evzeznsK9KC5MQ/dKzD8p7lZPHsAbZ/f7spgsrpBJ7KXUDvu52NuZZwoumLeWStVLOMYRoj6go391BeqVv5Zy9+fnkEHg8iTmYseVJw3TPnkjywgAdJiCp2A9ZkUjeRbtI0JhDcDzIS0dUm2LRJPb4XVpvIAVl2CGEvAQaK2/n/Rv6iDCEVRBCXOGepAKXtrEyIyHa8QuD1Qjs5VxuNUl1qKn7vsgCFGfGCUfFEzw== 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=YooEMRt3UcNDQDm0HxBjVFPVefbO54CzE1NeYmx3rSIskldpuUC1OC1gfeBNlxKmBgvoCxY2N5OoPs8bRqzkHiKqPM0gCSlqjP14gLOYPjFEEHhM9og8Piq9UDkvRBoMiy91/KfbSb9VMO0fH4HevfrMsRrVM1dl8zQNBJkCklo= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:44 +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.3088.022; Fri, 12 Jun 2020 13:29:44 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 02/12] aarch64: configure test for BTI support Date: Fri, 12 Jun 2020 14:29:20 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:43 +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: 07e3e343-a179-4e4e-fccf-08d80ed4af8a X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|HE1PR0801MB1737: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: zCDxEKj8K1APzSTLrnpG8nzpQvufTul2RMmICH660SaW5EEcDouMUwi4EHky3n8175h5BD77vQqpZgP7tUKOy0e20bptZjz3wFuuECQvbbDkNnC3z43ukQZva2SNESQM1zjgM0ODWOfh0xugg9nkTAYRsENl0aP2P4vvtdabkc0QBRAK+bu7L62w1lUJOkE7oyHjrq1Asn9utFvWMALQOWxgCY9TOSfYR1q4HGWYyh6Q2VuPJgOyVA5iss2kiPD3FunfMp1Pl6J5WWK/QTAJENo+wdont/AC471saAjpZUHBbmcqUrn1MQY779p+9ldVton6q8Qpoy1bCz807kmt4bnCWunmAoyJqKC3MwLCTPu0J4RzCh/4YR7I4ZUJ8kgjsU9RTapQLHibyMcGOX7OKGRnouu2P2X+WYLZmvZ6wpQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CU+hA3RnilrqnrpMzaf4XWBV+zTy55UJQtmSmC0NPCxVSGaJj95W3YRAP9FRemg2RaLqz/u7AOMs390a25QZ9V1ZTOZ71OTwaFxo6us6H39iWSu4F00vDvsASG8oS4vtRdAlzMCBZAwW6rpIz7YGrEOXnkoPOcCdG9ioMk8+s8J79LRKg+WKv4wTxcTicE5WwHALnl9eSIue5rZNp9X75flf95Chp6SMaxvy7uojePWPyEBr+yh7lwDta7kx3jmIocZjR35+zm8p1xW1uvlV4DJ1TG92axxvuUWso3h0Vz1zK0hRx4TIokDxWc9DQSJzOdmSpSOo01/LI7Gr4BsmeX/YGElUSGe/uV+hXmxRwTAi1fBigfIjD8lb2gWpYB/vYv/KTKInMmDVqKum69Y4/sUDswBiYwgWc06I9bmuetNyiVkIn0uVx+4NaLyqpDz1SwMvPq3C/tpPF4mF3TlzGNW74MD8/28CQxpEjzJGEeI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT062.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)(396003)(376002)(136003)(46966005)(8676002)(5660300002)(6512007)(36756003)(36906005)(44832011)(316002)(336012)(70586007)(70206006)(6506007)(186003)(82310400002)(956004)(6916009)(6486002)(47076004)(69590400007)(8936002)(82740400003)(6666004)(86362001)(356005)(81166007)(26005)(16526019)(478600001)(2906002)(2616005)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: f12d7f5f-fe31-491b-7bca-08d80ed4ab3d X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +765K4YNmin6X5PVu2gk7/IgTTIEw3C3ZxXE1UJwfKJDD52xgYD4rmFKXoSL2DfU+qR9TJyz2SfZMFWILzX2A5HIJ0wngdeo+KUal0ICd+PxUFCIMjFRaAdYTu8RyKMNtxc0yWUzBYI74P+Y2/C+7C2ygZh+DLbJqq03UcrD1nqJEWkddS30sNinCqtinsAYRAONSdpJq7pVkdTrkWUy19TiI0R+10NhwAis6IxxFhDQbC4zfbRjUWFx4RwJFxoZ3r+m/RO/wPYeBKB7rElfwsUnkAs//oxHrhrqBHIIzYT5wIlUmmKdBdyf4STC7kNw0nvBBwBTazoBk9YiQzQJkNcAKFG1fjPE3K//TNSRaxZn5fXDu/ubwpJ4G13s46KcQ2NhxRx5JC+tgoi7+2cFv4c7UGjamI3eXSwhhmMEHjl+R+8LHbcD8LaHAdvzwcKMhNOBqZU9XvcJHjsZM9i1ug== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:51.3322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07e3e343-a179-4e4e-fccf-08d80ed4af8a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1737 X-Spam-Status: No, score=-17.4 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. --- 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: 39576 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EBA0395B03F; Fri, 12 Jun 2020 13:30:00 +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-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by sourceware.org (Postfix) with ESMTPS id 2F4BA395A831 for ; Fri, 12 Jun 2020 13:29:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F4BA395A831 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=DH7R+z2S7C3zS1+fHoOGSPKmEQ+2U8QjLTpUzlfhUik=; b=hdzGx8d/mpzk+3UzvHWCYwKxVU4ytqDDmc95+D3lFXXXlv9im0fbHoaLvkVeKAOEQpnvV6U1MNpAYZpWmvbgoOlYRyHBZUQEctwIex2BhLJQZcFCGIsfA5XWlocwgkLXcY9AkQKtVWMzBwXzINssNoBGuVR7iAwIlrM0yofXARQ= Received: from DB6PR07CA0080.eurprd07.prod.outlook.com (2603:10a6:6:2b::18) by AM0PR08MB4068.eurprd08.prod.outlook.com (2603:10a6:208:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20; Fri, 12 Jun 2020 13:29:54 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::f6) by DB6PR07CA0080.outlook.office365.com (2603:10a6:6:2b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.10 via Frontend Transport; Fri, 12 Jun 2020 13:29: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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:54 +0000 Received: ("Tessian outbound d3ae83885012:v59"); Fri, 12 Jun 2020 13:29:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 76660667a5003de9 X-CR-MTA-TID: 64aa7808 Received: from f5e58b9f3c77.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F8752570-FA7E-47A8-BA4D-C74036E9D030.1; Fri, 12 Jun 2020 13:29:49 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f5e58b9f3c77.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hxK/qEcMIaccfnW8Uj0Z1hA49nmjlV8fvm1a7XOF3AR0aDoRSaaIka6INwIq2rAWHMsseCJIfgYcj+rkOfaYrw7WzdNB0bs2fb1tXZqzRM708pd/DSmQncaqPIy7LIFVjwmhCU0+4fAy20NXT0Pmfv4IgrBfNNvfOkrwJBoStGCRHfQGckcb3bp+5kODFFmDrkW2chd0uNz8Oq4rMQZH4I6WYdQrASVcB4m6gWKViXlysVSpON+o3F3vTe/o1bNkozh0sqUKRpZES2jLWSNcwnjV7RtQpTSFHrYZ/bHjOlU64oH/goWDsYMw3KeGsCPBUii1WZyLBznQr35rwogpCg== 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=DH7R+z2S7C3zS1+fHoOGSPKmEQ+2U8QjLTpUzlfhUik=; b=Jx1bCtJh9oGnHuju2OCoTfgFSVk3XMGmyUg/b+adyVNB32onoHCFhYN8Shgsh28cd4whLejgGlej9xd82jD1HHqEkYwLiMPDrjxIuG88JVH5gm3fHcngo3pM8KqAHmyDzi0ZPP35kJlmUdR/Rn6N2XrkGBZLRmeLrpwAfogV44+SXCfneCtCNCzRW58zSVjOoNNu9F5QYG+Kd3bpSSPS1J08lEzycFzlY5JfunYdp0hmKy3JptaKhAzx9d1N1CHkTS/D7WJkgfHfwF7UD04JwH25fi3prvsTvETyD5181gG3m4JINHKZBylVRh0bsh/QbJtDqEvJHyhQyLjAlufDLw== 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=DH7R+z2S7C3zS1+fHoOGSPKmEQ+2U8QjLTpUzlfhUik=; b=hdzGx8d/mpzk+3UzvHWCYwKxVU4ytqDDmc95+D3lFXXXlv9im0fbHoaLvkVeKAOEQpnvV6U1MNpAYZpWmvbgoOlYRyHBZUQEctwIex2BhLJQZcFCGIsfA5XWlocwgkLXcY9AkQKtVWMzBwXzINssNoBGuVR7iAwIlrM0yofXARQ= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:46 +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.3088.022; Fri, 12 Jun 2020 13:29:45 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 03/12] aarch64: Add BTI support to assembly files Date: Fri, 12 Jun 2020 14:29:21 +0100 Message-Id: <04a1d3f9c55bf600e85c8ed302524de311a611aa.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:44 +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: 51d33d9b-7ab4-4fd1-8249-08d80ed4b1a3 X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|AM0PR08MB4068: 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: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: E1Rx8wr/V4bYCGHeP6hqTlgL7XXy96nZ4OhXSW9WLqwzIwOa5pzUQhi6io2FqlQX1Pe5S0L+E3CJNDob059DeXN0z/muOZcWUOODRDh87M5xVEO5e7QtWDYK3yCBq8EZqPXNx0l103giWxKGTr7o0syf+2BpmHpnJFPs5w+KlnfgMKLqA902dxhzkZwUCTFvy9oSOWKPpvmBXRdILF0W6K5nNgWoJ1bY9FdxHdTEUrvzN31i2IpzFRcsfHlxU78Gj+xp1EBi3MMUE4d3RSj1wGWbxE1wV5mWg+DkJNMuME1j0O0OJOC6cARA+lvozCYTOX8VA7bcNiyq/U4mH/zdAUeKcHBHzvncm5TCCz11OfLpN9bJ3JGkLc4Mg2EA4PivybrzBrcfl3WjOfPxw7YiE/YKoWnahHNoqCaD8P9AWcs= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(4326008)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KYhqAVT+wLnj7VgoepBi93uoHdlqlCW5WhIXUGpdDvQ81wWyL/TE0bqjDrrxeY8d5TkRL9ffSTCoUiHNj4EzcvdI2Ho49FEn3eKBzwtvaagDiBYRdLoSZnQbzQxX7NNvDjFP6Xwa+z2Hei8FenjNFT5QLrp1UOxRpn1qbjzlNls5IQhMT5XGHLCIsCUxsUj31pomTB3CdsG02VR6t9sLNxb9JjR3tqubG+AhePj4SJhBlQubmctugNwjN2VaoXZqRxHnBAmm7+IvwbelhE5m7VYLPVb7nfB+mhNI5ngI4/R2u3rgwLQrNlNsoL9rcFzm19Vvc+VKHXC789qm+Hy75GHLbxQp/Q2TFBP5aOKDn3DrZ0YTVITYikT9vbO2bqlXBgAjhLUu2bBGjTu1LQ+GdEmR+qaIKE/gOPssQfleWBJToYfIi/lqOpRH8+10JsW5Bc5Ar0c6EQaRj50CXxbJtlcxY/1L2g2xutH2NVlInYjbQrtL8XjdCXN+EfAN0jYo X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(346002)(396003)(376002)(46966005)(2906002)(6666004)(316002)(70206006)(2616005)(336012)(478600001)(956004)(82740400003)(6916009)(186003)(44832011)(6506007)(26005)(86362001)(70586007)(16526019)(4326008)(47076004)(6512007)(8676002)(36756003)(83380400001)(5660300002)(82310400002)(81166007)(6486002)(8936002)(356005)(69590400007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 9cfed7f6-d7c0-44d9-dc27-08d80ed4ac20 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BuVEtnyvQLPFAFaBzqvyZOhQ79XJ2QlYUaDXNQKwkhAMeMLRmdZkiNoPP//upSkgUSe8mxqnU1SArTKDGpyIR6AdakJNqYoucCVZuNuU0EJW+uyGX28pmuA9vXhubmjN/DINqopaMSEE5qa05EekJ0/3SRglnT0jaaMqcHuj4iTs5QOAve1K8F4069iXsWH6cUE8uCRi7rlMc2olTSo3xjjfQBxAlmDjOn6LKKJvKSVkHGJF/XKBKEB0Kd1F6um9DdPnH5fPgx8tRQh1HlPRS2SdOTvqFTrAF9dcRjJgyKHbPoH+VZryGp/ZZiknMzLkEpJEgOF1PAAu+mgqj7dgJ4rLezWqG2vc6epOOE2gQLdSxAvBbsbQdpqrhdYbtU9sjVvFw/Plxs939MGZBeeeUOEid23mNzLLh2Fr/Oh+K9kBREDn/RpVAu9+jjwYj801I5QALq2vQhyxQkoV+H1NTw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:54.9003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51d33d9b-7ab4-4fd1-8249-08d80ed4b1a3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4068 X-Spam-Status: No, score=-16.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: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Sudakshina Das To enable building glibc with branch protection, assembly code needs BTI landing pads and ELF object file markings in the form of a GNU property note. The landing pads are unconditionally added to all functions that may be indirectly called. When the code segment is not mapped with PROT_BTI these instructions are nops. They are kept in the code when BTI is not supported so that the layout of performance critical code is unchanged across configurations. The GNU property notes are only added when there is support for BTI in the toolchain, because old binutils does not handle the notes right. (Does not know how to merge them nor to put them in PT_GNU_PROPERTY segment instead of PT_NOTE, and some versions of binutils emit warnings about the unknown GNU property. In such cases the produced libc binaries would not have valid ELF marking so BTI would not be enabled.) Note: functions using ENTRY or ENTRY_ALIGN now start with an additional BTI c, so alignment of the following code changes, but ENTRY_ALIGN_AND_PAD was fixed so there is no change to the existing code layout. Some string functions may need to be tuned for optimal performance after this commit. Co-authored-by: Szabolcs Nagy Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/crti.S | 2 ++ sysdeps/aarch64/crtn.S | 2 ++ sysdeps/aarch64/dl-tlsdesc.S | 3 +++ sysdeps/aarch64/dl-trampoline.S | 2 ++ sysdeps/aarch64/start.S | 1 + sysdeps/aarch64/sysdep.h | 34 ++++++++++++++++++++++++++++++++- 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index 1728eac37a..c346bcad72 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,6 +75,7 @@ call_weak_fn: .hidden _init .type _init, %function _init: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -89,5 +90,6 @@ _init: .hidden _fini .type _fini, %function _fini: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S index c3e97cc449..0c1ef112c2 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -37,6 +37,8 @@ /* crtn.S puts function epilogues in the .init and .fini sections corresponding to the prologues in crti.S. */ +#include + .section .init,"ax",%progbits ldp x29, x30, [sp], 16 RET diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 557ad1d505..9d96c8632a 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -74,6 +74,7 @@ cfi_startproc .align 2 _dl_tlsdesc_return: + BTI_C DELOUSE (0) ldr PTR_REG (0), [x0, #PTR_SIZE] RET @@ -95,6 +96,7 @@ _dl_tlsdesc_return: cfi_startproc .align 2 _dl_tlsdesc_undefweak: + BTI_C str x1, [sp, #-16]! cfi_adjust_cfa_offset (16) DELOUSE (0) @@ -142,6 +144,7 @@ _dl_tlsdesc_undefweak: cfi_startproc .align 2 _dl_tlsdesc_dynamic: + BTI_C DELOUSE (0) /* Save just enough registers to support fast path, if we fall diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 94e965c096..2cbfa81434 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -35,6 +35,7 @@ cfi_startproc .align 2 _dl_runtime_resolve: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -126,6 +127,7 @@ _dl_runtime_resolve: cfi_startproc .align 2 _dl_runtime_profile: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index d96cf57e2d..75393e1c18 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -46,6 +46,7 @@ .globl _start .type _start,#function _start: + BTI_C /* Create an initial frame with 0 LR and FP */ mov x29, #0 mov x30, #0 diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 604c489170..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 Fri Jun 12 13:29:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39575 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 44052395B040; Fri, 12 Jun 2020 13:30:00 +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-vi1eur05on2052.outbound.protection.outlook.com [40.107.21.52]) by sourceware.org (Postfix) with ESMTPS id 593B6395B040 for ; Fri, 12 Jun 2020 13:29:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 593B6395B040 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=7KJf+ADyhQiz4Qjf4hbykg0dqScQ9hch6qhDZIgPWcQ3tvc12nIPSaHE79S9tPQHRzzBS3Irni41kJkOFYWnlZTlNhNQUNsFSQ5XZuOdL+U9yTEpvnNcvGCxgdATN5UTE8jFCFF7a1Z5NcuAT32U3Og1udwg3jGRlYSug8WeFkE= Received: from DB3PR06CA0029.eurprd06.prod.outlook.com (2603:10a6:8:1::42) by DB6PR0802MB2581.eurprd08.prod.outlook.com (2603:10a6:4:a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20; Fri, 12 Jun 2020 13:29:55 +0000 Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::d8) by DB3PR06CA0029.outlook.office365.com (2603:10a6:8:1::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:55 +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 DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:55 +0000 Received: ("Tessian outbound 4f5776643448:v59"); Fri, 12 Jun 2020 13:29:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 42df59e275b656a0 X-CR-MTA-TID: 64aa7808 Received: from 343435107846.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A761430E-7391-4D4E-ACF2-223C8F7AC591.1; Fri, 12 Jun 2020 13:29:49 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 343435107846.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kqH7wtMhoXTGczcZXAimmvsjRpJmE5DjMift7ZhlwkxRS6x1Ee/NXu9qfqDXVn1yoxCBAbZQRVM30G0cZHIkAkjdFyeiiUYYbrXpmbqOvEAOeHT+q9kyjTNL/OEEC/018u9IxhHCdap4g6CmGLapgUQi8lJdC9TfEKP8kPJnNwyMiSNPWsIdUg3sYKNaC8JD0FDO5K+b4Q07ECLlzb9cvb1G14yUbcC9aDP0bHKCA9WFRYb4QlYTx7oTxCUqkBxGYCSz93y/vleinu0qbYhB5j/LgXmOzPW7YgK/TB7XyzFmjiJSNzOtuI+zJexXm35Fkb2Busq0kYZYHqHaiRnpDw== 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=fIMIb5sKnEAXSBI9AT0cJ6f2w2m3ReyAtpmIyjAwAd3ivusJDbi2yrqz1u+tr9rKusfPOJo6rPYiwnn3i1uPFlW+bgwygT3yjhIMotm50cfkJs0GwPmRycRctWd9jFL/oIXtqiCbGA55aqKJr0TAhajXm/yFvg1c1pQvSvuJ5dPibdNAESZMrUbojhmd8dB5154YIuwrxjL+Rbz79UfN4UATOFOO78+vpsZ4/RXXQFyZHFBAFs04kzdQwIMsknnCo2WntmHOWZQkZWe8hMMoSqql2142BO0f+QKN9QwKGCX2LNNXHrfsPsLsoflvsNl70MW8LCkBpfX6GEtP0xzSHw== 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=7KJf+ADyhQiz4Qjf4hbykg0dqScQ9hch6qhDZIgPWcQ3tvc12nIPSaHE79S9tPQHRzzBS3Irni41kJkOFYWnlZTlNhNQUNsFSQ5XZuOdL+U9yTEpvnNcvGCxgdATN5UTE8jFCFF7a1Z5NcuAT32U3Og1udwg3jGRlYSug8WeFkE= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29: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.3088.022; Fri, 12 Jun 2020 13:29:47 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 04/12] aarch64: Rename place holder .S files to .c Date: Fri, 12 Jun 2020 14:29:22 +0100 Message-Id: <6308b5090c076b8046d1a24cd280f4529a1e3e9c.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29: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: a57bd79a-4057-47b3-4f33-08d80ed4b20e X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|DB6PR0802MB2581: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6JOfZFPtO2QJgDebb4ziPs+eY0eykCzeodCF8pQaWFxRQxo0QEH4rrsCNHHTN+Fwv8h4q9QaZISg7X+4x8m/JKWBkPRXSrAfGt2V1OWcdbI6oPgYoEeu8jcZ30W9DQhghLwj+JYGthA4pmN2zvdMnM3p684JoI7zn9rqbCAz7JH4JrFUOFPTTqDjWrRAaf3FL3R1CfRz3Fsxrz3pIrp1PGl7dlHZuYKnJOKNDGLbMlcQd8+fKepzpav1xv7+1zFUy3AtzmugJ5fV0osFCW/3BcUtyo7IOKdn7+SCcp09cTSZDhsB3K6EHp3i1F4oeL8OPae0dAYu1AkY8XtiMUKzTVksWcjizPZIEV/2INdLRPtq3/gBZvlrdFeDJMmyNzSVa3ym7JCN9SJMTjY8vGHvfFFHw5PRFgtTS4+ZRBb7XaxPPHsxxqsHAjkjPvODyoIz X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xBfK5yXQYs4HHCumnyb0ycKzWqQD+svzS+v4OEUh9qKoX9h29xJlEf2Hr5OUVh3oD7gHV7uYSLAo+k/1/tIdAZxDxQZGfNTkr9gQtpvEtBMLoHQQjQKyBA7sifKS0emMH0jvT/JXVbTNoSYFyfd4AvrHx2cmrh7tOw6lHcMRYn7W6UQZbvdYzzUA95KuGyHOX6AwaBOCWKlcochTEOdMhVSqpBCKCmGYH0Rxd7N/SX1blT6+SLR1U44YC9pVRXoR5riDTDiZs6IsaJFhuBIjETUpn9cdGVROkjxsCUN/RJKhypzmIQjnj+eOEqymGT8DVVO2eXZV4itOHAgC7g+mgA39uye7UoNh+l+GCGY9O4rPtKh7uBrzkuRY6uf9YrzTvculSBaBCa3OftmXNk6WnK1C1CrW7/XcHbpyYaHXHS4iYzQRmX/L/NT+A13eBc/1WHjWgoDunHHVeDRM7u0AmO5ZXbTOH0LcLMa7IBK0VIqZU9HiQ6HeXmtUee+OUU6R X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(376002)(396003)(346002)(46966005)(5660300002)(186003)(336012)(956004)(8676002)(316002)(82740400003)(2906002)(86362001)(8936002)(47076004)(2616005)(69590400007)(36756003)(6486002)(44832011)(16526019)(6916009)(70206006)(6506007)(83380400001)(82310400002)(26005)(70586007)(6512007)(81166007)(6666004)(356005)(478600001)(142923001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: b35bdf4a-fe6b-444f-b43c-08d80ed4ace0 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LprvuNksqM2OFxne/T0NQkA6hNMAzfDs6ZEIo+B0cASQh7Ztmt+iD1Dx9/cCnoC6/NtnQefHN3398Vw/aQnwctjNnIky2rnf9NdnE0VKJU/NZuXaLS9QGN/3d5j8itN/Sk1VWk7NIZgZXtmpdvvDuQAPdbzx1KFgK6sS4yvgXgbDHwK3c4krAXh74uAI+INh5Rd3DQ8+iR53chGuecNXtYUMqGbkBJsJmid03lDHtcdsMgqHJs8gA7MYJZAe4m7Tp/LBuIUW3biVOc56Ug2bLdfs+RlAFl1zzM/X2GP731XrQHG5ZhcIlfJHQvDPJy/CZQUdc1wA+eGcMjvATf0Iv1ITXLN+faDB2ulw1D2QqO92adltLJu8VAyGMNydHKE7Dij5zQjaJb28fcI9W5csDWGQ9/haH6Qs0issFVKrfyU33o0ILvsmfcN9t63Ahby7THE/VoCWeMrVpREiiNljs1oGEyEUakxqIFjEhzuCHu+Le5SnZWfWYNtstG621bAa X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:55.5983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a57bd79a-4057-47b3-4f33-08d80ed4b20e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2581 X-Spam-Status: No, score=-17.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The compiler can add required elf markings based on CFLAGS but the assembler cannot, so using C code for empty files creates less of a maintenance problem. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} | 0 sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} | 0 sysdeps/aarch64/{memmove.S => memmove.c} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} (100%) rename sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} (100%) rename sysdeps/aarch64/{memmove.S => memmove.c} (100%) diff --git a/sysdeps/aarch64/bsd-_setjmp.S b/sysdeps/aarch64/bsd-_setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-_setjmp.S rename to sysdeps/aarch64/bsd-_setjmp.c diff --git a/sysdeps/aarch64/bsd-setjmp.S b/sysdeps/aarch64/bsd-setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-setjmp.S rename to sysdeps/aarch64/bsd-setjmp.c diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.c similarity index 100% rename from sysdeps/aarch64/memmove.S rename to sysdeps/aarch64/memmove.c From patchwork Fri Jun 12 13:29:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39578 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E327395B06E; Fri, 12 Jun 2020 13:30:01 +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-db8eur05on2055.outbound.protection.outlook.com [40.107.20.55]) by sourceware.org (Postfix) with ESMTPS id 8F8DC395B04C for ; Fri, 12 Jun 2020 13:29:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F8DC395B04C 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=OHBjULOhP0u42/EjUtWWjD5GafCXwjFnFT8OX6Lv7UxOPLzu8PoETpRwHYKDSfcvcNhrwCK77za+hv43jolOoOgInKttt/NBzro4rAIfxUzwkzYlkMGHBk9FLhPXxYh+ymC1X2aS45ZnMU7Os2iK0e1/lXH1wiCQIqadKIfNsgY= Received: from AM6PR05CA0013.eurprd05.prod.outlook.com (2603:10a6:20b:2e::26) by VE1PR08MB4686.eurprd08.prod.outlook.com (2603:10a6:802:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Fri, 12 Jun 2020 13:29:55 +0000 Received: from AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::2c) by AM6PR05CA0013.outlook.office365.com (2603:10a6:20b:2e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Fri, 12 Jun 2020 13:29:55 +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 AM5EUR03FT050.mail.protection.outlook.com (10.152.17.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:55 +0000 Received: ("Tessian outbound d3ae83885012:v59"); Fri, 12 Jun 2020 13:29:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 64f412ceeef552ca X-CR-MTA-TID: 64aa7808 Received: from 343435107846.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5A743880-748C-4BF3-95E7-A7F5CB364941.1; Fri, 12 Jun 2020 13:29:50 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 343435107846.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hev/Vph3tlDmz+M1uhxuFONVV/Cs/NDmzLaCG54LVwb6ZxROJORMN1C5HGqND+DdsK9TnW3O250N9QN3DvsUFgJ9Rdsbd36m6/mGBUG5WJoSSJFmbchFzfDMAID7w6gcKOXEQuq0Snlij9QEvSZ4rxunu4LynyqejliA6JtYJyL9tW7XgHFx6kBW3rcEazmyjMeSzaq/izc3YPCi+gA5MODUKK8M9X+eS5LZ5kfZF12w+obLZXST61M4u9BNqkchZLlifPrpRpc+n4++VFqJ0E4ZLg787zA28dav/1GMnqEXSBM51dplyDns7zYlHqbcZBol2mfGWN6UIPwIq4/u9Q== 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=NEzaFoHZk72TZPGbeGoGjpPp9v9zQSezuTxWwkAsuVcOyAwDfm0doA/LUv/krgjCeJ3Z76FpFlvhgs6loQ1OEe9w56le4A3rUMgQEwqkZBPNSH+iNDWgS1U4zwzC383GwTlc+b+v9BFOVKKmPbMKW4eI4ZQhP5vXHQBHDtjQfSTzmRZSYNXXNxxuGg8nJX9l3MepAL3HC0sMd/TRrfNY7xSzIfMK9LRHjo8XRJ6Hj0p5DqUvlvTDsUcvCmEILq1JnTeabvVND0lkBcNjmjrQRbWFVYQyKVYgMXg686BdAqLTxt9VyyWkOQFQ26QWYqBOK/TXEh9VF6odJOnlN+6vJQ== 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=OHBjULOhP0u42/EjUtWWjD5GafCXwjFnFT8OX6Lv7UxOPLzu8PoETpRwHYKDSfcvcNhrwCK77za+hv43jolOoOgInKttt/NBzro4rAIfxUzwkzYlkMGHBk9FLhPXxYh+ymC1X2aS45ZnMU7Os2iK0e1/lXH1wiCQIqadKIfNsgY= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:49 +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.3088.022; Fri, 12 Jun 2020 13:29:48 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 05/12] aarch64: fix swapcontext for BTI Date: Fri, 12 Jun 2020 14:29:23 +0100 Message-Id: <205587f38dc8ad7cda68f64c323ed0d9bcf56583.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:47 +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: 7bb40deb-2422-4cab-1658-08d80ed4b21f X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|VE1PR08MB4686: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ge5X3cU/LuobpnqCnM82AaORA5B0AWnYYJbmC2WDlZac5BaQfTNEzaA4oDKRdrrxPbMSJv3CAG6nydmwEHv/mC8HIYrJgwWTwejlita3rQNht7F2t4KV5SVfFmHEY85/TrP44Wa1PNiG2aLpqYvP3JKA6mPM+3VL3Nh/YroFsNkDgcc/18udRjov2YHgPWpIVwsXWeZioYuuLa0UjRFWAl3vOpJF66LEr0T1m+U2eSu7lFhYn44MF5f7HJp8l6CmJzyHqFWZj5Z3a51wQYa595RIPMfNxFNuF9YohfLrisI871PVtJH9KOEn1B2IIHT28T6uzeDiYgSo3U5Jyuo2UIdgduTRFy3aD+pD1J/NXW7rY9LqQN+jLQzuzWbNUdathdOUWdk8NVCXlduUgD67hS5SAsh1Eb7yHXLtdXJB35M= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pg3LV3juQoKPYctFFsKVsKe78u3Gb2TEkPaSOgDakYKyUxdk8usN5Kkts4UyoUC7GERVpXkYZExRxdHveRM+yOD9ts5E16GDxZY1Jhd8Y+LuDmaJWi0S0ND3dm2SEkAta3ktWlx7VaXFOS0uF8+g5KIs58kDOMwlpGAKYQrRK6vT9ng/9K23/vU9S+acXnR8mkSFXe5TxdShkd0eo8nBIWwxYLwj2gBTX5mXWRm0C6ZqyWF7NAFUdj8+L7M3kG9AuQbN7sNc6nPlmez+E0jnF/rpvfJnWY6SV4EMzeqW7kJQprM+61lm2xMCvC0YqobHjsDlK3HP1hDvSa65eC5DUNe/om3dGdIMdd9HcoBI2d47HpYbTp83u1pUhMqsBJ1sZL9jwKA7REm/F245pS0GubITBQIDX/VPdJQIdZUDk2w4VcaaFbgzGQkCHJ5njM/eI97IGFp7KcLJf598vsF3PcLWHnYXQDGfBS3aV6x/+aS6Mee/JGRq75fLTD4DyLLJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966005)(356005)(36906005)(69590400007)(8676002)(2616005)(6506007)(956004)(44832011)(336012)(2906002)(316002)(36756003)(86362001)(6512007)(5660300002)(83380400001)(26005)(47076004)(16526019)(186003)(6486002)(82310400002)(6916009)(8936002)(81166007)(478600001)(6666004)(70206006)(82740400003)(70586007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: d9823608-850d-4b3b-b72c-08d80ed4ada7 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XVoKjs7kXMVH5iu9EtoDzsvUPgbmj7JK/wwuQOZDsN4CldGf8o/GvsyKVTvKz8bxp2JrDegl8pXUcQrt4/EhryLmtrKxC/lnc+K8jJFbJCKH7Gx7qGFWi1g5EhBm8oK3eJYRDCjBl8Fy317g4iSiVMrJP8n34G4I2ZL3rMaB2a2H7bDZfWvUZkOtOv438+71AkBJs++w9G/qUC2swvJXk4hDw45zEcijlKNHMx0YYBEOKFIFc6iOWZ/QUph3GTyjDsTjAM3qQKCmya9UuKmFNbZColVOY4yzeM0/Q5GA4uoSonsaj+B8WGsSlm0IdCxNz82SW947Uxzl8wBuxvO4ZN0v+ZD2BLUaZIk1ZdQpiNiQcV+KVZG4IrUoNIEIz3PCb0ba6jQJaAhckHyx3CwQPNEYrMdycUSbyCVfBEySBX5rV/m6Jjt/n7NHgtNaHhfVXOJKKDdH27HlCkoM5LYN2A== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:55.6542 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bb40deb-2422-4cab-1658-08d80ed4b21f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4686 X-Spam-Status: No, score=-16.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 Fri Jun 12 13:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39577 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F2E40395B057; Fri, 12 Jun 2020 13:30:00 +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-eopbgr80080.outbound.protection.outlook.com [40.107.8.80]) by sourceware.org (Postfix) with ESMTPS id 5286B395B04B for ; Fri, 12 Jun 2020 13:29:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5286B395B04B 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=lLK4HZD7bXNQw3+NicfAn1dGOXUjk7gVbJ/4m/i4q0nvQTA0Z1CmjyhY5B3zyt/8q4C4VfDqbRLmDVRzI7HABA83KnAX+kF4XdffrXXQwfrk84bgZG23sVToH+15rs5BEKf1IY6EedIwZ6TPAnDZaHsx7otNwtiMO8jdPtbJsg0= Received: from AM6PR05CA0003.eurprd05.prod.outlook.com (2603:10a6:20b:2e::16) by HE1PR0802MB2378.eurprd08.prod.outlook.com (2603:10a6:3:c8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.23; Fri, 12 Jun 2020 13:29:56 +0000 Received: from AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::55) by AM6PR05CA0003.outlook.office365.com (2603:10a6:20b:2e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:56 +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 AM5EUR03FT050.mail.protection.outlook.com (10.152.17.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:56 +0000 Received: ("Tessian outbound 56dbe829191e:v59"); Fri, 12 Jun 2020 13:29:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 695c80cb209c5c57 X-CR-MTA-TID: 64aa7808 Received: from 76c30fe3e585.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A7227179-A6BB-4E82-8D93-723568EBCC2D.1; Fri, 12 Jun 2020 13:29:51 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 76c30fe3e585.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=futpian6yZtx80sD3/sYtAzG4Jz2mDxtADt5DcZrvOMSo4LKJwO/XPGIPZF5LdxoYYOsns03n7Sd+n/AYZ1nHIvPYycBgCrcT358pJty81Sy8hYKZOi+J7dGwfqJ/epwXrvZXM0LbBVMOUomGJZHy/IOdO3Gu5RM4dPDLQ6vSB3ntYSdEj1JrWdKOjRDyIaLlWNNXjJ1sBoBZjmjMsdXPwB5nRiD+pqV9XpnFlSNCkyBWZtqvpP4HQyCxNZoPRBpALjlbkpY4Zmj4b1wiF6p1PRkp4snocAG/Cjy1290SXijZ8EdYGmdJzgml+GPcF6VOuzH4TBpqlD2RuN6AICh0w== 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=B1d5ZRQ3UCVMoCC3p82BFuJmnWOWqiwXIE8ONLooabKVe4YQ2Jd0OC32Pajv6qbbFUpZd+EKeH07KrQrQAz1oSNz66v/J6QDEIfvGKyn1oBY0w4WGdCWCtotwA2THQWHjlWV+xg+yRB3QjkApqRBSZAcLQDN3l3MTolC5XktTTZkHuYA6SBfuLY0TAG35e1OslmLTduAq5saddk6U99oPiu2SCHW0/Hhc/7MPewiKBpUrbe1f+j5ITjTpePupAgWcXr9+FDCWqQTBt1bHQO1FBxPf1AHF6sFBtSSkav3BnBpiXY45Vi+jSIG8bUyy3dhzDQcOox9ppLovs3oUgrT/A== 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=lLK4HZD7bXNQw3+NicfAn1dGOXUjk7gVbJ/4m/i4q0nvQTA0Z1CmjyhY5B3zyt/8q4C4VfDqbRLmDVRzI7HABA83KnAX+kF4XdffrXXQwfrk84bgZG23sVToH+15rs5BEKf1IY6EedIwZ6TPAnDZaHsx7otNwtiMO8jdPtbJsg0= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:49 +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.3088.022; Fri, 12 Jun 2020 13:29:49 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 06/12] aarch64: fix RTLD_START for BTI Date: Fri, 12 Jun 2020 14:29:24 +0100 Message-Id: <57cb426ba11bb6b9938179dbf7f3deba2512f7c0.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:48 +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: cd03fa65-6e33-41b6-be14-08d80ed4b29e X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|HE1PR0802MB2378: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gYEcZNw0VfYUxPM8lp4fkEwF2T5f7UWbU4QPQQL+VqkDvCEqsocDGqpxaoL/bgeucwsJj+qADt2ptdHQSFm5ecGUqylktKI8SQqV5vGybuGK76rGsKazPkeKBesJdXQi4W6V98w0zE+u+BulSf4AFviAxnvfTixpNenLHbGlLOlXbCz3tWjwVCOmHQqLpDkq6hygr1OlP0LNsa7xfqrO/Vv+1a40GaouWRqa04AyFQmri1NyKvJdVYBItMaGb+5rVmoAmbY9PaVIXh06o97wHXkWeApmrejDY0LArC6s4FLB842iY17WK2KkxPAqVj7ML7ASokPNb66DxoChZwBlAAzQtgJnEa9Ny5mfHBRjV8DK6Q3JHdvDc3WDxfQsIRFq4/vcQNtraVO7WTpEagQKBQnQquMsTB7tpHMbMpPHL3A= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: N1Rlgb1pSaIPAunr5Fxy8wCLwCLPoZdgEuOwZX1as6OXO+zvXkvpXcVFbla/kMZcnHZgSjIQ+sfBwTP2W9/x7kYlxnNnk72EI1sWPEUW4GlWxDY9EaT48G9gsGhMdVrFACa3BX4B1+QacT4xImRKGggTvC/ho/VyDaV3SO0o036WslYmaerBlZAPxOyg1aGATySw6/Tny/wOFuwqVoUkDoXJixNIO8S3fO/vIlSjFzcTuRVMAtsM39xdMx3mpNs9f2/I35hzvtVeJJmuPFhzeGetagJnn3LJKLd3y/MCBcpQ1qsqQ8VlbYxNCldMx1OdVyGmpRqBEZAPqmYzVREolzx42rsBsrv/TB7/kpWe/gjDtAu7dAGBi+vLJBNMIH3t4ywhKXIYuwzNdYvotvfGqzwPEtr/ac+gC8z9EVwRp3bHcGmQoDfTLMsHnE3B1eMKnSBggvQkzBetmq4nCeVs8/ZzPBOZMuOC0c5JxWeKWiw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT050.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)(8676002)(16526019)(186003)(5660300002)(356005)(36756003)(83380400001)(86362001)(316002)(36906005)(2616005)(44832011)(26005)(82310400002)(8936002)(956004)(6506007)(336012)(2906002)(82740400003)(47076004)(81166007)(6916009)(6666004)(69590400007)(70586007)(6512007)(6486002)(70206006)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 535eaa48-9e76-4b72-b1d1-08d80ed4ae69 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kNrLvee1e3rtxd/qhYMBYIQukKvfiRdujiN32A4xi9xRvEYg1ZeQubsZSRiKkIauKvhnMn5f/1vJNLscFfWgw0OIfuGM5g1uTN+vflMu8w+cVMI02+AMwlpKy10Ts/7s4CIa5kdkgNtftNGu5B4jUlJ/fWAdyJnkrHDW+JJ+rY0H/4FosyQCuY4x7/I6zey0WZU0ci2GtKK/FXn9geXbtPxyQ03V1pD4XvmmpcMqFhjrQv0jsWn70+0sC6cynbWE3ynKQs1d5CmyY0ZWbJkRSOewsPlyUc1uPlCZqOvdxLSKjqDnM2KxpqGKhIbJDYd8wL7ItR+0cnXtP9/qcZOu5BQjgec35ST/LHU/itH5P8+04tKdbAV9Jg39Wid+9xoBldyZ7CZVcAO0c6wom84knzsJA0defA+ieNexpXSxoMC7U/gV8frqals1JFhgTHWg/pgFRMLZEJOklcIJG5pTpg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:56.4928 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd03fa65-6e33-41b6-be14-08d80ed4b29e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2378 X-Spam-Status: No, score=-17.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Tailcalls must use x16 or x17 for the indirect branch instruction to be compatible with code that uses BTI c at function entries. (Other forms of indirect branches can only land on BTI j.) Also added a BTI c at the ELF entry point of rtld, this is not strictly necessary since the kernel does not use indirect branch to get there, but it seems safest once building glibc itself with BTI is supported. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/dl-machine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index db3335e5ad..70b9ed3925 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) .globl _dl_start_user \n\ .type _dl_start_user, %function \n\ _start: \n\ + // bti c \n\ + hint 34 \n\ mov " PTR "0, " PTR_SP " \n\ bl _dl_start \n\ // returns user entry point in x0 \n\ @@ -178,7 +180,8 @@ _dl_start_user: \n\ adrp x0, _dl_fini \n\ add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ // jump to the user_s entry point \n\ - br x21 \n\ + mov x16, x21 \n\ + br x16 \n\ "); #define elf_machine_type_class(type) \ From patchwork Fri Jun 12 13:29:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39580 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 980C8395B083; Fri, 12 Jun 2020 13:30:05 +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-eopbgr70054.outbound.protection.outlook.com [40.107.7.54]) by sourceware.org (Postfix) with ESMTPS id 2F700395B05E for ; Fri, 12 Jun 2020 13:30:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F700395B05E 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=H6qBj2ojlRr2jbY5XOsJzhkEL8pcuairJquFqBkDsXs=; b=LpEi5Ve/IGHNPjIzDrfaFT4L5/oWbX+2IQG9KcTtQ2FUbiC+ce3nXpNPl5q1tYsf4lpRX5b04CDwxVt6Rz1U1aNh9k5FGTJ9Vzca+9w32UEgzwd+QrkwWW2bQUpHhEuAeOogqyrhcTaNxjK3yus1dNikhtmOiuMmWUHCVy0JX4s= Received: from DB6PR07CA0094.eurprd07.prod.outlook.com (2603:10a6:6:2b::32) by DBBPR08MB4345.eurprd08.prod.outlook.com (2603:10a6:10:c7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.22; Fri, 12 Jun 2020 13:29:58 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::a3) by DB6PR07CA0094.outlook.office365.com (2603:10a6:6:2b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.10 via Frontend Transport; Fri, 12 Jun 2020 13:29:58 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:58 +0000 Received: ("Tessian outbound d3ae83885012:v59"); Fri, 12 Jun 2020 13:29:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cd92577ab1fc8275 X-CR-MTA-TID: 64aa7808 Received: from a9d2c5e916ad.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3BC63C60-31CF-4686-8CD9-8A17E9E55CEB.1; Fri, 12 Jun 2020 13:29:52 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a9d2c5e916ad.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3fjFZlefGl99P3poo9nP5zinocLyPtZzYeuBwo7Q/KvPl4e4OzuqfMsGQ7KLiNmZkkZ2rLBL6/Sd92VMS+88dZX9L+P30kk5cHOK9B8aCKl1XYrgmJLu8U1djo0jpQb3YCluHX5psj7o6GZGehvUvgNJccRgB+JRRJVczP5Ae4BZlYW60/1kzwvxj9NGzDSQVtqDg7SIkAONZUbCmqTiaAPHczfzo8S2hGipKyogtXt8mHt8CEnNg0W84fG31idZ8ImM8ott36hHHUIQzOYaX/Lj7mGX4M/HBSSMNRjh3Qc2uF+KZkRQPiNL0+hpvfxAKejqrmKrISfZ1GcSIemTw== 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=H6qBj2ojlRr2jbY5XOsJzhkEL8pcuairJquFqBkDsXs=; b=dpuup26zbuJehzMufNNHig44kMOR1Z5ZwdsWDZfGZmjWORfmQuC3xQKm+jDF5Uki29XWSuSVEspBhM0NMeoiX4A/1bzeMZum4LLJY9tSZKFtrlvU2oNPAnb4kPyMYqxFjrnurzZJKNOWZ2rgyhv7zT6Rbtby3Um/IKQPsnjI3rytdfiSBcgKNzvqoBNMNSNE2HpNbQNLgPg+mRM0/WYBn7eAzxUZXvAodGvqrEyyO1mE/XVqY233TkAqLd6fpbY801nG+2CGAGQJLLW3alfgFbIfOtwGDdTkBUAClnMgXur/DD/EEF4laVU0y7wNh7LUWWJ3rk9+QdHkazNrovs4ng== 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=H6qBj2ojlRr2jbY5XOsJzhkEL8pcuairJquFqBkDsXs=; b=LpEi5Ve/IGHNPjIzDrfaFT4L5/oWbX+2IQG9KcTtQ2FUbiC+ce3nXpNPl5q1tYsf4lpRX5b04CDwxVt6Rz1U1aNh9k5FGTJ9Vzca+9w32UEgzwd+QrkwWW2bQUpHhEuAeOogqyrhcTaNxjK3yus1dNikhtmOiuMmWUHCVy0JX4s= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:51 +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.3088.022; Fri, 12 Jun 2020 13:29:51 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 07/12] aarch64: enable BTI at runtime Date: Fri, 12 Jun 2020 14:29:25 +0100 Message-Id: <54457ff0e2755acadc87dbf154b78a6f21cc19c8.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:50 +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: 33e34cc7-8df0-4cc1-660a-08d80ed4b3ca X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|DBBPR08MB4345: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2887;OLM:2887; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mfupHDle0E/qYfdfhnmXOTnrH6pulNDdV1e0Y8jmuBQmbeOzDMPDjD2V4AVVj3qxXjy+BLtsQspbd9+FRDBeEjZrWtawxGa2CV8WMkcR2p8VlZCpaBAKFeZw2Nk108C+GKVuqq2sNy4KW38nYG1AN7fNcxFWChx5rPLLO8eJRlBmoR4915gNBo4MT6xJmrTI6wyzXkfz0HJxF7LREPB8udnk20HQW6WxwA8O+bMKC9hbnn3KV/RKDr5tfrQBeY2BZLqCKU1Z0WaN8PYypqbwxfBm5cn7dZW6oPMZwbixTkNbmXXV7jKrc4qFfj3EKiIh7o4qcbg3GwoOFJ9C4ubQv7bhIg9dxNG3+qqI64JSDC7zT7GgznKkXLV/Nf2gTcqu1KuUUR723+5Iwh3fRyl5tStMxEZOtx6T3/Xj3y4XspYM97iXNjBaNWl3OMgzfLttp/WSIRCe/6w0I0K5IoITe+6ySgFvbCKWSDVPibU3tJ2GEM3J7fngsYO+zzkpKVwXmRwnhrWAC6qzWNsLv81mLw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(30864003)(186003)(16526019)(36756003)(2616005)(316002)(4326008)(86362001)(83380400001)(69590400007)(478600001)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aj05vzR4BoKPK7jN72tp3oomXku1A5NK7NXNQWWY7DirXbeHc0cK/1wXd1t8/vaCmDWdJAoE5tMSTUGEbu8lEzTKOmoy4OKlSFvur5gNa35jXesN/jVa0+QeX/kJ8Ln0bZ8C3KMWZTj/7LNxcAiKFPlP4t+gKiOhedqsGA8a8QoFw9TKru38Gi22dWqqab6LPVNdibxYdD22YMX+lELgXgu1O9abqaADQODBzSgERS9zS4pXxJ0Vl6V+YbKZuJhAqK/2HJbr+VYzg7HzcYN+79lCvCsSw5Yfy9zHHP33AIHx7cXN/5ELG3pmXn2LMLJy/zLofGq1B2QOxBCuXFkwaeGWUTKtn6djoxmAv7Fuosp/TJ6pdV+WzSxz26fgJOPIZtB9JC7H10I0IayHWy6uPv5nzcK45remxEnU/kvMGQg28XD70ZhBMWDvonbeh5FmF62nvSz8WbxQOecgKhsotFFHn1w97cahtLQvYekm66Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(39860400002)(136003)(346002)(46966005)(70586007)(26005)(478600001)(36756003)(70206006)(8936002)(8676002)(186003)(4326008)(6506007)(16526019)(86362001)(44832011)(83380400001)(356005)(316002)(81166007)(82740400003)(47076004)(6486002)(2906002)(336012)(6512007)(2616005)(6666004)(956004)(6916009)(82310400002)(5660300002)(30864003)(69590400007)(2004002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8e970adf-ae04-4273-f891-08d80ed4af46 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A+1Cg9QFsZe47y5quwF7gr37Eein34URoeER7i5fqC9RnGGab+Ic/TKbYrCL+nHV/yNPaBHtdK1Qlq8bINdJbzkMwEwPbcc6SnojveEAOvFOhirlfMXcHZJvxpXjtf8rCljm9Wj5bxddiTzo7cUFWkXCLerOLi101tk/CpTd2kDb/tbaGby9+/Qoi8CSaAeb/Ke3lihvbAc4k9BGHyKzLB4a5WLZzEP58+ALpJxKudGf4UFUkKXFm6l5C6pVNj7U8OpOjY05ALI+CpYrDnWHvuTb7nNHttXWPdh6gK3F+iEdVdGnaQ/95yWYOCW3Vquok387QSiYBn/WM0pFfHh8e8S+J+l8v+/jXowUZWPGedpNikCQNiiSW4OnNk1XWEF049+8QYBH3rTXuTOaKH2M3PKitrHdp7S+voCUDZikvB632t95VMbG40EMARl5VX/gkcsp3ZZ3NGiepmUxOCvu7dv0SZn/IFnEQjRig0os0SVSACitLc7o3XxAWnz50IRxf2V8XHcNvO0HMTjnz4Fk+d5rNAf1fr5nFxRmBz3yW81vYlL3lQ4LAugsqOI2pYYl X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:58.5076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33e34cc7-8df0-4cc1-660a-08d80ed4b3ca X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4345 X-Spam-Status: No, score=-17.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From: Sudakshina Das Binaries can opt-in to using BTI via an ELF object file marking. The dynamic linker has to then mprotect the executable segments with PROT_BTI. In case of static linked executables or in case of the dynamic linker itself, PROT_BTI protection is done by the operating system. On AArch64 glibc uses PT_GNU_PROPERTY instead of PT_NOTE to check the properties of a binary because PT_NOTE can be unreliable with old linkers (old linkers just append the notes of input objects together and add them to the output without checking them for consistency which means multiple incompatible GNU property notes can be present in PT_NOTE). A new _dl_process_pt_gnu_property hook is introduced in dl-prop.h and to keep it maintainable the rtld and dlopen code paths use the same function (if the main map needs special treatment, that should be inferred by the hook from the link map). Unlike the _dt_process_pt_note hook this one is called after segments are mapped to avoid unbounded allocation and additional read syscall. Otherwise the AArch64 logic follows the x86 logic for handling GNU properties (but the code is not shared because x86 needs to manage internal CET state and look out for multiple property notes). BTI property is handled in the loader even if glibc is not built with BTI support, so in theory user code can be BTI protected independently of glibc. In practice though user binaries are not marked with the BTI property if glibc has no support because the static linked libc objects (crt files, libc_nonshared.a) are unmarked. This patch relies on Linux userspace API that is scheduled to be merged in Linux 5.8 and now it is in the for-next/bti-user branch of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git. Co-authored-by: Szabolcs Nagy Reviewed-by: Adhemerval Zanella --- elf/dl-load.c | 14 ++ elf/rtld.c | 6 + sysdeps/aarch64/Makefile | 4 + sysdeps/aarch64/dl-bti.c | 54 +++++++ sysdeps/aarch64/dl-prop.h | 145 ++++++++++++++++++ sysdeps/aarch64/linkmap.h | 3 + sysdeps/generic/dl-prop.h | 16 +- sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h | 1 + sysdeps/unix/sysv/linux/aarch64/bits/mman.h | 31 ++++ .../unix/sysv/linux/aarch64/cpu-features.c | 3 + .../unix/sysv/linux/aarch64/cpu-features.h | 2 + sysdeps/x86/dl-prop.h | 6 + 12 files changed, 280 insertions(+), 5 deletions(-) create mode 100644 sysdeps/aarch64/dl-bti.c create mode 100644 sysdeps/aarch64/dl-prop.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/mman.h diff --git a/elf/dl-load.c b/elf/dl-load.c index 06f2ba7264..ab8237ac55 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1188,6 +1188,20 @@ _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. */ + for (ph = phdr; ph < &phdr[l->l_phnum]; ++ph) + switch (ph->p_type) + { + case PT_GNU_PROPERTY: + if (_dl_process_pt_gnu_property (l, ph)) + { + errstring = N_("cannot process GNU property segment"); + goto call_lose; + } + break; + } } if (l->l_ld == 0) diff --git a/elf/rtld.c b/elf/rtld.c index 882b070cc0..5aec2efaa5 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1508,6 +1508,12 @@ of this helper program; chances are you did not intend to run this program.\n\ main_map->l_relro_size = ph->p_memsz; break; + case PT_GNU_PROPERTY: + if (_dl_process_pt_gnu_property (main_map, ph)) + _dl_error_printf ( +"ERROR: '%s': cannot process GNU property segment.\n", _dl_argv[0]); + break; + case PT_NOTE: if (_rtld_process_pt_note (main_map, ph)) _dl_error_printf ("\ diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 9cb141004d..5ae8b082b0 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,9 @@ long-double-fcts = yes +ifeq ($(subdir),elf) +sysdep-dl-routines += dl-bti +endif + ifeq ($(subdir),elf) sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c new file mode 100644 index 0000000000..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..b6f8a88667 --- /dev/null +++ b/sysdeps/aarch64/dl-prop.h @@ -0,0 +1,145 @@ +/* Support for GNU properties. AArch64 version. + Copyright (C) 2018-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_PROP_H +#define _DL_PROP_H + +#include + +extern void _dl_bti_check (struct link_map *, const char *) + attribute_hidden; + +static inline void __attribute__ ((always_inline)) +_rtld_main_check (struct link_map *m, const char *program) +{ + _dl_bti_check (m, program); +} + +static inline void __attribute__ ((always_inline)) +_dl_open_check (struct link_map *m) +{ + _dl_bti_check (m, NULL); +} + +static inline void __attribute__ ((unused)) +_dl_process_aarch64_property (struct link_map *l, + const ElfW(Nhdr) *note, + const ElfW(Addr) size, + const ElfW(Addr) align) +{ + /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes in + 32-bit objects and to 8 bytes in 64-bit objects. Skip notes + with incorrect alignment. */ + if (align != (__ELF_NATIVE_CLASS / 8)) + return; + + const ElfW(Addr) start = (ElfW(Addr)) note; + + unsigned int feature_1 = 0; + unsigned int last_type = 0; + + while ((ElfW(Addr)) (note + 1) - start < size) + { + /* Find the NT_GNU_PROPERTY_TYPE_0 note. */ + if (note->n_namesz == 4 + && note->n_type == NT_GNU_PROPERTY_TYPE_0 + && memcmp (note + 1, "GNU", 4) == 0) + { + /* Check for invalid property. */ + if (note->n_descsz < 8 + || (note->n_descsz % sizeof (ElfW(Addr))) != 0) + return; + + /* Start and end of property array. */ + unsigned char *ptr = (unsigned char *) (note + 1) + 4; + unsigned char *ptr_end = ptr + note->n_descsz; + + do + { + unsigned int type = *(unsigned int *) ptr; + unsigned int datasz = *(unsigned int *) (ptr + 4); + + /* Property type must be in ascending order. */ + if (type < last_type) + return; + + ptr += 8; + if ((ptr + datasz) > ptr_end) + return; + + last_type = type; + + if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* The size of GNU_PROPERTY_AARCH64_FEATURE_1_AND is 4 + bytes. When seeing GNU_PROPERTY_AARCH64_FEATURE_1_AND, + we stop the search regardless if its size is correct + or not. There is no point to continue if this note + is ill-formed. */ + if (datasz != 4) + return; + + feature_1 = *(unsigned int *) ptr; + if ((feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) + l->l_mach.bti = true; + + /* Stop if we found the property note. */ + return; + } + else if (type > GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* Stop since property type is in ascending order. */ + return; + } + + /* Check the next property item. */ + ptr += ALIGN_UP (datasz, sizeof (ElfW(Addr))); + } + while ((ptr_end - ptr) >= 8); + } + + note = ((const void *) note + + ELF_NOTE_NEXT_OFFSET (note->n_namesz, note->n_descsz, + align)); + } +} + +#ifdef FILEBUF_SIZE +static inline int __attribute__ ((always_inline)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph, + int fd, struct filebuf *fbp) +{ + return 0; +} +#endif + +static inline int __attribute__ ((always_inline)) +_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + +static inline int +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); + _dl_process_aarch64_property (l, note, ph->p_memsz, ph->p_align); + return 0; +} + +#endif /* _DL_PROP_H */ diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h index 943a9ee9e4..847a03ace2 100644 --- a/sysdeps/aarch64/linkmap.h +++ b/sysdeps/aarch64/linkmap.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ +#include + struct link_map_machine { ElfW(Addr) plt; /* Address of .plt */ void *tlsdesc_table; /* Address of TLS descriptor hash table. */ + bool bti; /* Branch Target Identification is enabled. */ }; diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h index 6b0f2aa95a..4192049739 100644 --- a/sysdeps/generic/dl-prop.h +++ b/sysdeps/generic/dl-prop.h @@ -20,11 +20,11 @@ #define _DL_PROP_H /* The following functions are used by the dynamic loader and the - dlopen machinery to process PT_NOTE entries in the binary or - shared object. The notes can be used to change the behaviour of - the loader, and as such offer a flexible mechanism for hooking in - various checks related to ABI tags or implementing "flag day" ABI - transitions. */ + dlopen machinery to process PT_NOTE and PT_GNU_PROPERTY entries in + the binary or shared object. The notes can be used to change the + behaviour of the loader, and as such offer a flexible mechanism + for hooking in various checks related to ABI tags or implementing + "flag day" ABI transitions. */ static inline void __attribute__ ((always_inline)) _rtld_main_check (struct link_map *m, const char *program) @@ -51,4 +51,10 @@ _rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) return 0; } +static inline int __attribute__ ((always_inline)) +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + #endif /* _DL_PROP_H */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h index 4ee14b4208..af90d8a626 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h @@ -72,3 +72,4 @@ #define HWCAP2_BF16 (1 << 14) #define HWCAP2_DGH (1 << 15) #define HWCAP2_RNG (1 << 16) +#define HWCAP2_BTI (1 << 17) diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/mman.h b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h new file mode 100644 index 0000000000..ecae046344 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h @@ -0,0 +1,31 @@ +/* Definitions for POSIX memory map interface. Linux/AArch64 version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* AArch64 specific definitions, should be in sync with + arch/arm64/include/uapi/asm/mman.h. */ + +#define PROT_BTI 0x10 + +#include + +/* Include generic Linux declarations. */ +#include diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 896c588fee..b9ab827aca 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -83,4 +83,7 @@ init_cpu_features (struct cpu_features *cpu_features) if ((dczid & DCZID_DZP_MASK) == 0) cpu_features->zva_size = 4 << (dczid & DCZID_BS_MASK); + + /* Check if BTI is supported. */ + cpu_features->bti = GLRO (dl_hwcap2) & HWCAP2_BTI; } diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h index 1389cea1b3..a81f186ec2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h @@ -20,6 +20,7 @@ #define _CPU_FEATURES_AARCH64_H #include +#include #define MIDR_PARTNUM_SHIFT 4 #define MIDR_PARTNUM_MASK (0xfff << MIDR_PARTNUM_SHIFT) @@ -64,6 +65,7 @@ struct cpu_features { uint64_t midr_el1; unsigned zva_size; + bool bti; }; #endif /* _CPU_FEATURES_AARCH64_H */ diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h index 516f88ea80..8649314f9d 100644 --- a/sysdeps/x86/dl-prop.h +++ b/sysdeps/x86/dl-prop.h @@ -191,4 +191,10 @@ _rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) return 0; } +static inline int __attribute__ ((always_inline)) +_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +{ + return 0; +} + #endif /* _DL_PROP_H */ From patchwork Fri Jun 12 13:29:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39579 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 41AE6395B080; Fri, 12 Jun 2020 13:30:05 +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-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by sourceware.org (Postfix) with ESMTPS id 300B3395B033 for ; Fri, 12 Jun 2020 13:30:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 300B3395B033 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=Xkk70UnhwzcPDBDJqRTR+TK5gJxA5NMHZ+LDknF0r/E=; b=0hYZLihfuteEU7Sx/5erloYT7dVnS/nMVdo/gq9GsB0bStdMCQhYhrCnMLSwdbml5MqH7xLBIj0yOsp7C12uix5fi1XzaImLQGzf+KaOQTkR6yzRzmVTEWGUhCphaF8qI/ES6DjtkoOBPThj7un/UYQP51d0B25h6tmEe/YR+oE= Received: from AM6P194CA0034.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:90::47) by AM0PR08MB3619.eurprd08.prod.outlook.com (2603:10a6:208:e3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Fri, 12 Jun 2020 13:30:00 +0000 Received: from AM5EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:90:cafe::47) by AM6P194CA0034.outlook.office365.com (2603:10a6:209:90::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Fri, 12 Jun 2020 13:30: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 AM5EUR03FT053.mail.protection.outlook.com (10.152.16.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:29:59 +0000 Received: ("Tessian outbound 3e82c366635e:v59"); Fri, 12 Jun 2020 13:29:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a6ad93773cda9168 X-CR-MTA-TID: 64aa7808 Received: from 5b2b20db0eca.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E193A802-4C75-4A68-8902-2A6B82DC7682.1; Fri, 12 Jun 2020 13:29:54 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5b2b20db0eca.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fy82+wlt7Itx2XCkiBeADxATr1eLh4Zi2T9yoaByRUh1665OjMGEZg8ANiYC8kRRiYkxXxRPiMKcIxiieus8V97qlp1Nyt/Vb15l8hDI+7r0xHjYqnYOtcsphBcYE3mY1pKAgEILS/ikqJc+F4bP+T+nyEWQbDWpymXe9bf+upfY7HcJPjXJdEQxrepGJUqx9nFFjZ+8GdgfbQMm+3kHR+KUGdvB5zJY03OqNR5lZY+JqhYZIB3D74hbrNZfq3ppgXj52VUo/PWj29OEdM5jHTon4x9aLS8nr9kaguO9ybzITOcVHHhzzERZi65iGu+nPkmzxEjxsKi7AQFApOEQ9A== 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=Xkk70UnhwzcPDBDJqRTR+TK5gJxA5NMHZ+LDknF0r/E=; b=UgufGHE8bWc57czh+bz9ofD/kmAvMdgMMsWhscBlvP75Hy5u+/B0gKDd9DjcsmF1vHg7hh1tB1sQpc8W67VNGWEO7FNmtXI6nZiEERlYjFWLb8tiwy7JW3jtKlpqN7hHh9TtmcSMdbAenRrqX31CZJf/aM8PpOJ/qQx7hNve+7EGpfemE+5gxpXmKo8zP+RB5kWZX0Naa1PmCxpMH7VHXe0KTAp2Pke7Yt42G4aQ+swSZ2HCHp0fyMz5QV2dCwaVvTgUGpy9QWqRfpxROG4OEvcVWEeFAn4wi4AhGbrJXbaEDQ+iSmbA7Z4H8Eam6AbwijmfJzrWIpmPtx2oOFcmZg== 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=Xkk70UnhwzcPDBDJqRTR+TK5gJxA5NMHZ+LDknF0r/E=; b=0hYZLihfuteEU7Sx/5erloYT7dVnS/nMVdo/gq9GsB0bStdMCQhYhrCnMLSwdbml5MqH7xLBIj0yOsp7C12uix5fi1XzaImLQGzf+KaOQTkR6yzRzmVTEWGUhCphaF8qI/ES6DjtkoOBPThj7un/UYQP51d0B25h6tmEe/YR+oE= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:52 +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.3088.022; Fri, 12 Jun 2020 13:29:52 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 08/12] aarch64: configure check for pac-ret code generation Date: Fri, 12 Jun 2020 14:29:26 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:51 +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: 83cbee8e-c53b-47da-8d46-08d80ed4b4b5 X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|AM0PR08MB3619: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3276;OLM:3276; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: w4N43cfVoNqZ/aNkunmpPHOx+w/miL2JRVuZd5HRYk1YOiPHnM+zmGDitolKCSp736J44zUe9Vf3GEMFVyEUQ73d1dY8VOfKswU7qIwMMn1HPpJNyjo5A1CNLqFIgdUrNFjZr0EtaqkAIJqIlZpBA7OH0d9YKgYTF9a2CTX4B3dGW8XNDUZBDOpBjERdJbKjJ9hwYbbfiv0LK6qbO4A2665u5j5HBTr72ZjlIjQiCAq6P5C1M11Osg0wp9OW68VB2InBJHkr+zqYi3OtJSRsyJR+zwPQxepzB0c8SU68NMphU1UqURnbU2871M8ytXav8j1gDmfpKlR2K4BHS5tolswEvE7zULxFBGeS2ukREKXV4n2lHQMerIrVR/iq30Ok2FNjs1x6a4sjW33jMx8YIQ/UhOQPbcoZ4yUN6Z8BqK8= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4qBKc39oGwsb355lQhGuYZM2OI0EELf4paPXO93qj/YmQbfP5Vw+MqFnNyQF28QItch1S7g3qDOasDibRwWENabSsCb8XjV9sE8cdzfGIZb8YwFv6ep7TWC3MMQzYjBotKmYOU+65TjMuxLV0bDxV9SfXe3SL2A0z5Bk667UEPIN+qTQ5UCUQvdyr2QMcbMNLICqEsWubKXqsuwkyFRr2kc1FCtqP6ZhDdfEXoPpDrDQrqdcIEI4N8F9DfyqqsUghedOhmWrjsdyFlmiP47kPZv+I0oC3JcQvZYi2vw99a8H0D0k3173O0PIB9NSSKtCfLeWgRu5lCG1ynvHEntwd/7zl5zFuPQgEHXQruHjxFdKe4KlqZ7gT/o1vqMf/amyqmDTkmFcA4AcYHdGFDJeYN+9h7QXzajVS15VJn2DM5wIer932vP2IXBiGW4ZyczE+WEaATh6CxvGIRdsyUpkWT6nNFwomj+YhTVfQLOYXi0uhC8VSVtOpLPOyFSAGtFQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT053.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(136003)(346002)(396003)(46966005)(6916009)(44832011)(81166007)(70206006)(82740400003)(336012)(316002)(478600001)(2616005)(47076004)(356005)(16526019)(26005)(6512007)(6486002)(6506007)(186003)(82310400002)(83380400001)(956004)(8676002)(69590400007)(8936002)(36756003)(70586007)(6666004)(5660300002)(2906002)(36906005)(86362001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 626f87c4-56e8-4f17-ab7c-08d80ed4b028 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gNuSWJfKBCCBGdiUjAEp760JKtBQzdn9fB7/wtgcd7b79WbHIZuikqKmOVPrgbTyEbpOnXB+CrxstJKfpD5U4vpKWmEOp7ZRSrpEs14mR1Jya4fwd+5mI3XvzFh7oBiC6xLPRQIfxdhCHmF2sUsZszeM6wwGhSuTh8Ul+orn0n9cypvlLxuX1PfUXuBeIc+nbuFnU4sdAY5u9VZf7/cjZcwY2dA+0I1J4T0YMGYYjtTfqJjgFedQgwJGsTLU7Lz2z+PA4/2zuE0hupGr2j+LbrcEUKOGCqx50uLcX/wPpIK3KWKajQpaLsWUOJ4w7xHYou8h7mjSzp80O+TPo4R4o8pZ+puHJ5S44Rgv7KVU8jq2FUQ648WKLj16byJep1k45nCDVLuNOZGVTNUZ5Lv2PGqNMiGbXaUZ2/QzvHYayeaJbmotnXHAfuPADuZNlnDDysWgK5RJgoMkAEk0GK0ftA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:29:59.9838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83cbee8e-c53b-47da-8d46-08d80ed4b4b5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3619 X-Spam-Status: No, score=-17.4 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 70477a7fa5..5f1cdf5d9b 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -214,3 +214,42 @@ if test $libc_cv_aarch64_bti = yes; then $as_echo "#define HAVE_AARCH64_BTI 1" >>confdefs.h fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pac-ret is enabled" >&5 +$as_echo_n "checking if pac-ret is enabled... " >&6; } +if ${libc_cv_aarch64_pac_ret+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && { ac_try='grep -q -E '\''(hint( | )+25|paciasp)'\'' conftest.s' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_pac_ret=yes + fi + rm -rf conftest.* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_pac_ret" >&5 +$as_echo "$libc_cv_aarch64_pac_ret" >&6; } +if test $libc_cv_aarch64_pac_ret = yes; then + $as_echo "#define HAVE_AARCH64_PAC_RET 1" >>confdefs.h + +fi diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 798f494740..8248ecf2ed 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -39,3 +39,24 @@ EOF if test $libc_cv_aarch64_bti = yes; then AC_DEFINE(HAVE_AARCH64_BTI) fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +AC_CACHE_CHECK([if pac-ret is enabled], [libc_cv_aarch64_pac_ret], [dnl + cat > conftest.c < X-Patchwork-Id: 39583 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A95A8395B0B5; Fri, 12 Jun 2020 13:30:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130085.outbound.protection.outlook.com [40.107.13.85]) by sourceware.org (Postfix) with ESMTPS id D2D79395B084 for ; Fri, 12 Jun 2020 13:30:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D2D79395B084 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=6SJZVlDCAL33rlOTqM+nYYZmj6ogPWe10nsyzhOFgkSVrXeFO8s0J8ejkhCchVmy/vHUKMfV9WldnlgRj1paU8gPq8XbQUB5/TvBnO+sfgj71qWzeW4YWAUdZtk4ryUR1XqH0d27EVNl+ZO25CE+YStMWF8gWbUzrC9jMqryxE8= Received: from AM6P194CA0006.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:90::19) by VI1PR08MB4160.eurprd08.prod.outlook.com (2603:10a6:803:ea::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Fri, 12 Jun 2020 13:30:01 +0000 Received: from AM5EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:90:cafe::d5) by AM6P194CA0006.outlook.office365.com (2603:10a6:209:90::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:01 +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 AM5EUR03FT053.mail.protection.outlook.com (10.152.16.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:01 +0000 Received: ("Tessian outbound 3e82c366635e:v59"); Fri, 12 Jun 2020 13:30:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 268cbc71ec08505a X-CR-MTA-TID: 64aa7808 Received: from 39c482356b9e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 22BB592A-0ADF-4AD4-A72D-CB7CFFC4BDF6.1; Fri, 12 Jun 2020 13:29:55 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 39c482356b9e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a19Isn0VaAC1iJN46b6AWtG8NeTLTxgKljqMXH+3Oda5tlaJPGlZ/Zc/RnQd6cQUDbyfiS9AiTueQXvVZpRdpn6xzY8X+UQBTQpiuWJxXkfOyHhzf0BR0886ANzfIUBfiuTcfDE6+xGAVDCW5PxlB8x46vpJ3uwSzr9nl2P4QM562Y6gHhY3WrFzM39R8Qsaxt+ArvB7+a0PyrqZ6ECbeSbAhw4vN7Pv7CBS437CsWpfGdR50s1nAaF/hrH6W7TYZLgnUWFXtM/o/r/WFX50w52AtKK/ee+Cs1WNNZAtaL//9g2E07q/NQ9X+H0SrFoY9sa+ZgBbSVB9LvNuQiLH8A== 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=VQF0iwQYhjEnYM6TFDP9Rl5dkc+h13xVMMN+xLHX3Zjjh08zeGDIxA5aXHYK/BwFd4yyDm5o1Nfv3MOwhN+3hyTuUpJPrmgZ5VtpZFTpigZPKgIEg0wpbZbhpC6SY1wgdczdQJZ10wPqFR9mhTMKjJ5PbdLQn4yDru0ovuIL6QPJiDKmGVY/IOPzfalXPh+sclD99C1fy6HsYqCgKJd7/S+2cqaKdkvarsRxb8T1/+rEErf47MHK2+h3YwLbGXdxaU1iiyw5vdBhkdEvTSqiSkuJHdOtKsXZdoAP4Xx3+Gr11tEuxRsNveSFnScnVS1Dh8AI0aB3TwytcLU9AyVxbA== 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=6SJZVlDCAL33rlOTqM+nYYZmj6ogPWe10nsyzhOFgkSVrXeFO8s0J8ejkhCchVmy/vHUKMfV9WldnlgRj1paU8gPq8XbQUB5/TvBnO+sfgj71qWzeW4YWAUdZtk4ryUR1XqH0d27EVNl+ZO25CE+YStMWF8gWbUzrC9jMqryxE8= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29: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.3088.022; Fri, 12 Jun 2020 13:29:54 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 09/12] aarch64: Add pac-ret support to assembly files Date: Fri, 12 Jun 2020 14:29:27 +0100 Message-Id: <28395b80fdaf7a2394a3d8495d37dd1969acae39.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29: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: 00ee6655-bda1-4f69-40e6-08d80ed4b587 X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|VI1PR08MB4160: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: B8q94akbc30YjyV2NWNWWmidvOk7ZP7/pj9RkZyQTFd6LYeumFj1uMKWEMj2mplwPTxmlWjX5SzgIpuQDdvxXtCo/8a1H8Ga2O1X403MBp/OXsfniaONwCQ5RP3l5Mu2yucE5BdQn+LldhILGVXaxjaltzrZk9Dokf0L2QcpndgIHlb5+Of3YreWblkY6GiebKsFcIE7Ieje6N0TMDFKl40N34urXRbSBSZ6FIdCXhoogwBjzMFuxmAxgPdpKKsnasgE84xZG7zxwm/PLLPyIto/6XHVAWzvUduumy1f40scHX/MVbsvRFt6BfUHTouhvmks0QLbJ737blpmNva2Ylm0Cidi9Qoz+sUs85rEDsDdqnZ/n7CTYc1M9Kb2836agapzFkkca1/S7gfhQu9mrTNqdlxZle4A6wyssC2LXAU= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hwV2BPrEr3XWYbqvRngTVm7dycd9pMoAt9w94FXt3VQld0ktoHcqaFy3oMtoAhLmuq8hboQa9p/m2URWejecnso7IytQc4oPFiRswH6D+Rdqwxst2zBiHYEpUNGKflq3m1a/4ndZ7eoDxd9SlfH7UYLsKD+pbfe38+5ASQ2epAoivFwLdXuwuvVgF+LrD6MDyFEY9c9t5qOtnlhXY2tNv55rRwsgIoQZMooeeOQGq/XxLxQS5FsdzoljcTCl/dyU/qdKChKTLsOXzxzc9y1oVW21vFeAksohnA/Zi2xlBpbDKXiyuBQtNYw111qlxpq7GJKDc1kyfI/ZT6/v/pPSCagS3oIJqHHBEJEsg0bHIXnLQkexIWT5Br9pomzU5qjAelWpieD8JtIv69FRFpjrhQr1R8mON62vTui8tNJOsAEjEpFY9BZuL1boJe4WBn8MjcpULY+8QWIAwF+vCbHLp3dKGWTxJApLFbmf36v+HmI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT053.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)(39860400002)(136003)(376002)(46966005)(316002)(6512007)(86362001)(8936002)(47076004)(336012)(69590400007)(44832011)(2616005)(6486002)(82740400003)(82310400002)(956004)(8676002)(16526019)(70206006)(186003)(36906005)(70586007)(5660300002)(6506007)(81166007)(83380400001)(6666004)(36756003)(2906002)(478600001)(6916009)(356005)(26005)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 4703be33-ebc2-4704-82e8-08d80ed4b0f1 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: akPozwL9rlnXqj1EWHAH4XiDu3crF44CXXa5Dxe3uIpLw7XjafDv/LNGCYU5H1kulAKHRK9NeZwZe/SDyH9PDFzdJt+fEodji9b37/EWN+LGdHwW+rByn74LkApgES3wHv8T/dKUxsXrqBCIg8njwToii6rlz7NK+b4LIlUk48DuFK+xECQKX/h2J/tf3XIuHEX3peeYgyLCRuTSwyJ6sAnyQ7+TU6bxLn8B01Qoy1k9J611cpt/gzFrnwjLy8G0sPX9r4f339BcUJvUB9W4+bZ4H6JaLprHj4N7S/D5NQDIriY3TrZ36OVn+SOxqS7462FVd9GFCjHaLkouL3VSZJQknixcgLKTMY0RDJSXFinlZXQ3E9Hpn3GjWuSsXNJFvLHBTG/WM2wg8I9ymwaQa3BrY6+I44SFJqWrAayB6x6JIak8vF+1V5xAO2s56YnyK/slfPIP0zi9ja3uItwH5w== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:30:01.3761 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00ee6655-bda1-4f69-40e6-08d80ed4b587 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4160 X-Spam-Status: No, score=-17.4 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 Fri Jun 12 13:29:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39581 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A993395B0A4; Fri, 12 Jun 2020 13:30:07 +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-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) by sourceware.org (Postfix) with ESMTPS id 67CC4395B033 for ; Fri, 12 Jun 2020 13:30:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 67CC4395B033 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=PwLxOsYzXVc4FPRK6sd8AMPsOPLVcsLr3EAuHHz9OCsn4NRD60QdTvfxGevmbScK7RraCydbMTUCW64KGkupBWMruWlIbjlYetnqTU1SYaPXhSvPJJZGTzjdWGjU9QBX3jtlW4KWQJUIjQoPqhL8fMxirL+jUNg1UQulJhHxft0= Received: from AM6PR05CA0023.eurprd05.prod.outlook.com (2603:10a6:20b:2e::36) by DB8PR08MB5004.eurprd08.prod.outlook.com (2603:10a6:10:ef::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Fri, 12 Jun 2020 13:30:02 +0000 Received: from AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::52) by AM6PR05CA0023.outlook.office365.com (2603:10a6:20b:2e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Fri, 12 Jun 2020 13:30:01 +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 AM5EUR03FT050.mail.protection.outlook.com (10.152.17.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:01 +0000 Received: ("Tessian outbound 56dbe829191e:v59"); Fri, 12 Jun 2020 13:30:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a6e54ee44cec21e2 X-CR-MTA-TID: 64aa7808 Received: from e63d6670032c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 537F9861-D122-472E-9856-8739F4A42548.1; Fri, 12 Jun 2020 13:29:56 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e63d6670032c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FbkwJjIxNLEjml0Zor93+ABlOfyt4QqguGLIRdc/VHwulifow9daP6lE90UIkP5UmAy+ldJS39zwOng3p2BEi5m3uVOqEGxMoBEl/NBnPkhUGyd4lxZEtkbGaONbxUVh9bF3lw/KnDaEolDsQMzO/KxNJMCd7MfeuxcUbKcWjwzARB1xyn207IfpO8aKGRZttZ70EP8jbfgbgp0fiAE1zPhA0hcAUgXzCbeq793Tg+Vcq+DIlAAgv4THmdT6ho3tKp2lTp9OJw5b0F9GdFDE1HSl04tTG+Agp88oqB05y5oL050YHrVSsogHIhH8U45tZTir25PmhshuFjwRd1ZcBQ== 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=IaGta6+aBt9OajoK+Lv+eFAdUZCIrtpkwGmfXJQzVPrnVN+XUThCUdLEkaZdTBqoxQCVRf1BcwYu349BIjtNzXny6BZyZRHXZK2t4hGNOmTdxVApXCNsZ9D7JnJbgzPm/ern9S30IrDwFwHl2EmzEG7YHhxQ2nEVd4u+A3gb5GRPYA/M8GB+3FwXxG4GrTI4nFVVnrxGDF9Hrz1W/Eqv1wBltpQUcr+DkE/SBIeUhQosaKH4oQi1qk7rPjXPPcDKoES0hSTamdjrXHLY48jU4N5DX0G+sBKOkfN8j0jUA4q919nGpTV/pOKHh7Gx27UuFyTBFbUIL5vEq6UkYCxrSQ== 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=PwLxOsYzXVc4FPRK6sd8AMPsOPLVcsLr3EAuHHz9OCsn4NRD60QdTvfxGevmbScK7RraCydbMTUCW64KGkupBWMruWlIbjlYetnqTU1SYaPXhSvPJJZGTzjdWGjU9QBX3jtlW4KWQJUIjQoPqhL8fMxirL+jUNg1UQulJhHxft0= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:55 +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.3088.022; Fri, 12 Jun 2020 13:29:55 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 10/12] aarch64: fix pac-ret support in _mcount Date: Fri, 12 Jun 2020 14:29:28 +0100 Message-Id: <97703fc5fc42e66ef56c3d6d2585253a7a013272.1591899092.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:54 +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: 87c81799-04c2-45a2-3d38-08d80ed4b5d7 X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|DB8PR08MB5004: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: uyYEK6qzP2000F4K7RTw2jpQoHzix9VmVgib3Bber3lEaXl2bZe1Coe7KGUAHK4GiGdnkWIG0QiiYEVtmmLI2rlcKbCesPNUgYYQcOoJm5lMh+lrhz3+LsavY1iehzlD3FgpRdt39uciyk/bbxX52qqKZP0P5rSnfLiljn/PgBZxW+jxrlcu49FopPgcxKW//S2PnBt8tKQiGgdVTeb0af7vIMZqw6u+hp86PcjW9yEmJvMxzK+Sqm54JfOKAtNeeQaQHY7I3GyZQhWkK62uoq9phnBWSsZ+W19WF8RGNrrTKX6yBzQ3vW+5/B7rA/ZF88x9qBnhB5kNVw+zIsDZhxQtDw5bYWM5J4eF8r7lI++q+dsjjDb7TCe1I3xRMu1AIWUIXcwHHK66TDkki5ky6aMuuXkkZ7+AU1hxzov91LQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /B60HtXrQlfcabZ5eVw7ThAQC1wYayXurVQqN/1lW57oTE5YnKkZaLpTLdWcmiL2lXwaKvXmcGEpOTEyGOSSbXgLjnW7h9I50e5RicQAO/IZ2uv8VfdLJur3tfjjxA/bLwasiI9RCXB172h8L3HeANv4KaXcCDF9svicPyLC00sR7+38yp7p20SzfPk2SwaaT0EMp1XpnQAcreWLyoNE2NT/msW+c0cu6hu9ibmza42+EZ9Y/19Z2+8icOOwCkisY0ZEi3NENMh2Lu1MbnAaMML6khS0F/c0eM/HXWCPsfG4rcmeah/QioZyyFZIa1WG7yJcuDCEtm+bMHpaIZKLQreBPRyf1xEi1i4DO9UeGM8O7wfKRuzIs0yFGepI9iKzEBNbLRTQ+2VHYLeyeFNv6zD9zH/D4orXgV1f2tT58/NMIslbqBpo0A9Anac8ZNfQZaRidxV796lGj+7iS3oj2yGTjSlaj38yNCo2TcS3L+0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: AM5EUR03FT050.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)(136003)(39860400002)(376002)(46966005)(44832011)(6666004)(356005)(82310400002)(69590400007)(36906005)(82740400003)(2906002)(36756003)(186003)(316002)(81166007)(16526019)(6486002)(47076004)(8676002)(8936002)(6916009)(86362001)(70586007)(83380400001)(6506007)(5660300002)(26005)(336012)(2616005)(6512007)(956004)(478600001)(70206006)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8aaff92d-856d-43d4-cba6-08d80ed4b1b3 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6KLyRHnoyuJcPDcD5KL5vGK9sM8YfInuxQY7EkXGASi+Z900bFDofnVIIspcYbqSUFkCK2OzSzbCKTvD5Q4SgIPK1MIvxJouOHjbCSwUIeNtZOVFq2BqSHwXj4Zvij0wTOK6hy645VoSQwbCYiq9u6oWm3BNP5lPZ3E2gSyywYpF4w1+HB1OIeKjY/EYonJAotVTjwUWcp15zysiL/vdwCVv2ZgZ1BUWJk4EdKTSgsON6Eu5Rx1BChWOqS7P4hx9UAdVR9YDdMXSirKKdMfimVs/t3qtGVO2y3q2YPCOVnd2Yd4jIzeQgTyghjfcrimfEasA/YtEE/MSp/GXLBdd8OJDHNJsHuQBEQkEDUpWN3by4n9LLUVCNaP1yAqpsiuT7ebZGT8i0AsbIPy/73b5Uspk9RI0Nz3c/pEW4GZLQD9fp2b01IAZsdDGBqR07SjI1BwdErQeaAINVDOJOHpaSg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:30:01.8963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87c81799-04c2-45a2-3d38-08d80ed4b5d7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5004 X-Spam-Status: No, score=-17.4 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. --- 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: 39582 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F036395B0A8; Fri, 12 Jun 2020 13:30:09 +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-eopbgr140080.outbound.protection.outlook.com [40.107.14.80]) by sourceware.org (Postfix) with ESMTPS id E4AB6395B086 for ; Fri, 12 Jun 2020 13:30:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4AB6395B086 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=OrWIdejFRvcSzaJ59gNmXkyaenI0h4cQ+xf+ZbXTUZQ=; b=PvhTOXy5cjjbP0nOgq1QxJUpEBcV86ciT8lp+s5CICXJw90zwdAXY78qslXJuf6N1AkVRKschQ6L0Ac4ubl5PWbans99pr2C2mbt4Yb5nzEeTURC+24HoQTp1byhhup7G2hRFLuDukaX5qmiBwSHQ5syuYjAsgq7jy5CNe0Krjo= Received: from DB7PR03CA0075.eurprd03.prod.outlook.com (2603:10a6:10:72::16) by DB6PR08MB2631.eurprd08.prod.outlook.com (2603:10a6:6:23::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Fri, 12 Jun 2020 13:30:03 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::fd) by DB7PR03CA0075.outlook.office365.com (2603:10a6:10:72::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:03 +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 DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:03 +0000 Received: ("Tessian outbound 8bb15bb571b3:v59"); Fri, 12 Jun 2020 13:30:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4efc88d319e4b9be X-CR-MTA-TID: 64aa7808 Received: from d79903df7049.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 824A3C51-D1D0-4F5D-B4CE-862E9D875ED7.1; Fri, 12 Jun 2020 13:29:58 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d79903df7049.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AfIASoyJUoyG6928BNV/NQBLOKLgnBanrlwDiafnT4tpOJVDU2txmpfEiKPRw+vje0WExerO0hC9XRbjuh5I090PlDZq9ZgbVqobz+BBsK79cIQZAJ+YjFsqVKPwbaPMtI+AXowei5wp8k5aSfkUpj4yLq5ooFPx/UXko67yawY2RoDhY2eSItz83H0DSYnCBJDw5MjsA2rX14+OCdXXUHeRojncfiaCjCa+jbgI8b06mcNfmJSBSDrjx/f0X2JSLPRBcqF3hg4u7Mja2UD4vSWY2ppze6lJvVncc+kuRqUjL+fYczKMPnGZef/muzY3btPDO7szA6l5etzFjmz7LA== 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=OrWIdejFRvcSzaJ59gNmXkyaenI0h4cQ+xf+ZbXTUZQ=; b=nuIIMj3y+OZvW1oSFF3ySv9MoBkdfNvNHsiG8COAgroyXH9D9D9hAe4zDu/MaY+9w2MBxqQLU4YnFboRK9A3lv3f7TS96oG/z79m3XL7kL+m9HsQlAjLJ6UZMlanv3L/piFxLHzYD+7h6edNkBV0HEzN/J91uKNty4gry62ta5Wzl2YrGSi6aAQHrp4udq0PXMW62AkKsW9sR0gvR/Isv49qhLH0hN8oKzUCu9k6SmQPml3dy6njnNY1PpgVatTMaMNw0esFnuZspdDB4jqUZPDQqr/OUIMXQvPjlksLdpH8zR8ZjBCJb8QZUbE8JtI9wxK6ciKiHVDGX3VE+TFgJg== 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=OrWIdejFRvcSzaJ59gNmXkyaenI0h4cQ+xf+ZbXTUZQ=; b=PvhTOXy5cjjbP0nOgq1QxJUpEBcV86ciT8lp+s5CICXJw90zwdAXY78qslXJuf6N1AkVRKschQ6L0Ac4ubl5PWbans99pr2C2mbt4Yb5nzEeTURC+24HoQTp1byhhup7G2hRFLuDukaX5qmiBwSHQ5syuYjAsgq7jy5CNe0Krjo= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29:57 +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.3088.022; Fri, 12 Jun 2020 13:29:56 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 11/12] aarch64: redefine RETURN_ADDRESS to strip PAC Date: Fri, 12 Jun 2020 14:29:29 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:55 +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: 528520c6-b294-4b93-362b-08d80ed4b6f0 X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|DB6PR08MB2631: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: SApsYv7QZm5Xm9Cro+5iJJy+V87RVDW1BgGA9wMv/kxm7orfsRS2/hjtNNyVaPzqKoIrE3+8lSJEnnyrIV6VUgoOQzFGU26JrsRQA34H/kgkgUa3pSdYPFpMSU0L/Gk4tpaJBXWrJcVM4d4mucZdKHPt+DQpCPC897YZeZsdWWY11koXhgjdwFz4ns+E9kpu35vB0vskadbIDhhdzbEY5uS32STdoGrRl9XybyWVGk19DQRJhejxNw+O57WOnnnf4ofr2BG8nfNca4bw8npixO1l58lVRUYYHMIZKS1u1ZxaoP28NizEO+S48gXZ05mw4efo231u5Q535QufN1w3yWOSUjipzwj8zf369SI0abYhU6ZG87HffK94THmaNS5QjT0c7OvzoU2/tOC1i4zY/WTbldZ7qCcqIDgPU7fZ2Tg= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KSkvx6VvuYqr+Y49/g4+xU2dK2uVR4z9mJzpFZX4calnWSFKl6ts66VzsRFUBN+j8QSoFFKN2xVRahde/qAOUzgKs0NbsWpMviJota0+eDaNOi3viB5nlDUcYkE6W6dxoIH02gcFWfx9nVOm15AFOt2zYUp2OUDuKnCuHomooJOPfZjrJ+TJou+YHf/w0CjaXIuYRSQepo8dhTL3OT3sLH9BI5WPqtZ8O4vvccr/K0FtUNPAA5moYe5+dkeOZDnVXYZRRntilCFUaJvc8GaIF8KqkimR0RZKwU4qgz6figFaY1SrXMaK/nJS6bpeox5aLHzLbqgrhx301KegY13bBoYKfiNk0iKIAnTbbdwC0OvLVwvke96o3dTeEAOOFrKvPNdeeDdwcXkPIGUVGo6p/ExmcLQnoQEsZe7hQ9UvO52dHCAGf6yrO2GRUpihw6ikeSkEaUaBzg9lxzJLePEvLfXCxO2int91rqgVaUMJzqo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(346002)(396003)(136003)(46966005)(478600001)(186003)(81166007)(83380400001)(16526019)(82310400002)(6506007)(26005)(356005)(47076004)(69590400007)(6666004)(336012)(82740400003)(956004)(316002)(2616005)(44832011)(5660300002)(70586007)(70206006)(8676002)(6486002)(8936002)(2906002)(6916009)(6512007)(86362001)(36756003)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 232e7af8-5a2b-4777-54f5-08d80ed4b27c X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ew6f5Ci3gbTBNNKo5YPfKBTZN66PxpeXF7LOdfqkxBqX/1lMPrEtVHXxNJhlSZWUe1Bvs1thZQgZo0qCEN8p2qB1Q54RBt5Ra59z6KuF70Mu65viTFxnMk+QRtnKoj+XV8mcFfs3qlKfr/YShzOx/bOOMVibLIY5LTCgQsEeD7nf191AYYqa/zoDZAPGheP79fVhUIE6oMPabPo5O216pWa07yHnB/nQd8Ne04GvdyR/3EGoA9OYsLAvRCVl670uhHEuQ3sl22FmPLlPN+ROesqEaDrH12Xrrln01VPc2xMO0rFAjKWRv0R8XRl4pVKqfhl722vnHAM5Saic0U5OL7CQ1YY0jXeKqbo9gSzrUlw7HBuRYOg+yHbU9Ty4WosQMZwxdRFA+j1SscN3SfAlr6fm5k4Nkeo9dtfaP2M1w6ixspP/r88QPblUhva+n8cGRUnKBcH/8YYv93ub26y92Q== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:30:03.7916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 528520c6-b294-4b93-362b-08d80ed4b6f0 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2631 X-Spam-Status: No, score=-17.4 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/95891: __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. --- sysdeps/aarch64/sysdep.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 2879aeaa5c..593bdd35a2 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/95891. */ +# if HAVE_AARCH64_PAC_RET +# undef RETURN_ADDRESS +# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) +# endif #endif #ifdef __ASSEMBLER__ From patchwork Fri Jun 12 13:29:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39584 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E8CD395B0B8; Fri, 12 Jun 2020 13:30:11 +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-eopbgr60076.outbound.protection.outlook.com [40.107.6.76]) by sourceware.org (Postfix) with ESMTPS id 0DC3F395B0A3 for ; Fri, 12 Jun 2020 13:30:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0DC3F395B0A3 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=wwcMieugEEYLAEUb0p0PSxLa7sc3V6LU56sfIkmQLNzTPmfI/PMU0evV/tavaLDbBMCUF1naRKp7QnYDfr7zNKOlDIiTEm5b02pc8/3XgAzZQpLnwwZiVuLFZaYN1MGp2rjogJexv/1Mc/Z5G1ZKc0eTozUoaZDsCcnXEhGMmqU= Received: from AM7PR04CA0001.eurprd04.prod.outlook.com (2603:10a6:20b:110::11) by VI1PR08MB3215.eurprd08.prod.outlook.com (2603:10a6:803:45::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Fri, 12 Jun 2020 13:30:05 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::62) by AM7PR04CA0001.outlook.office365.com (2603:10a6:20b:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:05 +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.3088.18 via Frontend Transport; Fri, 12 Jun 2020 13:30:04 +0000 Received: ("Tessian outbound 8bb15bb571b3:v59"); Fri, 12 Jun 2020 13:30:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 85e6651b715d516c X-CR-MTA-TID: 64aa7808 Received: from eb4f796bc2ee.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C4616E61-82AC-4759-B3F4-3F1F3C14D07B.1; Fri, 12 Jun 2020 13:29:59 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id eb4f796bc2ee.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Jun 2020 13:29:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fdrSEXW030KVpKjYmSIZ9uR/RT+zgEHZ58lsoZ4qtACjc6Mlf/nYunYiAghDhanyRyJeajSYoZpii35p2ThJ9gxkBDZGl7y1ikct1iGozFpj1cf/fsIyJvN6hQnS3hDAD++9+uPi8kBbI+YT3oNi+L4aUhGWNXGEuwZikJEzoowwu+cXNbgH1Cd5gq7EfuX1i02MKz4+cOcTUm4jPdEtcO/eDVvIcI69aSdEeCHKIO3K41C3XJxbbpaibAH5TQzeElsslgRIi64krwP66RWekMeabhfY+3TA7TzHX8ll33/oDGIbLOiTt2vmEDx+XieDZDpduB8128hQAlsz8KHtug== 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=NH7vyFXYZl5Orc4EdAKzwQ6tjqbaBAcbchC9euZkih5pffAflEH9WgI/nKqdSQ5hrJIqn+nDUOqZ5od8Q8plbVNr2cD3dfdiVt+pHD7sFtLlp4NX8+FcuMxpstCNdcoRyj0c0gPdSAbbiWCA3l2oZfGC5teilgRSnje+ePaqwRw+ZqYg9h5hEatG3cwuT1sHHkDMQzQKd22S2DNF4dwqMV1pbOxtBnK5d7eB5z3vGL/314voXT7mWaSSMBJNDSK/f3cBuSCv1mwRvrhD6lhrW6ub0IVwhX26/ImPIL4zKvo7BVPYHapzmyP7t/8Fwyv+io+yQStewiN5zp/1N0cNwA== 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=wwcMieugEEYLAEUb0p0PSxLa7sc3V6LU56sfIkmQLNzTPmfI/PMU0evV/tavaLDbBMCUF1naRKp7QnYDfr7zNKOlDIiTEm5b02pc8/3XgAzZQpLnwwZiVuLFZaYN1MGp2rjogJexv/1Mc/Z5G1ZKc0eTozUoaZDsCcnXEhGMmqU= 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 AM6PR08MB3912.eurprd08.prod.outlook.com (2603:10a6:20b:86::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 13:29: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.3088.022; Fri, 12 Jun 2020 13:29:58 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v4 12/12] aarch64: add NEWS entry about branch protection support Date: Fri, 12 Jun 2020 14:29:30 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0017.namprd03.prod.outlook.com (2603:10b6:806:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20 via Frontend Transport; Fri, 12 Jun 2020 13:29:56 +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: c1aed6ea-973b-4e43-edc4-08d80ed4b7ad X-MS-TrafficTypeDiagnostic: AM6PR08MB3912:|VI1PR08MB3215: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pAdIcOOYOzoE5b4kD/+VQLvV7LSkSq9KpjRxp7KcYwAK4r4TaFODUMO45eNEVR+IQReY3EKawSNXCjJpBrDxxRsFWtNbuHQii6HH8ywfNYlcsJgXMJKt0Dc2XJsFuuQyYymefLm6/Cc4JugMG7NKB7QoCbY3oBu6mFEbR5M8ygIz9Xz9EGz+TTG4cVRAgLg+0c8+w50LSRBAu4q4h5Mqgk8aiQdFt1k2pVYdjgTVHiyWKuixTqfmOVdxtBtuK7WoKvS/BQGzFZ6/emP3qM4nhKzD67EHmKNHRARfP9ObJknAhTlXVVOwvsf9ftacFneU1DjAj1ssESla8eT7mqrQlchR/+MVKAp7wt6VmvRKLmXbEpOLNZKI7aiBJOx04HtUeGtq+BAqsy3YY55xQLFs5TJ65L/A/MzskOwfoKxGK2k= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(956004)(66476007)(66556008)(66946007)(6506007)(26005)(6512007)(5660300002)(6916009)(6666004)(2906002)(8676002)(6486002)(52116002)(8936002)(44832011)(186003)(16526019)(36756003)(2616005)(316002)(86362001)(83380400001)(69590400007)(478600001)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PUrVrgrgeeXoXM9htPLaE8JGynToSbrvp6gWopHc1Xu5xZZ757TD92cZ7/oKxiZqn3WT4jYIyyx9jfA30t6LYt4LpEbzisUJl+qShncpXz4S+RmJOE/1cF/JsPprgtLCxPmgwr5hyqkk/NnTHuntOyeq8Yuth/Tzp+jCTyhflsUID+i7ixLMkFCPGB7dDl6nNo4G8rZXLyJykrM4SZ4sYSbkgrP7RwN667x8jBoYqobbSx2KgAmybvQhBWinxdGThpayYKRPSe8D7XOoPqUdQzhComdUG+fO3OIMTpKcw9k9KQn9J9ct24Nm7yn4FRjKmXGTCUla+bH+LyiZlLfisMrdLNWnyyB2vKF3YsAtIe+M8jviTkpoy9JY/NyGK+bY+InWVeLrOnT4lDSpyYjJwou0tSjJRSTr7EnK9lkCEe07SiKNt3cbcmcBkViGKR9VVCIFNL4qZBE2bPQsNCALpZEjYxxckNF6eBCKme9FCeU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3912 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)(39860400002)(136003)(396003)(376002)(346002)(46966005)(16526019)(36906005)(69590400007)(6486002)(8936002)(6666004)(478600001)(316002)(6512007)(86362001)(6916009)(8676002)(83380400001)(26005)(2616005)(70586007)(2906002)(82740400003)(336012)(81166007)(186003)(36756003)(6506007)(356005)(82310400002)(70206006)(956004)(5660300002)(47076004)(44832011)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0cf02cc1-9dd5-4d45-8bbe-08d80ed4b346 X-Forefront-PRVS: 0432A04947 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R+F1tTk3KgK8VsS1L3vHcX9UUfdT+gABwj/9g3IXI0Atx3l/CZnz6bJeuF1Kfj9WnJPxh+9YnPVK49aNo6hutFfEV4XScdm6s3zO1CX+KkVmoafD/B7XNSjo7vnJDkyKP3tAusKV9xtDi80vcIGbRmfrF6ZulcpJ7NRvDWKxc0aUujpRl8ro0cggtwGYNbGvJMHjky2b+LegzdaB6+oYpWf4MxfT/r3Viq2DRinvraqp+kdM1OcrnB09Eafm46PlMbZRcCLr72uU0CRFIRuhYZLzz0gdLW5iersXSaeuWuVX4Pwm1z7K3Jfmv8H8bFnKELRBJdiaqCF+TdhSP3EZXDGlvz4Q8Nw6dYTdZ9TXvK7eO1QJsZTkVsbBv9QXYD2BFrKBec11OQ9JlWLse1JS/GTuCSXn10Ev8UP+rsc+aJh+3hWLK29m7QazAi7xVJW3BMwbRYy3L1+f8bLN63xNLQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 13:30:04.9810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1aed6ea-973b-4e43-edc4-08d80ed4b7ad X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3215 X-Spam-Status: No, score=-17.4 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