From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80042.outbound.protection.outlook.com [40.107.8.42]) by sourceware.org (Postfix) with ESMTPS id 1A3113857C66 for ; Thu, 18 Feb 2021 13:18:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1A3113857C66 Received: from AM5PR0202CA0019.eurprd02.prod.outlook.com (2603:10a6:203:69::29) by VI1PR08MB4573.eurprd08.prod.outlook.com (2603:10a6:803:e7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 13:18:05 +0000 Received: from VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:69:cafe::38) by AM5PR0202CA0019.outlook.office365.com (2603:10a6:203:69::29) 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:18: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=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 VE1EUR03FT004.mail.protection.outlook.com (10.152.18.106) 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:18:04 +0000 Received: ("Tessian outbound af2f2718b54d:v71"); Thu, 18 Feb 2021 13:18:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1a2075f89e2b4281 X-CR-MTA-TID: 64aa7808 Received: from 20c8e71b27eb.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2BB0660C-B5C1-49E8-A0F1-3CB56E14359F.1; Thu, 18 Feb 2021 13:17:58 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 20c8e71b27eb.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 18 Feb 2021 13:17:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UYJAkOJo/SLrERQWobsXyy4nWyoXiQsdHNyfVLTa2mdKaPmCwGYrdZlxJqbk+xtTRSwbuJb3240G/1lFrwpSGl3uwxb4NpRZmmtVne7M0FbTy+GGPFKWliNmM0glvsxMn0ILxDRo8HlTfkXZPsjBAGAq2eI8ncHU2hjyBmGGYUVeLP9cm8sH2dJTi06SXN+o0pluSMCYyRgfrxozJM3RwVtwTyNUYuO8bkOnzq8oaVZivUW3NA8X20qE5LGiTqCcANYddMsC30t6eQrf0y5HQC7GH99LJ8diM66rp471U6AUKA5c9NuvJj4rCNkDJNGbxCRY6rN0a23MKErzZ5TO9g== 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=acwrq5aBiNUd6DyeyR6Ji90MQxWzVJwvTIVrv2LKloc=; b=JWZI4M5ddU0emESJWi+HHmxAA+G7ChPZh/MXoMRMBdf+aaRlC7vZYBtNCmKb/60pThw4pE39vzFkIXmpivdJ/zr1bMV0Xppa1rRGGkJwfg5q5hDiI8dmRryvEA/nznNzH4Tt6D8YpqsrCFVYJG4zfSxA04XHo48+72ZNuHorclp7J5KqxVdacfosFQFLwEZAv73jNUB/SKXVUhWgFCRvIF3JOX8YfbHkZyHB23doNlFY9os0fmUGxQDIqHSg4DJEpMDYo2AGqr9+vD1Ibk1ptqiLwLC3KU/vF6tjC5W3DNIikDKU5Zn5GNdMMmdQlzs2CyPSBiPUocuyfo61Big0RQ== 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: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; Received: from DBBPR08MB6313.eurprd08.prod.outlook.com (2603:10a6:10:202::19) by DB9PR08MB6411.eurprd08.prod.outlook.com (2603:10a6:10:261::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 13:17:56 +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:17:56 +0000 Date: Thu, 18 Feb 2021 13:17:53 +0000 From: Szabolcs Nagy To: "H.J. Lu" Cc: Florian Weimer , "H.J. Lu via Libc-alpha" , Joseph Myers Subject: Re: [RFC] : An API for tagged address Message-ID: <20210218131751.GC12795@arm.com> References: <20210211173711.71736-1-hjl.tools@gmail.com> <877dndmxj3.fsf@oldenburg.str.redhat.com> 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.50] X-ClientProxiedBy: LO2P265CA0124.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::16) 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 LO2P265CA0124.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.35 via Frontend Transport; Thu, 18 Feb 2021 13:17:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fc7e6258-ca41-45d2-a8e0-08d8d40fa007 X-MS-TrafficTypeDiagnostic: DB9PR08MB6411:|VI1PR08MB4573: 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: ybfnpABYeKWNdii1ufVXnyqZywc5a4DShICwgAam+O5de24L+fJCTk3AjOQ9U2S/hKcoRj/KoOBBZe1AKQTikGbBJuTJF/zn0OcAcOJ5voD2p+ElHajIB/hKcs1t/KbdZPXZa5CXS46GJwlm3YN6LQpOQnMQskW8a5G9q/1nP6EKh910xxmASvY0/6l21FGxCLtYBYr2YgUfnkYu5NYKhjk4gpbD0dRpuLlw6JcrXV+XilcdmRMp2+nc1PhdU6zZARwNXwppdRURk9JRzIGdk53ukdkupIlObEVIEODyhA0QXsNzfzVn2MMHgTKaJcU2Yb6GNK700j7O9r6GCl7txHMvorEY8jIcFJL6py9KFxxCkLv9izhQN21QIteOeXX1LQATPHh84Vxhql4XISYIGvkFlmieKL49r7DlgzTqAP5SokPdIEQy5CXWkO4wah7AuSGZ5ft9hxuuXQHovzx5Vo0w/4lpu+71q7pto//361e7PZ5ALXqpJTf0pR9BUTWP2YAl0hp9WbHoEvPltJsbp3KdWBooNfszXWuPj1fp3Xx0n11EEHuh+03rPUMewh2WX8UWhcVD6A2+oeKL08xkyB/0frkte3/1JCIuqL9SVfI= 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)(39850400004)(396003)(376002)(366004)(346002)(136003)(44832011)(52116002)(7696005)(66476007)(2616005)(86362001)(66946007)(316002)(55016002)(66556008)(966005)(956004)(4326008)(26005)(8886007)(1076003)(16526019)(186003)(8676002)(16799955002)(5660300002)(83380400001)(6916009)(478600001)(2906002)(8936002)(53546011)(36756003)(33656002)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?QTQ2by85eThLRDVWUTFPV29weWxnZXhJM2pGbnRkdS9zd2dSY3hJTW0wSytv?= =?utf-8?B?ZjNKRkZtTHlpKzUxSkVRWko5ZGphVFdPRFV6b1poS2laQ2t2ZVN0aWRNMVJC?= =?utf-8?B?bk5LK1ZNTG5JSC8zdk5WSXFidnE3am54RE5kaDRTQzBCdmlTNTlwTE10WGF0?= =?utf-8?B?WjNSWktoWUdQSTlQbkxEWkM5OWhjTzFabXJhbldJWU5kSG9zVlhucnliNXIy?= =?utf-8?B?bzhUdHcvcDRFeTNmejZWRm91VitxY0NTNXg2NUlZVnlyay9URzBFT3UySE8r?= =?utf-8?B?VUZTS0tkN3dmbDA5MnF1a0dCNitvN29JR1dHY05ML21PbUpVVEhRK1NZZGF6?= =?utf-8?B?MzUvUy9ZR0EzWG9PS0hBTlZEL3h3cFJFR2l6ckZJdVF1Sng1ZHVENTlnVVJB?= =?utf-8?B?OG5IWE9UMEVpYkJmaWl3ZEdnUjRWbmxoYlRxSVduWVBVbk91NDRMN0ZGWkk0?= =?utf-8?B?UTNBdnZHVm9scWY5SGFYTHJDMjFMNjVWVkt2TmpjRkZsMW9ydjIvcHluV0R6?= =?utf-8?B?MFRQUFpSWFNrT1JvK3Y2NmtNNnVZeHRtVitNSG1SVWpUTUlyQ1lnQzNaTFRq?= =?utf-8?B?YmJpeUJLVmZyTVl6STBKRmRyT3hoUjRxYUhKNU1wR1JWWnI2VTFxMk1Ub2lK?= =?utf-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5RWwx?= =?utf-8?B?dEtaQlZsNkgvMG1qaGVuaEZzclNWb2xjYUZISUx1R0tSQUZMWG1yUzQ1STUr?= =?utf-8?B?UmJXMWMxSkpkZ1RpQThIZDdyMWM2L1NiMDNhUkM2ZGVEd2toZFY0c3hhWEp5?= =?utf-8?B?aHQ5b1RZS0tBaXNCVldTMWpkdU1MQ1BQeXJQQm1DWkVRMlc0T0JuN0pudXB5?= =?utf-8?Q?SRfZ0/om00guGWJHxUGlOTLChOVSSwQny4XPlKd?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6411 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d6ba567d-17e0-4cac-3c17-08d8d40f9aca X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MUBcj07/H1iYtFCKUiTO0sShC1wTUgKoMs+8JRcGJcwnyw0nQQeThuSEXz2bZX4XxvdIE9DjGAia0SWuc3XmnEuRGbJ7Iqkmh79R4AmeXFkP5VkxI/bGIBhOVX4upYWsgv2wcFLJTAWx8M+aY+f+xvNqHgKVnxk/2aW8UOjIcNOHeJUWgD3/FJLT2pX+kWHnXG9O+EGvwhkAce11W+WQJttsN/5npjuxs5QSmoMIR8yffVjqZsujwwiqlgVCzRwq3CXu2ogITY3x/IJJeL5exVlDWx+ccy/0Onqcgv26oJefeK8FSVVHPe4/7XsBOaujgYh/8OpDFlSKf6yU9/xW5dWW3zNgCI24AHCBqNIG2MeAvF2NHSY5L5dvKEWg/PRi8/XxksFdJ+HrdHCCmnpmZWk2Skt8H6IfBRp1UtnhsptXVmT67DpoeQiiryXA7PSvV8FOIwFS4GdQoLn7fKKlrvYcLdCikjlzRGHn2tXaGHnytKlyf8Z3nOaAorAX5w1cstagzxcJ9AFGO2Pm3+e8tVZoxmGdbyJK0GcqLhb4v97zW4pTNRnGR+rcoBGCjLilOkgZCzUACNAnfGr8uZc1xNA7x4+Q9TtpWovfupoqfz9uSbhVb0WVuWypP5N9eRV+WlX5evhDF0n6DbBMaTpLCbZQkDnDE/kJMVatDs/1C/oJltQnzqu63T8Ec44ALCVbd7myfP/bMzxDsT3aPzynMpfDKUs03ZayWhAvbS2gl4Q= 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)(136003)(376002)(39850400004)(396003)(46966006)(36840700001)(33656002)(336012)(956004)(8886007)(186003)(8676002)(26005)(2616005)(1076003)(83380400001)(70206006)(2906002)(53546011)(54906003)(16526019)(8936002)(82310400003)(5660300002)(478600001)(6862004)(7696005)(36756003)(82740400003)(81166007)(36860700001)(44832011)(16799955002)(4326008)(86362001)(316002)(966005)(47076005)(70586007)(55016002)(107886003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 13:18:04.5730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc7e6258-ca41-45d2-a8e0-08d8d40fa007 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: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 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:18:15 -0000 The 02/12/2021 05:06, H.J. Lu via Libc-alpha wrote: > On Fri, Feb 12, 2021 at 1:43 AM Florian Weimer wrote: > > * H. J. Lu via Libc-alpha: > > > On Thu, Feb 11, 2021 at 12:28 PM Joseph Myers wrote: > > >> On Thu, 11 Feb 2021, H.J. Lu via Libc-alpha wrote: > > >> > > >> > An API for tagged address: > > >> > > >> Please write a longer commit message, discussing what "tagged address" is, > > >> which architectures have such a thing (the API should try to cover > > >> whatever is common between architectures as far as possible - is this > > >> meant to relate to AArch64 MTE, how does it relate to the MTE code we > > > > > > This API is for Intel LAM: > > > > > > https://www.phoronix.com/scan.php?page=news_item&px=Intel-LAM-Glibc#:~:text=Intel%20Linear%20Address%20Masking%20(LAM,bit%20linear%20addresses%20for%20metadata.&text=With%20LAM%20enabled%2C%20the%20processor,linear%20address%20to%20access%20memory. > > > > > > and ARM TBI: > > > > > > https://en.wikichip.org/wiki/arm/tbi > > > > Do the setters/getters change process or thread properties? > > On x86-64, mask is stored in TCB. TCB will be updated. It applies > to all threads. > > > The interface assumes that the tag bits are uniform across pointer > > types. I think that's not true, at least from a historical perspective. > > This is true for LAM and TBI. on aarch64 TBI is always top byte (top 8bit). there are separate data access and instruction access TBI, but they are both on in linux userspace (there was an argument to only use data access TBI so pointer authentication can use extra 8 bits for code pointers, however the TBI setting is slow to context switch and we would need it to be per process if it's an opt-in feature. it's not clear if anything would break by disabling code address TBI, but for now we are stuck with the original ABI). when MTE is in use then 4bits (bit 56 .. 59) are used for memory tagging, the other 4bits (top 4 bits) are technically still available for application use. but i'm not yet sure if we want to expose that. (e.g. in case of a fault on a tagged address by default the tag is zeroed in siginfo.si_addr, but kept when SA_EXPOSE_TAGBITS is set, except with an MTE tag check fault the top 4 bits are never kept.) originally in the linux syscall abi tag bytes must be 0, so in libc calls the tag bytes must be 0 too: the architectural TBI only works for memory accesses. but userspace can opt-in to a tagged address abi that allows passing tagged addresses to the kernel. https://www.kernel.org/doc/Documentation/arm64/tagged-pointers.rst with the tagged address syscall abi tagged addresses are usable in practice (e.g. for HWASAN, but also needed for MTE). this abi is mostly backward compatible (i'm not sure if anything breaks if it's unconditionally on, invalid syscalls may no longer fail). https://www.kernel.org/doc/Documentation/arm64/tagged-address-abi.rst we want the libc to decide early about the tagged syscall abi, later there is no reliable way to do it for the entire process. for this we may need to mark binaries that use tags (such marking also tells us that the binary is not MTE compatible) unfortunately HWASAN does not use any marking. (lack of marking is an issue in other sanitizers too). currently the opt-in is done based on a tunable that requests heap tagging. > > > People complained that our protection key interfaces are too slow to be > > useful. Do we need to find a way to inline the tag/untag operations? > > > > The internal interface is inlined. We can also inline the public interface > if needed. But set_tagged_address_mask isn't inlined at all. i'm not sure how the set_tagged_address_mask api would work.