Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1228884rdb; Mon, 2 Oct 2023 03:22:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtLXUl+SiY8ynuLPMmt1moa5VrxMTxkd3CCLk7oHnuqkFsVclnBEW2O/had4VGEq/Fu4VX X-Received: by 2002:a05:6870:b14e:b0:1d6:96f9:66fa with SMTP id a14-20020a056870b14e00b001d696f966famr13900344oal.54.1696242144332; Mon, 02 Oct 2023 03:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696242144; cv=none; d=google.com; s=arc-20160816; b=Z+W2yoZGU4t2quD580ICm20lFZ8BsS6yzKxTm11CaQqv+aHfmrkq9vLfKNjJp7R6Df WNVOkmkXFmHuZD37tppykiDrRGAHP1vWtpc4hRbSTTVzvLHcx60dUmFHFR7i2lBj9NKI IK9Ead4dI73BysjmOqKZwuE/ulxgqH/eUnsjx6vGu94xdgoG68/sLqDmhInxOduFXqZD LbAzbl4xiMN4yrVTGaotrAVQMVqM96LVPlcm9B+khUkNLjbXABUJ8nKyKxhFqLhuVzeP SFf0Lo3Mk9vopGYog0Z0g44XDv+kJNmz/ffNVmrRkxwYf8AfQdU1QK4WpsZRVNEla21H sV6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=3Kw1gfX638yH/94hhS8D+jNIjZbBhxyNQ0T5FKpktkI=; fh=qe60JpySaDoJmiThKcWx9hXm1ZKzhvS9iAXt0saL0bA=; b=KmPja9jQ9zFf+9TOT8tNAlYkOTULYEPXVVmuX2B3OPpLMD4ETNqaxNNZrm/cm45d1d pncF/QXpIgo55j58pqokON2hxa+WDWrDFLhFQ5Mszl+AZkvI3iOxyLD90MrdOOq8MxyQ rfXUY1n7hY4V1YEYGn96QLTu+BiCdhA9EqbJDcaNXc8+qitmZyWj4Fuq7w13HqVyRMH0 /g7mGseRT5cn7EwjpoatV9qx48ZUXJylWLrgVMf3ac8r2eZvtzk5rrHa313vI9DruKjb u3pbr4oq09imvrCoGSsl+6Pl2FtujqLMnXkVAWTShESLzmZUbqwoIqXm28qlXc3x/71r YWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=MC1FNFhN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=zwq+t0Qn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id w64-20020a636243000000b00573ed0023e1si27479388pgb.333.2023.10.02.03.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 03:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=MC1FNFhN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=zwq+t0Qn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 17D378060837; Mon, 2 Oct 2023 00:11:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235687AbjJBHLl (ORCPT + 99 others); Mon, 2 Oct 2023 03:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235599AbjJBHLj (ORCPT ); Mon, 2 Oct 2023 03:11:39 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76462B7 for ; Mon, 2 Oct 2023 00:11:36 -0700 (PDT) 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 197F01F459; Mon, 2 Oct 2023 07:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1696230695; h=from:from:reply-to: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:in-reply-to:references:references; bh=3Kw1gfX638yH/94hhS8D+jNIjZbBhxyNQ0T5FKpktkI=; b=MC1FNFhNKMLbMSs+NYQjBALxt6PY8tjNwaBHAsJxE1X1TuSIeHEScQp76DJoe1Xz197+s4 1ZF+M2ys5AsXYzr+Erbhy776jcicupaFzT51v15D3qWxUq0ZSTdFO8hwtlzAJf9WEgbX/0 KFsxgB27tJF4+GV6RDMWmufNqD4fPsA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1696230695; h=from:from:reply-to: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:in-reply-to:references:references; bh=3Kw1gfX638yH/94hhS8D+jNIjZbBhxyNQ0T5FKpktkI=; b=zwq+t0QnU9ntCV4e/kmzBXLlxGsLdD/EHKPxF6JR0LRaHTRxaLqN4qjgmBZNNTBncRm2Ad 9DvQwhn8vw6twFCA== 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 F15CD13456; Mon, 2 Oct 2023 07:11:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Z/hNOiZtGmWBeQAAMHmgww (envelope-from ); Mon, 02 Oct 2023 07:11:34 +0000 Message-ID: <6b198ba6-083d-0e0e-92c6-6042d4d208b0@suse.cz> Date: Mon, 2 Oct 2023 09:11:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v3 3/3] mmap: Add clarifying comment to vma_merge() code Content-Language: en-US To: "Liam R. Howlett" , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jann Horn , Lorenzo Stoakes , Suren Baghdasaryan , Matthew Wilcox References: <20230929183041.2835469-1-Liam.Howlett@oracle.com> <20230929183041.2835469-4-Liam.Howlett@oracle.com> From: Vlastimil Babka In-Reply-To: <20230929183041.2835469-4-Liam.Howlett@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 00:11:48 -0700 (PDT) On 9/29/23 20:30, Liam R. Howlett wrote: > When tracing through the code in vma_merge(), it was not completely > clear why the error return to a dup_anon_vma() call would not overwrite > a previous attempt to the same function. This commit adds a comment > specifying why it is safe. > > Suggested-by: Jann Horn > Link: https://lore.kernel.org/linux-mm/CAG48ez3iDwFPR=Ed1BfrNuyUJPMK_=StjxhUsCkL6po1s7bONg@mail.gmail.com/ > Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka > --- > mm/mmap.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/mmap.c b/mm/mmap.c > index f9f0a5fe4db4..9967acbd070f 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -943,6 +943,11 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, > vma_start_write(curr); > remove = curr; > remove2 = next; > + /* > + * Note that the dup_anon_vma below cannot overwrite err > + * since the first caller would do nothing unless next > + * has an anon_vma. > + */ > if (!next->anon_vma) > err = dup_anon_vma(prev, curr, &anon_dup); > }