From patchwork Fri Aug 16 11:13:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bert Karwatzki X-Patchwork-Id: 13765997 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 40B8EC3DA4A for ; Fri, 16 Aug 2024 11:14:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38BF98D0062; Fri, 16 Aug 2024 07:14:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 361E78D0070; Fri, 16 Aug 2024 07:14:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22B4C8D0062; Fri, 16 Aug 2024 07:14:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E0E418D0070 for ; Fri, 16 Aug 2024 07:14:27 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 89C1BA93C3 for ; Fri, 16 Aug 2024 11:14:27 +0000 (UTC) X-FDA: 82457850174.23.4BE2B8C Received: from mout.web.de (mout.web.de [217.72.192.78]) by imf23.hostedemail.com (Postfix) with ESMTP id 899F0140010 for ; Fri, 16 Aug 2024 11:14:25 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=isRfwnJm; spf=pass (imf23.hostedemail.com: domain of spasswolf@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=spasswolf@web.de; dmarc=pass (policy=quarantine) header.from=web.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723806807; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hyLy5zcuz4oq+TGeFENweUivt0Um5vv9+zRVy5K7Dk4=; b=yj6oMomoZgacpylZJYn2ti80oPpv+DnNjNmHqx/AyjNC8/lI2LGAQOt926pnKX9rZSArhq u3sjQWPI9qzDViB07X2gJckN93uFfI9nh4zurRFzrLoCZBxJbg6AA3Y7mvFGHAMO9a/NIH bOIhpYJ7CJolHkRu1FNsZswm/tWINWU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=isRfwnJm; spf=pass (imf23.hostedemail.com: domain of spasswolf@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=spasswolf@web.de; dmarc=pass (policy=quarantine) header.from=web.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723806807; a=rsa-sha256; cv=none; b=Xl1QrmdICamDPf+bBYlJ2kPR/ErdDtaH1dielvUUVYWIn8bt4kduoFDgxokvoiSNNQVDBy n81vpkEr5F6XEwWZffO2FYmSLBpVyyZNs0knej5LMfO+AbCBP3Mb0XpXd8DRpv0xobVqCZ SlS2kNZnSOUj8d+SmiPTMOPr2vrsx2I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1723806858; x=1724411658; i=spasswolf@web.de; bh=hyLy5zcuz4oq+TGeFENweUivt0Um5vv9+zRVy5K7Dk4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=isRfwnJmdoIjdoxSXjRx1ZoOuxuydYKOM53dmNbr/J8Hdsa9t64eLYIv4NGyNM5Q 2EpEg/PT1iMa85RnmPd5GWHFbYHslvIhUs9kOsxI3VWROgifb0YX+8ToDLs8t+GAP idIz8diiz6X++gTr6PYCtOoI+b7D6NJy4bs2arEh4U1PTvxyDl962zvBEqBLFJ9sz zrv6AvuF83dor92u7kJJiJZRABYiBmVvYtmQh+B7WEskiYFgyKIg1kjorIPojmgw4 gPYjjsWTdyB6mlC7000R9/24PjVIwCq/U6acU0XT41BII63oG6+DbJmSTbH5YAV20 XAMLRX6ldMimz74o/Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from localhost.localdomain ([84.119.92.193]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MvKXb-1sNFZA3G6b-0180Kx; Fri, 16 Aug 2024 13:14:17 +0200 From: Bert Karwatzki To: "Liam R . Howlett" Cc: Bert Karwatzki , Suren Baghdasaryan , Vlastimil Babka , Lorenzo Stoakes , Matthew Wilcox , sidhartha.kumar@oracle.com, "Paul E . McKenney" , Jiri Olsa , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Kees Cook , Jeff Xu Subject: [PATCH v5.1 01/19] mm/mmap: Correctly position vma_iterator in __split_vma() Date: Fri, 16 Aug 2024 13:13:42 +0200 Message-ID: <20240816111405.11793-2-spasswolf@web.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240816111405.11793-1-spasswolf@web.de> References: <20240816111405.11793-1-spasswolf@web.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:+jC36m1sRkvD5Vpf0wAeR0fwYwAGuLGXzoRuZyjrkTvLj8USB2Q nwExSus+XkiTkJ34jIqqtkqkt3AO+PPmAXiqZW3RgRrAhEoDWGFU5Pu2G7RFqxKwzSAmdNJ BsjgHW2psegBvLOjhAiyuX3tDxwTnsAU3qt+LoA681DQK+0eHEkUA58ufkSG58CFxlRpR8Y f2U9vLsm0g0bfzfuBOn+w== UI-OutboundReport: notjunk:1;M01:P0:xlXs275Tsxw=;5tLYSClCHU2trUPg31ml7gJdKMK DPbAa4ogoE6zX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2Kwv6MaxlH1PnHka1euusThlFPnumRjMlAdgyIS4VrknRYIrB+v95FngiVnLNQbHKZW+2xBfTg6f0tSxMQ6mXg/DqOstL9LT8L76BbMy1cjoQyhcmnD8Gd4PiinvNEz8dGBOWNOzGL5Ixo= 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 vma iterator may be left pointing to the newly created vma. This happens when inserting the new vma at the end of the old vma (!new_below). The incorrect position in the vma iterator is not exposed currently since the vma iterator is repositioned in the munmap path and is not reused in any of the other paths. This has limited impact in the current code, but is required for future changes. Fixes: b2b3b886738f ("mm: don't use __vma_adjust() in __split_vma()") Signed-off-by: Liam R. Howlett Reviewed-by: Suren Baghdasaryan Reviewed-by: Lorenzo Stoakes --- mm/vma.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.45.2 diff --git a/mm/vma.c b/mm/vma.c index 84965f2cd580..02e4f7cf489f 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -246,6 +246,9 @@ static int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, /* Success. */ if (new_below) vma_next(vmi); + else + vma_prev(vmi); + return 0; out_free_mpol: