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 AC538C4361A for ; Thu, 3 Dec 2020 22:26:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51D5622203 for ; Thu, 3 Dec 2020 22:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbgLCW0T (ORCPT ); Thu, 3 Dec 2020 17:26:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:53120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgLCW0T (ORCPT ); Thu, 3 Dec 2020 17:26:19 -0500 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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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?