From patchwork Tue Jun 25 19:11:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13711863 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 E7B0BC2BBCA for ; Tue, 25 Jun 2024 19:12:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B7216B00B5; Tue, 25 Jun 2024 15:12:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 813206B00B8; Tue, 25 Jun 2024 15:12:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 368DA6B00B5; Tue, 25 Jun 2024 15:12:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0A8786B00B5 for ; Tue, 25 Jun 2024 15:12:22 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BBD72A057C for ; Tue, 25 Jun 2024 19:12:21 +0000 (UTC) X-FDA: 82270356882.25.D12C21E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf28.hostedemail.com (Postfix) with ESMTP id 664CDC0002 for ; Tue, 25 Jun 2024 19:12:18 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=e9BJF1HU; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="yl/N9pF0"; spf=pass (imf28.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719342730; a=rsa-sha256; cv=pass; b=wrw/WGqpAiXwgWBfZoipkTcO+/dwVTE2uhwvxwU+H90KS8kKef1xqtuVBjU81G3zWrUvL8 XNfABjQv2zcDjWRIboZ1bPiaBy+nc89bjd/NmrvPrnyMJsrxhg8wzIxCEZB+PGAloHeV/a zvooRVkh3xl2b+ivSMhMRwfKx5ZbhXU= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=e9BJF1HU; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="yl/N9pF0"; spf=pass (imf28.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719342730; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1DoxtPb5EdsWVu0FMLjwtMRXKfWWaZ02jMrwbY8xjCg=; b=79VWHWFhSc7+eHv0LK4n4Hz7u5HSSOO0pC9kwMLp9ILrM9OAEicTNo2bhj10SJ9UUOIcjp 6BOH7EtYAXwumWeMTJRWSqAsqjLp1QJ09Mv+WquJSKfx94NmaXG9dJ5QYOEylxnAKgvm6U lk2sdNgAYqFGpQtM7Ul0WKFk9krgHI0= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45PIfUqf023000; Tue, 25 Jun 2024 19:12:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=1DoxtPb5EdsWVu0FMLjwtMRXKfWWaZ02jMrwbY8xjCg=; b= e9BJF1HUBMWMMg8bhqOBpGItD5sJ5O+xJYOCDIMBpwhmp8udgCSTzwsWADl0TVTh Fz0T8AFsEn+IiJFOR298dBW6LSoYAixPXVpXY19flWbeh4GwQxuXHkwab7N/oyEP d4a/HWr6YXx0U4/jQKbNkHZ8NqR8+ZOklDLd6bjjXuqz6Hv/DOBAQc83SJSeVuTP rliaWVaOMjSAzcsss48NG/n4K7FxNF/jGFfmVcXxZ8TWqGeugr6wOHPeG7o2s/Nu kAd4QhCsfEvNxlQqX5AumXVVQmokXDIoqwK4WAWWyhi3ud9ly/cMFXnUtP3G6m8A wODlO3iaOONsAN+wJve2xQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ywq5t1k2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:12 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45PIqmFt010741; Tue, 25 Jun 2024 19:12:11 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ywn2egtpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QVEo4a73gpKT7S2BBD0GZxKyo6AGTXtA4cxu/Pg7i7sbOkZsW5rK7d74I8dByts3FmDn8Bf96ZWirHuqp2orFdCTnuMSHj/jp8iYlfMt4uc9dU2H7AHe4Q1D0tuS1kjqHUfYS9aVZPqh+Upq/sNea4ZTNixeJzAAcd5ZemfmB2Jqswpv4EyWjOX+oBKBNiUbJbo+aTDF4YJ478iMHW9ib/4Ef66D7vkv3ibGdtM2i8IJz3Lx4d0m0eu/f6+K9Q4QKX8SdgaN6G+OLoX3y2aVE3fRHwbLZmZZTP2R3RIYIfQmX8tup7QkovfQkpHESZ/8B3hAuoiLqvi6owpjIeGt4A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1DoxtPb5EdsWVu0FMLjwtMRXKfWWaZ02jMrwbY8xjCg=; b=Io5uHQgc36L6Ad5GRup7M1Rlqxhqc21MZy+EYhKr4fVJrSEa3cEmiEJm/StfacDSPcnevsaABrMAAMzQYHwZlp2ecrZ4Gt9iGoEVuyVMZlmQcke0Hxmn4aB6bCkUS1pQViUjjWhFoU4/Ismek6HBE4Od7avPyJh2nt0eopQ63x5GH6FyAnWYku5zfzR/VxGenxJvgblNFMkSHoNscVxBYNRd87Ns+qFvcXOUZ3S306vl2s4j+t4IUjcTOlvllwvuaShvum6SUl4VL/NpjtkgiQE0WTGayAKB6wOH0J1MTtcsOkUrw1i1s0wz71Y3gCeIH+HtoCLMunsS1dfqq7dJMQ== 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=1DoxtPb5EdsWVu0FMLjwtMRXKfWWaZ02jMrwbY8xjCg=; b=yl/N9pF0DEtFK6O/i8ZduA6JFAgN5xV8EYgttJU8vTmPE1volFpw7dY2WgAXa2binJiOQIjHeudbPWV1EJ16+hf3RfrXXvTxan66kwJQEzEx4AryWBTQO9BieOWGg4ZquigG6aY8f8mZgtj0Rh63U/AQH03CUuwAS4aLSWueESU= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by CO1PR10MB4707.namprd10.prod.outlook.com (2603:10b6:303:92::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Tue, 25 Jun 2024 19:12:08 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%4]) with mapi id 15.20.7698.025; Tue, 25 Jun 2024 19:12:08 +0000 From: "Liam R. Howlett" To: linux-mm@kvack.org, Andrew Morton Cc: Suren Baghdasaryan , Vlastimil Babka , Lorenzo Stoakes , Matthew Wilcox , sidhartha.kumar@oracle.com, "Paul E . McKenney" , Bert Karwatzki , Jiri Olsa , linux-kernel@vger.kernel.org, Kees Cook , "Liam R. Howlett" Subject: [PATCH v2 08/15] mm/mmap: Inline munmap operation in mmap_region() Date: Tue, 25 Jun 2024 15:11:38 -0400 Message-ID: <20240625191145.3382793-9-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240625191145.3382793-1-Liam.Howlett@oracle.com> References: <20240625191145.3382793-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0017.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d4::28) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|CO1PR10MB4707:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dbfd661-7819-4291-36b4-08dc954ab586 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|366014|376012|7416012|1800799022; X-Microsoft-Antispam-Message-Info: XwdcP5vv4jbudIqAzSrKPiN+e0G3/x3yS9/KrqGM7hB8aUIy9QsXM4yavS1CNHuqeAol8MzlMTrRUiFcxHByddZ+45BAltVZk1ZcByatXtxQI7Y59OCDTt5Rgy353yHwu2j/aAaGXiPYrXladzZR17ct//VQ443EcAP8xQxybcb9IIR8UNCXozcsgTxoqKTSVdBxH+nuDDfh98nFu1Pg0pU3NXQyKqqT1jTRLL05M86m/ArP5fpiEwWB/+pWD2951jzn38EBBRwNzpMAc8q8/uS/cLEwZeBKdutrNmvEpuqjfI5HR9GpKrKL3hUbrO7xZcD7DcLnwbLhZA+qEnrG6Xgs/0YskPbIYc1Eg88XcVcShtnJcHjSvYohgunVpVaZlhznXwWoMJKtu/nGOBdHJX0zmgFCMcKIVFbiacumUvM4X3K2V57NQRNSuMTHpTiG2WHK7JhtVV/w+hpkI8k+/OJ1akmku8lgoXP+D8pMShPkaFE+bO0c1Vkr4cktBpt6W47cRukIh2pVoT8nV3DE8nL21w18387NS6BvSWjLfij3qmcLEh9Ixic9klqwOmU/upse0YKcPhsjKikSUGupGCeJFLNyuTWHxlWgx+6Okfz33WW6rtrtkqAJgRnzSHSr8v13u0rvGkfVr7hm6sPZP7VXCB4SbGoZeOXy1xeN44djJs/1k6VU54q5YjXVMgiP5M/f18rG8EbdWxZrs2o/jNFCjU5Fc1s+bwBF+6jzunm1VwtXCAO2kZvQrc743yfbs1W1H8vnTRHPWAvo5EQPWqudb8psDFj5iD57RPTKRvfMJwB2cpWA7kygFxq5r80Pbo8nxcTQd3OxCVvkNWiO/S3G13kXjgYLEyDpvIT1nx+jOTPB/2kxwsR42RrRwnzyVPTEsrAEtXcv+nMTnypuJMeaPPaTXTC99WpzBLjJyNjubeqXD1lJmMkQeKqaYyTXL3Ympcn+/nh0C7NhzSLONMgJtn/fnFfy57eVVxblNWV+MNbKNS3ezFfFa3lZZ3VTxieWL9vNACwgcQ8wCVVhfDMSe2t2N6qcmxlKxP5/ZcKZzs0OE000df9NwjhFLTa0Tgk174/ZD4MdVzR4VMZna1kpdbVNqDgRPg8LynSE4G2EaTRdPfKGU98PNXsS3c1a11w6FQHaA+3Wxoer89yKIpLEMvSnmHToMXIPtft1bcVyxCT8VoM30WRUV4nBGu2CGesPdNnYcJgZ5TrevI/2VNT/CgnXXmtOv1GJO9MdNdebHMSCHdwaJDInuqJrTx50kk5VCNIcVTXPNC+Pzr8RgQorv2yGslR9Jk0oWia0++7aMN4lL9wv2HOipgQcbhZn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230038)(366014)(376012)(7416012)(1800799022);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /RljETI5WQA4YzLC2oofCgCNZQgljRaqucng+uaiMsQkxgSNGlerZp37Acc20ZRKpZoEzfObLBxC2l3FjrciuNSatK1JnZPYCbp3V0i6IlxftisBli7Z3rSEY5H9CXApxTFafqaYZT3ekEKAGmoZJpeW+q0Sjt0AVLgD+pL3TaBJ2b9Z8lBHRNO9Bzc64utxbyvy9CpIybf3/fmFG4HhfZbo5qC1K/jt22QZkDtB7UYKer14rkPNlELRJL4VXmKvsWnbrQs4r6GZSX96aGaCXytWqapEhUzVAKiwVVNqowYY0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xznnfzbWZN7dM/5pcUuEqxN2Nf5YAy8te0RcVGOMhYS6yjLtjfwKC8ULGjlnQqMmvtfV6BgUP0vImN8ux8PvcGtwpzxMyv2Wi0JmaxZvcvtr26/JrU2fYuLOJNW+uCZL4mxwNEz77SKlwdLvUwoYKelCIXS66vEbUBZfU1mYU5EVhl0/cFgqWmdOMpPgcDzIIXUiZ46n8F4b4z+R7pwdRKrOM4ZorIvXlIAUtJqNZ1yj7MYjSPcc5biQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: viFCLWDmSXZMzXyvEiwG9Vbgigx7alWEvxToddeq3l2ppqiTmzH8H8uSxe1yXb2QqByUoWayRf99Phmvq8nVqH7e2fpm6dqf1v2cIPz/j0pw3W0yJwMifXQC4YTNEEYPR9Yd8+iG3o9p+KPBsLBOfavclPZLkB7iU/Zs7pCuGHJP5vSuDzdnngqaMBXMo516310LKo31LDcAO7Q9YDD6/Kj+J7mjjh+MoiE3rpHPZqyM+0TQx9UxDgH4Ca90a6ut37ZlMUYbD3tp+57V/Gb2vs+EJtRbtIKI/mVh2ksPouRd8bmkWXQO37SRJKE+HJcblGo8M9k+z7QuI6o61YJZTlzn8dEYvXcfpu62GBqAy6Rp5T2cQD78Ui8/D/LwtvCg0z0mfJ8aL3whwObyj6LTqGA0PWHXJ5CothPqh+IkS7p11VfJdmsVCUo/KXiNzSKvGeBQw7Kced1P15ch7r+kHp4ViXJzO8YB8WJejh/FtecxvkXgao8c61sGpeEztrci6p3lOAftt5Q0dFo5MMOte7Gt0cEBDRH/pgbmxvmFeMqu8jL3UyjKPYbH9pWQJUKrNIsv/4A5fU7mD0nWOBQScORv4+k0zL0m7yQ3TtT3t0g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5dbfd661-7819-4291-36b4-08dc954ab586 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 19:12:08.6168 (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: jbmR37RPGx4zXRF6d8ITlOd6vpXDBfHcwAz5HY7KW90YQD7LzednJqKwVoiFktdpRpAD2l3nDL4WiG1Ur5tTcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4707 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-25_14,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406250141 X-Proofpoint-GUID: Qg10Wj-9hnBdFnDrHzvOAY_JxdxilOXj X-Proofpoint-ORIG-GUID: Qg10Wj-9hnBdFnDrHzvOAY_JxdxilOXj X-Stat-Signature: rfropqfx88wfn4o8dz1wsjp7zes58qd7 X-Rspamd-Queue-Id: 664CDC0002 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719342738-323115 X-HE-Meta: U2FsdGVkX19lMzh85JBb4GvcYAj6uWFYYAinfhUuch2nL8veNKAKcnR8OvvSrFkDWr0okdXkAVHpGnLpcdyFu1en7gEkNeU4F6EwvQAerVMSJ/ekWrDDOxIowP6w/4iWeWWQGc7iy+s5JNLVTJfJwmHAnBXeevbL8UXS1OSy49b4i5ro7TFmXuw+bvfpyNmkm8IncNk00Zm8NEDpd9oi2H4uciBzlzMm09ifrhOszMcO7bJK4POk5nSj78IM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cHK8hop3i1ovH6hbgxZhs6c/jaTTTF9oWXcOn6HDlP/aL4shCen5WqI37PRYcpNzNtHvgpeJiFAteyP+2KivMIbrEMkaoHPQ/zU5TT9HjWvbYQnWQHZ+tc0pCY7duXv99DwjRC2Bhw== 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: From: "Liam R. Howlett" mmap_region is already passed sanitized addr and len, so change the call to do_vmi_munmap() to do_vmi_align_munmap() and inline the other checks. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 8d9be791997a..e9858ca8bbd4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2937,12 +2937,20 @@ unsigned long mmap_region(struct file *file, unsigned long addr, return -ENOMEM; } - /* Unmap any existing mapping in the area */ - error = do_vmi_munmap(&vmi, mm, addr, len, uf, false); - if (error == -EPERM) - return error; - else if (error) - return -ENOMEM; + + if (unlikely(!can_modify_mm(mm, addr, end))) + return -EPERM; + + /* arch_unmap() might do unmaps itself. */ + arch_unmap(mm, addr, end); + + /* Find the first overlapping VMA */ + vma = vma_find(&vmi, end); + if (vma) { + if (do_vmi_align_munmap(&vmi, vma, mm, addr, end, uf, false)) + return -ENOMEM; + vma = NULL; + } /* * Private writable mapping: check memory availability