Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2919625rwb; Fri, 20 Jan 2023 08:56:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXuR0tYLijXEM96XMYpO8c5HWfcPV5MPQV24DG9+WWCOHG7Uookw7sftufVKeRvmwbapHN5Z X-Received: by 2002:a17:906:ad82:b0:872:e6fd:1c79 with SMTP id la2-20020a170906ad8200b00872e6fd1c79mr15627372ejb.77.1674233604986; Fri, 20 Jan 2023 08:53:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674233604; cv=pass; d=google.com; s=arc-20160816; b=boDBttNuhFFOj8roGOcOJAPH4Z2RU3VbIdUygXYNtPlDzFpYsvtGOtraRilU1jk2DT m+ErzdCNImSpwOJCxW4hlg8pf88VMYv1kd4G8PUiTbXMEKL29Hl95TlfvBEEr32HD+83 JQRnKAyIlQLki6N2wiRXW2ZTo3yJUtKYZQlhBb69cp6U/+6GD59Er8Bh1cTytRJ3dwf2 tzXfwvsBM1rC3ZHK1y/kDsWNOFaiXW00eT2y8P0p7BJV0bbN9qDij4WFxNI+0nV3fp4E BK2X+SaD93maMdga7iwtcmMTPgUZt821ta35ixtmmeY8Fj0oJZj0bIHk3KVGhes/z10D HiFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=wtPp3eN9iK5NopTe9WlgicVNohmSkC3cxheIrIE/maw=; b=CIAb6IlZtMXHwJEwcZgle/Q5zwErDhZvlvhHyl3IX7wrXRFL56+Ltjc+Ik5vBKOY+H 7M3PbiPye3+HyCPrGEF2cwJHkT5+uzDmOHzeuZPNm17QkwBcgG1ZGxIlIDlSPW7rTq2c o1HQ63nhqhksJDPBE3d5fwfMPKP3VAcbokURLWqOj8sseniGnlozxd3jm6RULfus0Gox IKqEskLrW+BhCtt1fplzDk54XFI2FIPyRMhMATzU+BVYx7xYg2IrVLTbBbPgnywr6G0n U0ntVNJ6piUyhM2C6vKmLvkeTsXu8o92qbOfAzYsBdnmec+nj1Y2LAam3kDVeKEeqydY N1FQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=y+0jGYt4; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YYhzqJ+6; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go20-20020a1709070d9400b00855da26bccasi22162947ejc.974.2023.01.20.08.53.12; Fri, 20 Jan 2023 08:53:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=y+0jGYt4; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YYhzqJ+6; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230210AbjATQ3x (ORCPT + 50 others); Fri, 20 Jan 2023 11:29:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjATQ3w (ORCPT ); Fri, 20 Jan 2023 11:29:52 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE1E6E42B for ; Fri, 20 Jan 2023 08:29:09 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30KGBgNo011451; Fri, 20 Jan 2023 16:27:57 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-2022-7-12; bh=wtPp3eN9iK5NopTe9WlgicVNohmSkC3cxheIrIE/maw=; b=y+0jGYt46jBurJUHEwgqiT2SRKNI87uBcqy7XcZbeH5z1aT2kjZvXoSKmOQMz+eOCeOe voTcqZNBq/LTPekg5bILRQqtM26hS+Zl1OxkRkZSvsahjm57qHflUmZ1ki4A0cAz6sMt MON6TkoXGd7YnrbmenYcFNnukZthGYxwHQ/SulxzCi0Wg5e7kF4zGapojoRF7WpWpUWe As3JDvNU4golU+0zzpPtrBAVaFdC+sLWPYJckmFWH+j6l/H+opNcg/nsS6m1IGUyM/pn TjMtnYlZ8LetEuHhEZeeuQHDMmlATi+2N3+RFevPV+6Kg+XpuQN8i8bn4i5wsouGCRRf rw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n7895aqqh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2023 16:27:57 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30KGNKAa004680; Fri, 20 Jan 2023 16:27:56 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6r2w1fg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2023 16:27:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JUBRLak9yXOzp2ayTdvQoBeEeW1oy17Lxg9iKyyaRcgiwGuZHUIz/xyIhjwmTu0aA/zPv+eFqugSI5s+XTCF02UHnZ1MG4oS1DzhaUKjvFoT2Zr5XSRueJOvJKOnMSpStuHn7XxMyP9IFam+fYHdBF6b/ucF813O31q6SdzH10AXJj24i/gLTMdwRRH9uQIowhblYC6jljnn5/qhRIwZRcV8ExXK6YpQPfbCfSd6E3JVV8GR5ciHfZeA6pBTMH8A86pqHG8IBSuXP3KjOqDgoSwLSfIjwksx+yWdE4lNrWNZDmxAfNkJcbgl7TsNbW7uLISJnudlYjPPm/h0NWoi1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wtPp3eN9iK5NopTe9WlgicVNohmSkC3cxheIrIE/maw=; b=VFsYBKDxfJLYFob4VUmELIWengWQc8H2/7ifnEastdkg8yDXv2y45dEb3s1bnm7tCS0Cpdh1VcYa+9gHM1U41OHJ300s6B38ypFppV2eC/HLAG96oTGaHWxgwyG7MpU7s1mO6TF7tP3vQtJRPvAG/IlyidnAx5dkkCB9groxn+tI4Dg4pAkRDe/gOQek+Z7cQWKMUKYHg9/1DZXlfbTnAaYIKN6gsB8HZ7AzkPr/32DH+27BfZJ4IWCipNQOJCuUGjCf87BiadEBR3kk1KH7nWK2Rc1xkAxpmRiY/Jfs3zOyHHkosTmKyOj5h57yLvNpvezXofyDRo4QKLT8FbueJw== 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=wtPp3eN9iK5NopTe9WlgicVNohmSkC3cxheIrIE/maw=; b=YYhzqJ+6qalHpNebx/Pvb1x3XNpQ9syPN44O1jDsXr4Kvjo8jtEKHP0xVWTF3Uy+KGTe1bE1K7foI/giD44jiaVWDAh9WgBOjn/1O9b1kZs1lNgTZy1jUmOy0xhqD7YcSdT5uRGBMe8o2CGFCDKtxA8QXyXkezpWXDiAhLzjKCk= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SN7PR10MB6619.namprd10.prod.outlook.com (2603:10b6:806:2ae::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.7; Fri, 20 Jan 2023 16:27:54 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::7306:828b:8091:9674]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::7306:828b:8091:9674%5]) with mapi id 15.20.6043.005; Fri, 20 Jan 2023 16:27:54 +0000 From: "Liam R. Howlett" To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , maple-tree@lists.infradead.org Cc: "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v4 17/49] mm: Change mprotect_fixup to vma iterator Date: Fri, 20 Jan 2023 11:26:18 -0500 Message-Id: <20230120162650.984577-18-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230120162650.984577-1-Liam.Howlett@oracle.com> References: <20230120162650.984577-1-Liam.Howlett@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: YT4P288CA0053.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d2::10) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SN7PR10MB6619:EE_ X-MS-Office365-Filtering-Correlation-Id: f8f828d7-8095-4dab-af8f-08dafb034724 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MDZmWyhd84Pb7/yixS2jJ3jD4fbugUOXEWyhGzZgqrwEYm4I7IJe+6b/y7327ymTZ5Oipu9lFNJ5Pppjo8CdaRi05lTNHhguOpAcs5znsNFMz+h6eugW2qJnJANLKTWtuePp6JQkfeo37U+zU8BeP3JQo1C47WQ7IiX0WB8wLFUU5vAew/hUGu2b+tiC/4Ct6dFYNcjfYqC87SwyEBByWY4+W5mnP6EtZTvg++F+XR/UuHJq0whgMfHQqeOEdO3ErCbq9tuTf7Ba5POzuhDaaLK0ANeqS3wFeMesoztBDbGZOjf9xKO2bZ6nY1V32Yo0aF5NrSlp3bvaOurScwnMI2yOHRo9bMLUT8g7cwP1xrHArlb9ZKJoBuxfPZhwB5WiH2kndYqvTcM3zCkvmeMk68pTPSJlOe4nFcyPgAQHFSI/PofuXJAwqUQalshkFeB6d6dIR41F3S+ih07dyiMGBajxqB67PgSuKuaPEW4t/ArTykO25VWnn5QDoaGN04wXFNK1g3vb7Js3QA1ZU5bR44sP7f1pl5dC1t2zKPQDR94KXnwaqpIrlfqZetJyvyeJEeCAmkuj8nQKBEnrN56IVsJz6avTGZoHxHxnby9vlXKww4bb4uJHBv0jQdvKLC9VMaHbpZhWSS6BeGyQnE6+HQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(39860400002)(396003)(366004)(376002)(346002)(451199015)(83380400001)(54906003)(86362001)(5660300002)(6486002)(2616005)(38100700002)(8936002)(478600001)(6512007)(41300700001)(2906002)(107886003)(6666004)(4326008)(8676002)(66556008)(186003)(26005)(316002)(36756003)(1076003)(66476007)(6506007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zUEKC/rWe/a/xKFTvv+3aoPiuxmozMYJNEwvZsKRj0u1IK7zyd18sDkPUsqz?= =?us-ascii?Q?vBBLLsl46My+G+GjgV409rFRouYM46mYtXhVOKsR2dce1DW1TsDkgtAbm2pl?= =?us-ascii?Q?YcPBrTZZu85i6cSCSszrcGMWmsjMlYQWx7LTexv3Il0UoMvbK6/u3H+LX5DC?= =?us-ascii?Q?j5x0ObSNXR6WThnKywshvXDdpsBp1jHrzTHw7x249NqO8uGRXZvE1vKJD/U1?= =?us-ascii?Q?dBWZ/J9CIVcWhN/rzDKNp3krNAYUo1DcT/0bKYvIJkUP+aH5r2XeNKxxKaw8?= =?us-ascii?Q?K3Y/d1Litmw/22vxMTWK+rz5in0pjT64+Ob8iY488p2/FrPnfLIi/uztpK/t?= =?us-ascii?Q?ZK48B/tpqvNSXEkbGj5Ct/uBwSTo7qIBfADmnw4U17pr6lO6x3sGpRnje/0V?= =?us-ascii?Q?Bd/jwT0FlldSc5lEWp89XWzQpJZfXDnU7vZulZrFvr+0XkDfaHAikLbShENQ?= =?us-ascii?Q?lhK8h9hfvEb06vN5hIiP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ekWBzWR19CtTVD5XnWPvUy72OBZpEv7ipd2VC20PGdgm3riLuYTD9x4Ca2vRn4V/q3mNi3MnRgPPP5jThQSs8S18niI2vOwxJ0B5nM5kYgUEJZNKkpJYFZ7gT1KriP8zdd6YV4swYXVSC/2KvpEk/MY1cbP2Lli/pVLchTo1XbH+Fuu+R+4oHDbCNUGqSKYl9jFYESXvSkNOz+wworR6f6G4Xf9PJycsiIwJXlih0oGg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8f828d7-8095-4dab-af8f-08dafb034724 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2023 16:27:53.9343 (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: fngPoPCqB1K0KlLEdnb4KyD8+fhSuzFUnzWYVSAe49NZe+cB4mxpBz9hWgsoOVAQjSI1Y/FrKuThbG1shKszjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6619 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-20_09,2023-01-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301200157 X-Proofpoint-ORIG-GUID: LX4velZOPk1AdnYDc9MUz36b4KoaiUDT X-Proofpoint-GUID: LX4velZOPk1AdnYDc9MUz36b4KoaiUDT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Liam R. Howlett" Use the vma iterator so that the iterator can be invalidated or updated to avoid each caller doing so. Signed-off-by: Liam R. Howlett --- fs/exec.c | 5 ++++- include/linux/mm.h | 6 +++--- mm/mprotect.c | 47 ++++++++++++++++++++++------------------------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index ab913243a367..b98647eeae9f 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -758,6 +758,7 @@ int setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_expand; unsigned long rlim_stack; struct mmu_gather tlb; + struct vma_iterator vmi; #ifdef CONFIG_STACK_GROWSUP /* Limit stack size */ @@ -812,8 +813,10 @@ int setup_arg_pages(struct linux_binprm *bprm, vm_flags |= mm->def_flags; vm_flags |= VM_STACK_INCOMPLETE_SETUP; + vma_iter_init(&vmi, mm, vma->vm_start); + tlb_gather_mmu(&tlb, mm); - ret = mprotect_fixup(&tlb, vma, &prev, vma->vm_start, vma->vm_end, + ret = mprotect_fixup(&vmi, &tlb, vma, &prev, vma->vm_start, vma->vm_end, vm_flags); tlb_finish_mmu(&tlb); diff --git a/include/linux/mm.h b/include/linux/mm.h index 956025940053..bd0017ab13f3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2197,9 +2197,9 @@ bool can_change_pte_writable(struct vm_area_struct *vma, unsigned long addr, extern long change_protection(struct mmu_gather *tlb, struct vm_area_struct *vma, unsigned long start, unsigned long end, unsigned long cp_flags); -extern int mprotect_fixup(struct mmu_gather *tlb, struct vm_area_struct *vma, - struct vm_area_struct **pprev, unsigned long start, - unsigned long end, unsigned long newflags); +extern int mprotect_fixup(struct vma_iterator *vmi, struct mmu_gather *tlb, + struct vm_area_struct *vma, struct vm_area_struct **pprev, + unsigned long start, unsigned long end, unsigned long newflags); /* * doesn't attempt to fault and will return short. diff --git a/mm/mprotect.c b/mm/mprotect.c index 6ecdf0671b81..42ceb0548754 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -585,9 +585,9 @@ static const struct mm_walk_ops prot_none_walk_ops = { }; int -mprotect_fixup(struct mmu_gather *tlb, struct vm_area_struct *vma, - struct vm_area_struct **pprev, unsigned long start, - unsigned long end, unsigned long newflags) +mprotect_fixup(struct vma_iterator *vmi, struct mmu_gather *tlb, + struct vm_area_struct *vma, struct vm_area_struct **pprev, + unsigned long start, unsigned long end, unsigned long newflags) { struct mm_struct *mm = vma->vm_mm; unsigned long oldflags = vma->vm_flags; @@ -642,7 +642,7 @@ mprotect_fixup(struct mmu_gather *tlb, struct vm_area_struct *vma, * First try to merge with previous and/or next vma. */ pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); - *pprev = vma_merge(mm, *pprev, start, end, newflags, + *pprev = vmi_vma_merge(vmi, mm, *pprev, start, end, newflags, vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma), vma->vm_userfaultfd_ctx, anon_vma_name(vma)); if (*pprev) { @@ -654,13 +654,13 @@ mprotect_fixup(struct mmu_gather *tlb, struct vm_area_struct *vma, *pprev = vma; if (start != vma->vm_start) { - error = split_vma(mm, vma, start, 1); + error = vmi_split_vma(vmi, mm, vma, start, 1); if (error) goto fail; } if (end != vma->vm_end) { - error = split_vma(mm, vma, end, 0); + error = vmi_split_vma(vmi, mm, vma, end, 0); if (error) goto fail; } @@ -709,7 +709,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len, const bool rier = (current->personality & READ_IMPLIES_EXEC) && (prot & PROT_READ); struct mmu_gather tlb; - MA_STATE(mas, ¤t->mm->mm_mt, 0, 0); + struct vma_iterator vmi; start = untagged_addr(start); @@ -741,8 +741,8 @@ static int do_mprotect_pkey(unsigned long start, size_t len, if ((pkey != -1) && !mm_pkey_is_allocated(current->mm, pkey)) goto out; - mas_set(&mas, start); - vma = mas_find(&mas, ULONG_MAX); + vma_iter_init(&vmi, current->mm, start); + vma = vma_find(&vmi, end); error = -ENOMEM; if (!vma) goto out; @@ -765,18 +765,22 @@ static int do_mprotect_pkey(unsigned long start, size_t len, } } + prev = vma_prev(&vmi); if (start > vma->vm_start) prev = vma; - else - prev = mas_prev(&mas, 0); tlb_gather_mmu(&tlb, current->mm); - for (nstart = start ; ; ) { + nstart = start; + tmp = vma->vm_start; + for_each_vma_range(vmi, vma, end) { unsigned long mask_off_old_flags; unsigned long newflags; int new_vma_pkey; - /* Here we know that vma->vm_start <= nstart < vma->vm_end. */ + if (vma->vm_start != tmp) { + error = -ENOMEM; + break; + } /* Does the application expect PROT_READ to imply PROT_EXEC */ if (rier && (vma->vm_flags & VM_MAYEXEC)) @@ -819,25 +823,18 @@ static int do_mprotect_pkey(unsigned long start, size_t len, break; } - error = mprotect_fixup(&tlb, vma, &prev, nstart, tmp, newflags); + error = mprotect_fixup(&vmi, &tlb, vma, &prev, nstart, tmp, newflags); if (error) break; nstart = tmp; - - if (nstart < prev->vm_end) - nstart = prev->vm_end; - if (nstart >= end) - break; - - vma = find_vma(current->mm, prev->vm_end); - if (!vma || vma->vm_start != nstart) { - error = -ENOMEM; - break; - } prot = reqprot; } tlb_finish_mmu(&tlb); + + if (vma_iter_end(&vmi) < end) + error = -ENOMEM; + out: mmap_write_unlock(current->mm); return error; -- 2.35.1