From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB5BC43457 for ; Thu, 15 Oct 2020 11:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B07892075B for ; Thu, 15 Oct 2020 11:14:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="vpsjFyG1"; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="vpsjFyG1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbgJOLOt (ORCPT ); Thu, 15 Oct 2020 07:14:49 -0400 Received: from mail-eopbgr20074.outbound.protection.outlook.com ([40.107.2.74]:4481 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726987AbgJOLOs (ORCPT ); Thu, 15 Oct 2020 07:14:48 -0400 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=vpsjFyG1H2gNEPKuSdkIzlCxk95q9e9GSsRgHQ1nH2RfIENghHqhlVKJPSH7Hw3E4F4S2NPLVCQcMHZvK7LG5WbSA12OqlRLotZpaPEXHoKIroqFhYU3UOg422AITd8QRNuYyFgvkOKF7C4HUWG0CUryOAVFI+/ePXOXrOmFXbw= Received: from DB7PR03CA0087.eurprd03.prod.outlook.com (2603:10a6:10:72::28) by PA4PR08MB6013.eurprd08.prod.outlook.com (2603:10a6:102:eb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Thu, 15 Oct 2020 11:14:41 +0000 Received: from DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::4c) by DB7PR03CA0087.outlook.office365.com (2603:10a6:10:72::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:14:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; vger.kernel.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;vger.kernel.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 DB5EUR03FT006.mail.protection.outlook.com (10.152.20.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:14:41 +0000 Received: ("Tessian outbound 7c188528bfe0:v64"); Thu, 15 Oct 2020 11:14:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fc332f62fda21c8e X-CR-MTA-TID: 64aa7808 Received: from 8287c33b6d53.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FA1D8D6E-496F-4C48-9AB8-1B1F40713AC3.1; Thu, 15 Oct 2020 11:14:35 +0000 Received: from FRA01-PR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8287c33b6d53.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 15 Oct 2020 11:14:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MqySt0VdIDls9J3OxeFdqxkYVn5nBSjobXLBdASELCsUkK7z75352GMm57li/goUPF/xs2EFTuK47fHHZ2GWy71FCH1kN9xPNOm7xGTMwSuHaj6+e0jUibrNDxnsQbjIA6K1w8mAWsI2DD7h9QSORQByXyQ18cq2likwj5Kj2kCldt0uiR4v8P1A7EIf6bD2HBHPo/wxO4YqC/whC8EurtwUZLZt7V2Iu3SRKadVCw4XUAvLfC8Xn/BjY1zMtL6FDl+54Uv/s0167V29+I/D8kX8qWmfM9o96etcybZ+YG4THuWI/BytfOedjTXXHcvWdmF0og2cbxlvghhcShUplA== 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=cXdMU+kv0NH80NK3V50fgBTWiK6WomVjfrKGG93T21rKExe9RMRMJo0U6s1wv6MX0iyh9OjFGYIvMYZlVnL8nzhEdIgM9/ULnjhwMK1cNyVviUHvsIK7gZMLBv9VBqnX93JPyQ44idrepX057nSCPEu+UsMtMmsvLkRJQ+/SxstyHoyFYIeCqnYfZBove2p0Z8d1L5EOqaXccu0hWoTFT4ENg5OaCKzauuAR5Hxy41cOzLLtXmfD0y+XZxCdHqsRo4kfXXSILr3WXzBsljHwLXU5/KeRwjbm5svFWF7/I63l40Cf9aqIfwghLpWuDJHm5R5OlaDcHmdponKgqWxT6Q== 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=vpsjFyG1H2gNEPKuSdkIzlCxk95q9e9GSsRgHQ1nH2RfIENghHqhlVKJPSH7Hw3E4F4S2NPLVCQcMHZvK7LG5WbSA12OqlRLotZpaPEXHoKIroqFhYU3UOg422AITd8QRNuYyFgvkOKF7C4HUWG0CUryOAVFI+/ePXOXrOmFXbw= Authentication-Results-Original: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PR2PR08MB4809.eurprd08.prod.outlook.com (2603:10a6:101:1a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22; Thu, 15 Oct 2020 11:14:33 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::957e:c80e:98f4:23d6]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::957e:c80e:98f4:23d6%6]) with mapi id 15.20.3477.021; Thu, 15 Oct 2020 11:14:32 +0000 Date: Thu, 15 Oct 2020 12:14:30 +0100 From: Szabolcs Nagy To: Peter Collingbourne Cc: Will Deacon , Dave Martin , Catalin Marinas , linux-arch@vger.kernel.org, libc-alpha@sourceware.org, Andrey Konovalov , Kevin Brodsky , linux-mm@kvack.org, Andrew Morton , Vincenzo Frascino , Linux ARM , nd@arm.com Subject: Re: [PATCH v9 29/29] arm64: mte: Add Memory Tagging Extension documentation Message-ID: <20201015111429.GH3819@arm.com> References: <20200904103029.32083-1-catalin.marinas@arm.com> <20200904103029.32083-30-catalin.marinas@arm.com> <20200917081107.GA29031@willie-the-truck> <20200917090229.GA10662@gaia> <20200917161550.GA6642@arm.com> <20200918083046.GA30709@willie-the-truck> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::15) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.54) by LO2P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:14:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cf133ffb-f9a5-40cf-8291-08d870fb830f X-MS-TrafficTypeDiagnostic: PR2PR08MB4809:|PA4PR08MB6013: 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-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NX2AUxlMVd9jQRl2laYVGpDVKath54SGObtuRNWfOPgP3k+LDKnI8nnQyT9i+0e1W07uCz5puU0ANKljblOoDyNFy9uCqvw+de5Kg8tE8/h87I2P7VwhIxsnhwdNyr/73mG4ZQDJIPumSYV3qW7wZTaDLQv73KU2YTDYD5xuQ6iIlNjViOJvN7AYHGKDOAhEnh7Oe3bQQtbyrbVk8LAljuMJyE7bCZb3ID36VjCKbuNqgscjXhH9RC5YE81H4Kyy5lenhU06V9bFWahilnPXa/dT1opAp9ybNo8WsNB6Uoa1J4NjOrn7+cT8dBoMfZPX434CFAZggy3vbT0Wwd7NzTQ+Pn/5dzrKjg/zvt7sU6BV+2sSKYYI79rT6VftbxYbwZQ0bn3BqspaePnzBL69tXtXZY+7OrKfu9F6BFttfhk2I8huVzqLS0xa2+2a7FZI48FflPghABSjt9EwtrO5Hg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PR3PR08MB5564.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(366004)(396003)(376002)(346002)(36756003)(54906003)(55016002)(2616005)(316002)(83080400001)(66476007)(186003)(66556008)(66946007)(966005)(956004)(83380400001)(86362001)(16526019)(8886007)(34490700002)(33656002)(7696005)(8936002)(1076003)(4326008)(53546011)(478600001)(2906002)(8676002)(26005)(52116002)(5660300002)(44832011)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Udh2321Ap8jwL6VBn4sOtJy9q1/VXlpUvEnGGO5hwBoSm/wfayNxTz3b+HOohyuKay9CicOSqNDyoa9y4Y77vNwGbXVUvuptX1H9PT7ieRh9XPzU31BcBbqb0vVNfwRVlS7Crng2iFMyHtW/Kqs8hQD+YOi8WRilFpoxaqZqdu3CrKIKSsbMhkqsh1JFkog/eH72K7AFHrLadJ3NOhwoFZ5fWM4UzkUb0QorqFj59/Pra48+fkffNB2PsT9fkpe8ogRp/VXYlfC/FoYxrD4hcTR+1VF/0dR3T4txeh41uM6S5y31+hM0lBCd7/rirda3BifZHhoK1xne2oLDS/SdOvm3LwW3j0IA64LPGJIVSSyrumGE30IxJ3hODNL/aBzIRWPh36UHV8mcVZsrHoM7O4AuAoXaMqgVaG9+voDpTYOoLrC4l+cKgifpi04PGoEywG5uyuYSiJcMsrSEu4qBoQFzIMZUSTnYJx5amFSwP9Fkc64C3x1sTL4kTz/CW7XX1ND0oQgSDPeaI8LcAiEa0n0B445JeIyT8NGmR/Nr+O0LVTMLbJsB57vqw2XsrFeD+8jkGuXyd+bomkFMjgiK4d6uf2T0xdZwnpHE+XSj/3C6U3Ey2fCwpYN+5duBMFFjp2iq6FZRlTJGSkhqO8p5VA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4809 Original-Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9bfad322-18db-498a-9ba9-08d870fb7dfb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hvSLCHlIIQ3mE6Rf9zuqQhPp0L1cjvRjP9LPpygMQ7+mPHJDcWzPgJhoDt+IP7O+jYlnMpPBgsZlbhfluAhrQWW1n7n9UEPBju2tsj8sau26ViCWQf9YBmuo77P+q0byPMH+9tFr/MQTXYjAVzw7jyJq9WmJ7b4pVZ9ZPtjtAHY/sLDc2S2ymC6zZfZkx/x1VHKOHDh1FkcA0c2fQgIU2QddzD5XnpoXtjoHItZrRfdTUMrBYuR5X3zE/fgGiBUbNLt8HFX4slgAuSRrI3TRk0ITt7Z9RxvcSqcQavnPWfhn0YHc+NReel6hgxJRlSi0bTkNvGizbAxXw+0pLv55Ds1ARA6Zb47A1P3luk8Tnae6Wh6u+wRChwXubPUR7Hvn+50s6wC0CRS4kL0eiZf2bQMybzYRrlfcFxAArwaLNKvZnxqjk9dXrLESpSKTGQ8KVpPUli0k+LmMUXHKIIZI+9Q3ppBAzbY7d06LvH/Q9cI= 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)(346002)(376002)(136003)(39860400002)(396003)(46966005)(4326008)(81166007)(82740400003)(316002)(83080400001)(36756003)(83380400001)(966005)(54906003)(44832011)(7696005)(1076003)(336012)(47076004)(55016002)(86362001)(478600001)(356005)(82310400003)(5660300002)(8886007)(26005)(8676002)(70206006)(53546011)(70586007)(186003)(16526019)(956004)(2906002)(6862004)(8936002)(33656002)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 11:14:41.0789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf133ffb-f9a5-40cf-8291-08d870fb830f 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: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6013 Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org The 10/14/2020 16:43, Peter Collingbourne wrote: > On Fri, Sep 18, 2020 at 1:30 AM Will Deacon wrote: > > I think so, yes. I'm hoping to queue it for 5.10, once I have an Ack from > > the Android tools side on the per-thread ABI. > > Our main requirement on the Android side is to provide an API for > changing the tag checking mode in all threads in a process while > multiple threads are running. I think we've been able to accomplish > this [1] by using a libc private real-time signal which is sent to all > threads. The implementation has been tested on FVP via the included > unit tests. The code has also been tested on real hardware in a > multi-threaded app process (of course we don't have MTE-enabled > hardware, so the implementation was tested on hardware by hacking it > to disable the tagged address ABI instead of changing the tag checking > mode, and then verifying via ptrace(PTRACE_GETREGSET) that the tagged > address ABI was disabled in all threads). > > That being said, as with any code at the nexus of concurrency and > POSIX signals, the implementation is quite tricky so I would say it > falls more into the category of "no obvious problems" than "obviously > no problems". It also relies on changes to the implementations of > pthread APIs so it wouldn't catch threads created directly via clone() > rather than via pthread_create(). I think we would be able to ignore > such threads on Android without causing compatibility issues because > we can require the process to not create threads via clone() before > calling the function. I imagine this may not necessarily work for > other libcs like glibc, though, but as I understand it glibc has no > plan to offer such an API. no immediate plans. to make such api useful we would have to expose it to users (e.g. custom allocators) which is tricky. note that glibc has the necessary infrastructure to do the internal signaling, but it had issues in the past. i think it had problems with qemu-user and golang c ffi and libc internal issues around multi-threaded fork/vfork or simply stack overflow because of small thread stacks and growing signal frames that are more likely to hit at the wrong time if libc uses more internal signals. so i think such per process operation is easier to handle correctly in the kernel. doing this outside of the libc (e.g. in a custom allocator) is not possible (without relying on new libc apis) which i thought was a reasonable use-case, but likely glibc will enable sync tag checks early and leave it that way (the only tricky bit is to have an opt-in/-out mechanism for binaries that are not compatible with the tagged address abi and i don't know yet how that will work). > [1] https://android-review.googlesource.com/c/platform/bionic/+/1427377 btw in the bionic implementation there are writes to globals (g_tcf, g_arg, g_func) that are later read in signal handlers of other threads without atomics. i'm not sure if that's enough synchronization (can we assume that tgkill synchronizes with signal handlers?). From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D99D1C433DF for ; Thu, 15 Oct 2020 11:16:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 378472075B for ; Thu, 15 Oct 2020 11:16:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OIL/CBaJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="vpsjFyG1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="vpsjFyG1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 378472075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+6N3DCyOR7zblz1yZtlVGlGYlvAQoIvOH8U/ja1Bf+I=; b=OIL/CBaJZX1k5TXy5LfPVxhl2 sZeHcHCk6t2gWXHRuCR8YPqjrXBSg9LY5XZaS0oJyccviqy3obH0w/ClRzM4DK4nlWg7YOcU6XHMb Egk9etL7AZHdoWCHRbhfC/bOanDrHhKwpWIqO/+1gsiRUnXgxBcgnChRCBi60+YsudB/C/07Q2j6B rbw97GRdaXBJiVZAgLqmvgESWI8jkueEVAfBafrL28qbKbnSI9S0HL/qcpqaMaQMfiOBJ74kVZC14 3anjWjHGHoILhbR7w1tyePZlpq2B279w2hpgXenEPQSxDEGZZ+4FZfjkyVUjFbG0+lMY0EZijiNcX eeAv0lKZg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT1De-0008BS-G3; Thu, 15 Oct 2020 11:14:50 +0000 Received: from mail-eopbgr60071.outbound.protection.outlook.com ([40.107.6.71] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT1Da-0008AD-Se for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2020 11:14:48 +0000 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=vpsjFyG1H2gNEPKuSdkIzlCxk95q9e9GSsRgHQ1nH2RfIENghHqhlVKJPSH7Hw3E4F4S2NPLVCQcMHZvK7LG5WbSA12OqlRLotZpaPEXHoKIroqFhYU3UOg422AITd8QRNuYyFgvkOKF7C4HUWG0CUryOAVFI+/ePXOXrOmFXbw= Received: from DB6PR07CA0177.eurprd07.prod.outlook.com (2603:10a6:6:43::31) by DB6PR0801MB2104.eurprd08.prod.outlook.com (2603:10a6:4:76::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Thu, 15 Oct 2020 11:14:41 +0000 Received: from DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:43:cafe::93) by DB6PR07CA0177.outlook.office365.com (2603:10a6:6:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.11 via Frontend Transport; Thu, 15 Oct 2020 11:14:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.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 DB5EUR03FT036.mail.protection.outlook.com (10.152.20.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:14:41 +0000 Received: ("Tessian outbound 7c188528bfe0:v64"); Thu, 15 Oct 2020 11:14:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fc332f62fda21c8e X-CR-MTA-TID: 64aa7808 Received: from 8287c33b6d53.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FA1D8D6E-496F-4C48-9AB8-1B1F40713AC3.1; Thu, 15 Oct 2020 11:14:35 +0000 Received: from FRA01-PR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8287c33b6d53.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 15 Oct 2020 11:14:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MqySt0VdIDls9J3OxeFdqxkYVn5nBSjobXLBdASELCsUkK7z75352GMm57li/goUPF/xs2EFTuK47fHHZ2GWy71FCH1kN9xPNOm7xGTMwSuHaj6+e0jUibrNDxnsQbjIA6K1w8mAWsI2DD7h9QSORQByXyQ18cq2likwj5Kj2kCldt0uiR4v8P1A7EIf6bD2HBHPo/wxO4YqC/whC8EurtwUZLZt7V2Iu3SRKadVCw4XUAvLfC8Xn/BjY1zMtL6FDl+54Uv/s0167V29+I/D8kX8qWmfM9o96etcybZ+YG4THuWI/BytfOedjTXXHcvWdmF0og2cbxlvghhcShUplA== 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=cXdMU+kv0NH80NK3V50fgBTWiK6WomVjfrKGG93T21rKExe9RMRMJo0U6s1wv6MX0iyh9OjFGYIvMYZlVnL8nzhEdIgM9/ULnjhwMK1cNyVviUHvsIK7gZMLBv9VBqnX93JPyQ44idrepX057nSCPEu+UsMtMmsvLkRJQ+/SxstyHoyFYIeCqnYfZBove2p0Z8d1L5EOqaXccu0hWoTFT4ENg5OaCKzauuAR5Hxy41cOzLLtXmfD0y+XZxCdHqsRo4kfXXSILr3WXzBsljHwLXU5/KeRwjbm5svFWF7/I63l40Cf9aqIfwghLpWuDJHm5R5OlaDcHmdponKgqWxT6Q== 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=TuIOZqds7HVmTbwOkKNoCaPeCnxVgYGSP9f3kGwQKOk=; b=vpsjFyG1H2gNEPKuSdkIzlCxk95q9e9GSsRgHQ1nH2RfIENghHqhlVKJPSH7Hw3E4F4S2NPLVCQcMHZvK7LG5WbSA12OqlRLotZpaPEXHoKIroqFhYU3UOg422AITd8QRNuYyFgvkOKF7C4HUWG0CUryOAVFI+/ePXOXrOmFXbw= Authentication-Results-Original: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PR2PR08MB4809.eurprd08.prod.outlook.com (2603:10a6:101:1a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22; Thu, 15 Oct 2020 11:14:33 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::957e:c80e:98f4:23d6]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::957e:c80e:98f4:23d6%6]) with mapi id 15.20.3477.021; Thu, 15 Oct 2020 11:14:32 +0000 Date: Thu, 15 Oct 2020 12:14:30 +0100 From: Szabolcs Nagy To: Peter Collingbourne Subject: Re: [PATCH v9 29/29] arm64: mte: Add Memory Tagging Extension documentation Message-ID: <20201015111429.GH3819@arm.com> References: <20200904103029.32083-1-catalin.marinas@arm.com> <20200904103029.32083-30-catalin.marinas@arm.com> <20200917081107.GA29031@willie-the-truck> <20200917090229.GA10662@gaia> <20200917161550.GA6642@arm.com> <20200918083046.GA30709@willie-the-truck> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::15) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.54) by LO2P123CA0027.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:14:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 581d2d6f-adaa-489d-d47a-08d870fb8310 X-MS-TrafficTypeDiagnostic: PR2PR08MB4809:|DB6PR0801MB2104: 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-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NX2AUxlMVd9jQRl2laYVGpDVKath54SGObtuRNWfOPgP3k+LDKnI8nnQyT9i+0e1W07uCz5puU0ANKljblOoDyNFy9uCqvw+de5Kg8tE8/h87I2P7VwhIxsnhwdNyr/73mG4ZQDJIPumSYV3qW7wZTaDLQv73KU2YTDYD5xuQ6iIlNjViOJvN7AYHGKDOAhEnh7Oe3bQQtbyrbVk8LAljuMJyE7bCZb3ID36VjCKbuNqgscjXhH9RC5YE81H4Kyy5lenhU06V9bFWahilnPXa/dT1opAp9ybNo8WsNB6Uoa1J4NjOrn7+cT8dBoMfZPX434CFAZggy3vbT0Wwd7NzTQ+Pn/5dzrKjg/zvt7sU6BV+2sSKYYI79rT6VftbxYbwZQ0bn3BqspaePnzBL69tXtXZY+7OrKfu9F6BFttfhk2I8huVzqLS0xa2+2a7FZI48FflPghABSjt9EwtrO5Hg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(396003)(376002)(346002)(36756003)(54906003)(55016002)(2616005)(316002)(83080400001)(66476007)(186003)(66556008)(66946007)(966005)(956004)(83380400001)(86362001)(16526019)(8886007)(34490700002)(33656002)(7696005)(8936002)(1076003)(4326008)(53546011)(478600001)(2906002)(8676002)(26005)(52116002)(5660300002)(44832011)(6916009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Udh2321Ap8jwL6VBn4sOtJy9q1/VXlpUvEnGGO5hwBoSm/wfayNxTz3b+HOohyuKay9CicOSqNDyoa9y4Y77vNwGbXVUvuptX1H9PT7ieRh9XPzU31BcBbqb0vVNfwRVlS7Crng2iFMyHtW/Kqs8hQD+YOi8WRilFpoxaqZqdu3CrKIKSsbMhkqsh1JFkog/eH72K7AFHrLadJ3NOhwoFZ5fWM4UzkUb0QorqFj59/Pra48+fkffNB2PsT9fkpe8ogRp/VXYlfC/FoYxrD4hcTR+1VF/0dR3T4txeh41uM6S5y31+hM0lBCd7/rirda3BifZHhoK1xne2oLDS/SdOvm3LwW3j0IA64LPGJIVSSyrumGE30IxJ3hODNL/aBzIRWPh36UHV8mcVZsrHoM7O4AuAoXaMqgVaG9+voDpTYOoLrC4l+cKgifpi04PGoEywG5uyuYSiJcMsrSEu4qBoQFzIMZUSTnYJx5amFSwP9Fkc64C3x1sTL4kTz/CW7XX1ND0oQgSDPeaI8LcAiEa0n0B445JeIyT8NGmR/Nr+O0LVTMLbJsB57vqw2XsrFeD+8jkGuXyd+bomkFMjgiK4d6uf2T0xdZwnpHE+XSj/3C6U3Ey2fCwpYN+5duBMFFjp2iq6FZRlTJGSkhqO8p5VA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4809 Original-Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9bfad322-18db-498a-9ba9-08d870fb7dfb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +k/ONZgx7PxXbEIb9pBzH++CVcdCqNlK3A0xsxNY+vcedIlpqwpyb3eJuJVQza68YHzApFJw6B6gsdgoGS7yn3c0oN6I+wJFcO5dQUMWHo/H8Pa6whu9UlBhQMjrrzeoPE9Xt8XXO28vK2rPwmrk7bZ+zVUQ+6Ti5hRhlR3hExLXbS+jME0i+5DLyqSYhAIm6Y3M5zCWQusS6onj5W5fJUZr2mK+8NlGn/Uv09ZMpHgF53tUrt7eO0KRkPAGaf9Ys1liwMwh7Bsw9Ty/A945+VjUdwJXMrGUR6mn6tm5rFvClTgl2oYXFW+6B9NwGDZ9Ogl/NV3CdK55FR2rtbaOEm0fHSaR2UgG7b/LmiDGWsT9C+gSEvKCWmeHfdvp6hSbXByfsR+H/Bot3bvecOpg6Lu1d4etTPioYO8uTj3eUtarxURwl0MUl50kD8qR0jy+oKH4vh5WAI5UtW1HEX2CD95cjBqgmLe6sBK2HBAtolw= 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)(346002)(376002)(136003)(396003)(39860400002)(46966005)(82310400003)(2616005)(478600001)(956004)(54906003)(53546011)(5660300002)(55016002)(356005)(316002)(83080400001)(81166007)(47076004)(16526019)(86362001)(82740400003)(26005)(336012)(36756003)(7696005)(44832011)(83380400001)(186003)(966005)(4326008)(6862004)(33656002)(8676002)(8936002)(8886007)(2906002)(70586007)(70206006)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 11:14:41.0885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 581d2d6f-adaa-489d-d47a-08d870fb8310 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: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2104 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_071447_042666_52D22701 X-CRM114-Status: GOOD ( 24.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, nd@arm.com, libc-alpha@sourceware.org, Catalin Marinas , Kevin Brodsky , linux-mm@kvack.org, Andrey Konovalov , Andrew Morton , Vincenzo Frascino , Will Deacon , Dave Martin , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 10/14/2020 16:43, Peter Collingbourne wrote: > On Fri, Sep 18, 2020 at 1:30 AM Will Deacon wrote: > > I think so, yes. I'm hoping to queue it for 5.10, once I have an Ack from > > the Android tools side on the per-thread ABI. > > Our main requirement on the Android side is to provide an API for > changing the tag checking mode in all threads in a process while > multiple threads are running. I think we've been able to accomplish > this [1] by using a libc private real-time signal which is sent to all > threads. The implementation has been tested on FVP via the included > unit tests. The code has also been tested on real hardware in a > multi-threaded app process (of course we don't have MTE-enabled > hardware, so the implementation was tested on hardware by hacking it > to disable the tagged address ABI instead of changing the tag checking > mode, and then verifying via ptrace(PTRACE_GETREGSET) that the tagged > address ABI was disabled in all threads). > > That being said, as with any code at the nexus of concurrency and > POSIX signals, the implementation is quite tricky so I would say it > falls more into the category of "no obvious problems" than "obviously > no problems". It also relies on changes to the implementations of > pthread APIs so it wouldn't catch threads created directly via clone() > rather than via pthread_create(). I think we would be able to ignore > such threads on Android without causing compatibility issues because > we can require the process to not create threads via clone() before > calling the function. I imagine this may not necessarily work for > other libcs like glibc, though, but as I understand it glibc has no > plan to offer such an API. no immediate plans. to make such api useful we would have to expose it to users (e.g. custom allocators) which is tricky. note that glibc has the necessary infrastructure to do the internal signaling, but it had issues in the past. i think it had problems with qemu-user and golang c ffi and libc internal issues around multi-threaded fork/vfork or simply stack overflow because of small thread stacks and growing signal frames that are more likely to hit at the wrong time if libc uses more internal signals. so i think such per process operation is easier to handle correctly in the kernel. doing this outside of the libc (e.g. in a custom allocator) is not possible (without relying on new libc apis) which i thought was a reasonable use-case, but likely glibc will enable sync tag checks early and leave it that way (the only tricky bit is to have an opt-in/-out mechanism for binaries that are not compatible with the tagged address abi and i don't know yet how that will work). > [1] https://android-review.googlesource.com/c/platform/bionic/+/1427377 btw in the bionic implementation there are writes to globals (g_tcf, g_arg, g_func) that are later read in signal handlers of other threads without atomics. i'm not sure if that's enough synchronization (can we assume that tgkill synchronizes with signal handlers?). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel