From patchwork Tue Oct 29 18:11:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13855274 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 4B3A3D3A678 for ; Tue, 29 Oct 2024 18:12:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A71556B0099; Tue, 29 Oct 2024 14:12:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1EF66B009A; Tue, 29 Oct 2024 14:12:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84A736B009B; Tue, 29 Oct 2024 14:12:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6628E6B0099 for ; Tue, 29 Oct 2024 14:12:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 18DA61A03DA for ; Tue, 29 Oct 2024 18:12:18 +0000 (UTC) X-FDA: 82727434104.29.5E85991 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf28.hostedemail.com (Postfix) with ESMTP id C14B1C000A for ; Tue, 29 Oct 2024 18:11:49 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Kuxh+4lT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OOOwplpX; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730225480; a=rsa-sha256; cv=pass; b=sQ0cpIlfTroZfQXekkrfQYZhgPuDimTVBJezT72ZFke/K0hxCI+S1QRSXwrCV9JagZg5QK eOXSictww0F85IOdXQPNlcoF6sTpNm2p1IKGJLb5k5EWf+kJ7chqHLRYAzcZijRVJbR6mL ILRWastwHNOSIfY7OSgXvCSmPJqyLhM= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Kuxh+4lT; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OOOwplpX; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf28.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@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=1730225480; 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: references:dkim-signature; bh=+QDEXsl2pFJid9vGF0AX0Oh1jFYKn/rHyMJJW7fRLbc=; b=JaayS+Mnz6oagP/R8B6DUbZutxxVYXOxW0ffto+3mpbC7DD5sXIsj2k7nX+q0tQW0lNEJ8 eTPQwdAyIxD2/DGXgMeH4c9RNn0SlzYTDWFaYs0r1VH0hFfw35pKBlYL625sUbzeYKTh0W LwtQBX+9cKrU2iHWEp/9t8zQ6yJFE9U= 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 49TGfZMp028589; Tue, 29 Oct 2024 18:12:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=corp-2023-11-20; bh=+QDEXsl2pFJid9vG F0AX0Oh1jFYKn/rHyMJJW7fRLbc=; b=Kuxh+4lTD1TIj03LLAThepiPnXV3nvTb 777ajbolNL+IcpVLV30ISpO82tiagxOli12nReSUHSz6XvagPw4JwmuQmgER24CO mKOAZQj2WvS4xxxN8A3Ig+NCnDriJ9QEFfqPda1f1/5E4a333PwtL1Tza16iYXkL PGTwx/zKdmWDnxw3AqGuRoUJjh0K4AhjYTQGEAX+RD3ScwdaSJJlsEU8Za11ajz8 wSOFsx8fr3BzAXEmAza7c5ERGojqLF9pB/huKUjnjpunAuqGxplDMZxELpwd7IQV 5VukzhZIIpVYuZYEJtWYMlne5xHsD2/XViUMB1lMV5rRmYtVmZZGBQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grdqe5wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Oct 2024 18:12:01 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49TGwU0x008427; Tue, 29 Oct 2024 18:12:00 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hnea1u2c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Oct 2024 18:12:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nvJSrVDmSTOE2GEqeZxW/DRAIDcRN5b839rx+JLHKrurJfSl2303o+AWSMlJrBpIG/e5hWQIILXhQxtZhazdxdznJtpFhqTnkTqRwKC/IxK/dV3lFii4TuuCD90dGe4oIqq7/cXQSHtgZCQsRvaKrggf/eqDRCxgu2uSCfZjViF2PCAnU1Aqnz5uOe7F9Wmvpe4xNdvGDhvxOunecHmbA8na4Jp6OLeyxNPAVphc6XjM8+AU2Bb96tlKB96poABtR8ZimDM5CanE9PfFfoUxp1H48pjCp5hIkm7yeG74/GGOCxMf4C2Siz69B/BMvifW4Fyr0Zgtq/hw9VRrby0zKg== 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=+QDEXsl2pFJid9vGF0AX0Oh1jFYKn/rHyMJJW7fRLbc=; b=qZvUFDs7miSyJoyoCjoTgO3oVV2OMbsXgXQA9j2fJHC8Nbe2VOQOuknlr4trdbKx/ubIgbcIl5AMIZPXJFlRolKACtffK0dHNXdDSG5ljay1beZAaSokwrfXBVNwZ2EyLwqyAItK2j8usCoAtHpYht1ctp0j+BeijHEFoIWtIhXpeeopssG6b/NhIOtccM5B1vz5Q9/P80YNrNhWWJKy8WYRqdAqecixHGdXMUCMls9uhUX72RpxbUxhUTJoJEzh7MAl1BhYARGWhqcCIbL7fB6lUeNLrC8Ac3dgqNbcq7GSvMuvpGSt3u5e9+48Wv2b7L8fb6hGI1GE4KxUzF60tw== 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=+QDEXsl2pFJid9vGF0AX0Oh1jFYKn/rHyMJJW7fRLbc=; b=OOOwplpX5/F750gyUHjXkM/G6rlIfw1r7ZYg/vEhS5hytIeQJe1vjXT4avT1BcdzSjfAdVSiR0Wjzz43Wr1WraVD5OIHPluON7hTtwnmp26tTVhAL9wu93EO2ulb7T7Q7mEKDc2GfuuvN6CY/V6+s55M8yO7Sqr8W9up+MfUAkQ= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by PH7PR10MB6966.namprd10.prod.outlook.com (2603:10b6:510:277::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Tue, 29 Oct 2024 18:11:56 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.027; Tue, 29 Oct 2024 18:11:56 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka , Jann Horn , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Peter Xu , Catalin Marinas , Will Deacon , Mark Brown , "David S . Miller" , Andreas Larsson , "James E . J . Bottomley" , Helge Deller Subject: [PATCH hotfix 6.12 v4 0/5] fix error handling in mmap_region() and refactor (hotfixes) Date: Tue, 29 Oct 2024 18:11:43 +0000 Message-ID: X-Mailer: git-send-email 2.47.0 X-ClientProxiedBy: LO2P265CA0152.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::20) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|PH7PR10MB6966:EE_ X-MS-Office365-Filtering-Correlation-Id: ea8d1005-96c4-4238-ecd5-08dcf8452c53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: hvBoKTp5iPFpXDM5XV74qhkA1n5qMl+KKGcXJdu7y8CubGxMMZRNk9bFG1K4K5DMhoyhLGe3ywMRcL18sjN+kruoZVfoLCimZadHOkVYmtzjKaMsmWOMbWPB/u+Ei/rsAS+Qx0U+5Vvd1plQ63mY9NB50BP+34nCh3HHFJwYPNrLkncvrtweeO40qnfzMdh0AqahN+dHsE7Zs2lMGgJWoVcIHtWSGMXjuUzYUbv2nMbamYFUPqsKB6guoH2mwayTFz8n3w8r3i8UqfJVUvCylvb0XgNHdLuQLkBU4hb0eKGmoFivJZCx2settWHELEZqJiWqwjodzpJmJyZHyMOk769UEunMKk0xsC1Xe8oWzACMZ1AjENOK3AGXBtElljMz1RQvWViorFbhz7psh3JZVF6z4RcGHrGn6CIK9OQhLpypIuskIsef1VZ6/diBoZie9PWADME+4ELPPGIpGAPoT/Kju7YkvYsbyThjriXVWKSy7iilhi95WEnqYfXe8nQk+w2OpQRB3WeeozRDHy1wRbisx81HOCUFg77s7cx0vos71J0m1FM+IU0HGReybCzHcpRD3tJdNxYpoeSM2gLIOzM99BEAWtlcQkidVLI0a7eN4EWmSvW1iqwZFxBpHBbs6vy/vNCvrZgr8+4WW42R5/MmmN/rAP0fYTpJHcx8JD4I05ZCTrreF2YWnMBsU1G5fjIVv6vaLIVnRw6WJQmdNqhSIS55jxWi0lBhzaeuMT91wQY8/WwPL1uvzzpOUI7gyVyxqpxe5/gdH8EmRwJqPQxH7UcX0EwHWxz1Zi8tvkjokTL/nYx0MUVTs7gC0fsP15jJ6wiH3ffDwXtBcOkLtxXb8k5Lqy9bBWNlem+vZ3Gw6hZnpzDnBC0qA1itnIX1JiTMgM98ZY56V0pueYVPuKCzOf34vLvp2V9xmSeim1s1FCwb5HDS2exLJvn0Xley0/BBpSr0Zq6FyDiwDyOdBN1Qt8/HFyhp396q3UIN8JepAFyC6C0BKKe2vKhOJ83pwirpoJQDRQ5+GfSknRTEXNGVs3R2TxiX/jokMj3zVpMJFqv1VDCrMWtinFOQlQF4LRhCBSz5CRQhhwb5HAi1U+FQTjxHjlCTrkYqjeNJz2OVZo08zJ+hZew+fnZ0ZPAIhovhY3OhFF/zpbzO9Smu555T1r9ZAG+oSpr4n5LdQXgiCxMmFYVSjGXjGgONyJ+0MIL3BZ+/hnQURiHlYua3ceosBQwYbrMgSSbaaohW7w+2h9dBqcaVTje1Xah+LBa28bhZ3k78fJIcyohumQHbePgQud+GgqABPnBdrW8aEyGyHnfzUTDim1SiTw95CPB6 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)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qKlpM6KCKgscW27Baf5FcuXg7kG1AaGZ5iuvekuDMbs5YcJGbN+uHU5OAnY4412cGSsxwcKmH9EnYOwgaAiyvPMetJ7h1+7YjsLhUuw16+y82Wl92KyQ4q2Jk0R/kvkMXFRug5nrJK1d6yLbzGvtlJbynve3CUEjUyQmWJ5oBCFRzMy7gWWTa/y0iveICImx9hBxLuFfpPUh98qiTia5l+i61npV6L6KoFDhK/LE2MGXRRMobwAGdNHd87bbrQEPTL2YgHH7tEGmqePM8La+Ctl3BXK/coidrHkDJprQLD4HLyTAs1dHOwNA/+cmsu+iSUDf1FKKFlYFgKajNtnhUO95kxJGBedpyaAHaAutIJZ0mFVJxnOCPBMthyslQI2AgPSjIUKPQMEp920SdGcqkV8mvSdhJv05D+kQwrHbm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ix3wIS20lryVby91NXsDIVTzKye9i84lcTbKD8LHhvSndX0v8mtqoSfp39bkhmgC2bp+qB90zPT916Jf2metDKnNdHNlrQASYFnxlePQe/2eLUToUNa35w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 36djGcIJC10gZDQQwaxvcvIdyJuFqD0DBHWUvnb3RgrHs/zWImpr3c8sw1sxiXnuDHj3OoRoc4YHrB64ABZB7/eBeeD9DKmNBfl4A6rIy5vDeGSXy3mgmXYheqOvwpweQiKX+94O62Ta2uDhWNjg+XJnO6YVWY7kZDpsDbaUNCZ58xIZcCHab8E0GhNhcqpsYrZWnPcGhbET17kAV3nW6gKDJzUaoSoLopVxxXy9WAwZGvEygjwwSxwweFWSm066XgeGZkVDU3P77fU/DxgRuxdoV4bjbG3UNnqq2DkSFoyZXaZlYpDdukRfAddl8GPxIO3HFp8z2VyDfFZ423vcy5jUE7SQDJHubGcVPF7iLUYrGSXlguL4vAfyRYxNHllEOIQIzgVInq2o4436IcuBiv+Dl9bkGtvuWSsVgpYXAUKBRWCZNxqYiRbY+VD/YKArbd3OWIF1Ka6nOSO5SKgJ7B5RXmg3Tc0X/yg3fvA/kbOMszC0B8cmIbEN+zlsJ0WjJSnI1BBicdLsHAOUpBDDQ+iEJ4gNro47bJeDBTpsoCiN6vlo5XzKi/z53w06seTJ48rxbwUTt6xnI1INJbrpw0xucrmJReOaHjIJvVEAtJY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea8d1005-96c4-4238-ecd5-08dcf8452c53 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 18:11:56.3087 (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: RlqRaBFUS8CUiCg1TiP63v0IpeepRzNjgVjibbYBmuSRjF/98rVWJP12nUOEyM3vEQ1DcEcJeCT+r5gswwKfMo6q2DbDnVppKex9xZ0P28g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6966 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-29_13,2024-10-29_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410290136 X-Proofpoint-GUID: s8_tk-zgM3uss7jfvM5FqStNOfCcNzfL X-Proofpoint-ORIG-GUID: s8_tk-zgM3uss7jfvM5FqStNOfCcNzfL X-Rspam-User: X-Rspamd-Queue-Id: C14B1C000A X-Rspamd-Server: rspam01 X-Stat-Signature: wxgjxrxxgh56xxm447kaoksmtxrebgqc X-HE-Tag: 1730225509-451828 X-HE-Meta: U2FsdGVkX18A3XFQGd0Ag0jffh2OaT0lztI2LxpwVxXrIDwuz0WOSto4ZLOXu/rEjE9I00PfI7oKbDq1ImbdZeJh/j1t05sUNdHaNX4+UaUxaayrRegRQdNw/T+6Uyc0iRWRGeJg+nX/8CosXF3aFE8ut77Y1PkSzX5Eg5oJdzx+Vq+Alsfah2wpPKtNGXbpGuSb8x7xljUz7RoklMMQPQ2l9dzPeLtYCcr1cxZ8reZY7d4XzAWoj0a7kcQ+aohKwNK1EvDnZNbTk2FDDUa+prhL0nNSDHgziFxyCFdt0+LGWxgY+CLxpZ29UtAACneiBHUuUU+x+SzFAFevMD2cei1DbJ+CvZzzKx6q8GXTvhhGemuSGuM0tT/K0Gg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Hpigiyjg5bQWLIIO7fpMcT+oZ3nuc+NRpdCqVFigEkXiegFOyhidsMEqrE96vpISCuAks3WmHTc2mmmi319obduyENgFDCf2/yzAovPr+SLu2io4IeWBYYekMJg/lS/mA== 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: NOTE: This should be applied on mm-hotfixes-unstable in Andrew's mm tree as it relies on other pending hotfixes. The mmap_region() function is somewhat terrifying, with spaghetti-like control flow and numerous means by which issues can arise and incomplete state, memory leaks and other unpleasantness can occur. A large amount of the complexity arises from trying to handle errors late in the process of mapping a VMA, which forms the basis of recently observed issues with resource leaks and observable inconsistent state. This series goes to great lengths to simplify how mmap_region() works and to avoid unwinding errors late on in the process of setting up the VMA for the new mapping, and equally avoids such operations occurring while the VMA is in an inconsistent state. The patches in this series comprise the minimal changes required to resolve existing issues in mmap_region() error handling, in order that they can be hotfixed and backported. There is additionally a follow up series which goes further, separated out from the v1 series and sent and updated separately. v4: * Reworked solution to use arch_calc_vm_flag_bits() as suggested by Catalin. This also ensures we do not break MTE in a KVM scenario. v3: * Added correct handling for arm64 MTE which was otherwise broken, as reported by Mark Brown. https://lore.kernel.org/all/cover.1730206735.git.lorenzo.stoakes@oracle.com/ v2: * Marked first 4 patches as hotfixes, the rest as not. * Improved comment in vma_close() as per Vlastimil. * Updated hole byte count as per Jann. * Updated comment in map_deny_write_exec() as per Jann. * Dropped unnecessary vma_iter_free() as per Vlastimil, Liam. * Corrected vms_abort_munmap_vmas() mistaken assumption about nr_pages as per Vlastimil. * Changed order of initial checks in mmap_region() to avoid user-visible side effects as per Vlastimil, Liam. * Corrected silly incorrect use of vma field. * Various style corrects as per Liam. * Fix horrid mistake with merge VMA, reworked the logic to avoid that nonsense altogether. * Add fields to map state rather than using vmg fields to avoid confusion/risk of vmg state changing breaking things. * Replaced last commit removing merge retry with one that retries the merge, only sanely. https://lore.kernel.org/all/cover.1729715266.git.lorenzo.stoakes@oracle.com/ v1: https://lore.kernel.org/all/cover.1729628198.git.lorenzo.stoakes@oracle.com/ Lorenzo Stoakes (5): mm: avoid unsafe VMA hook invocation when error arises on mmap hook mm: unconditionally close VMAs on error mm: refactor map_deny_write_exec() mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling mm: resolve faulty mmap_region() error path behaviour arch/arm64/include/asm/mman.h | 10 ++- arch/parisc/include/asm/mman.h | 5 +- include/linux/mman.h | 28 +++++-- mm/internal.h | 45 ++++++++++++ mm/mmap.c | 130 ++++++++++++++++++--------------- mm/mprotect.c | 2 +- mm/nommu.c | 9 +-- mm/shmem.c | 3 - mm/vma.c | 14 ++-- mm/vma.h | 6 +- 10 files changed, 159 insertions(+), 93 deletions(-) --- 2.47.0