From patchwork Thu Mar 4 16:34:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42255 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 9B1163AAA0AB; Thu, 4 Mar 2021 16:34:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B1163AAA0AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614875665; bh=NYR6xRXlklh3NrZmSiYqxtKI8RiI4hCuXCze+3SYQYc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=KR9ok+LhsexeT7HimJteNxdmxY9DNJH86MsPmTbWMAheOz7m6wmNngVUH63Jor33B kR5sUrrhi+81ovqpL8XWGq6KGRtHgcmIW6bw7WWfFU+iA1e/qqCreR5i5ONIdJxznw v/870IMtwXMn7CX+TIwwsFQhAeMmhUHTXkDVlIeg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by sourceware.org (Postfix) with ESMTPS id F1B11389041C for ; Thu, 4 Mar 2021 16:34:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F1B11389041C Received: from AM5PR0402CA0023.eurprd04.prod.outlook.com (2603:10a6:203:90::33) by AS8PR08MB6919.eurprd08.prod.outlook.com (2603:10a6:20b:39e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 4 Mar 2021 16:34:19 +0000 Received: from VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:90:cafe::49) by AM5PR0402CA0023.outlook.office365.com (2603:10a6:203:90::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Thu, 4 Mar 2021 16:34:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT006.mail.protection.outlook.com (10.152.18.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Thu, 4 Mar 2021 16:34:18 +0000 Received: ("Tessian outbound 155e15b2e217:v71"); Thu, 04 Mar 2021 16:34:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ecde818e72690a46 X-CR-MTA-TID: 64aa7808 Received: from 41e3babd368c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B8EE7D73-8E10-43D1-8636-E8133CB7FC0C.1; Thu, 04 Mar 2021 16:34:13 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 41e3babd368c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 04 Mar 2021 16:34:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zu/dVvx9csWZZX9BrhuFKLcBXTs6BXa6MnbVfLm1wxUDN3y5N15PfAnyyNaEAdCcRG2hXTMzvEqR206d1Gf0qZXhc+oKADxCFq8jnvgDevsiWserKuYo/mcuzQ4nfsIuVzu1KQJp1dAozjEOGcin4X+zH4TynubTboCvOgbY/yTAFZFXotx5F8MhXYDrrywxo+tRjzwt/QaSsD2X3LtQconmSvYawDLlnOyeUBxJ21OLTGQkLk5MLcdP4ft86WYED4zEEv9RRVzEST6nkjF74Mdv8M4hn8a4L0l9pxEZ1bPLEWru7W/ubegFG8W2ithbnBdkIEs2lnR6sWI4VfBSsg== 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=NYR6xRXlklh3NrZmSiYqxtKI8RiI4hCuXCze+3SYQYc=; b=A5vvyv7d1gz8jBOaIMFwFnrs4haxIg1PJFE+faLEKtCAmT/7l5YLYeGJAPOAGlPTZ9T1UhBvYN6PHaYYLMXkLqvRHyxry1MZIyv/4M3WMuF6QEYDF2QrYvlt/PP7DC8N9OEZsExphdCkJ3abD7xUtEPOBtRe0/z0aKsp1YrwBKSRfX4yAhBroJxEnJX1t7mntM2CYmJXOiRKC359BiEkC8jgXlAiMzpZLDhhqBEM0JbXzknJdjqd6voHSjee7oUeK19isSJyKH9uNmKq12aLl+8qRtfI/Yni1dyGgQflYPXUQtpdJUDnW7wyN1hvzf+WxFyoak5TBrnHQr2pWMD/7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Thu, 4 Mar 2021 16:34:11 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336%2]) with mapi id 15.20.3912.021; Thu, 4 Mar 2021 16:34:11 +0000 To: libc-alpha@sourceware.org, Richard.Earnshaw@arm.com, DJ Delorie Subject: [PATCH 13/16] aarch64: inline __libc_mtag_address_get_tag Date: Thu, 4 Mar 2021 16:34:05 +0000 Message-Id: <5ebbc6850c22874c46958177c759464c3bec34ce.1614874816.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO2P265CA0501.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13b::8) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.55) by LO2P265CA0501.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.25 via Frontend Transport; Thu, 4 Mar 2021 16:34:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e609ed5-223c-4a73-0f7e-08d8df2b5bcb X-MS-TrafficTypeDiagnostic: PA4PR08MB6064:|AS8PR08MB6919: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: EgXdLiun5Mn4XNWofWRv57LtW38GaZxgAVzBa+WFV+wLa6+AYtrOC4GzpSML8b51h5dKrhem2k3FeBHuy2vAKjvuNzFB7mj4HDP72v9e735do21LRBqd80PR2J4FCODlTat5PC7r67aGYAA6eJKvucKRg0er340QDC53jap7BQsuJ0aDRgK8JU6djGUv0qNxsU+NQ+OceNAdaHU7uKbWu3CSq0pYCqptAXMPb3KqJ2pXXccR/aIpOR47WyW0AR0lKoQdFWjIQZw6XQS5IpJvqfeDjLAR9+Mu7aIMATJPnBOjLD+CwwK+j3qDpc3Ce/1+m14ZmP9cqYzRjWnQ9D9LFWdykycFAzLjdmHyu0GwU2Q/NyKGhWTH1usughMeMVQvhRbZJpj/0fOmBIxCcvIF7S5VvbrzuKdOYQ6ikqGJe1bqNdx5YUhcD2enbq4R3F1kM1rb8ukPJux8WQSzstdWSnSyKh101rLRunihBug2EJxhx4WOgZMr9IrcG/9d3u7bIHc0HwNhjlkp75yF3+WoUWFmDSOeN8YfjwQvUdckbnzXM6+HU2HDmN/w6XB3ZHYlOOIfneSRPQ7QMOR2mFvFARas6uaQ6/HfyNWyTaq4BASHxeTBLimWUlvSAr8UzZQN8KyKXhMgoie0uQZzU2nvyWHTkqYnmuFHeyf40c6b8WTtUkk0A5p/bsyMFKzdJ5/F X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(366004)(376002)(39850400004)(66556008)(66946007)(66476007)(5660300002)(6506007)(26005)(6486002)(316002)(83380400001)(16526019)(2906002)(186003)(44832011)(6666004)(36756003)(8676002)(6512007)(69590400012)(8936002)(478600001)(956004)(86362001)(6916009)(2616005)(52116002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wETEVAA1ylGCw6T7PGTl1sdVxa9+7ArGn2QlPapaEIq3z3mG3932DMS4yW07gC822kUAGniLJgX1Q/AjoPAbBt+IQHOUo6txkT4M6rzmG/W62mbSii092zRvkpA7ARPM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dGAgNADQ+y0p7vV28fKlPT/7i16yR5FVaxIeesSlIT8URBJis2BQtoegrCEq5nMZWrLNtabSp4jV7PfLT2D6bbN53s1e+2CBBwQT3sNsAT08GZR253ht8EoAUfQSMq8r X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 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: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 1ff5b586-9e8e-4ec3-e852-08d8df2b5736 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kkK2SFtHOaYzOh/vvdbQ3fHYbTW6ftVX0OFAIvjwiuBhwy3TMMG2m5n9SmGqP/sfH1ByWqjaEjLbv5MTg7OTopZ96Ckbwm7P7/8wq4xMiLelaY91JnPmH8BJ9wR95VYnK8qrQcljjRdlTNCYLSkzym0NPBfkpKmtDCySjRSapKRJ5TjAsoIsAK6pEXVtVnCrHum8+YaJCc60CA35dIemB0EkuEeP2zcvZuIZCdf6Z8xFvOvXsAXBPRIS/Zbm9gTVcg2NM93EoKlxW9lbPGvmmI4qPHbD+hd90uTQgWQ8bc3QYkCiGuKy6P4Ac+6wRzHn06yeT0egkkvnFBqz6wUoFrsPnvl78xl7hkw8QTbi/80lw7XFJK9w5lllt5Uozj3sBHUxmb8Y8b4rpKSX3h0p0P4/ZHZa1g9WoYQnfhMGeVjXtRtCiQNy8xVaWjPuShl/24U1nV+4j/nicFMd1wiFsJeY3SLUZTa7AExEtQglz3+I4VXyT7o3mCTxOSbfwlwsnXjw1NcBx++fM1K1k3tkMTwI5rmp/NzgXYVqMNbTUQxzqu47W+cdwNrIadMxjeBtVHS4pQGNvQ60++9LkrieH2cnP5mo6sWR0bgS/TtLWkjDkPOaHUPxBeCs4QzAtkFdu+VNuI/ijaqL4RfbloLJXbk65u8lW0DOOPr1EmY5esPBCra3WBhLi7A1+SDiWHGc0lh9sKc6iYzLfed1vf/KTGRoMDD9b63H/RNNmb/IdJpUmyjIjdImFXNMcSs+kCB11q3KxZRgTE230u3BYAIR6kF/YStagOQUV7vcvHeFaUE= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39850400004)(396003)(346002)(376002)(136003)(36840700001)(46966006)(36860700001)(36756003)(69590400012)(82740400003)(2616005)(5660300002)(956004)(336012)(16526019)(186003)(6666004)(26005)(82310400003)(478600001)(316002)(8676002)(8936002)(44832011)(83380400001)(2906002)(6486002)(6862004)(47076005)(6506007)(6512007)(86362001)(81166007)(356005)(70206006)(70586007)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2021 16:34:18.8247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e609ed5-223c-4a73-0f7e-08d8df2b5bcb X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6919 X-Spam-Status: No, score=-14.2 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: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This is a common operation when heap tagging is enabled, so inline the instruction instead of using an extern call. The .inst directive is used instead of the name of the instruction (or acle intrinsics) because malloc.c is not compiled for armv8.5-a+memtag architecture, runtime cpu support detection is used. Prototypes are removed from the comments as they were not always correct. --- sysdeps/aarch64/Makefile | 3 +-- sysdeps/aarch64/__mtag_address_get_tag.S | 32 ------------------------ sysdeps/aarch64/libc-mtag.h | 14 +++++++---- 3 files changed, 10 insertions(+), 39 deletions(-) delete mode 100644 sysdeps/aarch64/__mtag_address_get_tag.S diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 259070cfad..5d594debea 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -40,8 +40,7 @@ endif ifeq ($(subdir),misc) sysdep_headers += sys/ifunc.h -sysdep_routines += __mtag_address_get_tag \ - __mtag_tag_zero_region \ +sysdep_routines += __mtag_tag_zero_region \ __mtag_new_tag \ __mtag_tag_region diff --git a/sysdeps/aarch64/__mtag_address_get_tag.S b/sysdeps/aarch64/__mtag_address_get_tag.S deleted file mode 100644 index eab6c49285..0000000000 --- a/sysdeps/aarch64/__mtag_address_get_tag.S +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2020-2021 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 - . */ - -#include - -#ifdef USE_MTAG -#define ptr x0 - - .arch armv8.5-a - .arch_extension memtag - -ENTRY (__libc_mtag_address_get_tag) - - ldg ptr, [ptr] - ret -END (__libc_mtag_address_get_tag) -#endif /* USE_MTAG */ diff --git a/sysdeps/aarch64/libc-mtag.h b/sysdeps/aarch64/libc-mtag.h index f58402ccf9..da1b6be776 100644 --- a/sysdeps/aarch64/libc-mtag.h +++ b/sysdeps/aarch64/libc-mtag.h @@ -35,17 +35,21 @@ #define __MTAG_MMAP_FLAGS PROT_MTE /* Set the tags for a region of memory, which must have size and alignment - that are multiples of __MTAG_GRANULE_SIZE. Size cannot be zero. - void *__libc_mtag_tag_region (const void *, size_t) */ + that are multiples of __MTAG_GRANULE_SIZE. Size cannot be zero. */ void *__libc_mtag_tag_region (void *, size_t); /* Optimized equivalent to __libc_mtag_tag_region followed by memset to 0. */ void *__libc_mtag_tag_zero_region (void *, size_t); /* Convert address P to a pointer that is tagged correctly for that - location. - void *__libc_mtag_address_get_tag (void*) */ -void *__libc_mtag_address_get_tag (void *); + location. */ +static __always_inline void * +__libc_mtag_address_get_tag (void *p) +{ + register void *x0 asm ("x0") = p; + asm (".inst 0xd9600000 /* ldg x0, [x0] */" : "+r" (x0)); + return x0; +} /* Assign a new (random) tag to a pointer P (does not adjust the tag on the memory addressed).