From patchwork Mon Jan 25 11:03:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41809 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 1E0043947C3A; Mon, 25 Jan 2021 11:04:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E0043947C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611572645; bh=OoxasUT/ZaUTVNXIqDuxiHJo7NdWWyJBhxHLHWF2fBk=; 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=rLYb9ddw+VbuZdxAOYs53IRtX1ETfTGOnNyAcoODHzN6zyUnM9KbWUVWzK7Zc5kFI vp+hNgNd8YeVpZRFpqMZuD9qOjWJuYojW9eoQK90ieAs51qgM8W/SyiCMMpbFFyMWv RdvZ+XNIEvEnw2ozxLatzRRnaTiyXX2AFdO9+Rcs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) by sourceware.org (Postfix) with ESMTPS id 462DD3840C23 for ; Mon, 25 Jan 2021 11:04:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 462DD3840C23 Received: from AM6PR10CA0105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::46) by AM0PR08MB3490.eurprd08.prod.outlook.com (2603:10a6:208:e4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Mon, 25 Jan 2021 11:03:52 +0000 Received: from AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::fb) by AM6PR10CA0105.outlook.office365.com (2603:10a6:209:8c::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Mon, 25 Jan 2021 11:03:52 +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 AM5EUR03FT032.mail.protection.outlook.com (10.152.16.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Mon, 25 Jan 2021 11:03:52 +0000 Received: ("Tessian outbound 8418c949a3fa:v71"); Mon, 25 Jan 2021 11:03:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1dda3ed76794958d X-CR-MTA-TID: 64aa7808 Received: from 5f048b128740.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 881970AB-BD9D-4567-A0E2-A580CA69DEC7.1; Mon, 25 Jan 2021 11:03:46 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5f048b128740.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 25 Jan 2021 11:03:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kd/NkI1eWfzRSfmcFWpAApPOAbtrz1NyY42TrOjMjvX6a4jLKrCdTYL2vonz0Oo7mOTfnj4xFHa9NXLiklBGcg4tRUnAVqU6CR3KQ92D+8gGf5MWFjnECdqFy4TStULdwZ+Wd6UbFg1pndzT3Lveb+aQ2MNhT6yN7IHqG0AaEnzoyeF2N5Z9adlrvRgrcpKreVmBMi5+fOxES5vdX6I9CrNqB2E0Z24h6CpZJfgyTIGFxns8LT0JEh0AkZ1XWku8kFz7IkOUZKcnoBGQKauKI/HI5HVF9+6OvSGLBtbAHXShP4xoOKwiXIcer9ejgN2FyYEfEgMJ/pwfZCa6qFzn/w== 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=OoxasUT/ZaUTVNXIqDuxiHJo7NdWWyJBhxHLHWF2fBk=; b=L0elTOID3OmsMWAHZouNgecZdz+EF3LwvVxc+D89+EJonZxFeZc5dmxGlvoqMedn4gHtcET+rBY5kIXiv5MWcSjFlLnIDs93fW45HBBeuxsG1NcBk+/WscZSUYFNFa4ynKFmIbcOdGbGPJhjqD62Io5SShaYe6LaYm/E1jl1rBfJAwd4vu6xgaCR1W+JUeCtr2f7stITcONVj0pI+ov3t4DQ4tdx41wEBPpyAolOhOzB0rXBGZYqDjO4SHK5HO1oG0w0pNzgU+hSte5Km9h7sGHLchXM9O8Qcy/CTiYKhBg61sio4+B7bdOPiS1uHi9JXefPDlXk/g763L/2aaablA== 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 PR3PR08MB5722.eurprd08.prod.outlook.com (2603:10a6:102:8f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Mon, 25 Jan 2021 11:03:45 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::941:f3b7:c753:21f8]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::941:f3b7:c753:21f8%5]) with mapi id 15.20.3784.017; Mon, 25 Jan 2021 11:03:45 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 1/2] aarch64: Move and update the definition of MTE_ENABLED Date: Mon, 25 Jan 2021 11:03:39 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO4P123CA0473.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::10) 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 LO4P123CA0473.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Mon, 25 Jan 2021 11:03:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 584f7a8d-2fcc-42b9-ccb5-08d8c120e675 X-MS-TrafficTypeDiagnostic: PR3PR08MB5722:|AM0PR08MB3490: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LMq+Xsd15ew/HYWN4fQB//i48q6JLUSm07+7C3F2eG4Qf0gASuWn/gJ5B00T/RJI+bcV23rhZ0wA//ehyOS8X47NmFs3D90LVcvmTsTA8x6kig/F6A+t7qqUM0UxxoZ6xrtP7mxFUX/00Ur3z9rvhoiIKwO/dHwBH7OF28JHJmYc6b2CmN30gTHYNX904XjBaY0/ZEhKZxUcUoQvgv3IamTzd1S05ZfZ5n1wp+5Jc+wlSwMl3PBCojiST0aDznvchIEO3dvbUvYRru3K47+ZHEA4UuJ7Q11Cid9VSKuv40aHx/KdwVxpieqGCRte6m1dCaRbQlIx+yaWGtLGs69zgjLyYnutcCSVmZYht+aDkw6gBaJwLe3J+OC/Jk9YiUDbCxcLCqZ7XfF+ZsUf0vnAlHTfp93ZEks8AAyM5VuyNXhfENYINLukaUKBtvcXvS/sKRzAsl4dW/i2/9BN5jewgdwco6+ZlyAedfH29xsBTiknSaudIFrEeWGba0VspVVX62r4HYyYSF722LuaB1XsdA== 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)(39860400002)(396003)(346002)(376002)(136003)(366004)(186003)(2616005)(26005)(8676002)(956004)(44832011)(66476007)(2906002)(316002)(6486002)(16526019)(83380400001)(66946007)(66556008)(69590400011)(6666004)(478600001)(6506007)(6512007)(86362001)(6916009)(52116002)(36756003)(5660300002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0m9c92wPTlnZap6I/lM3aKgVyabeGjOwXqI6p8mdj33NQ142PI9C/dL2Q3dtH71mj8YtJy+ra8IdsEHxv9XPRSwN2M46rEjqY5vRiNTpEgmNYI+yOxSsZmLxD1egEhEzjFlqiwYVm/JYX4Rl07WemSVkZ9uDtiMz8pb/F4uE8cQdFVnbCsVW7LZtZ5ijrqCGHM/bcBu+Oa99DFDI24hdO1PQeOroeBjeFlNLXkguiQsA1TWrzjZd9G022bKvG08vENQUtb1Q5pbPBdUeHoC9Cjd5xXaErrPJx9shWlSEUmIE8/4RfyycBLSad9F/LN4geLL9hg8dsqL18iQphS7JBwHpBDxNul2+pUrgHeDpefTcjHR9nblmGYy5/U4QKREihyfMpARPLtGI1gwvhrQIab5JbrgeMF+pgzJz8qAlRWQ71VCiSuih/VBcxU/Us/ZXBqsILboRk0SOF9/Wf9bl6Edls20TgekZ7DcVdOZRzZXyeMRz498IWwMn/463uPqivAIuRvNn05oMLj+ZhwUE79fEm3In+ad6BR6YsvGhVdu9jWLz+4Yz2xC4Y3SmI5zjajRxOsvga+LtQ+Vt3NPtytgfRKarhI17daX8tNC1JqQOEFWVhmqZ0018zVfz4g+5UMGDaWw+uhn50zqaM9f3LNQPBTrlEQTWqDPHbU4h9ddy8E6qpawUJXeDWNYAXTXa0gLFixuh0/uzzO9GNqK2q8URT4poErGZUeofj+nGW9KZwVJsux1NFM/0ChoZZcbEdW5+vV6u5x3XvLKf89ym1wYPRGhcE2UnDIoNWd6DEcDa7597puoiPhxx1n4BXEB4CblpXobOnmZRusd4o2H6IB5PKiQMeOQUV32zmVf3EhmXwK2k5icYFi43tTJjOLtBIqFQnRHCd4HbseQFQly6x0GiIxpis21b4ZIsMjD43x4J5kEdZEnNJmqbcFw0R9JdNPMjxl1ES1o9URphv7gr7TeGqXntoUTwP5UxNwzgBHw+HY7k9SjCK6P8jc/HnYEd X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5722 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: AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ea7c64b1-2132-464a-042a-08d8c120e220 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U1p38p9Jv0WohASrlrHi1lrhAERM0u/JDKbdgUqVwMtRryxCc8wpNZwc+x8mdFeJJ09y+uVyh4igqpsHUqXaEtXQW/dfm+6yfhmvE6tQCD2hG//IxJnlh4rutDQdHM+0u/pBhgWBso8BG4C+c89j7trMkPmNKD7pThsugew7hCE8DNsjLemEm5hoDRRSk2dp2704cKXpcwvyRdOTNjB8KbMEBbPbB87MHVMsLjhF7hE+pUJ1/JJ6gigbwVfp2HLk7GsR3Jk+bGEXuNLi+fZK3T9dTBg630gF1wogWpf6xt4rr0DNFsoXwJHr8GbR1uZ7NvBB6ozMb5mI1YQWO3ZdLXbi1BQXx34tab+EutgyOWM7lBcnTS6LjHLu/711NJrmCUM3KudcjCQrWExWjurysmRVnkoAMFwb7Ve2JBy4YuNGUowwWmdLyVRtgogR3Y4oi+dsh48AiAsFCn/n4A4lmqSbB3Z29vqJFcjzTYJ8sG4oV4Loqnuvsk45j0WydV6R2v0cEcppXvkZgCTa1DsLPZWOFIdB1LmbBab3cTySKEhbgNSKsdAZRCd4/6A3yelkIA/FILSISlUY8eflmpEPIA== 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)(136003)(346002)(376002)(396003)(39860400002)(46966006)(36756003)(6666004)(69590400011)(478600001)(956004)(336012)(82740400003)(47076005)(316002)(5660300002)(186003)(8936002)(6512007)(356005)(16526019)(26005)(2616005)(83380400001)(86362001)(6916009)(44832011)(81166007)(82310400003)(70206006)(2906002)(6486002)(70586007)(6506007)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 11:03:52.1919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 584f7a8d-2fcc-42b9-ccb5-08d8c120e675 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: AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3490 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, 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" The hwcap value is now in linux 5.10 and in glibc bits/hwcap.h, so use that definition. Move the definition to init-arch.h so all ifunc selectors can use it and expose an "mte" shorthand for mte enabled runtime. For now we allow user code to enable tag checks and use PROT_MTE mappings without libc involvment, this is not guaranteed ABI, but can be useful for testing and debugging with MTE. --- sysdeps/aarch64/multiarch/init-arch.h | 11 ++++++++++- sysdeps/aarch64/multiarch/strlen.c | 11 +---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h index bf8264b561..fce260d168 100644 --- a/sysdeps/aarch64/multiarch/init-arch.h +++ b/sysdeps/aarch64/multiarch/init-arch.h @@ -17,9 +17,18 @@ . */ #include +#include + +/* Make glibc MTE-safe on a system that supports MTE in case user code + enables tag checks independently of the mte_status of glibc. There + is currently no ABI contract for enabling tag checks in user code, + but this can be useful for debugging with MTE. */ +#define MTE_ENABLED() (GLRO(dl_hwcap2) & HWCAP2_MTE) #define INIT_ARCH() \ uint64_t __attribute__((unused)) midr = \ GLRO(dl_aarch64_cpu_features).midr_el1; \ unsigned __attribute__((unused)) zva_size = \ - GLRO(dl_aarch64_cpu_features).zva_size; + GLRO(dl_aarch64_cpu_features).zva_size; \ + bool __attribute__((unused)) mte = \ + MTE_ENABLED (); diff --git a/sysdeps/aarch64/multiarch/strlen.c b/sysdeps/aarch64/multiarch/strlen.c index f3c018aab4..8f38de69b5 100644 --- a/sysdeps/aarch64/multiarch/strlen.c +++ b/sysdeps/aarch64/multiarch/strlen.c @@ -26,21 +26,12 @@ # include # include -/* This should check HWCAP2_MTE when it is available: current - linux kernel does not expose it, but its value is reserved. - This is needed to make glibc MTE-safe on future systems in - case user code enables MTE. The ABI contract for enabling - MTE is not yet specified, but it can be useful for at least - debugging which does not need a contract. */ -#define FUTURE_HWCAP2_MTE (1 << 18) -#define MTE_ENABLED() (GLRO(dl_hwcap2) & FUTURE_HWCAP2_MTE) - extern __typeof (__redirect_strlen) __strlen; extern __typeof (__redirect_strlen) __strlen_mte attribute_hidden; extern __typeof (__redirect_strlen) __strlen_asimd attribute_hidden; -libc_ifunc (__strlen, (MTE_ENABLED () ? __strlen_mte : __strlen_asimd)); +libc_ifunc (__strlen, (mte ? __strlen_mte : __strlen_asimd)); # undef strlen strong_alias (__strlen, strlen); From patchwork Mon Jan 25 11:03:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41810 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 ABD9B3947C3F; Mon, 25 Jan 2021 11:04:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABD9B3947C3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611572654; bh=U2MO/uLYmORYgI2Cuan6obh/nWGZrmnNP9ykMVsrYyE=; 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=gyt7s4NFYwdeJlowp/ZyQmJcOiN4jYeWg3sGvuVmk9ZDr0QFlTSiyhCgUxQT+isLH BObq030PZVSOOrtiWBwEoL534UW5/F7pmIZ/eV2DyDISI23DvymWk0W7xdGp0PxUDg 2tBTqIVWoxdYt2RCfCM7AMZnTLJe9DwY7fRmYwzc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2086.outbound.protection.outlook.com [40.107.21.86]) by sourceware.org (Postfix) with ESMTPS id 5199C3947C3F for ; Mon, 25 Jan 2021 11:04:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5199C3947C3F Received: from AM6P194CA0104.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::45) by DB6PR0802MB2502.eurprd08.prod.outlook.com (2603:10a6:4:a0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.12; Mon, 25 Jan 2021 11:04:09 +0000 Received: from VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::77) by AM6P194CA0104.outlook.office365.com (2603:10a6:209:8f::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Mon, 25 Jan 2021 11:04:09 +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 VE1EUR03FT054.mail.protection.outlook.com (10.152.19.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Mon, 25 Jan 2021 11:04:08 +0000 Received: ("Tessian outbound af289585f0f4:v71"); Mon, 25 Jan 2021 11:04:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ce653a56571563fd X-CR-MTA-TID: 64aa7808 Received: from 4840285cbc23.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BC2C8B21-B267-41AF-81A7-D320B1ED02D1.1; Mon, 25 Jan 2021 11:04:03 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4840285cbc23.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 25 Jan 2021 11:04:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLZfFcXud4hzxDHr5IkF/rQ6wGqXMT22NxDKTMp+ievhagujoS//lRp2+Ci42s6Zt/sx8Bc8IpxA1y1T+S1ddCv0kdV/ng+R/hLrfHB/3OAH6ivphXLRh97rJZQ/uBGFCU26TjQdAD9VlMv54bTiVqY3gaeBnVeijySwaqnTIwuDg+izS/2rMA583bi2Xxp5z9+dpP12RliAQ5UJLAVpfaEaqoFtdB1ORsOrlNZZp/0U9/Jr0YykgF66jc1pcZlpsj4xXPX2qCbVwcUpkRd7LT4jF0MluqgzxRmlelHdi6XXJpK/u6+AhHrsCjpCEuW7y8p3iv9G44YY7qn6McJ4fA== 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=U2MO/uLYmORYgI2Cuan6obh/nWGZrmnNP9ykMVsrYyE=; b=CW4OIKskibN5R6Dl2i3q6LVNYGu2j+HEdBu4/HSMc5o9lQNvblWffcMP/sJJ7VAw2KdU9Tktaz81n0l7SUfNmp+aYMJADMc5oe6WLovFgCGwyRFfEigy/E4ls1dkiGDweMeqGUxn93Q9dLDCTxxbx/3Fh63BxbGEYG2C0M7Pao9fF1oT6TXmBe8ecwkLC/USdHqfb77+AOjppFEJ86espOn53nbAC70nJjD7uuCSWVsmDNX1qpcbZXosmYsh4UC1pwcTKeWZslXGtxN9qz0yN3HPljpZm9mW6IQM3XonugAnmGEjXaEMxGvFi80GZgCxYTxfmC2qVCtao7Zdl0kAuQ== 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 PR3PR08MB5722.eurprd08.prod.outlook.com (2603:10a6:102:8f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Mon, 25 Jan 2021 11:04:02 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::941:f3b7:c753:21f8]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::941:f3b7:c753:21f8%5]) with mapi id 15.20.3784.017; Mon, 25 Jan 2021 11:04:01 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 2/2] aarch64: Fix the list of tested IFUNC variants [BZ #26818] Date: Mon, 25 Jan 2021 11:03:56 +0000 Message-Id: <224874374ec839e932d0a7d4e3d152fb5f74b30a.1611572339.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: LO4P123CA0079.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::12) 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 LO4P123CA0079.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Mon, 25 Jan 2021 11:04:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 31919887-dd71-4099-47fc-08d8c120f06d X-MS-TrafficTypeDiagnostic: PR3PR08MB5722:|DB6PR0802MB2502: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5797;OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: O56yjW2aX5EKKMTTIOd0x/tox3ac2vPUgv3g1JG+OB7lR8uGAzSjhxKNKMbZCmcwenwbbd9sSjnTlpX10/AVl9cU0WUCMHIzwGlFXBY1A/bqZ3ZP7gnBu2X+KW13s/CsCx9wiB0BQbaMkFAKxFsg8hyan27ma10mtzGPd00BtwQSb6EN+vDn61NfFVGToEdSpk8p3DMCaSWz962EuMbJS2Q3DK0Fe7gHOF2Twl8FR33M0vjX4wG265C5EJJ4tr52259P5I2o1xk+7Qm2Nu1PTFI0pgsXsqg3+ovvmN6QGvtCEiUzWzMNE72qFQUbO8KlWR7eVNQLD75TQc6THydZC5vyLXAAjIzmyAP6Ks2UuhSkSOweEUcILpoMo6l4XvsLX1w7XooYpc80n3nQOAsXQ77Fhp1NUpUibrVKYWWEaHcvD2wjzFkqnlzSXOWACu0UqbfeoP0xFxbpRqUcJFNQVw== 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)(39860400002)(396003)(346002)(376002)(136003)(366004)(186003)(2616005)(26005)(8676002)(956004)(44832011)(66476007)(2906002)(316002)(6486002)(16526019)(83380400001)(66946007)(66556008)(69590400011)(6666004)(478600001)(6506007)(6512007)(86362001)(6916009)(52116002)(36756003)(5660300002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AEgpnsFCYtxPd9o2rkrW9Mr0nuIvNIyCvphuCzMxvFGXm7mDqAme/lbMO5nObDcxdJPZkiBsCOmddKXLxNn0Rfwl8wYDzNiubDIPZIgEilgT2fXe1/MJ5wCxVT978LMKlzeVvrQpcAKJUGeiEhYOSSOiCEvNAJPq7PpNNBSRuPeejAg58cSUJkYeaCfpUVAaq7OSGvNqVxZAS+AUrIJLL8JEMThrnVUDZNuYsvDxaxPR2Vi1xTIs+fR26YzCys6FpFnEFvhXbdSoBuzIcGIc7Lgu2Kwz5renC1qlYIFQxHk+ELYjDrWeR8GY9rZQTKxip0ImVMMF4BB5WRNkcUmv6Iyl6bVOFLvIA2dzVOEeszTjVUBMmTRGBxLcaV5WAf+bNN2o/b7pMXZye6V2U0275o2DS2G0gzgPlihhaHN2r0AK7wbpheUNBcpyElvj0MVrchHGIpA/ii8IijOcUzmjkmIQSNAiS4MBGHue8Clrq/o9pHITTcoclQh4XKlys7B7jKmzSG1ougaF9eX0cBIz37fWecFAnRl5ZTVpLRv1sxfvpXbTT3EXg49vQQY/WllwZFtD0+bAvm3fc2SeXCEyr4XlxpHVpN+K1D3yhbAmO9z/uUKkU4fWUvWFL9tzLHCwoSAFZPACc7vzTBqJxwponEL4WGwy+Zh3Q+owF95v/jPjxCtwfpZehJbo5UxvBdAYd8Uz5VTT/B4drR82vOR5JOhdVL8jfh166A0TutXS2gpWRWNatQm170HbHmuvbMU+yoaPZwJOHSrdS8+2zdTPiSxhlWmic0kNcN47yY5WlA5Xw0UlQ34rxWUYFNsffVqRp6863XvnAA3joA5w1Mv/3BocF75wBhkFI01N+CyAuL4MlGLR289G331eFv3ul6fjaPULuBYQhPSr6ZhVyV5dTmq5yvKFIwsFWf3KWQevKVzT63ozszA28ryC73n6ocefEGcpHkd4eeBuKnzgTITfg8cZy25K51aiG6IH57aRnCkyuXCfzgU6HmsrXvRVMmfI X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5722 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: VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5ee75ce6-4dc3-4785-7118-08d8c120ec22 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kVVWAaUGW5zo/5nDQuMnpsdsJmrPuq54Ff+LaShopvCEnvdkNBGirB+X0vQi6hpjGn2vx8c8o/G4eb051Hg4Hywx2S4JzWtGW63tf+zRkhTLVnjwR6c0u+2cNs6SzohWyJI1l3aJj31EkTygKewgtn/Dv5Tjxx3pSqCFcvl6FpCOpXarMLf3f3z4BAdlxUMtx6oHK67qoZ/3NnwAwocOOOHayUAfNqlobG1ZYe6Yo/8l2gq8gU0pqlDxZArE1sMLb4wRj7sTXaQhs8B54zh+SwC67O3K3Fjvbc8hEg3ghgxm5DTppEW7TTZd+BaqEyyIbTObiqIFjwF2Dh77/83ZA3pGuHhwXY6OfRj6YH0/xn4j3crpEqDIkvcqUX6cF/ChFCfUh8U4z2S27GvTWVmn1pWpS8k0O9R4K07jF91X5tSl2oKC4tuTt7na46jhT4vZk+gvFj7Yv6hupXxgtYTlYduXSmTrhxUfkQgOessgKegiBAh98flQDDqxuKhj4nL3 X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(46966006)(47076005)(316002)(6666004)(336012)(956004)(6486002)(26005)(2616005)(8936002)(478600001)(5660300002)(83380400001)(36756003)(70586007)(6506007)(69590400011)(70206006)(44832011)(82310400003)(8676002)(186003)(16526019)(6916009)(81166007)(2906002)(82740400003)(86362001)(6512007)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 11:04:08.8483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31919887-dd71-4099-47fc-08d8c120f06d 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: VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2502 X-Spam-Status: No, score=-14.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: , 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" Some IFUNC variants are not compatible with BTI and MTE so don't set them as usable for testing and benchmarking on a BTI or MTE enabled system. As far as IFUNC selectors are concerned a system is BTI enabled if the cpu supports it and glibc was built with BTI branch protection. Most IFUNC variants are BTI compatible, but thunderx2 memcpy and memmove use a jump table with indirect jump, without a BTI j. Fixes bug 26818. --- sysdeps/aarch64/multiarch/ifunc-impl-list.c | 16 +++++++++------- sysdeps/aarch64/multiarch/init-arch.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sysdeps/aarch64/multiarch/ifunc-impl-list.c b/sysdeps/aarch64/multiarch/ifunc-impl-list.c index a69eae65f0..ce9e5e35bf 100644 --- a/sysdeps/aarch64/multiarch/ifunc-impl-list.c +++ b/sysdeps/aarch64/multiarch/ifunc-impl-list.c @@ -40,29 +40,31 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, /* Support sysdeps/aarch64/multiarch/memcpy.c and memmove.c. */ IFUNC_IMPL (i, name, memcpy, IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx) - IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx2) + IFUNC_IMPL_ADD (array, i, memcpy, !bti, __memcpy_thunderx2) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_falkor) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_simd) IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_generic)) IFUNC_IMPL (i, name, memmove, IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_thunderx) - IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_thunderx2) + IFUNC_IMPL_ADD (array, i, memmove, !bti, __memmove_thunderx2) IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_falkor) IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_simd) IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_generic)) IFUNC_IMPL (i, name, memset, /* Enable this on non-falkor processors too so that other cores can do a comparative analysis with __memset_generic. */ - IFUNC_IMPL_ADD (array, i, memset, (zva_size == 64), __memset_falkor) - IFUNC_IMPL_ADD (array, i, memset, (zva_size == 64), __memset_emag) - IFUNC_IMPL_ADD (array, i, memset, 1, __memset_kunpeng) + IFUNC_IMPL_ADD (array, i, memset, (zva_size == 64) && !mte, + __memset_falkor) + IFUNC_IMPL_ADD (array, i, memset, (zva_size == 64) && !mte, + __memset_emag) + IFUNC_IMPL_ADD (array, i, memset, !mte, __memset_kunpeng) IFUNC_IMPL_ADD (array, i, memset, 1, __memset_generic)) IFUNC_IMPL (i, name, memchr, - IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_nosimd) + IFUNC_IMPL_ADD (array, i, memchr, !mte, __memchr_nosimd) IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_generic)) IFUNC_IMPL (i, name, strlen, - IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_asimd) + IFUNC_IMPL_ADD (array, i, strlen, !mte, __strlen_asimd) IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_mte)) return i; diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h index fce260d168..a167699e74 100644 --- a/sysdeps/aarch64/multiarch/init-arch.h +++ b/sysdeps/aarch64/multiarch/init-arch.h @@ -30,5 +30,7 @@ GLRO(dl_aarch64_cpu_features).midr_el1; \ unsigned __attribute__((unused)) zva_size = \ GLRO(dl_aarch64_cpu_features).zva_size; \ + bool __attribute__((unused)) bti = \ + HAVE_AARCH64_BTI && GLRO(dl_aarch64_cpu_features).bti; \ bool __attribute__((unused)) mte = \ MTE_ENABLED ();