From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) by sourceware.org (Postfix) with ESMTPS id 684763890420 for ; Thu, 18 Feb 2021 13:50:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 684763890420 Received: from DU2PR04CA0153.eurprd04.prod.outlook.com (2603:10a6:10:2b0::8) by AM4PR08MB2755.eurprd08.prod.outlook.com (2603:10a6:205:a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38; Thu, 18 Feb 2021 13:50:46 +0000 Received: from DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b0:cafe::4e) by DU2PR04CA0153.outlook.office365.com (2603:10a6:10:2b0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 13:50:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=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 DB5EUR03FT027.mail.protection.outlook.com (10.152.20.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 13:50:45 +0000 Received: ("Tessian outbound 46f6cf9da5e8:v71"); Thu, 18 Feb 2021 13:50:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d63e60fd860451a2 X-CR-MTA-TID: 64aa7808 Received: from 61b0a0c67a4d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 278669BB-F7C3-4F70-A8B7-92E27D3A9C9F.1; Thu, 18 Feb 2021 13:50:39 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 61b0a0c67a4d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 18 Feb 2021 13:50:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RWdilpvInHGIDYUg+88p/1tHsTpHwzuulvKEFMhGa6d6LHD9TBafdR7nzcja05MbHkXsRjHTt6Y4yACfvcQzpeue0oKXjTko+M4dPJkTJiWE/eQ0wrbDNixK86KWGtY6j1KBwDIUvf2mqKqcZWpTZwDoE9SERWYDVyg6bppmEOgrJtJfW817UpS8UH8ZDJzaOQWa1rgK9+TyTm9CF2jywA+TJN0+5PZPooqJyxU2Pl3UC4KUvtzevwqryO62Io1i9rDRkePmORE5MfgtrbjDS+VXcsWs2/nIjfpHA7H2zPnd04PiH+bmzlAHth6GnMJo+FE1Ay85yuZ7LQVLFCmYHA== 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=FkTIQdvwKYg1SIZGIiVyQFFXS09ggsKL8TLDSzjtlGc=; b=jt9RzTvRQMFYHA/C5CbvJTumQ9GIia7b/bzApbtxwNUh5f93BFmdpLwCoMzNKhlja3ukRghiSvw38wFn1ZUIxI3rplTj3lf09Gh1gUuW5NYgCOUmhk/RHg7HNRPrmtP1HDQG2mYfgKT/zbO/bXBLm9O/fi7FLCZIlFZ7+Pg+4B3SNj28MS+zf4/memPNuaMns1OhX2F01neujfe1S9gWXHJxqrK0p+lwXM5F3HIa+c5cFiiAK/xKTiQonuHRxaon9cPZ53BSrIpJq/+1+TwZWNWp2F3Hc3vEZ1JtWWDzmJJruRRf6nQsOIDja64OwwSdDsgfOK4GKI671ObDuHt63Q== 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: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=arm.com; Received: from DBBPR08MB6313.eurprd08.prod.outlook.com (2603:10a6:10:202::19) by DB6PR0801MB1639.eurprd08.prod.outlook.com (2603:10a6:4:3b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 13:50:37 +0000 Received: from DBBPR08MB6313.eurprd08.prod.outlook.com ([fe80::1cf6:2c6c:4b7d:572a]) by DBBPR08MB6313.eurprd08.prod.outlook.com ([fe80::1cf6:2c6c:4b7d:572a%6]) with mapi id 15.20.3846.043; Thu, 18 Feb 2021 13:50:37 +0000 Date: Thu, 18 Feb 2021 13:50:35 +0000 From: Szabolcs Nagy To: Florian Weimer Cc: "H.J. Lu" , "Kirill A. Shutemov" , "Shanbhogue, Vedvyas" , "H.J. Lu via Libc-alpha" , Joseph Myers Subject: Re: [RFC] : An API for tagged address Message-ID: <20210218135035.GE12795@arm.com> References: <20210211173711.71736-1-hjl.tools@gmail.com> <877dndmxj3.fsf@oldenburg.str.redhat.com> <20210218132419.GD12795@arm.com> <874ki9mrn4.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <874ki9mrn4.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.50] X-ClientProxiedBy: LO4P123CA0069.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::20) To DBBPR08MB6313.eurprd08.prod.outlook.com (2603:10a6:10:202::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.50) by LO4P123CA0069.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38 via Frontend Transport; Thu, 18 Feb 2021 13:50:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 61be9652-bc17-467c-b2a4-08d8d4143100 X-MS-TrafficTypeDiagnostic: DB6PR0801MB1639:|AM4PR08MB2755: 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: OGZKx+NlGKc5qNUVkmsWphV+Qln7XthwuMBTK6TCXUIIYVk+qjfZf+CcxmJJ0snIxN4r+mZtZdG1rR3QiQEgrttxtrCJp5+aRE/B0Q5jhqhAbRzH+Hy7pDQ/JObpKjBGwzxATKMpOJLdo5rJZcSuy0qB8DMafcGA3i5qFnNGnlNUx4lR2JWw7zY6mKgFtNTOIoqEmqo/LeS3E0lv3LLeFhfmCN+tOT0MOpMB5G1AfYvmusHFxMW8l8IAPzItCiE+vV9rKr4tmemLYdxTrpeU90alXeJaBpFL9+4a5KbtEIpEj7P5SDSu9eEv0psEdeLfMHAZ85Mj/f78rWmaurucYBSg0qtbMjfupWZ8dj3qWmi3gW7qkuvYCVxJcetW8e1G1jSLErJAwIet01ECgcOUSFYuA2Ha6o7jDhGf559uwTHLLDz6U3HFJVsDf44Lhe9zG1d1rfZopznsFP0AUNk3tepVglRtwwMM18ix542rBYOrPHJTB73Gs6SzYDmyepR4bBGIVG1YUF+8o0Ag4oLHhg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB6313.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(39850400004)(136003)(376002)(396003)(26005)(5660300002)(52116002)(7696005)(8676002)(1076003)(44832011)(6916009)(478600001)(8936002)(83380400001)(186003)(8886007)(16526019)(54906003)(36756003)(316002)(66946007)(956004)(55016002)(86362001)(2616005)(33656002)(2906002)(66476007)(4326008)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?T2YvaHNPaTVLVWxwczMrMkJpSXdzbXAxYis4UTRWWm5YSzFsbERJWXBtRVUr?= =?utf-8?B?OVU4ckF5RkFYL3BsQ05samE3QlhZbWVuWXRqTHNMSnZRdVNpVUlmYXRWVHZQ?= =?utf-8?B?emhuRkF3SjJibjk2V3NCREJhOTNaQ1REZ3JEbXUxVXluNmhxOFlrempFZ3RG?= =?utf-8?B?NUF6Y1VBeEJiRkkxaHM0VklnUndwRXE2UGZSV2lOSUx6TVZnQVlpSTM4WGFK?= =?utf-8?B?RVJYSWVxZ1N2M0JBR2lBTDRYVFdBZDFGT2d6RThrM3hxemFzcXY5ZkdTOVhk?= =?utf-8?B?d3BUTm1pSGc0OGhEWkY3TXNqTmdneXptQlk4OW9QS0xFNlJGSGdEYzl3R24w?= =?utf-8?B?QlBUV2k5d3ZYSjBlRTU0TEE2OVF6UnM5K3Mrd1Q3Z0QvRVhVWjh5QTgxem9M?= =?utf-8?B?VlZ3dndvNXllQTZTUUtIYXk3Tk1sVXYyRURJZGx3VXFUK0xHcHdmOGRkT2E4?= =?utf-8?B?cmhhdDdJWGY5K21kOWFocTVCVDFGdlZ3RHJYUDB2Qi9kdlZzMjVsSTFiVzBr?= =?utf-8?B?THBWYmlTalBCRDNVblpwM2NvVExTZ2ZwWjAxSHlsUHgzQm53bFVLaFhnYmc4?= =?utf-8?B?cXZsRHJjcnlSM1pRckNuM2tqeU5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VGpkbzNGN3lKdlJvN0xDWkdNWk9kTGlHU25tMmNBcHdlVGpDd0dNTWxW?= =?utf-8?B?WUhuOHlrK1BOOTQ3MEd5dk5vcTdyZEI4TGVzZWlDZGVUb0JFNkl4SVRRODF2?= =?utf-8?B?Tm9INlZkNWU3U2ZiSmdMQWpLMnc0L3g3NmY1L3JqT2pLN01zbGQ2aEZaNzJw?= =?utf-8?B?Mm91a2FGK2RvVzhJbHpmOXQzZzI2cTlFNFRZS1hjYlBYVDBVeHVIVEZERk5a?= =?utf-8?Q?VsyUoC/2//QUpdu776kDRIKM1TCFAclvjc1w/+v?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1639 Original-Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5909c011-0473-43dc-831c-08d8d4142bf6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4FElO03Z9FvtRxjxP7FviMAXVfxoEiOAyYFYRekumqk9SZpvIOdWzrdYDH3LbEeyWxvUlUscs7Cwa+EKzGIZLUKDAN4BfBwPlVG34tm5Ek10NrENk7g5CZB8pyLxQx5os6RUEBG+KH7R088x1NVYyPowgV56xhTi0W7SqFD+X5LalMQbpjM4BuJXXsBvZ72sCBxIjdgxcb8rbYDNgmNrAi59jCiwSIw40/S9/EnOmYL3gHVK64CmNvxoyP8ScAsb+H9Jys8uRrNP+9ptWk3TNlzTJCElnrPr0RUD3+R67MK/nI8Sl+dc39NV9TGjKXRgIVOWg/g5Q/ER+bUI81vZK5ol7RMjgVQn5sJo0Nwb1TnF8FqzyNZ+6Q1otPhm7ucT06DrI6KqbwlTmvKS4NnzL94lAd6pAZ20JeIO3+eEwqiZLFtrCX9JHsfKBgqKaNJmZQITUoeaHzLfm7+WXgNysiFIc6xp9nTD9k7q2mV4p/TLBrbjkudDvhxY+5jdMqUG2e/FiuAqS9pFEh3VmL+sZLeTsBM9o3i4xJGChm9u4oqMUky0H1eoAsQvJt/YtomkVrIvEk6kjUZqgaCdbMH5NlYIx0mNh7hpUzL7vJPG9hNCL0qYG6fzkjNFjYDbv/GnmLeCULjWlPwT3QnTDCcq8R6wTBhFwEdpY2pR1+9nRx8= 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)(376002)(396003)(136003)(346002)(46966006)(36840700001)(33656002)(26005)(356005)(186003)(7696005)(44832011)(81166007)(82740400003)(82310400003)(55016002)(70586007)(83380400001)(4326008)(8936002)(70206006)(16526019)(336012)(47076005)(8676002)(5660300002)(316002)(36756003)(2906002)(1076003)(478600001)(8886007)(6862004)(36860700001)(107886003)(2616005)(956004)(54906003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 13:50:45.9418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 61be9652-bc17-467c-b2a4-08d8d4143100 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: DB5EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2755 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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-List-Received-Date: Thu, 18 Feb 2021 13:50:51 -0000 The 02/18/2021 14:28, Florian Weimer wrote: > * Szabolcs Nagy: > >> was called in a thread. It won't work when 2 threads have different address > >> masks. I think set_tagged_address_mask should be disallowed in child > >> threads and in parent thread when there are any active child threads. > > > > i think this is the wrong api. currently the libc should set > > things up early. api for user code is too late. > > > > user code does not know if it runs single threaded or not > > (although we have __libc_single_threaded now, i'm not sure if > > we can use that for this purpose) > > We could, but it's possible to launch threads from ELF constructors (and > I think some libraries do that). So you could avoid the call or > diagnose a failure if single-threaded, but the tagged address feature > wouldn't compose well. > > Some kernel interfaces have this problem (e.g., unshare), but they are > less general-purpose than tagged addresses. it is possible to have a prctl flag that requests the abi change for the entire process. (and then the kernel has to do the sync across threads.) the semantics is not entirely obvious wrt memory model if we want to do this for e.g. MTE tag checks, but for syscall abi it should be possible to define reasonably. e.g. a use-case for changing mte/tag abi settings for an entire process is a custom allocator that wants to use heap tagging. by the time it can call the prctl the process may be already multi-threaded. there is also a problem with coordination between concurrent callers. this is simple with the tagged address abi which is a 1 bit state and we can say that it always goes one way: no tag -> tag, but more complex state like mte checking mode or mte tag exclusion set, requires coordination, which tells me that there should be a single owner: the libc. but i don't know what requirements intel LAM has.