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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5768C433FE for ; Thu, 3 Dec 2020 22:25:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10C6A22287 for ; Thu, 3 Dec 2020 22:25:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10C6A22287 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7BBA96B005C; Thu, 3 Dec 2020 17:25:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 743E76B0068; Thu, 3 Dec 2020 17:25:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 633FB6B006C; Thu, 3 Dec 2020 17:25:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 4D2766B005C for ; Thu, 3 Dec 2020 17:25:41 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1DB5D180AD81A for ; Thu, 3 Dec 2020 22:25:41 +0000 (UTC) X-FDA: 77553404082.16.smash57_0e0a445273bf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id F088A100E690B for ; Thu, 3 Dec 2020 22:25:40 +0000 (UTC) X-HE-Tag: smash57_0e0a445273bf X-Filterd-Recvd-Size: 2055 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Dec 2020 22:25:39 +0000 (UTC) Date: Thu, 3 Dec 2020 14:25:37 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1607034338; bh=Ax4Wt0Tiiw6ty+hKE7knRXHEyQvkXrcQRlGxKC1Qgcg=; h=From:To:Cc:Subject:In-Reply-To:References:From; b=D1CFoYa3jVoUV2wqynG9Wn22SwA3cexgqwgVEfG016b9SE6Cpn5CDLMnYY4ScDekn YXKEtJZDxRIsoWYcqwxZ/ZnTG346Z+4NyC+yGP/RuRrXfuL9Q/xZ6tfCP+8anpg7og g/JiV16Y6ZHp37SppqN9NfFWNi081bTOQ73e3B1s= From: Andrew Morton To: Liu Zixian Cc: , , , , , David Hildenbrand , Jason Gunthorpe Subject: Re: [PATCH v2] fix mmap return value when vma is merged after call_mmap() Message-Id: <20201203142537.c69ab696573e63d54becff07@linux-foundation.org> In-Reply-To: <20201203085350.22624-1-liuzixian4@huawei.com> References: <20201203085350.22624-1-liuzixian4@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Thu, 3 Dec 2020 16:53:50 +0800 Liu Zixian wrote: > On success, mmap should return the begin address of newly mapped area, > but patch "mm: mmap: merge vma after call_mmap() if possible" > set vm_start of newly merged vma to return value addr. > Users of mmap will get wrong address if vma is merged after call_mmap(). > We fix this by moving the assignment to addr before merging vma. Let's cc David and Jason, as they commented on v1. You cc'ed stable@vger.kernel.org on the email, but there's no cc:stable@vger.kernel.org in the changelog tags. There should be. Has this bug actually been observed at runtime, or is it a theoretical from-code-inspection thing?