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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D9FAD743D1 for ; Wed, 20 Nov 2024 20:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C0B96B00A2; Wed, 20 Nov 2024 15:02:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7708F6B00A4; Wed, 20 Nov 2024 15:02:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59DA46B00A5; Wed, 20 Nov 2024 15:02:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 38B646B00A2 for ; Wed, 20 Nov 2024 15:02:53 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B1AD4160AE6 for ; Wed, 20 Nov 2024 20:02:52 +0000 (UTC) X-FDA: 82807545408.05.1784C0F Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf03.hostedemail.com (Postfix) with ESMTP id ABE342000F for ; Wed, 20 Nov 2024 20:02:25 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=TRBGvpMc; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=dvn5ijSg; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1732132902; a=rsa-sha256; cv=pass; b=f1Gw6v+LaR9ZL9dKdY5EHG71bOedzlT/Nt9oUY2NgaT/7GbXIDcLbtRrhYhrnveFl782TW 1+4voXa3twMYh/WryOtLOl8OKvQk18sX09Wq4RWJb6kJRxQ/vm6rCaulv0/bNn18TLusqw KWFJe29neQWa1J1L4kO0YS6XmXNo7iM= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=TRBGvpMc; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=dvn5ijSg; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732132902; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iehF7aVHuFhGwwOfmnlff1amk5BcpMOLl7dNNiMhUJw=; b=yVspbeiaan9bSbLlBf8p52mJjORMlEz6Z6i01RKWIsimCxhHnqSw1XNekt1tDvrm0j+wDD UVpiHTTjnqppfyIr9zqtv4P5fXPE5/G38lDkf7ZkE0N4SUiE4hANwQEZP/dCqnp2GW8gNd f2F2guNZXNM1EjdHhD2NSj7nbcMMfm4= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AKFtZiH026627; Wed, 20 Nov 2024 20:02:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2023-11-20; bh=iehF7aVHuFhGwwOfmn lff1amk5BcpMOLl7dNNiMhUJw=; b=TRBGvpMcTZWo/3lpz4vglxxlGqVC22YbyX FVrZXyGGX4wzNByfSPnVMGtQdc6qLebwzT1KAXFUjlVI4y7X0vbizqkieF0eIFCS pmBodVVg+IYk4ZJNY1uArBrdoO8V4mkbKaSWuEZ+jvfeOuOMP6JpdyCe90IT+aXb RunVUcG0y2qDYVOHE4DS3/dMMVR++U7g1jKHTEjs7QZK7XrUhDXP3w0RtiLYmDQp 6A5CrSsyhXk3fp1bQZgHQQbuzPNAlSe2eMIsX36GCRHjy6RA46HMq7Rs4VbvIt/z x0NjxFt4yK4dHkxa2IykCTaf37rrO728fVN0vQJ/upGt6nRkrrRQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42xhtc8962-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Nov 2024 20:02:36 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AKJPj1X039203; Wed, 20 Nov 2024 20:02:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42xhuahm26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Nov 2024 20:02:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ySCx905e1XGZa7tvTu7jp0O3zoV13QaFK930JCni4try+GceEUfZ+GhehA6DmcQGdeT6d5MtA+m4lWAgfpur2c0VYL8726h/psWLJaampDRbJ/r61BHAMGVXvBbuO1Gkkb75Ja7rnSeBE+f60g72GZpCDnvt94FSUv2RkCF0A/yS/s/8sd3QDvhagKFN3UBLRSRIIbgivug81QUsW05fov4pQINbg5LLD/XtTyUIac9otEkshMmFzRsdJZDJxmhWN3YcYr2HpCgAwTfLXmKuZJA61OKCKwzI41NnuzyTefvK0Yv9wTJXNa/uswS1ml43+T6ryJMiNSlGcXiMymiCuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iehF7aVHuFhGwwOfmnlff1amk5BcpMOLl7dNNiMhUJw=; b=Hg8Q3SCP7ysGWeu9LLyEBUWkc3afEyW9nCLjWrbWZ3hUWCnv2ohH/mGB3jAah67BEYX1vdChKk1KWWNxX4DpBdOIlaFfHTHt17s72y7okAeKQCnpXPEBXRCFYfdGYDJjN2GmULJEpSQsdJ/RzEPj0InCLjNHEqowzmDkYzmNQIseEb6Q3Ppx2A5Tg1h3LvnLmlxhREp1Yiz/WszVCPzNCogBX7caiQfczRvWic2n7f2FD7xh/L8Buwmc+w08n2corc1TLQEsAPRq4JUqZWKlW6SLt6ANUEI032iOrE8t/BwsB86QFRTikuvOkLV71xWT8y6+5TawMoyogzpB3dQjGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iehF7aVHuFhGwwOfmnlff1amk5BcpMOLl7dNNiMhUJw=; b=dvn5ijSgXv4UOjYR1UlCl2hIfLZ+8xR22fQVFrL6O/QrL3lqY/W62CWmQfp/pcVWQwCD6A0Bwtrtlpt1RlFf1iU7sGcRCzyw8i04Fj0gY+KpuDzddczve/y6rGUOKb7cDFLwkHzht44HEK/JPtO4U3CeTMMKYmUZ68yAwzxLEDo= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by CH2PR10MB4167.namprd10.prod.outlook.com (2603:10b6:610:ac::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.15; Wed, 20 Nov 2024 20:02:32 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%7]) with mapi id 15.20.8158.023; Wed, 20 Nov 2024 20:02:30 +0000 Date: Wed, 20 Nov 2024 20:02:28 +0000 From: Lorenzo Stoakes To: Alice Ryhl Cc: Miguel Ojeda , Matthew Wilcox , Vlastimil Babka , John Hubbard , "Liam R. Howlett" , Andrew Morton , Greg Kroah-Hartman , Arnd Bergmann , Christian Brauner , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, rust-for-linux@vger.kernel.org, Andreas Hindborg Subject: Re: [PATCH v8 6/7] mm: rust: add VmAreaNew Message-ID: <8755851f-de55-4411-9a8a-80ff69f35905@lucifer.local> References: <20241120-vma-v8-0-eb31425da66b@google.com> <20241120-vma-v8-6-eb31425da66b@google.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241120-vma-v8-6-eb31425da66b@google.com> X-ClientProxiedBy: LO4P265CA0091.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2bc::8) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|CH2PR10MB4167:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aa7be7d-899f-40e7-685a-08dd099e4406 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZUPvbDdmTFU+vvEVzbJ92BrQjcSHuECBOQ35CmXmz+l1IcuNzwry3PxiKXOa?= =?us-ascii?Q?dPDtiKA3hQxjGJX4q7dHrp17Rv2g8nZG5V8LwkelnCJwm/CECru4uTxoptwP?= =?us-ascii?Q?qXksrzN4pgqqYPOiHWbT2iXQH0p9UnCHBROKcSeMnWF9nJ0/hkG9A1M968Bp?= =?us-ascii?Q?6W7Ui894C/E4zYun59H3qWDoUaUyFfdT9KVpRzSd0CtuNRPxK+xoe4PQvr4C?= =?us-ascii?Q?3YJwBHn9pDBdFVDR299FTg0bmMxNGGHWTIQYyT0/djRsQ2frM4s+uAo//geT?= =?us-ascii?Q?wyDU2h2ukLMk0pMxlRd3NDXu/cG7YGCtPrCFzn6ejOp4vn/RiFKViAKGpvv/?= =?us-ascii?Q?F4KYyYf/IiyU04qU6p/Rv0OVJ5L/rQ8m83JYAe/GCJ4D9+qSNp3yLZM0c4zN?= =?us-ascii?Q?4oT6aLRfk5q++UreNV+wAnJIvrpmPWLGax6dFxL8SshI5x/sHRRDAOOISq5c?= =?us-ascii?Q?LGhBqTSDVXF1Nqe4AIncvQXPMIixOqbtsd5j17FiOIU0gU0XbnGpP3ADXMqg?= =?us-ascii?Q?HzT13silnQEMds2LyhlVyQZ3/V2aZZdHh7/6X4bsVfgx4ZOgERguyLu3l1Lb?= =?us-ascii?Q?hwV4m6+0mmVELyx7+sGEIby2tY/z8QEPv6wFoBWCObfN7i43s95zA8YF1Wc5?= =?us-ascii?Q?feomlGSuSw/Db562by/lxwPi0jiRYYUcfbKnMxMJRROpE9KgB4QbWMs62KCs?= =?us-ascii?Q?AEnVUNsWul6vCbikye038haOS1qMuQ9t4RyeF8n+metuGXakw/JDf7gTJ0te?= =?us-ascii?Q?2yF0Fc8izy9sMM7BtEz6V9SwnnvAQcYY7wIKr03dO8dt3eOt/F0JUrhxQbzr?= =?us-ascii?Q?95xImkUy5xYwKdQTI4KhDZAWgxm0SWxK4nF0QVAo9kITlSMSu/bJeDXmvdVv?= =?us-ascii?Q?m/3OEkBnpkRQgYJBjNqcNEYI4xgd1xjXtvw6JNLPEVSfBxR0FhoP4nN+BLJ/?= =?us-ascii?Q?jLjKszV85wWaYScfHcJRmnOXqePzZyv7OBic7pEUgzENpJNNtLMqV1Eye79S?= =?us-ascii?Q?ed/6IvQVydocyrhHA3oTHGQ3KVdL1T5Fj+wxT7CyEAIkB4eLXJGUs96MIcxG?= =?us-ascii?Q?V5AmREEHLIghWNnLF3+i+h3onYwhmo7cwqQdJHf/E3262XYOJlVP8yMsGCjK?= =?us-ascii?Q?ySdIGXkmfChiL53NSXIRdT9Ikg6V2EbwFLzp1CSNeU4vnfKGZ0z3aDuVnwvY?= =?us-ascii?Q?ulLMmL2y9/1lJxoGW93y6/pLn8HIxkqqXa90DRGslXZZzDC6j/Cf5rjR0HxT?= =?us-ascii?Q?L/hGRYI2xCaYqWrCRpoQY9e+Z5M0LWv0u33wpIVhG3u4iBhmXAtX4V7TgzMd?= =?us-ascii?Q?YSqvMv0wvhLrYx5xdoP7WaQz?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cpoQ3R2MEgElP5UygkH1EA+ras2P69qIB5d4MbxKQtrn+tKAw2zL5C2IE7G5?= =?us-ascii?Q?0L8mjmpz6yKoWT5DqFE1PuZgkH1bqmcyHPpj9ZqiwB1fia9kuIdF6y9JHicZ?= =?us-ascii?Q?JxH7Ay/AUsSuaDmqMXsz0YoSRed3b3qnqt8lemf7XGFJI700MJe2Fp7l2/Yx?= =?us-ascii?Q?6LxJ1pPDuXvfRSsy8JmDY/p+hN40oQ8kVTtjoX84jF5hnZkvFpyhM4AMBUuu?= =?us-ascii?Q?prLvXm19a9No7Ovi83A1tg9PXXEvvWKj/+MYDpe3DduONHw/mizQpat3t6ge?= =?us-ascii?Q?rDmwiL2y31nEGUk25QEU8/xt3IVMPTm3QMNBs2SQv4yjfPsPye7yOiI78PEr?= =?us-ascii?Q?PRY7ncqI8pABzyzXxEUyA140jrJp1XqV0JJDlehtV24ug1pp99OGm9AU/Po2?= =?us-ascii?Q?jImnWzYmjuEoIq4cub6chz6JiJrlgaz9MSnghK1Jg/7fd+dNEcFhZOLT27/H?= =?us-ascii?Q?xHM1NCU12YnENYeBX04WRNzInd37H8Q9C/N88IJReu9Bw3jt23W+9qhUUeaJ?= =?us-ascii?Q?60rPNI2nvfEJ19R85sQ3Jqt8+qpotVCbQV2oRLf9NwApBs401EPn6Q9/3P6t?= =?us-ascii?Q?R+vCYt/NFsLGvO2/r3RnTfx+b1sPths+M/S37RUiFK/PzA5UcUUPeAJadHwU?= =?us-ascii?Q?Hgnc7XbGuZdd4uuiWDFPD6CqpVKB/5pi0lOEF7ptXpBMJmbln0tOjK6yuOyv?= =?us-ascii?Q?NKKPzWgH56WFjZufMjYg1JbtSYr6zsRdrKfAmaQhsywKUI5qMxCosw5WTWgz?= =?us-ascii?Q?CZH9LOilQNdKcDZIqsFd2eswX8WqJ+zRcl8Os9OG6f7D5kzm/NaXJpICgT8t?= =?us-ascii?Q?nnptwSfa8Yknxysz24raTvKdpzWAAu/IXjz9RAWumisCIbbLzPvtfMMeUqWn?= =?us-ascii?Q?79rF0XR6pk3dWUUh44dAZ90TmdRexaI1xhDZXsxdn8o02wnAx1cFo5ddiIwJ?= =?us-ascii?Q?V1oguIbbV3B1JUtU5beJaAIiLKh6EHNxLoMGuFkoxPEmi7/7OvzGzEAi+Lkl?= =?us-ascii?Q?PgujTNcyJH+dUFj3NsOrHUfT0TOGQDuEN6A7FyP76JEVgV3BzKgrbdmnicYR?= =?us-ascii?Q?qSyLzh/O0yvSFxW+APruKHSFsxAYvgzgrdZC2GyvWZ5d6xih4acKUxY/bKRS?= =?us-ascii?Q?8nrsMdebsg0pFyo42In+lBaikW9z09jfAsVsm6HnCIecQV36Gq5RigcshpM6?= =?us-ascii?Q?Y7ADSatbsDVX9CHZC+/ozN+cp+1Xx0J+e+U3VwFiJdjBosX59TR58jG626aP?= =?us-ascii?Q?ULjGN463Qkyzo5bfm8zTQ9lTtiwi/ZYGzpP3Kqo5TRHMIP1LKjXtO1A1M/1s?= =?us-ascii?Q?XBV8vByVuRZaiE+lpuaWEQ0KGd8dJBnLwh9IbpFHr3tXEmifjEsoP5DuG2Ux?= =?us-ascii?Q?O45Dm4c562w/zLxpnvQXpPZkvv4oD0u8oE4I4y2yn/OTlkqrWNFoTm8f+Qqs?= =?us-ascii?Q?Q6i1JBm+2YFs5HMSWehJ4IiOMthyejui5oL8f/KDRT0x6JNaisM091+sgjRs?= =?us-ascii?Q?6kQcCmaBaS2gOxkqvjuM7hBQk0H/wNROoql711oSLtsI9RSsh2kDhJWNSRJe?= =?us-ascii?Q?T422BtMpL/FIQjRDXlgpgzGcCX64EGhP0uX/z/Pk8x8hRT1HgiXfmXme9EfD?= =?us-ascii?Q?zw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ZmpA385fikNT6QxN+f5mbrDElFjYZIQAZmP0KIsTEeknJOZyWRWME/5f2rY9pqJNLWEXZMouaAQFdiIvFdN9WNoIB4y1p423JY5NVJroy4ORAdrtp3BnXLDGObPyXwGaiHImNSzV6s5EfYI69usIqX0zNqDZzEMx7DvGApTxrhMrmtmpdIDgE98WvElJXM+6Shho1ANqfbI8T2ryr01OU94JpD/y55vQrgbqO75kvnzhhDjqaw2sKJR7m9g/Gytp13IY0GRS7Wa05+76RypvcHaydELwecx7fuSu4+g/nQQAPmjCU+Nxh2d37L/nEIhjgzEHcxR6Qmg2ovbzV+1yrfPhFjNnVfVMwvPdub+SKLcPj1uYrd7dvFJA6UGdgYs+qh8o1Zxn3apweE5fQmZIkqVxsfRJGgsArA7tunfO4gTkWHMCUsWp36h85ly5zHjYBqsCOLcXm2Y1lTAA1W5ixSXvwAfde+pahh3LUs0KLP7T1gTGRk3qVBTqcS95vx3QL1Rni/lEzjH6gp8SLf0LV62NDm16WaIUXfAZesicxXTfV1ypfs62dl2KRx+pPm2NjoOGzqKHQnpFf06Kis5kjyG2bQzSbsWP2wQCHKIxmOo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0aa7be7d-899f-40e7-685a-08dd099e4406 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2024 20:02:30.8602 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j+EtmhO3mpsCHk5Um9Pf6jXsh1+pWoS8XHbrE/ad8RJJz5TwiHiyd0YccEziLdmLJkyCjWzqa8OhuSNqi1XX96Tk8YP4NNJwUd0cA/e7xdM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-20_17,2024-11-20_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411200140 X-Proofpoint-GUID: L67w1R5WkClqdY5sPzXSoqFsJpt79Cdh X-Proofpoint-ORIG-GUID: L67w1R5WkClqdY5sPzXSoqFsJpt79Cdh X-Rspam-User: X-Rspamd-Queue-Id: ABE342000F X-Rspamd-Server: rspam01 X-Stat-Signature: otxnt754f7yatkrfm1ntc1rxbr4qbnxn X-HE-Tag: 1732132945-763956 X-HE-Meta: U2FsdGVkX1/Vjizx98iUnHadzJqUMhYzUEKcmRmL95N8kaDeK7baEZz0yNu0PZmPqXPT1I9yUNDCyDZJQkpKzzgd6ayd37Ha0gn7TFXNFcx+Ve0HN5dxynS7e8Ud22MdFPXojK0e0tk9pvaI/jlBH7JNYonUi00CgtaZrjx6aXVu+ZH8f6gY8+Q+aogG1X2jxm4n9RMWH5poUOuxs7fltUIIbm3D+oud3J6rC4gJy+U3oZul26Nvurb7k5/dBMK+cQy6ugLZco+5Lb2MiPmJg7O21Rj+ypLKvBE9HGmQlAQHx0kExcKSRQgwAWYxrjlRjcnugMrXyEmXlu5eLTq2Qp69BDjCRpZ9l3l+9/OflCzGqhpjyBmkl/4OzE58LQTJorg5M7xBP0bEizev/tXj39ZQPYz0yUyKZKfP353POZjTq05ZgpeGvffVSlpQhDdMravgUSbwnRYpzw+vawX/4SQQM2+K/uA4UaiCDXz6I+uywb2X3IFfigI5IA0cnL53C3yj8pKgKpkxi4s74hyYaDk+qsI+g3PKskb1S39h1DxYVRjlXoqz4i1pD65RF/dVn9ktiHb+rHUlGPXsoosk7l4c+nNUxH1IRv3croH1YpPt5tvh3a0uYD/zcxMD/wkjFu3zh50LC0Z2ax4jFLOTYCAE5QAPzv74pZlKFgglsUTTm39UPy0lflkG7Y/cNuMYEJYt/aAQaBDX6sXU6GgGLhk1JUwHYbofCTbhi3GA8npbhm+bj1CWh6s/HCAUMlfx5JpIdhMgjswW+xyKWX0ovhZldh8rUVnMPXiVMEF3UD8XHtN5Kq3XwxsVUo5QhlHKDSF/laRwjbX/LR60J/P851tRgS66Gbw2bch/7Ym6UfQ6Qpu2dmpud9yV8fETmx4HXoQl5B9/tkZpIzCHALqPCqP7hydUmQOCU5SLj28r10Q8xkHXBGDbYLJLu3bIR2MvR+WObBeSbxTnGVqpn4K C1o2Mce9 hsaZID3lmYOZCUzhezgKf7sSOkx5acglZ41VJvbaBtJIxrpQ5lAdUB3rwlltRGB22IHk8s40+UxaYI64DOy+KFFFMZ67nlo4S6e0zQOOv8JDg/GDoFLNiUO9McmBeQ1vKTPV+A3aYwczvIoAJvUooWDJ76INorB/cBABFDchyKAeiBgnpDEK1Swk98lGZ6tmrJ/8zMsXI65JOOafffkJDPGR73ULD6SYqRrXCeZWRQte5ozeH8L0Px5vPge+v7vZvsquNXY4NZHOzoqw7uMABgvYtgOiSCKU5E+2pEMQfFCanrxrp9PN8aI5w7R0Ocwnzq/Li0HZJEGTndpX7qcMb9q3A6o7tHAguE2utyaCZ7dU9dWRO+/HVls11iig7xDrYY7wNjJogv+O9jRnLyqnRfdJ+j8PyqWexHa53LO9p8iDv4V5Nv7BzSgIwfwmNc6iH0Ll/85KCKMDILkSWbzRul1hajjusXMJz4Y4BvXs8u621uyF/lpAm2OElNng9ezUc/U1lqf91gT/aVj5K2bS/5OfNy/nK3qq8ye5BNTJA3m4x6VpBbcibK9qjjuh9shvCrLx6msv7t+9dOyjdaoE6h9dMjuSsvjm5sL8dj2DXRFsO8zMSH4V/6xIejNufWW0NQU8y X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Nov 20, 2024 at 02:50:00PM +0000, Alice Ryhl wrote: > When setting up a new vma in an mmap call, you have a bunch of extra > permissions that you normally don't have. This introduces a new > VmAreaNew type that is used for this case. Hm I'm confused by what you mean here. What permissions do you mean? Is this to abstract a VMA as passed by f_op->mmap()? I think it would be better to explicitly say this if so. > > To avoid setting invalid flag values, the methods for clearing > VM_MAYWRITE and similar involve a check of VM_WRITE, and return an error > if VM_WRITE is set. Trying to use `try_clear_maywrite` without checking > the return value results in a compilation error because the `Result` > type is marked #[must_use]. This is nice. Though note that, it is explicitly not permitted to permit writability for a VMA that previously had it disallowed, and we explicitly WARN_ON() this now. Concretely that means a VMA where !(vma->vm_flags & VM_MAYWRITE), you must not vma->vm_flags |= VM_MAYWRITE. > > For now, there's only a method for VM_MIXEDMAP and not VM_PFNMAP. When > we add a VM_PFNMAP method, we will need some way to prevent you from > setting both VM_MIXEDMAP and VM_PFNMAP on the same vma. Yes this would be unwise. An aside here - really you should _only_ change flags in this hook (perhaps of course also initialising vma->vm_private_data state), trying to change anything _core_ here would be deeply dangerous. We are far too permissive with this right now, and it's something we want to try ideally to limit in the future. > > Signed-off-by: Alice Ryhl > --- > rust/kernel/mm/virt.rs | 169 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 168 insertions(+), 1 deletion(-) > > diff --git a/rust/kernel/mm/virt.rs b/rust/kernel/mm/virt.rs > index de7f2338810a..22aff8e77854 100644 > --- a/rust/kernel/mm/virt.rs > +++ b/rust/kernel/mm/virt.rs > @@ -6,7 +6,7 @@ > > use crate::{ > bindings, > - error::{to_result, Result}, > + error::{code::EINVAL, to_result, Result}, > page::Page, > types::Opaque, > }; > @@ -148,6 +148,173 @@ pub fn vm_insert_page(&self, address: usize, page: &Page) -> Result { > } > } > > +/// A builder for setting up a vma in an `mmap` call. Would be better to explicitly reference the struct file_operations->mmap() hook and to say that we should only be updating flags and vm_private_data here (though perhaps not worth mentioning _that_ if not explicitly exposed by your interface). I'm guessing fields are, unless a setter/builder is established, immutable? > +/// > +/// # Invariants > +/// > +/// For the duration of 'a, the referenced vma must be undergoing initialization. > +pub struct VmAreaNew { > + vma: VmAreaRef, > +} > + > +// Make all `VmAreaRef` methods available on `VmAreaNew`. > +impl Deref for VmAreaNew { > + type Target = VmAreaRef; > + > + #[inline] > + fn deref(&self) -> &VmAreaRef { > + &self.vma > + } > +} > + > +impl VmAreaNew { > + /// Access a virtual memory area given a raw pointer. > + /// > + /// # Safety > + /// > + /// Callers must ensure that `vma` is undergoing initial vma setup for the duration of 'a. > + #[inline] > + pub unsafe fn from_raw<'a>(vma: *const bindings::vm_area_struct) -> &'a Self { > + // SAFETY: The caller ensures that the invariants are satisfied for the duration of 'a. > + unsafe { &*vma.cast() } > + } > + > + /// Internal method for updating the vma flags. > + /// > + /// # Safety > + /// > + /// This must not be used to set the flags to an invalid value. > + #[inline] > + unsafe fn update_flags(&self, set: vm_flags_t, unset: vm_flags_t) { > + let mut flags = self.flags(); > + flags |= set; > + flags &= !unset; > + > + // SAFETY: This is not a data race: the vma is undergoing initial setup, so it's not yet > + // shared. Additionally, `VmAreaNew` is `!Sync`, so it cannot be used to write in parallel. > + // The caller promises that this does not set the flags to an invalid value. > + unsafe { (*self.as_ptr()).__bindgen_anon_2.vm_flags = flags }; Hm not sure if this is correct. We explicitly maintain a union in struct vm_area_struct as: union { const vm_flags_t vm_flags; vm_flags_t __private __vm_flags; }; Where vma->vm_flags is const, and then use helpers like vm_flags_init() to set them, which also do things like assert locks (though not in the init case, of course). So erally we should at least be updating __vm_flags here, though I'm not sure how bindgen treats it? > + } > + > + /// Set the `VM_MIXEDMAP` flag on this vma. > + /// > + /// This enables the vma to contain both `struct page` and pure PFN pages. Returns a reference > + /// that can be used to call `vm_insert_page` on the vma. > + #[inline] > + pub fn set_mixedmap(&self) -> &VmAreaMixedMap { > + // SAFETY: We don't yet provide a way to set VM_PFNMAP, so this cannot put the flags in an > + // invalid state. > + unsafe { self.update_flags(flags::MIXEDMAP, 0) }; > + > + // SAFETY: We just set `VM_MIXEDMAP` on the vma. > + unsafe { VmAreaMixedMap::from_raw(self.vma.as_ptr()) } > + } > + > + /// Set the `VM_IO` flag on this vma. > + /// > + /// This marks the vma as being a memory-mapped I/O region. > + #[inline] > + pub fn set_io(&self) { > + // SAFETY: Setting the VM_IO flag is always okay. > + unsafe { self.update_flags(flags::IO, 0) }; > + } > + > + /// Set the `VM_DONTEXPAND` flag on this vma. > + /// > + /// This prevents the vma from being expanded with `mremap()`. > + #[inline] > + pub fn set_dontexpand(&self) { > + // SAFETY: Setting the VM_DONTEXPAND flag is always okay. > + unsafe { self.update_flags(flags::DONTEXPAND, 0) }; > + } > + > + /// Set the `VM_DONTCOPY` flag on this vma. > + /// > + /// This prevents the vma from being copied on fork. This option is only permanent if `VM_IO` > + /// is set. > + #[inline] > + pub fn set_dontcopy(&self) { > + // SAFETY: Setting the VM_DONTCOPY flag is always okay. > + unsafe { self.update_flags(flags::DONTCOPY, 0) }; > + } > + > + /// Set the `VM_DONTDUMP` flag on this vma. > + /// > + /// This prevents the vma from being included in core dumps. This option is only permanent if > + /// `VM_IO` is set. > + #[inline] > + pub fn set_dontdump(&self) { > + // SAFETY: Setting the VM_DONTDUMP flag is always okay. > + unsafe { self.update_flags(flags::DONTDUMP, 0) }; > + } > + > + /// Returns whether `VM_READ` is set. > + /// > + /// This flag indicates whether userspace is mapping this vma as readable. > + #[inline] > + pub fn get_read(&self) -> bool { > + (self.flags() & flags::READ) != 0 > + } > + > + /// Try to clear the `VM_MAYREAD` flag, failing if `VM_READ` is set. > + /// > + /// This flag indicates whether userspace is allowed to make this vma readable with > + /// `mprotect()`. > + #[inline] > + pub fn try_clear_mayread(&self) -> Result { > + if self.get_read() { > + return Err(EINVAL); > + } This is quite nice! Strong(er) typing for the win, again :>) > + // SAFETY: Clearing `VM_MAYREAD` is okay when `VM_READ` is not set. > + unsafe { self.update_flags(0, flags::MAYREAD) }; > + Ok(()) > + } > + > + /// Returns whether `VM_WRITE` is set. > + /// > + /// This flag indicates whether userspace is mapping this vma as writable. > + #[inline] > + pub fn get_write(&self) -> bool { > + (self.flags() & flags::WRITE) != 0 > + } > + > + /// Try to clear the `VM_MAYWRITE` flag, failing if `VM_WRITE` is set. > + /// > + /// This flag indicates whether userspace is allowed to make this vma writable with > + /// `mprotect()`. > + #[inline] > + pub fn try_clear_maywrite(&self) -> Result { > + if self.get_write() { > + return Err(EINVAL); > + } > + // SAFETY: Clearing `VM_MAYWRITE` is okay when `VM_WRITE` is not set. > + unsafe { self.update_flags(0, flags::MAYWRITE) }; > + Ok(()) > + } > + > + /// Returns whether `VM_EXEC` is set. > + /// > + /// This flag indicates whether userspace is mapping this vma as executable. > + #[inline] > + pub fn get_exec(&self) -> bool { > + (self.flags() & flags::EXEC) != 0 > + } > + > + /// Try to clear the `VM_MAYEXEC` flag, failing if `VM_EXEC` is set. > + /// > + /// This flag indicates whether userspace is allowed to make this vma executable with > + /// `mprotect()`. > + #[inline] > + pub fn try_clear_mayexec(&self) -> Result { > + if self.get_exec() { > + return Err(EINVAL); > + } > + // SAFETY: Clearing `VM_MAYEXEC` is okay when `VM_EXEC` is not set. > + unsafe { self.update_flags(0, flags::MAYEXEC) }; > + Ok(()) > + } > +} > + > /// The integer type used for vma flags. > #[doc(inline)] > pub use bindings::vm_flags_t; > > -- > 2.47.0.371.ga323438b13-goog >