From mboxrd@z Thu Jan 1 00:00:00 1970 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 87CE2EB64DC for ; Fri, 14 Jul 2023 14:44:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 118F68D000C; Fri, 14 Jul 2023 10:44:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C9A58D0005; Fri, 14 Jul 2023 10:44:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED2B08D000C; Fri, 14 Jul 2023 10:44:47 -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 DF6908D0005 for ; Fri, 14 Jul 2023 10:44:47 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B741EB0309 for ; Fri, 14 Jul 2023 14:44:47 +0000 (UTC) X-FDA: 81010489014.02.D5494C3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf22.hostedemail.com (Postfix) with ESMTP id DC676C000D for ; Fri, 14 Jul 2023 14:44:43 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vzYYlG+V; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=eT4qVabG; dmarc=none; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689345884; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IjeSCcUdkUyv6NElS0uC99+S/b+alHnEZdLYL9qlJ0k=; b=CxwegXFne9Xyhbk5HkAjftsrdyatadjIKffPcH93aonanEzP0IZEuxVeQgsb0/UPH8MEmV QZqjwiDTb//dCkFBJqlwsYvCcL8RId8g4TjvvrZmYdBg4A+Xtj50VZyrHpAQCJ4ElOluoQ T0vFPowZGUveFm9WPgvlVr9B65J8onI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vzYYlG+V; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=eT4qVabG; dmarc=none; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689345884; a=rsa-sha256; cv=none; b=pmkrVv8GD7PTgEzFIa3KeOr1zokzPlcLY9gJ64XF2F4OHMnjbEJsIaQbRP4SSJX+E8+Z7K 6Ec9q3Wb+aKKXJ3UEE9fENn138QPN1DbbYdP5ZIxYREXA94htFSiZpAiLNDsLMvKrr5jmE XauEXhLOK9bMX3e0tM5xM4GxtG2mQsw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 091C01F45F; Fri, 14 Jul 2023 14:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1689345882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IjeSCcUdkUyv6NElS0uC99+S/b+alHnEZdLYL9qlJ0k=; b=vzYYlG+Vfq0tK8FhWqoZVfaORtCNivOjGvTXl1VIA+V6mifrQhDK9YXjw8BYPll7ik0Wpl FUlKTUyhhsswir+xrAOSU1XDCS4phHKCz7zNzvY6+h+V1xHLenxNvkQ+ZtbmLf8XTEvWWC KQii4U05U3sV6IIo9BStDA9BTHbUaoE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1689345882; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IjeSCcUdkUyv6NElS0uC99+S/b+alHnEZdLYL9qlJ0k=; b=eT4qVabG6Evho8V8OIuzXvavbjAsmDfwHDdS7PLGZJOl070STVjNGHPyr/xihFErg/5d/h TJz7dIcxEcleK9Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DDAC513A15; Fri, 14 Jul 2023 14:44:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dkllNVlfsWQWJgAAMHmgww (envelope-from ); Fri, 14 Jul 2023 14:44:41 +0000 Message-ID: Date: Fri, 14 Jul 2023 16:44:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH stable v6.1] mm/mmap: Fix extra maple tree write Content-Language: en-US To: "Liam R. Howlett" , Greg KH , linux-kernel@vger.kernel.org, Andrew Morton , John Hsu , stable@vger.kernel.org, linux-mm@kvack.org References: <20230706185135.2235532-1-Liam.Howlett@oracle.com> <2023070748-confiding-abnormal-b7e3@gregkh> <20230707164507.mfekysya2jyupghp@revolver> <20230712005442.r5ehzbkcxu73whvb@revolver> From: Vlastimil Babka In-Reply-To: <20230712005442.r5ehzbkcxu73whvb@revolver> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: pftxenqm8uh9syskkw7btnhzdtyujq6k X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DC676C000D X-HE-Tag: 1689345883-591990 X-HE-Meta: U2FsdGVkX1/kyi33MaobEzlQzxf3W6y6m5dcGxoL3RtvFm7llO1np88HQ0csLtvvVX+RpMrNy6syqIBTzBwLltZyi+HSxTmGQUcsjjTKP9hQBdhLTDEHzcTd/H6Mj1MpVxLa/vwaGv0U/g1ek38u9huN6YHfkrWY2/1esxobIXf5Ut+uPHJvwvtYt4oB7mko8/PWJ+7B3RAINXjMhYwDeUj4QR5PuChACoA6cr7TPGOHnfCYkLijZlNFJDkmdeklla796RApkRIcOlYzxYpVgWQmsRpZde+M62zWJxhyROp76wQuynyT98kroP2mTRoHt0GcUyx+ir/Omx3h5QzXbxyPLD2cS9vSXYrogdCqSk3PDiV/zW2oub+uWlZSlOyx+9nwBMjJze03E1Y+knAZHhvAyf57gy9ly2oHBjWQQjsTrq/IEyIl/BRkVKc8z6ZfzYMjRtONXBwxMOvVfzmb4Wkw8xmfQVSoWEWz22kiyOWRXOLHSOQXwhxdOuElgcgLYLz/DnF8rFrLj1hp/PH+upgSkLN9OYxbIcBwBYbMApOK97gj4UJqYBMkazG8cnOKXgUud1tiB+JfcJ1WrCu1OnVLWDMaLwmJ0dpyYpQqFRGoXQHkzqzshpmdqSgbR8IJMoUaMMZIH8WCPgP15p6ZD+r4xI6XdbOWWEJotHeunUJnaR24tEGWFbmey1rlOhXm2BMzFxjsPVAn/16cZd9f5l2Mq+HiyOTrqzAJCPTP13VvwTBT2Ku1XCN3XmkJOym0AggLADxDS+hXmp5iDMaWXrN9X2VadvgS9ivXuFbHQb6k661NADdm5/3mPeM4a25V+G88Qut1t/1mjTgihnTi9OG7TTmEP1DCaGOJFJjbPsBh/V1tFpkrc4LG1BZ3o9KLR0pwOm+x4VEAlviEXvJYzbQbJh51I1EPcD53Q5WDxG2nqXO9B6jjY4kam9nYuqsvUERZcd9TMQvITUi8qa6 X/bya3Qs eIpQRKFpM51Fo21WZ8Yep6UnUK9MeSA7XuQ8ugI7NH+X1cCxAXmAs3Hq5L/GkENdH+jtihiJMf5YryNYuPO7qEU49qtQ+fvE6b47h6Sii2Hfo0ImyPbdvHY42J6PAc0Ywz2MD7cFlF9KNTZ1RuiU8yWUMJMoYuS71yt3c4CzefRkqzZfLeqY0FP8eukPd2HJGOiJcbWR9onEZZvyrxR9kUe6byVNaPTZq8ZFOvSvnD1kv6DSOcbqO7EaB4IoHBhY8IzHNMDU2H+2J3/kLZQTP/IpScQ== 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: On 7/12/23 02:54, Liam R. Howlett wrote: > * Liam R. Howlett [230707 12:45]: >> * Greg KH [230707 11:55]: >> > On Thu, Jul 06, 2023 at 02:51:35PM -0400, Liam R. Howlett wrote: >> > > commit 0503ea8f5ba73eb3ab13a81c1eefbaf51405385a upstream. >> > > >> > > This was inadvertently fixed during the removal of __vma_adjust(). >> > > >> > > When __vma_adjust() is adjusting next with a negative value (pushing >> > > vma->vm_end lower), there would be two writes to the maple tree. The >> > > first write is unnecessary and uses all allocated nodes in the maple >> > > state. The second write is necessary but will need to allocate nodes >> > > since the first write has used the allocated nodes. This may be a >> > > problem as it may not be safe to allocate at this time, such as a low >> > > memory situation. Fix the issue by avoiding the first write and only >> > > write the adjusted "next" VMA. >> > >> > Are you sure this is the same git id? The one you reference above is >> > _VERY_ different from your 2 line change below. >> > >> > And the changelog text is not the same. >> >> Yes, but I am not sure I've indicated what happened correctly. "commit 0503ea8f5ba73eb3ab13a81c1eefbaf51405385a upstream." is indeed not the best indication. For stable it would mean you're backporting said commit, which is not the case. >> The bug exists in the older __vma_adjust() function, but I removed >> __vma_adjust() and inadvertently fixed the bug. So the bug doesn't >> exist upstream *because* of that commit: >> >> 0503ea8f5ba7 ("mm/mmap: remove __vma_adjust()") >> >> My comment after the commit id indicates what happened, but the >> documentation wasn't clear to me on how to specify what happened. I think it's because the process discourages stable-specific fixes. However this is the case where such approach is much simpler than backporting several series with non-trivial vma_merge() cleanups and subsequent follow-up fixes... So I agree with the exceptional stable-specific fix. Can you pinpoint a Fixes: tag? Some of the commits introducing the maple tree? Vlastimil >> Does this answer your question? > > Friendly ping on this one? > > Thanks, > Liam >