Message ID | 20240717200709.1552558-21-Liam.Howlett@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 91225C3DA5D for <linux-mm@archiver.kernel.org>; Wed, 17 Jul 2024 20:08:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 676136B00B0; Wed, 17 Jul 2024 16:08:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FA8D6B00B1; Wed, 17 Jul 2024 16:08:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D7E96B00B2; Wed, 17 Jul 2024 16:08:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1DC666B00B0 for <linux-mm@kvack.org>; Wed, 17 Jul 2024 16:08:12 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CDB971A0CC4 for <linux-mm@kvack.org>; Wed, 17 Jul 2024 20:08:11 +0000 (UTC) X-FDA: 82350331182.14.7446293 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 5ADE1140027 for <linux-mm@kvack.org>; Wed, 17 Jul 2024 20:08:08 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=oCaIEyoE; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uT53cubk; spf=pass (imf26.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=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721246868; 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=BpN5Sb+yntfE6ooYu+FyKWdD7AXq/Jrvngs/MG7YjtQ=; b=TYwsbrMOoYLQ2i3WQdn+1P1zrrzdWpzchg486gJcYcA9a9kchlU47utkI8VFWTuZWvLBaF bq2atKDjPaX5n4eUsYF1fD6w3cWEBpsirRQ8J8dKdKEIx3smUA0aTClSosfoaxDGBU+VhM Ll9UaDRgbnNtfuXhuxREwmNrIZVoeD0= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=oCaIEyoE; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uT53cubk; spf=pass (imf26.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=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721246868; a=rsa-sha256; cv=pass; b=OSeUFtrgCna76TIcfeQ0P7FUXi6EXfcRBmpkbm8wmlZC+K0dlKgf3Xkk9NZjeV0O+4cFlv 8hjJV6slmwrNDH3h9Imq6IvIvAYF5AdAkvKPDlXJ1JsguzD2ecgeJjSPr0ENWLSp8KS/YI cNUb+uWMQKaNq+b4kY1+Z8xyUYN4e50= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46HJsRsR016988; Wed, 17 Jul 2024 20:08:00 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=BpN5Sb+yntfE6ooYu+FyKWdD7AXq/Jrvngs/MG7YjtQ=; b= oCaIEyoEOOKweepnRY/O17gDQ1KYf+NiviAOEN19MseRbz8orrvJYpuYufitJbch 8FJCmDpv2YtIcafbr88bWrj+3FwqkQW2XJflTGkY0u8WiUD07R6NCDQnQFngs4xy nam+SYrNboE9Rc7lZP+p4plijOoq1vQ+cveBCcAkFvsYBdNorzExGH0zJ/E0xuC3 aozqm6iifoVFN0TeJ1PmlwJjLYwwcGGp3Qo91aCHnhx9RwPanHXZAe/KKoNpzWEm 09rceZyySoYd0zWXHnrX3H6lq6Pj8sH86yhiJ7S28W5ybK9ZWP/gF9lI/2gdBNi1 q78t8eVEEQefJ32f0hqtDg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40em3m0344-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2024 20:08:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46HJFPQn021621; Wed, 17 Jul 2024 20:07:59 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2044.outbound.protection.outlook.com [104.47.55.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40dwetrpdh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2024 20:07:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TYYAjfuJEdtoe8HscfTsht7RrpE00gqgYTMaDwUGpv1Y0QZvzaOckc1qc19L9Zi3xdIpBF2wFUBLiM9Z/WAdZ2z+7TEaWSCh9P6kWUowY8JMCeT5bhmhPVjzDiN+SBKfp/hYKaG9TTd7qKi7PPFhjiBpP1S/YKPnZr3VUnxywuBRYIjvoBgviZriS5J5DkCqj2sIvH0dr4FONyRq/cGTU4T2qx3tGwL/UaY7Kgi448OpF/poUIQ+ED6O66brVUamWzeuCGZ7NP+o4pepxWRg+CTBpPPu6nZ7nYeZC+pl3f1nURNAM8y0nJnzv1J8PGjpkP+09mUPi9f1XS7Rgcf4BA== 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=BpN5Sb+yntfE6ooYu+FyKWdD7AXq/Jrvngs/MG7YjtQ=; b=pdSgowjc72smq3Wh68L0XgDgeBt7Pfp5rhdW6XiKKwX0eCrSYfuUmRwq2g4F6DcjlPqyYefDUNTLTFZYE6t56wVbxxHr54UKRqtN8TTZHIgZsrmeccY0qlNTTcv+5DwNMNkprIzDopDRol+yAS9OcTTkPuLvEOV9JnlFLJtXJtPYuUHPtq+mNhIdurh/2O6Ee5eoCh5qK/rbPGqjz6PwIiif/N3MGMp43tdAOhehwpgV8aKo3s5bA57lhbcnHDr/rw93CG8MkWZL9F0zgu3lcUCJ/BtqPGPZyqb6ATDWda1DLmrADaphxD2099WeI1wHE9y/+JhY6zELv0WGHmkaCQ== 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=BpN5Sb+yntfE6ooYu+FyKWdD7AXq/Jrvngs/MG7YjtQ=; b=uT53cubkZd08e/vKU+Xi0owlAcr+NyteekPZpA4YSl3o5Jh1Tm3byvpBzXhlS3KpaEVClu3CjtBzS89OnxrgByBO47QfWiYSRcx9bb4k9BNlmbRmX44MEHn2MgZ1peoMVyf2MLD4iSvwUjZkTTm3GVEgQfOKvCIBvuPFcg7SIMA= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by PH7PR10MB7694.namprd10.prod.outlook.com (2603:10b6:510:2e5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.15; Wed, 17 Jul 2024 20:07:57 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%3]) with mapi id 15.20.7784.016; Wed, 17 Jul 2024 20:07:57 +0000 From: "Liam R. Howlett" <Liam.Howlett@oracle.com> To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org> Cc: Suren Baghdasaryan <surenb@google.com>, Vlastimil Babka <vbabka@suse.cz>, Lorenzo Stoakes <lstoakes@gmail.com>, Matthew Wilcox <willy@infradead.org>, sidhartha.kumar@oracle.com, "Paul E . McKenney" <paulmck@kernel.org>, Bert Karwatzki <spasswolf@web.de>, Jiri Olsa <olsajiri@gmail.com>, linux-kernel@vger.kernel.org, Kees Cook <kees@kernel.org>, Jeff Xu <jeffxu@chromium.org>, "Liam R. Howlett" <Liam.Howlett@Oracle.com>, Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Subject: [PATCH v5 20/21] mm/mmap: Move may_expand_vm() check in mmap_region() Date: Wed, 17 Jul 2024 16:07:08 -0400 Message-ID: <20240717200709.1552558-21-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717200709.1552558-1-Liam.Howlett@oracle.com> References: <20240717200709.1552558-1-Liam.Howlett@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: YT3PR01CA0057.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:82::27) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|PH7PR10MB7694:EE_ X-MS-Office365-Filtering-Correlation-Id: 6742c728-1243-4ea8-c0c6-08dca69c2680 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: d1XnepONywIkVt50e1BlPFGlOKT+LeJE75heLCj+ba+PuS7UytO9fOPEFhQCCNlPBH9FAaZNggR2nRmeACvC1PjIkCFZpOLI3Wrh152HJEZHTvRK958dxB7g+TiqWL4JuSqC/nMYEDrS64KrpPdaicaj3WocpH8TOOZ2/FJNuNtQer3TqECP8jKReRvEI0y3u7+UcVOPa7Wq/LsXge1z8qVms6jh82RciZgMLT0vk/oavommpkvupavp2PQInJveYh94dA0ehLbd9GhkpXM2kGruy2sd0B92tjs21BG8bzg77mnPgPnaGGgPo/6dVt7CS/oNg8KhpwfYTrt4CYV1QBDuwTcGp0TTnO8zIsH9S5TL4KREphgReZvNV1v6jGH6BgFIfs4vqg+8KCsp+YdsW2LnOBsP9iB4fHJ96cdtunxhcLOpiE9Lkjq7Dp8a693pKeB8pppCETfkZV99Nd5DuL1a9dn01EcyjIxB+cNQ6frrCGu1XjtloZZAxRkB4ZnEZhnCk1x5hAe+dyeODqTLvim90DUXzf/HkxR+fBB0xv0rjU5ROcD0mWGhfwpUO5cCM7TKetdOlFPutJM/BqrXtC8QG+gbNqNB5phLjjQQqPEOfiBlbnWLZ3DdguOm8jhiM0qHAM3LaYu1rnKTOR+VmYTXqJNe/1/E1Km+eLNXoiljL+KKB6NTkyqJ6Ex5VQ3p9kcEjs9+FRZt8trJmCAXBbJ/+lQNIA1D9/72NpI3uEZLCRbUlQlYnAkzmASlyOGc0bAZX2DcSoHZHKy/eMJ5sbOC+myT26+PsrbVGPFxF81tNTMxhJ3diNdABG9m0HrEhq3smbN/l82TQZvZBjdfB2b/8iBqFOt8dIjhAAal2c0cNVO6TOaVR2539SNcxW06B+hmjyOBezoMsliJSF1sVd0hlBZ3NcTTxq3KamFcdCtlvotGppGzwDDePQZCi8W4hGDB8zH/PdLqU3ZSx48r+AQEkDphy9YQfwgeMHt1vmsD/10KYBLTJtGUvg3wfQDmg6kN3CmFpd1hAl1bLDscpIWtjLA+J6wcGHu7UyfQRNJPD8QRq5dD1353ggsXiRiuUGiWREWIv2zwUzPBnb7eEnXwm8/syxRv9HOFsP4NbtfcIj8rZUR7HEGys0wl1Ax4lH7KSSlWQSdhQvPOVHC4gEeqUJw8Y0g6JXVFeuReRWVhZ4qyQgN6i5Wn9AHJJ9AGT5FOr4u4XCImK++JsgMSlBDIWE+Qk7utCWBWUNvCNXv4XC3VZEvVmf+CAIlZBBOFUymHTwOQ40qizUwnMfrTioLmIP1mZ0eESNSaBWOpujeZJ8/xspRlRNgZkJBrJYRE8QgCXVzDpRuwEWF23j6IIQ== 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:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 85KhO5mnJdpPwZ1pWRPB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D3lS8eSBXAQ2zbM1Xq1t/QZj8gZOkX7rJXxFqFLI3aMf202Q151PiFypJqHpa08EbxSEHIvHrtq2PYkqPnPTF6T+TlsCJXWxpRgNATdOiS+/rau7h24xFbLOFjhedi0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6742c728-1243-4ea8-c0c6-08dca69c2680 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 20:07:57.1984 (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: 8nYccWxoLGSDwzKGcR/BA9QTJc19dECB/2OVhXj+4Yn1qB3N5sSbaXCQ9q9vB1ahRavjTR+GK4eAQIeQJ6R7uA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7694 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-07-17_15,2024-07-17_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407170152 X-Proofpoint-ORIG-GUID: sgIgW5COgo9dI4b_YDTuOfL861fMObY_ X-Proofpoint-GUID: sgIgW5COgo9dI4b_YDTuOfL861fMObY_ X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 5ADE1140027 X-Stat-Signature: mf55xaga7o7apymjaj9b5uqmfbgc6hx6 X-HE-Tag: 1721246888-428410 X-HE-Me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ohA4SYs3dDTxIkIFMuyZBy3AT5kLLGgNpUHSawaJNpEcYQOeNXYAQM9DG6O5A2KddkREoD3+D6pbrv9NJCL+0sQjOf2iBhtI5JnSTeUQOdFdqO9aQtrO6uDozhFhyvszrNn3Foh5p2ogwhSMNt3XrKdf/tRqOdbNNgzDFoa1gmEfyZq8lSKiVPdtAVGFvtM/NOc/3W8VQ/6r/eHnuZuUkFL0lCrOC84zCFQgvuB6y2tB6ZbRYHnMiWZaTKbNoq/+PbIGv/8sH3ibqMqwnx3uozdUgAXgRoWte/5Ln/Q2Pha4oOOEHf6xMi/J3q/fL5DPiTTHRzJ29UfjVD/Jlk3v+6OnBf62mgy4a35IRTj86eo6aVtOuU9WOKOi4iyymtaL4am6J1vooPDbn9DPIdUNkPqb7/QSg0Bq1n4pKKIzGoT7UbShIiZGOcwWgsY+wqJ5T4FAy4ztIX7BY= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Avoid MAP_FIXED gap exposure
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index ca752317adef..5e74f5cb7be4 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -402,27 +402,6 @@ anon_vma_interval_tree_post_update_vma(struct vm_area_struct *vma) anon_vma_interval_tree_insert(avc, &avc->anon_vma->rb_root); } -static unsigned long count_vma_pages_range(struct mm_struct *mm, - unsigned long addr, unsigned long end, - unsigned long *nr_accounted) -{ - VMA_ITERATOR(vmi, mm, addr); - struct vm_area_struct *vma; - unsigned long nr_pages = 0; - - *nr_accounted = 0; - for_each_vma_range(vmi, vma, end) { - unsigned long vm_start = max(addr, vma->vm_start); - unsigned long vm_end = min(end, vma->vm_end); - - nr_pages += PHYS_PFN(vm_end - vm_start); - if (vma->vm_flags & VM_ACCOUNT) - *nr_accounted += PHYS_PFN(vm_end - vm_start); - } - - return nr_pages; -} - static void __vma_link_file(struct vm_area_struct *vma, struct address_space *mapping) { @@ -2977,17 +2956,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr, pgoff_t vm_pgoff; int error = -ENOMEM; VMA_ITERATOR(vmi, mm, addr); - unsigned long nr_pages, nr_accounted; - - nr_pages = count_vma_pages_range(mm, addr, end, &nr_accounted); - - /* - * Check against address space limit. - * MAP_FIXED may remove pages of mappings that intersects with requested - * mapping. Account for the pages it would unmap. - */ - if (!may_expand_vm(mm, vm_flags, pglen - nr_pages)) - return -ENOMEM; /* Find the first overlapping VMA */ @@ -3015,6 +2983,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, vma_iter_next_range(&vmi); } + /* Check against address space limit. */ + if (!may_expand_vm(mm, vm_flags, pglen - vms.nr_pages)) + goto abort_munmap; + /* * Private writable mapping: check memory availability */