Message ID | 20240820235730.2852400-20-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 AE05CC3DA4A for <linux-mm@archiver.kernel.org>; Tue, 20 Aug 2024 23:59:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E94A16B00B8; Tue, 20 Aug 2024 19:58:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E1DD26B00B9; Tue, 20 Aug 2024 19:58:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B85BA6B00BA; Tue, 20 Aug 2024 19:58:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 90C556B00B8 for <linux-mm@kvack.org>; Tue, 20 Aug 2024 19:58:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1D782A78B1 for <linux-mm@kvack.org>; Tue, 20 Aug 2024 23:58:41 +0000 (UTC) X-FDA: 82474291242.27.464EC25 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf06.hostedemail.com (Postfix) with ESMTP id DE942180003 for <linux-mm@kvack.org>; Tue, 20 Aug 2024 23:58:37 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=B6wRyGX1; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZBh6Tzj1; spf=pass (imf06.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.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=1724198212; 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=sz4HyiBxeYTd9ERWqAfMhOMdcVpivHhrD1PZOvJqvI0=; b=6QqIuf+BxWPKYuyq1CED9dkdgJCviSnf86sVRKr6EC6rIgnDQ1OWxTSPvmgXhAWAHoDq2G kjhcvXxStNa1T0JTngbAfrWPvmRRgeZB1Y+uCf+061D0usS4N82SpS/UIEqqLpTJsg9olm atbQJyotnuZKWVXh3Ok5NdtteNMKfDI= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=B6wRyGX1; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZBh6Tzj1; spf=pass (imf06.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.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=1724198212; a=rsa-sha256; cv=pass; b=o5VMtZxSB/RvcwgpkOpQO8AOvVXCJ3KUG6ePQ0kgwvoqrL+XGWLjn3TIlMHbWnLVah4FhC DYohNiUbZ2TBXMq/kupgZZGyo3sddEog9IOh/CZOw+qeXOOh65tK001pGnby0XCv/GEJEB vjUBT2ugUZeNBc97QQ+czpQxIVsq//Q= 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 47KMBh9u005273; Tue, 20 Aug 2024 23:58:31 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=sz4HyiBxeYTd9ERWqAfMhOMdcVpivHhrD1PZOvJqvI0=; b= B6wRyGX1oFmkushSpBz69lbejw6zWi9F3GuNSAesoiC+hAXq8sNAeBUsHXEveC5W vFGE8tOZLxQeZGnQoyw+lKWnuiFPAvRBJGBrhQtefXHQacYHhPAaC8QTWd9z36vD w3qHqsIZS2fzC/irXNO+IqYtkpRL+JMaPQPk2umNlzFI2lc8j30tNCi52FFNmZsx giDGK9qISH6uL03Zb7jn1VtxeDFTcJ4MbPh0qZWhRMsNDIUlSIbBwsnMG+qkfdNX FURi6AqqG7TWDpVLDsekletuQjgz5N+OK5oJVkahtTqsf/EMo/TRoxDyfZ9Xhm3q M8nOwlqqCLWFvOKvThV8Kw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 414yrj0mmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:30 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47KNi8tm033645; Tue, 20 Aug 2024 23:58:29 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41552xg9w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SxyQklxBVhCEDU+InWmTM5Y9L5JyILYnnLhtL+unD8znIrI6RIkuxDNU6Y0/0TMNd+eEW0iGBrNibnvRVB+I9Bbcl03TsD0lWwT5Et5r1meoDRz2e4SXLCsgnKVMc8VFSQe9ubh1W9oAmj+U6H6qeIUo/+HDg3YdNDOFZuuNr4BIL5NX1/iti5Jyon0D3a3wI8dkkyxV07qRJiXnHoEsFUHzycC2uJC6j4bz6cGhcJl1AbpZwJEN7oHXj42MLogPrc5JSqBJ2JyWR/+Q0Ue+6GdAyLFibBNFHSbC/73i/kYNBDTd8mySr/0XAf1aUe1OfJCqxzn8E8CfzW6kHnUxpA== 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=sz4HyiBxeYTd9ERWqAfMhOMdcVpivHhrD1PZOvJqvI0=; b=N6G0Ujbu9mPxjrojP7cqktX2RCFs052reHb9R2Abtb3X7KoCrg32rkaePkkhfQacHO4i6SF7F3xygEerRq9LLNDOrJF5QDAo0vuI1dWnGBl+xhBm7reWE7SiOkJVH1zFJ2l7sMpv46yIZmmKfPfUVzv/RPLPpoUK0VEXKa4Fk97nzjqkiY/AovcNGVCsmpC+MNa0WiZeWR8KkTv85F4cHsLu/3zteCTRlr70PrR2G/vU+uzfTOqh4746Z/upmKQmhFUbgNcSCfEqkxZVwKLNX1HQZiRIl6umjkHqDPDodcPo4vGdrLsa1rRnJPe/CfY4y1OJHD0iMwWWkL1lA718nQ== 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=sz4HyiBxeYTd9ERWqAfMhOMdcVpivHhrD1PZOvJqvI0=; b=ZBh6Tzj1BdpfjZDiuitejV7o4JCqqu+AdQ1vrH+GQBSF1ftAi1o9kTsFG8VTqopDTicTXCO80WE03AmcnbpuoxcR/0epvPcY+82QG0z2ust/LHhfbDXxp+AaXzLkDBEIuVXPfc5DSMJEMZgBklC04q7bwv23Rh+MngceAoW60dg= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by PH0PR10MB7099.namprd10.prod.outlook.com (2603:10b6:510:26d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Tue, 20 Aug 2024 23:58:22 +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.7897.010; Tue, 20 Aug 2024 23:58:22 +0000 From: "Liam R. Howlett" <Liam.Howlett@oracle.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan <surenb@google.com>, Lorenzo Stoakes <lorenzo.stoakes@oracle.com>, Matthew Wilcox <willy@infradead.org>, Vlastimil Babka <vbabka@suse.cz>, sidhartha.kumar@oracle.com, Bert Karwatzki <spasswolf@web.de>, Jiri Olsa <olsajiri@gmail.com>, Kees Cook <kees@kernel.org>, "Paul E . McKenney" <paulmck@kernel.org>, "Liam R. Howlett" <Liam.Howlett@Oracle.com> Subject: [PATCH v6 19/20] mm: Move may_expand_vm() check in mmap_region() Date: Tue, 20 Aug 2024 19:57:28 -0400 Message-ID: <20240820235730.2852400-20-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820235730.2852400-1-Liam.Howlett@oracle.com> References: <20240820235730.2852400-1-Liam.Howlett@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: YT4P288CA0040.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d3::21) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|PH0PR10MB7099:EE_ X-MS-Office365-Filtering-Correlation-Id: 98b71778-8145-4b0a-8c33-08dcc173f8f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: 6HB7SkiB1n5qDLyW4+LIc9Ipsj4udKNexB2H5htK5LN5/xLxdZMsDtb45BxrhrUEX/S54gdwp+J0Lgg+RTX7FyL4jWv7gXGEUmLXimGUAHJ538nhyX2iNptGBupsngKvBKGZxMmYvDIhniv5XquOG8aTphpq+awxdojMrtllEaRUFHV4mMmEbAHMIm/Cb9F3ZN5tWV6OfEhF4ENL4IoMjzdBnsaDDag3eyXqYNAqa858XjrVKgud55l0n5V+G2uHh+F8niHw+wE7xedmUwbC4qnMQJCRx2T/GcbMX8WbQenyVh5tA6V38CSM3jpCspY/qJuFdxTRCMT6gC/CsOz1rpZ3GjmtwNnnA9f1w7lCfA2maVgwOTfOXiUFdBqsjj2jjL7dKk5CkftjSz1/BjI5uuExeGCYDszHs5Tj3uDIh9hBGrU5X2hWe+qxn0Y/Q9qpEnUfUFgmG7yLovQsYp2BfRmnrfZbrazXD8yX5RLta0qWhaSomPF2rEOs5uzH69cuU1JCYz8fEXwMkToClniaEMMhbkExWiOuwboFkRTpGik+M2UC5GuNSBokhdBS9ImyoGjAxOSvlVPLIkwaRX9nyeGWYdyCtRv7AIABHJt/KvhV3ScPXlbOqOwtMjT2nf3Eok37bwOLoX91ddWNFASBzy+bX5EOQdDXiu3WaZICmm9aFsD2ajPZhuIB0BEpgEUYUKLO7a37A8z9TA+p8eS5Yhk+nhjIHup05Yf6mhSJIzKRUTuSB6Q5JdAextDJGKyCyirYzbQ5jpsnALM4E34A1GIBmtoONNhEr8uMVamdOBg7VwAkqpt3nKnCot1S8oDOQCNEPCLb5O2lgp605noHtjaHbqV7uBl0AmOOuVOpHnE6zafaWh7upx1e0KfQJIQs63+BJkZrujFKuQjRTkj5dKUfhU8K2NQIhYgzNfjtzWOgExu2hoejRziNrmwxjpSi2v5e6D76uh3KeV1KpNbN/BVLR9FUQpxf/etpXkgYNCf1FI3tQTDve/z0iuO2R+YQN96sxReQJZf2aetxFLRKaA+nM+7kb5BQDTq6qnw8hgoeSul1VRKOCJpEK4OMTvp63XOs6lBxzGloyabli8qS2B4U3GmvjT/BQ6wVNLjqE8HgBfA6HW3PcXuEFKkEBsm3I/vFXkAONktYkdJrx+PLIUIGrsMGZhxhzRqzM4xOdNqJxvjRGdb+SVxFLkxTy4gBL/buIqnp6z9G2rPemIJrXgPlW49PAPC/mX7gfSgpa57RoSa4sQEpGGw35QTHJgpg+biSlttyGAINXxiO7W23YBMh7RTPTnGlBwdst0phREBmVaQxYgMCtnLoPn+d4E8MEH94GEXZ/4bmWntarubclg== 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)(366016)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +6EcUHwjgXtSJWtT59cKAimladhc7nMKyo0kBjQr2ucYmKZNTVPEAD+y0zORJssR1eDPF6o8iU085WK0tBL3SN2afbUGOlERsnjhxy0EYVFm9+1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5qQ2QyMBnaxmlNWW+SGS/nS5hQVBvMKdkJVGo5p2tPGo3QIjBgE4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98b71778-8145-4b0a-8c33-08dcc173f8f6 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 23:58:22.3318 (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: /XQiiJghoykLaBOqlzxhV6tXQRwUaWFfWPmzbymOZbbiwfFPM0a8kWhUACMM2wJm37FZcDXBdrJUbNvwdub8PA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB7099 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-08-20_18,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=871 bulkscore=0 mlxscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408200176 X-Proofpoint-ORIG-GUID: _mwame6VNS5XRcoMRfGcjQwjgA9wF9Q0 X-Proofpoint-GUID: _mwame6VNS5XRcoMRfGcjQwjgA9wF9Q0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DE942180003 X-Stat-Signature: oaafudujgoj4b94higfp4qhyzzu3uo7a X-Rspam-User: X-HE-Tag: 1724198317-350598 X-HE-Meta: U2FsdGVkX1+4hpCADqtMws22Se2Vy/HG6LxVgAIAvFDn8KOxfIFsVB5GD4eCJVzMyDREIQxri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eZv4k3t3GBnDeVNi08CPJYtyp974HWyjRqt0ZdqeXdgTuPx9LK4/rySBYcH6IlhgivPXTCzVmIJXyBqjR4z52uGd45Sc6NqilqJt/zQXAu1gaaz7rlbvuaUWmU8I1XzpckLX0N1WX0VFTr/ZUK5EC4eyNtp95gPLzeRhTtyiGC9uwwD2H6XZsrDNDYAxnaTIalNH0qE6UOiD8Q0RDlb0iMVVqsB5wRS98U2x2ONc2wgBGaSkyYnquFYof7EppQKVFeeOaC9g+uR+tNrJgxLC73oLs98sVL1A7O/V+jili9YthUEdeHHCo4FX7KOaLcCe1qbO+mS43C6Ba0LjvD 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 49d9e95f42f5..012b3495c266 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1376,17 +1376,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 */ vma = vma_find(&vmi, end); @@ -1409,6 +1398,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 */ diff --git a/mm/vma.c b/mm/vma.c index 5b33f7460ab7..f277ab1b0175 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -1643,27 +1643,6 @@ bool vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot) return vma_fs_can_writeback(vma); } -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 DEFINE_MUTEX(mm_all_locks_mutex); static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma) diff --git a/mm/vma.h b/mm/vma.h index 7618ddbfd2b2..f8b4d3375a5b 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -305,9 +305,6 @@ bool vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot); int mm_take_all_locks(struct mm_struct *mm); void mm_drop_all_locks(struct mm_struct *mm); -unsigned long count_vma_pages_range(struct mm_struct *mm, - unsigned long addr, unsigned long end, - unsigned long *nr_accounted); static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma) {