From patchwork Tue Oct 22 20:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13846146 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 03FF5CDD0EA for ; Tue, 22 Oct 2024 20:41:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6873F6B00AE; Tue, 22 Oct 2024 16:41:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 636EF6B00AF; Tue, 22 Oct 2024 16:41:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43B8F6B00B0; Tue, 22 Oct 2024 16:41:14 -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 242266B00AE for ; Tue, 22 Oct 2024 16:41:14 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C0FDE1A029C for ; Tue, 22 Oct 2024 20:40:43 +0000 (UTC) X-FDA: 82702406934.17.6AE36A7 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf23.hostedemail.com (Postfix) with ESMTP id BAA47140012 for ; Tue, 22 Oct 2024 20:40:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=C2O1lyzb; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hOOGVyeL; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf23.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729629518; 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=jpITDfRM7U2Jze6ESs4lS36slS67iQuUDSMEzftcL+0=; b=2LX1LiLyzHqPHqfSkgXAEIu4kwa64Tmt+oq57uM7RKmiC/Xo7WeWXw3MteRmYsJ0q72NIK oV1Ms19vzFfOOyAo6PbwovAOf0e3ypVCkKEMfkXiQssHQMk57cUpWv+jVYlUpCgWF0jh9k mEcgzBwKauV7My7svSda5gwaGxSfQ28= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729629518; a=rsa-sha256; cv=pass; b=Zxsr5tXvQpJOESgpPb3TMDDrfxmKRbsjYELtLV4oQNiP60UhwUjt5156n1uW0PMQ41IeYg ZG8JS+3WBS7809rTvAicj9b4jrJZD3fLUEYAMSDmpL3h/6lU2O1iAYqjI8HuZ95l4pQFjm vIQjzugGVxWJ8IjCKULjvEKIbFvKg48= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=C2O1lyzb; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hOOGVyeL; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf23.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com 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 49MK3YJS020540; Tue, 22 Oct 2024 20:41:07 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=jpITDfRM7U2Jze6E Ss4lS36slS67iQuUDSMEzftcL+0=; b=C2O1lyzbZv1uyqr2SiiEpvYZJ+G8PQ3A sFzFjTHY/ibgDsyPFaPbNzUpi5yFBZIDEB+rxIqOqI6XvU9+AAwH76xs8t6u//VL NzYrRY3u8ykgAt23a49/W8QdK24HALdqGMcRySS4+8H9GuP7hw0TX2/btLabzP7x 91zAFZaqe99t2QrZRrtSHm3XD2pRb1/GHPJr2WcWNmY2KwU5ZOlp66ACLqNjahMG Dvj0GsNP6DbQgkLz0qMVEyfkmjf1J0XoAhLBvjwBcB3GSwljkkH/+AlEH+i9hbEl CaPyvzMB44YFiA5UgUfJ5cbyU3E/aovUkT++f47acGiXVNsAozJAEg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c5asencx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2024 20:41:07 +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 49MKLAUF026976; Tue, 22 Oct 2024 20:41:06 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2046.outbound.protection.outlook.com [104.47.74.46]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42c3786xpb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2024 20:41:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HWPkaRU/2HXkTXyIy6JC3b8MhgCO+wFUFgt+NkO5VGpNkaSB2ecozNJUu4q2fmndtzoOL8kVbWW7Tc/yU31XV+XhASrz5wHQTMF+Onj7wKZ2D5My4G09C58kmIERa3Tb6g/OHEGNip18UeLKMotmNyNjUAV1mjmMmcGzoF1hbV9DEde+3XHJLyggik2FRH2vzVQOG3xncXrPJW3e+SH2h5+1h/TnYYFaGFMG1xC7lRlzY02yOtUZjrOmV6vDBsmL6UPbW3THMzPftR9YaHtV6LovYHi4qoyqfoZKSjTOr83LfNfLwLv67uKhBKJ6BxT5yjBa0oCZTVuk8rnpHthskg== 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=jpITDfRM7U2Jze6ESs4lS36slS67iQuUDSMEzftcL+0=; b=LAsFYmwcEBONOpURcgpYZCQsoEEKI3R5wn9BeiGHYRQxi5fKqjo/6SgTeSy11mqBA/3UgKjjdloVj+7Hc1Bhzls4RaGp1OqTzUD5Wi+36XvYpZD5lhRmgv1qPe1r5vTcejBh/3NF31nZv3QgbZl/XjMdO4aQ3YXaBYhPiAIjNS7lqyb+VtgPYR6GSnb+JuOo+PaWf3IHRSybi/0mLCVCaI8gyFXJ9TRcsKh6fuxIsFdSUF/LWl78f80R1i5XhBd00xHEczVMmHCKpS+zFjPDHhHwFfnSOtmOHLRJEpY8yessXWsDB4N6lBSoMeftz0qviSYofKtuwdPEYdCOiJwWSQ== 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=jpITDfRM7U2Jze6ESs4lS36slS67iQuUDSMEzftcL+0=; b=hOOGVyeLMpMDqLWX9osD4w7ImH+owFzoCwNgb/Jeo8IBok4QP4R+mS2txIaDiTdDSvwg7EDBsY+vcJe0a3qoTm/7Lw0bw4l9cyY9+xsXxLyy1J2UaWeJNLsFm0e9Hot0wkmdgc0xAgaxIEK0or3uovpJKJ0uVWHxrgvVqstWuzk= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by PH7PR10MB5879.namprd10.prod.outlook.com (2603:10b6:510:130::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Tue, 22 Oct 2024 20:41:03 +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.8069.024; Tue, 22 Oct 2024 20:41:03 +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 Subject: [PATCH hotfix 6.12 0/8] fix error handling in mmap_region() and refactor Date: Tue, 22 Oct 2024 21:40:51 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 X-ClientProxiedBy: LO4P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::21) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|PH7PR10MB5879:EE_ X-MS-Office365-Filtering-Correlation-Id: b9295443-7a62-459a-5475-08dcf2d9d862 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|10070799003; X-Microsoft-Antispam-Message-Info: m61Qhx2Jco9s4LTO3eRc8FDoAihAl773rKQR/xKo4phg+fV7wGWagLOQ3Tg/MdvgDr1tOqLwQa9qD8C4l6SmAgKDw1TkMDDEZfzLskgzojkZdR6lmU3R0w0V2w4HPZ/+6R1waEb5zXUU3Mm2sn6fIxOSEly1XzRo9l/0nUoOG6Sb0/npcvNvvd7HKLZ9oFLZcuf0KIV4woFgGOYwC/lNQFZgxuh2nLCldiU/bNNw6zU/PN0m20NAX52yzwlT+D/04EsSHV+90oLwQ9Zc1m5is3zeSrwYtxjo+n2CbRWUyXdEmTx3xtgxWmQzuKl2DF4mcOz2TfIFzUcVgwqDveF+ipaVV21CXZ7+nQ/xSQbW8QrwPpxpIaN5434NKpoyvuOj3Fl11mQp82jenXB/DT4kkEGFoJkoMzCaSvVkdMoT4jg6OE2bC/Vo37EKmK2PEBrgdZJnywKUuWi8u1xBkFp+LQd7e+4QEf9qe9ET/80DRH+pPPxZog87btxf5fv4N0TxIx9xDdcFgTBH1NL90ZgFVD67l5YxsSZJGtvdF4CWPfICqxgHsDWXyKTyskxx2puSD3BFtJkt3TEled6XOokVjblkZcxedNIDR4yT9XRPEw+K1asHc5j9LhxaKGDWe4LMG6NAW12BlyxMR2E+GeqVBB3iaxjYrSRcMCjsgh/SL/Gm2vJuBOg6GI2FWE0rcJQgFp4fP3YQwusYz4jqszqteRC94mBI+hqf4noFoY8n/WiKDfT1FZmPA7BkzcsM3PBuWqPanvUaZLqWbdxn+m3cRnubkFZq8liVdj3cjn4mBw9W10POrNZpINfqH8j8BssWmi77H0RL8MprJgSyoqCTO5We3ErBx3cdGzgBxKpEVlXSri+0zP/Rsqv1AoJ+VuqmGukiERNA3KEx0/sqWhpXWzVfzaJQpXZ54Uk53EaGSTsFKPCsrRC3nx9pQ2PPDke0J6OEMyEhR3jdQrHBlDV2HAYuaT+GBr6DOjvU51mjxs6uJ/kpaKrX3fpyvNAUIPwrGNjWIbwOU3qKIjPrpGc1EswRTJzWpaw6vSb55NxTHvnlZlmQQZWPWUd9X1Ko/2XmFOGkyUTtCRk8mOiFQUiIRv5ooAUzKeshWJuvcF64e8MiOc2AELWPOhDwTC8KyISD/GdNU9pCEWtEmDzRzWDJ7GzIChk16eLID9yHW+OzZagIv0yr29gKEmuO3Wjvzbuij9KjyJYLNktv+i8OrdVxlA/EG5b4rLZgd1jDfoqIpb9R5Wdc0SFNNpQQBF1PRKDdkMO/XoVFklmlebq4xucYTIx6//lV5zPn1gOMexenUYdPVuIaiwPYSLBiyAplVs6h 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)(1800799024)(376014)(366016)(10070799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xd8JniwwgdaJfUN1/jMRUaff8ReHVZl1giY+lWpKch65AdeVEMBtQlyOl4fJY0jHedck8NPaAyO33e4JvBUUAUSlRbNByGryLbgleqyP9xbj7P3e5ISejYrhqR367n/HAldK7X2lga7K5qLsje+PHUO6Qnq67sQzf/bAFkr0N2mgzLRog2dRgTYRsqfpvphvWqH4jBRD+gy11dR7WWX4tb21D0uvLyDV8CL7FxqtKvNLRfGMRzxUNuKAjMQISWD0rhgRuIdUt81H5OX48qr2vzNZXrfc/aVNiRiGz0cRBMao+1JmlU00KJxIIasx9mvcoTLl2snf7K7895yC2i49BTBS9VHMMpYOPKY1QURx9GxPp7omZ2IDDR/ITCq6AClPVpo/ZI+IFhJm9Hg4ZHtNawupbqxDloVoLXA0luhOae4zHZD1YIAqalZNU/usx4RafTCz9+9ZbhaiobxjrVxDeqhf29MPpSCCibgqpex8tU3BZa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BOAXC3BU5Hps97E6xEckuIRvRMau/wWNbPL2wDLg4SMRxNJfEK78MqXOCp6zSGww9tyy3b3Mzd0q94jjI1r3UODsiuqm7Ldnix7Qkk1f5PT/sivzriX1bGGw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1rcUn/Uctsg+C7lYLUUi6C/9emE1UJ4vEyU8QwUtkAI1FgsH9QWkknkMXbq4vKis2YMEmqkR9TiZEkfX55mofW27tVkJCgQdTIZHNO8HhYXIk6K/G3/YqNbHab3eX09Qrnx0Er1DHjOHfAC4J7kDptPUw5qvcgDiH1Ft/sGIqCXDHWhKRmlT16Oaszb26PIxNPPU0EYYdO8dKu+ZyfkxN0hTIqe9OvH1vFXeULeXfXZrnyFFkN40yjyfprAcSjxA7Wr7XQFJtU76A4AGzNQI9czR8O2+HOSwekeIl9LxrzjeBok/FLWGDj4GrrnTeLyUZinlg8dLq++GWOivufmcv1TKlNODV0uvNmsV4w+KD6DymqTL6+rSoeeBwQkwccuT91ZVL2sTal9A1zcjyjK+0I0Ims5v5+q9zM3yE0mmjP6HJPt+Tv2kxxf/6CKKg5wrSjwGfmG4KSIFWLBjwGnit0iHlGpXYLYqTdVsANMfYG4LRWbzh2liMHBBaAo+kn5P67i1WOvyAcL0u0jYzanvEB6tKgZOId28w+FSPjvInJQf3onBc+4CfUiQPvWmmtWDRnGv/VQXvcKtR2IniV9E38s9NKy84VGdCvZO/QxCiIo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9295443-7a62-459a-5475-08dcf2d9d862 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 20:41:03.2809 (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: 1knojpsHqgp32A9p1EIa4funUrSggGkAQCTVo3C7ra3xEK2RcA7sq1tIcmhAibUO9QiHGzJcrE8wHRtbHln4f3VF7Ig7/JcGfTaTT5mN/WU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5879 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-22_21,2024-10-22_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=967 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410220134 X-Proofpoint-GUID: Qgr1MidGYbvtQUveCIpGH215mYdrO_ZH X-Proofpoint-ORIG-GUID: Qgr1MidGYbvtQUveCIpGH215mYdrO_ZH X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BAA47140012 X-Stat-Signature: d76b9tf9fdfawazdsh8qfbqgqnpq5czt X-HE-Tag: 1729629659-670322 X-HE-Meta: U2FsdGVkX1+bad+PQTVoBACndwvzcq8J17mwc4hKWQr66GTU5kNgDog8PacBet78reHFSnyd20I7ry9eg9XM1zvY1X9ZLcnMyyrE+Yk54shyxs98xioVcYCkf6mox+kA/TyDMcxoZUvk2BAEvzQjhelqoaIYgcvTyTm3n3HP34N3JFR3jJzuk3AfxItsYbeEpIq7CSUkXGqSeqicrA45VrQX56ow8jQXr1MZlJ0K7dJOHezgWbdy0MFvvmdGV+e3Rhm/rivBPvag5c0TAhu7vv9H0hELzYPngRONm5HXTPi9IIo9qAM1ABd1OJ1RqBRKb162YcCmYwvNXai+VID9OVJLbVcDK1X3oB3hHj/xQER3V/Cp1Q4C8/DwR/DAk3Gs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19qpg/kv7GV2Xs5dUAGsM243RcPhqJaPbqXcy9zrUKWA8NV74e8W5XYWLwHhnD+OFaE/j1UJAigdDPpiFqtCDRJlGyR 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: 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 first four patches are intended for backporting to correct the possibility of people encountering corrupted state while invoking mmap() which is otherwise at risk of happening. After this we go further, refactoring the code, placing it in mm/vma.c in order to make it eventually userland testable, and significantly simplifying the logic to avoid this issue arising in future. Lorenzo Stoakes (8): 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: resolve faulty mmap_region() error path behaviour tools: testing: add additional vma_internal.h stubs mm: insolate mmap internal logic to mm/vma.c mm: refactor __mmap_region() mm: do not attempt second merge for file-backed VMAs include/linux/mman.h | 21 +- mm/internal.h | 44 ++++ mm/mmap.c | 262 ++------------------ mm/mprotect.c | 2 +- mm/nommu.c | 7 +- mm/vma.c | 403 ++++++++++++++++++++++++++++++- mm/vma.h | 101 +------- mm/vma_internal.h | 5 + tools/testing/vma/vma_internal.h | 106 +++++++- 9 files changed, 591 insertions(+), 360 deletions(-) --- 2.47.0