From patchwork Tue Jul 11 17:50:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13309283 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 53775EB64DC for ; Tue, 11 Jul 2023 17:50:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A36736B0072; Tue, 11 Jul 2023 13:50:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E6236B0074; Tue, 11 Jul 2023 13:50:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EADC6B0075; Tue, 11 Jul 2023 13:50:48 -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 6CDA46B0072 for ; Tue, 11 Jul 2023 13:50:48 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2CA34120286 for ; Tue, 11 Jul 2023 17:50:48 +0000 (UTC) X-FDA: 81000071376.02.C20F392 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id CE7841A0016 for ; Tue, 11 Jul 2023 17:50:44 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=U3BvEiem; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lNfTaOrA; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689097845; 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=Rt/4sLdDmPq66oPK56lMe3m8JmEGzuPzXCimo3LL5wQ=; b=M3jPHC3xrpr9KA5h6NmjBD1iaJCwDpsSsJHtAtS7GbvYgPAgkh/BZBkQ+VKyVekjEkf2p2 zteOGlHC4j5CEjxqCamcwOKU3Lr7eaKTlyQW92lsLUtdsxVYeMgOLm+tFDawkCIXinmw7+ attayp8lwFxnkztec8Qo2LwZ3w1An2c= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=U3BvEiem; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lNfTaOrA; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1689097845; a=rsa-sha256; cv=pass; b=pt65oSf41P0FXc/vcBHLm/K5fN4CUXVE8DmoixPcPaLUUro2+qI7iRR6xte1WVq+2Ly6Gg hZ5LJ2RlCC9XIlNE3cscH//p9AJIOEA7ppE9Ec+FpPDvflfMYm3kyBMUt/Veb56TS2uTlc +egVw4bE2gcn24VH9/hmcoDl2hf8XYE= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BFSJ65009120; Tue, 11 Jul 2023 17:50:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Rt/4sLdDmPq66oPK56lMe3m8JmEGzuPzXCimo3LL5wQ=; b=U3BvEiema5Q/CjSeSOT6gG31iqDVVbnTuGC9ZYtIoDbxd+tIl9W9adpMJn8tHZyZWg5g Qo29ZXf0ciCAWh6M2bYpzMLVk0aVFD7bdcbpw67nA0uIZ/TPxcNrF6Bzfr0uP963+moU xxlvgCj5jtWOWLuUvX4jKnFU2dhHrJdLpHMS5JGHht7MTaOFnz9SUNo35OXHoEx/avg4 s0OS8DAxOzVAzCt81jIXsCWrcx9F1lShygsmtlhiudzpNSGm8L6wVq3PkMlCuZIFsoUA dFAl4O45eA50O7T4oMsBPfaKNB6k5gaPivLoyqeLjtTjITt+8/dDKweOq+j/3h+Eiden jA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrgn7u99e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 17:50:40 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BGUdNG008276; Tue, 11 Jul 2023 17:50:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bgdmv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 17:50:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXvhtdfUFlLaJwSxxr+JryYhNQSN8qY5KdfIHaNJK8gzbSEnb0kW3gJD4tGq+ef02x3vfvZxs5BN5gTugJj4QItVR1Y2bfG+H0CbrLMHUvcKUt2Daa6zthtwbOe7ANizery9mzOcSx3NaAAmZV8avSVkD7z2thec/g9a4PKRAu+/b13JdZqY5YtUFsxjmYAdHowc1TSDHn2OjOMvqYRRcaAeaYiuHdeBAbi6CGktJ+Ow3mnUs7zjLPzFGc7jC0YxhbIPUXTTqFGnqIQI8foDDND+VS23vyQ/YTVp/mHTH7NW+NjDGzcDTA3vaYUJkCNXjW0sF1SNRm3LUHrBuu4SWw== 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=Rt/4sLdDmPq66oPK56lMe3m8JmEGzuPzXCimo3LL5wQ=; b=dsDn9Kr0pTcexTUGfBOtZn0E8WNIYeEPCP0l7wwanQQ0TjmKSFEiqIuQQJuQJz3M+ZYIkuuwNNX/kQf60chypM8c3Ptram8tvjDVDWtE9J6MDBxsbgOg8+E4UfTGs6SzxWnM+1drVgdBkfNKCx1I0CiumWz/hs7zQNqnYS43n0/7GICAKbSrn2wU61VY4BCbA3Bl3uQXWVPT3fz04A0PJk3oZujGJ/rFWnesdIIc9LyErACEOrIvs9z3zwJzd2q5+UktXZax0z8AbrrpZ8u5Sk2RRAjeNzO6ID1ubqWZ2iIwO3h2ZCv6ygC1We+TFS8bom2iDsNBzQYqR9tS5AYWBQ== 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=Rt/4sLdDmPq66oPK56lMe3m8JmEGzuPzXCimo3LL5wQ=; b=lNfTaOrAZawHrw3sUOhaC8jzEWkY5rLL2ZmDyoUTDSfaBpiSE98DyYo6trj6u1JGd/hS8q3HECJDIhZMqBjGOLUjIpzvxkka6BrnHzXex/Je7qtJZA/rHCFxQD0qL8ud48Ixt7mBPcvTQxdGhceRDy5xaD6+4XGL7ePqmqc0Ics= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CY8PR10MB6802.namprd10.prod.outlook.com (2603:10b6:930:99::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 17:50:37 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c370:eff7:9ddc:f188]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c370:eff7:9ddc:f188%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 17:50:37 +0000 From: "Liam R. Howlett" To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: "Liam R. Howlett" , Ryan Roberts , stable@vger.kernel.org Subject: [PATCH] mm/mlock: Fix vma iterator conversion of apply_vma_lock_flags() Date: Tue, 11 Jul 2023 13:50:20 -0400 Message-Id: <20230711175020.4091336-1-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: YT4PR01CA0373.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fd::15) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|CY8PR10MB6802:EE_ X-MS-Office365-Filtering-Correlation-Id: dcc972fc-3971-4698-4e89-08db82375542 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yFLQ51ytCaQD7Vlq0vOJK9f7LPv9YwzdbLqtK4kpX87sHg7FNmv4xC/lpB+b3svtfRV8MwKmjjafmHdw69YtXI5SPJq3ZaxK80DAEFXN4IPj6WDhFgdj3flPI1y2VLRbuPnICZiiIMEduxSwTZxuUfl3F1i/S0EcrRllA5L9I7qj+rUpDLrkgGrLraWdC9fH41vqFboptEczzqx55wOcs+cdIzVowDTxZUS4+DcxQSz6c9LZdNJ6GvRfU68/mOd4wO7RRCUkDXbfqcPG18L9iVD2f1rajn+wuLlq0Jp+O8tF+uJ3fsulGVOR9J2LtdqH/4Cpx6mPyGTZKhOzgk0e7B1WMcbscJWFfsFFnAqFWS2wcWLmvtocsah10h06MOwPeRkFMid3Zz3NjlBDDje4aH0P++AmP6HzUIJhsxpv7BOWTxBtJXTCmee7o1m+bjmPQ+w1uQJOtN9hkMRp2dHTElo6OwdK0CUopFtSVbm/EHdVbrDOx39SL5D7qDeuq2KFnUX0vWJuSSBFX94ENB1qnNw0yUQeynD3kzlMXwoxS1o= 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:(13230028)(366004)(346002)(396003)(376002)(39860400002)(136003)(451199021)(86362001)(38100700002)(36756003)(54906003)(6666004)(6486002)(6506007)(26005)(186003)(1076003)(966005)(6512007)(2616005)(5660300002)(2906002)(316002)(66556008)(66946007)(8936002)(8676002)(66476007)(83380400001)(4326008)(478600001)(6916009)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TYh8kVxB4cVoTo4+5ulvQ30CL+ECy7fZ3zHAHUrsqVJtWhp8U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Apf8SDMMfLap/QXuIcAUqV9CozHrMbA9KtjKxhXRcl6SBCBFI5X0pOHyt4RQfuvzGrqJRg8ZvXJJu65N2Ziilmi/8Dwh4k8kPAP+p8TN5xUuSv4PqZarqaKwX+4VZf3P01EwPo4f4mNsjNWZCKi5I4uJFqiRM9u87Ypupik0TWKAALmuM6D37BBz1TegTowmL4zJ7ihbPNO/w0+32/UsXSUyrZyLf8p21zGhkhZ0K8yyql1QxNHrinqVu1ZwxhBIx/BAlG3Bu4+ixkwbtlXVErEHcOtuLchBmgHzi6mQONYc61DvC6WwZ+ISAhkHFGIrGyROZBcQ+uX2kysfJoSKxKmWzreXHwNLXCg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcc972fc-3971-4698-4e89-08db82375542 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 17:50:36.9680 (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: pIvOz0iDiTYoRciF5/FRUa385dlaJU9DENYI88Jf7GxKvSQ8OcW8h96DxprRHevRfQSdZRQywVAuCPVOFRnFsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6802 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_10,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxlogscore=853 adultscore=0 suspectscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110160 X-Proofpoint-ORIG-GUID: jAZFZ5JEC0lsmVL1RUgyx46UnCoKPmwH X-Proofpoint-GUID: jAZFZ5JEC0lsmVL1RUgyx46UnCoKPmwH X-Rspam-User: X-Stat-Signature: rj9qf376iwct9jdzuhmmepjeyeca8zau X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CE7841A0016 X-HE-Tag: 1689097844-26828 X-HE-Meta: U2FsdGVkX19RtZ1RTXc6qkuBGHNOrkNne6oCQL5NxiruYUBphGYbLZUq3LKlgxd6JmdL2150qOfBZzAL6F4+Aodg7TCpO61Tkozf0YYVhvgpMX/b2UMNd1Sucap4vZoZEue0Iora3PGqy0T0O3A7OqXklHQjrUjpY3mRLjiAjwfVZgfCenz9xNwGpNQbKYcL/oGcaF9MIO722newYs6pQvftzYHYRi+64QD+JQywLgNTXmm9XYBSoyIYJPL8nPfw99vvvTQuL6qdNsliaP89uW595ICtX1aKkxOwnCB3hYVHz7l0KALuPBVQEChGs90bFhskDbP+5bJQ4bF4w4y/uChmfEcCaVzNk9+90KHu9fcTqcr6HTU72XgMFOUZKC03gkb/3u5uOsdkcs6Ud2b2/XYfryI+W7IqcuyLJn67MhGQxSviCtV0Ecr4BB6KLtDAp+Ka6OpZDdfEK2rDusiPUi5I/z7gP38a75S46NXzLJat1DDlN8h5mBr1FBKUcrERKAScmrI7rsLEuPjgSdFI3hZEKQ2HYMRyf4brTTj5+gTgngVGJ/zO0e4CLUVa7fSFsix7CEBprqkFL8dewcXVOLM/58CjjCz3k9LQhIBs6EtWALe/FRjqmjUYx4Y9rk2+YSHPaHj27bkkPxP1+6HkeqOpno1SXidJEjRXPIYPQSzCX+aajh8Dj7qXqql+khSvjMvuupcReiXPLV+D28oD0FufX6YcxWg2GmL940NtIqAJvtsJx7V0qkfpwrIwjZWqprh/OHxtcwFfNLO+KqIlWAvj/tqERuCsUsUZCBI4AWoMXKed2WAXRO1IZfzTJmHwYd7mnsPentvZxi+PVcBzVERul4nTBVLlMo8sW2mu2JxFK3NfbUiwvGRghK1CB+gUbPXnG9wVBzRZP7eQ/rNHLqJZoggSrcYqWpWPlWiaJwEC+vn04+ajR9JSCeXNfY8ohS77JJzP+ijtW6amjG1 c6WOymyJ NKihe0e499aaYzhG2OGpgJOPhfM4W9GmE+baG86ZeQnILWgUZYZbdjnSoceNS/IMG2hRVEBqc1HspcEc2KtXLko6sOj5q0E9BTS00KGOP3L/QBjJf6Hf6KTWnOCW2j2f6jIhZUz1G88c/S30xR7c6kBU6UcKwDXEkDdpGydwYNDFBAaSaUudnp1zhAPgPcVJvEqqU10FhVGDwyGWK+8cHLwWJotcmuESIOn6WpulaGwRDvAhtyIyBVLphBFUMz7FI3xJahl4UCkP2WkMdbUz9zQrjQoMTSlEuM5pgyulYR4zsO2Vh42Axq6/PNKSTJcAWj+54DM+DgZMSydl3e3lgC8JD73JEIhIIyc7cvAWF0HndrmLeudl4qTR3WJYor/aLlO+8SmrgopieealtBCIA2yplsA7GJjsWdCFgcSXJcfm9HeBmBjGob7+arO892ebTHAPWm2rfi4Ng6CTt1K7b9z78nBtS6WwcLsFbRrzDR6crmNHPQzUyHcX3KqCkj/gAj472ui6COvmLtsdVtfrnve923Zn3AMtQJs/2 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: apply_vma_lock_flags() calls mlock_fixup(), which could merge the VMA after where the vma iterator is located. Although this is not an issue, the next iteration of the loop will check the start of the vma to be equal to the locally saved 'tmp' variable and cause an incorrect failure scenario. Fix the error by setting tmp to the end of the vma iterator value before restarting the loop. There is also a potential of the error code being overwritten when the loop terminates early. Fix the return issue by directly returning when an error is encountered since there is nothing to undo after the loop. Reported-by: Ryan Roberts Link: https://lore.kernel.org/linux-mm/50341ca1-d582-b33a-e3d0-acb08a65166f@arm.com/ Cc: Fixes: 37598f5a9d8b ("mlock: convert mlock to vma iterator") Signed-off-by: Liam R. Howlett Tested-by: Ryan Roberts --- mm/mlock.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index d7db94519884..0a0c996c5c21 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -477,7 +477,6 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, { unsigned long nstart, end, tmp; struct vm_area_struct *vma, *prev; - int error; VMA_ITERATOR(vmi, current->mm, start); VM_BUG_ON(offset_in_page(start)); @@ -498,6 +497,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, nstart = start; tmp = vma->vm_start; for_each_vma_range(vmi, vma, end) { + int error; vm_flags_t newflags; if (vma->vm_start != tmp) @@ -511,14 +511,15 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, tmp = end; error = mlock_fixup(&vmi, vma, &prev, nstart, tmp, newflags); if (error) - break; + return error; + tmp = vma_iter_end(&vmi); nstart = tmp; } - if (vma_iter_end(&vmi) < end) + if (tmp < end) return -ENOMEM; - return error; + return 0; } /*