From patchwork Tue Aug 20 23:57:24 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: 13770674 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 A7083C3DA4A for ; Tue, 20 Aug 2024 23:58:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BB386B00AD; Tue, 20 Aug 2024 19:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93BD16B00AE; Tue, 20 Aug 2024 19:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A35C6B00AF; Tue, 20 Aug 2024 19:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3DB1D6B00AD for ; Tue, 20 Aug 2024 19:58:32 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E71E1120696 for ; Tue, 20 Aug 2024 23:58:31 +0000 (UTC) X-FDA: 82474290822.27.188E10E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf28.hostedemail.com (Postfix) with ESMTP id AC8E1C000D for ; Tue, 20 Aug 2024 23:58:28 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=a5708ec1; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tPcfkCGT; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724198292; a=rsa-sha256; cv=pass; b=hj2yPnxwdRjVuCXzfeXrnotku8HGLzMP90hhkmnZ6UBT9ePGDe8CPqCtHxhVPxdE4E+bAl hcT1niCAXn2kQtMCc20/RGpZdvNZLmPkf8qQ2LZa0TZt6MYMM4CxuCRn43RKUbf3OlF9S0 +5BB4lEyiYkAZlkDMd1DuEq5hatTLVg= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=a5708ec1; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tPcfkCGT; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@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=1724198292; 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=CKnNlRY4znAwLGI+HO8zfHTa/X/PrK1n5BdvPU67AfQ=; b=Y9tbzPuqvIcNT13fNjLM+5QilNUDIjJugZCf5ttI8wftgF4EzfXjA3oE+QOt5B0IfwxHzl 978Pqj/O5mpf5ErMTy08TZqhPKGAlfe5jB1cpuXr/vBDV1pqfSpqD9LXoka1fDDBsBVXz7 d6EB2oloATu7UkfMW8cHNt+6SgEkQV4= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47KMBdNE016629; Tue, 20 Aug 2024 23:58:22 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=CKnNlRY4znAwLGI+HO8zfHTa/X/PrK1n5BdvPU67AfQ=; b= a5708ec1Qe3yqZtM12mpU+4kXUhqu2ZYNjA3jgP5Ar/RgGd2j4Odaggxr7mqceeS woPt1m2da6yrT5wDhMIYWnRlKFHPtouF6OMwT8HIC/rJ5kf7cI7N7aeG6Qy7abbt 5wYd8D4oBpXsqkspt8WZ+c8yVmzpDh+RXAIeKI/OVVf7h8DE71OkJd4dr1HxnmRj ZgSi1v7bYzEQaiAqrtXZz1eS7mtjdZK4QrqXd00noNZMCa+HGRRYHKD3foMJd/hx M4bitfT0/4y9T01eGPSM2g5/HkAeHP8b7AZO2CbevGMyQ66kh5KDDuZLo8ktkBfz jMhVvBQfeDBvdFoZlbi1jA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2dedrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:22 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47KNY1IM023382; Tue, 20 Aug 2024 23:58:21 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4154x78g2k-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uBSplbAc+CSTHuXcB0I6DxgEX6BIWq+4gIw8AMDJe0J9uqx/jX4RIaVRGKJjsvQY6VMiMiT/n/h/r8mfl/h0P17YoYxOWNPE5H5rc563L9FiEcQYYkKiaWYaO+XdwVty6OQxfoYv3U9o0ScTMxNM61PFWriMA7CVMQXtSCgRQtdj40zdOUe9jOx67FsRIvPoTYaKTa5WSRjGyqOg28Y9zVng+gXnBKqin/DWJygqXVAtofQYeCrdN9ACHua4ar/ubFpMLUAUPhlE77K3vD0183rr7IsrUfRlMiVKEbKVC/wGylLwC1XXtKQ0M84dDHZ9Bx+vpHeLKaW97UPWpxwZlQ== 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=CKnNlRY4znAwLGI+HO8zfHTa/X/PrK1n5BdvPU67AfQ=; b=DkznyeLukdbgL3kZHbZpJ9x+6q0LcHqVSjv75yK87NzWcRQPGSt2zd4oK4rsDZsHQsPJqDvl7kdKCGEafsVUmykb19J/BbNlbvyN+weUidSNR4qxIdY/BCzHxl3wTOYYoIa4KkpMYrzAnrutnl70LxU85gE9BIlCeU+aJpji7Os6sHp9cTlOL2bFLrjlLmB55xVAC033GOV72awq/qneiqjX2nmLS/Xd2ZzfClKNlWlqb/1Lzxy0vUrCa/9dEotIGTqFZxpSG6zTLecO26zsE3rJswtGRycQb+RtlyfIQX5nb9DC+IZDf7MMpTmJaVwRT8lGp4jjet2b6gquwGtT7g== 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=CKnNlRY4znAwLGI+HO8zfHTa/X/PrK1n5BdvPU67AfQ=; b=tPcfkCGTfJgASJqKwvZjfKP6gcScWeXNEB3FqgzWiN5NEkF9oxSQpTtUhN3LurgegfygY7X1pMdBBw7Did+ueqXItxnZpXWpUhJb0vaE8grt6jWRHx+sRUmuXoe102hNN10FMSBRp14TLae3XFvnmn2uRwPgObaUtTpc1zmvT94= 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:15 +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:15 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , Lorenzo Stoakes , Matthew Wilcox , Vlastimil Babka , sidhartha.kumar@oracle.com, Bert Karwatzki , Jiri Olsa , Kees Cook , "Paul E . McKenney" , "Liam R. Howlett" Subject: [PATCH v6 15/20] mm: Change failure of MAP_FIXED to restoring the gap on failure Date: Tue, 20 Aug 2024 19:57:24 -0400 Message-ID: <20240820235730.2852400-16-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> X-ClientProxiedBy: YT4PR01CA0167.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:ac::23) 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: 839c3e95-7057-4593-4400-08dcc173f4c0 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: AHhK11IlXFH75vDVFqqoknAhntVKkAFgeCIeHYgxSv2WVAPc0xBlQgkNJIjSstMA/la0EznrPEPZ4Fxyg+UJX4bIJgYx27hehW/tl3a8KuV8C6dsADAHIOwQDepn0IWFBbK7sWJt6RRMz+bMsOGPj2Gc/LJAZJ6WQ3ZBLRYev2BdB/cn3XGWocQP25Klr+Ai1V5If/CxnKMV4P3okd48JtlM+POYBWmnX7I8KZ8pPoHQQG/02t1caCVEtiZKyXt/TbWxRSAH9VbMIa1nemYMyedJemMZdI595DHYLS6G58fApXAeehI652Syz+0396vmPO/YxZiCmNf9YFKzZIIyD9qV0v3R4kHVrmKJX8+k4GJdOjh01MyOdwzrUGnT6Z3ujeAc1W1Bk2OwT/YEaG7JoRJE79qks4x0wCbRWiZqAaNMJpavU6rtkCI7vOQ2qW9c8/w0b+LsKLjKJqNS0rN9IdTGlKL6APWqhOBmsDlralD/TA0WrqKKprKtEvdVcflLiEMiQr1IEGOO1/hWfKpSpAiOAR3CV+KaRIMRczd5cReJ09J4BHH5dGw2GpT5M4GtAsecPih3sUsMSTINKISFB/XWB5L+n53KlWnYwOHEre0659LrIELSM1y8LfvExIahg1cU+BUb8t/wCKNxI5beOMDY0EWticDpmGgVM23I/LzYKDe1LhemSM3gSX9S4F+w80PLLj/Hnh/d1NjUAKNnqgs48V+1m4g3VlDbCrRZWv0qlwxxR4NIdCa0q7QGGc9w30NXSj6vZ1FFgsOcDe5bozZnXC6ZFgnolGKC52m/x1pzKq5/r1lkOPesEsEa1XSpI1ENrb2MHQt4qXUGbksBJFGgkKaRCQV8uiaO5vnK1aBgZwzBKmhwX0R+G890VE5roHiBQ0n/HPHjV5vwC9rpxRipWUi/FXfRg5QfzZ3Q6gIofKLyJA83vmazGqVpVeNn44cc2liJc/tpeotn63jBSPGmG5E3rPx4zy8pvpk2dGgqANkPZx9mHBExeKuycgv50R+jn5cfXvHhTiA6ev7F5FfG4+q7tSlT/ZXPk0PR3sjMqGjmlL7qUvd1kZrl+YKibbCWjf0ix9QyJHwjYgmyrwIerV/F4ip8wcpFH5udrxSaX8F/IDfld6X3ZeEdN/d70zjtD90/alDsYTqCDZypuDxg/HeP81bxD6yAn+TOo22JLSutWvihYq7R5exFAsFaCiou5Kr+XKEBLPQyV9n+KtUqW99WSWpURTJBaPoG51GfZ+9g/q+0MGT3KDcsTz1tsWnioxZMrOaK6wUFSCfomZkuNoicXp0aNfKwWXSWDPqmuptRv+SoAzZ4bRbl/0RFZNXdGEbs7ap6xUGphApHZQ== 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: Z0b0tsbEOhtmBwbBnzILMekcQkVCtx2JW40NHGuSA7gOnDmP8aPNrtGrSk7jVmU4qFnH3h0Q/q0ZB50ppgInu9zM9TW1M9q016leeDiYJnxRB1jdrs11zfTNoqDRyCZ8LSs4y/FYsL7RDP50Bhjz9rlb05vPgG7cP8THlFyiue5AkpToHHGA76PMzSPp90lj0lmhcZ0RVCSOzS8Q7wnmXAozLxTqDH4QX2TnOmTrskNOPxACoj1Ws/UIVm2VC66q6Mp1RWDjZyt9iSc9VyR0qmywnvR2HJyVjq+5pY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kfMOIlM484yUN18SQpQPQLswf2vdm4gKiMfaOMGuO9YbjAIFW0Dty1pqxqGyzdFrDhWhrhAmPrk7hcCLsqfjzWzpU0dLXxbuRtJm81UrsIUZWcY2kFOScX1RcEsoAzc3+Lwgskyb0nfD2V5W9R9c0MHbnSYXTVrdiAZCAuvBFQb2Vaf+S3wr/9Lg2Vg4H+UIU9/luiAwBIx0Dgug937dsOEH3mHetHPqBVLcL1vhkHFJJA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bp8G8DoKUvdURNZ90MPNWH8rfQoxBxsgM8PuRcNOf03LyJZEljjPWssoGYCVYSckVmEP3znSeUyPQxb7P8S7Z0A+XptkASut7RZByIaqP4eUnOybYbyfpZlC6MUZTYjOlf4GkGdF7LmxvqFdmDJWqMw1ebxOmnmSzZJGxJZ6pglDzJjy/4vi3foKSK25GpGPipQpMN3iK1M8llgTAilRLtSouSsoOyGnAImzsehJVC33NcUu58dyiUgJNwRWSsdhtG9F9dTbkogDL584wxQN5XAh/XqdPIB/JUFf/XuqOZearctl+hMC7123cP30T4xZ1Hf35PirXTVdqapYtxNW3OGgRrkGHnwygmEU6YEo1BgfAE7GJEeXLPaG8kO61NVlZDXVnG0A4nYm8uB1HykwBv9xbORnBkBnjbtUF90+wZPb+gJtdCsWz6yKtJwoyPPNpX2QTDbjHCC3OFcnM8PMAaqa1QRqsjMT1d6tOgiW0bPoEwlrpSHgNZu3HCKvAQsI/Umgo67Pv/XNfMJotKsbc9ZcANXC8GWrkhLSvs4ZOlNFm+pVIFrQIziFIwrUj/LbMHNZQkSmSUbE5dAjm+bmk8Dj44PL5kmUlEKKkAlkS4Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 839c3e95-7057-4593-4400-08dcc173f4c0 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:15.2705 (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: RTM2EuopIMZr6lm9K28Hc99DiEFC7UuHdOju3QYn3Gz2F7FqhaCZbFrd00lpwm+Oa1hnmzmdZoWKt29JSARokA== 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 mlxscore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408200176 X-Proofpoint-GUID: TPsk4msRKmLbfgiSTxbGDVQbfhF0-6uM X-Proofpoint-ORIG-GUID: TPsk4msRKmLbfgiSTxbGDVQbfhF0-6uM X-Rspam-User: X-Rspamd-Queue-Id: AC8E1C000D X-Rspamd-Server: rspam01 X-Stat-Signature: ehawpdwqmcbpdwo8h3iojs6hqwajah6u X-HE-Tag: 1724198308-509038 X-HE-Meta: U2FsdGVkX1/zG2XWDkEJr7X6f8Y1exDECpkNxPigno4SqNNjT5ELc6qs8MGLdgtfSKoFRSXo5Rk/YOrIwNff9LdHy+XLcw2nCcE5PCMXw9Ze1YVytvQ18khzFHKW+YImu2WtaZn1vhBnqwnokyVkhmFLFJDTZXPqB+oJFvZf1OcL9caqdA4+tf0Q7WwfQcgxv9SRdKALMAy9wyJAUKxcKmxstobc0yLGbabtBLO+P4RnzsZOlmAREqEjyUv6e4m2FyeJR7KumjusTM/X5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UtN51cGTju6PTow+IkFjqhfTcwvnYnFdVR280+Vqi04nlPoUptcnNN1I8C6pFKlAW0yoFLbbIyoLi1qEhmitcjWVg5zRvIsAlgYcXvcO0q5gNAEUXA3bUom7YKou6Uz0edwv3FWQ7w== 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" Prior to call_mmap(), the vmas that will be replaced need to clear the way for what may happen in the call_mmap(). This clean up work includes clearing the ptes and calling the close() vm_ops. Some users do more setup than can be restored by calling the vm_ops open() function. It is safer to store the gap in the vma tree in these cases. That is to say that the failure scenario that existed before the MAP_FIXED gap exposure is restored as it is safer than trying to undo a partial mapping. There is also a secondary failure that may occur if there is not enough memory to store the gap. In this case, the vmas are reattached and resources freed. If the system cannot complete the call_mmap() and fails to allocate with GFP_KERNEL, then the system will print a warning about the failure. Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes --- mm/mmap.c | 3 +-- mm/vma.h | 62 +++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 6550d9470d3a..c1b3d17f97be 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1622,8 +1622,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, vm_unacct_memory(charged); abort_munmap: - if (vms.nr_pages) - abort_munmap_vmas(&mas_detach, vms.closed_vm_ops); + vms_abort_munmap_vmas(&vms, &mas_detach, vms.closed_vm_ops); validate_mm(mm); return error; } diff --git a/mm/vma.h b/mm/vma.h index 756dd42a6ec4..7618ddbfd2b2 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -82,6 +82,22 @@ int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma, unsigned long start, unsigned long end, pgoff_t pgoff); +static inline int vma_iter_store_gfp(struct vma_iterator *vmi, + struct vm_area_struct *vma, gfp_t gfp) + +{ + if (vmi->mas.status != ma_start && + ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start))) + vma_iter_invalidate(vmi); + + __mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1); + mas_store_gfp(&vmi->mas, vma, gfp); + if (unlikely(mas_is_err(&vmi->mas))) + return -ENOMEM; + + return 0; +} + /* * init_vma_munmap() - Initializer wrapper for vma_munmap_struct * @vms: The vma munmap struct @@ -136,15 +152,37 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach, bool closed) struct vm_area_struct *vma; mas_set(mas_detach, 0); - mas_for_each(mas_detach, vma, ULONG_MAX) { + mas_for_each(mas_detach, vma, ULONG_MAX) vma_mark_detached(vma, false); - if (closed && vma->vm_ops && vma->vm_ops->open) - vma->vm_ops->open(vma); - } __mt_destroy(mas_detach->tree); } +static inline void vms_abort_munmap_vmas(struct vma_munmap_struct *vms, + struct ma_state *mas_detach, bool closed) +{ + if (!vms->nr_pages) + return; + + if (vms->clear_ptes) + return abort_munmap_vmas(mas_detach, vms->closed_vm_ops); + + /* + * Aborting cannot just call the vm_ops open() because they are often + * not symmetrical and state data has been lost. Resort to the old + * failure method of leaving a gap where the MAP_FIXED mapping failed. + */ + if (unlikely(vma_iter_store_gfp(vms->vmi, NULL, GFP_KERNEL))) { + pr_warn_once("%s: (%d) Unable to abort munmap() operation\n", + current->comm, current->pid); + /* Leaving vmas detached and in-tree may hamper recovery */ + abort_munmap_vmas(mas_detach, vms->closed_vm_ops); + } else { + /* Clean up the insertion of unfortunate the gap */ + vms_complete_munmap_vmas(vms, mas_detach); + } +} + int do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm, unsigned long start, @@ -297,22 +335,6 @@ static inline struct vm_area_struct *vma_prev_limit(struct vma_iterator *vmi, return mas_prev(&vmi->mas, min); } -static inline int vma_iter_store_gfp(struct vma_iterator *vmi, - struct vm_area_struct *vma, gfp_t gfp) -{ - if (vmi->mas.status != ma_start && - ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start))) - vma_iter_invalidate(vmi); - - __mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1); - mas_store_gfp(&vmi->mas, vma, gfp); - if (unlikely(mas_is_err(&vmi->mas))) - return -ENOMEM; - - return 0; -} - - /* * These three helpers classifies VMAs for virtual memory accounting. */