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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 2EB9EC2D0DB for ; Mon, 27 Jan 2020 22:34:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE70020CC7 for ; Mon, 27 Jan 2020 22:34:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dcLteYXi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE70020CC7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E2EA6B000A; Mon, 27 Jan 2020 17:34:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 176A66B000C; Mon, 27 Jan 2020 17:34:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05CD56B000D; Mon, 27 Jan 2020 17:34:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id E1ABE6B000A for ; Mon, 27 Jan 2020 17:34:12 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id B2A49180AD802 for ; Mon, 27 Jan 2020 22:34:12 +0000 (UTC) X-FDA: 76424868744.09.game75_41d3cc50cf627 X-HE-Tag: game75_41d3cc50cf627 X-Filterd-Recvd-Size: 4138 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Jan 2020 22:34:12 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id p23so3761022edr.5 for ; Mon, 27 Jan 2020 14:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kff3NaTIW20pZaIb7KyxUJFhaAL5rAMZfCM5Cj65zKM=; b=dcLteYXiqYKv1WHOfAf3rVdpBgqxKWRTBbFSxrhkjtAhJbBCOCLiGTfDsPDZAi8LwC 2AlOgUZE1lvmQD84XRv7w8X6Q0fyRWRV/Cr/DQO6InEO6DxpG74ofsdekO9AUoaR7Q38 TevVCE+WIuIW1MZ7d7pobTPFJInrlnLMpck69eAslrW4w7H1YQ5dnPfDbu9I1yFJY3Bx xWx8LMkrbrUUGpZ7dL64goyfLvVorGd0cWhoVksTwXSl0bdlwtQHn+Hc+PHeZ9xyM05q /NNShn9u9FWtC9htX0mxN0sIjHpuSSXJRalIXygXSAGAS5EDjOyFkIrJP26E8zOUU29A aVGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kff3NaTIW20pZaIb7KyxUJFhaAL5rAMZfCM5Cj65zKM=; b=eIGiwTJYGeaoPUc1ov/fClTPoD3wguNs7dPsbjJK7LSxcOr5i9Tilo3krBw73fP3Ui qf2kY+yqNNcDRGtJgv7pFhOimFI+DGkRxJw+pt2OG3HLFBA5YaJ/xBc1DBPvdwjLKyGm emu5Mqf9YmQ8nMwTPJ63WRH5nG4/S+7tLduYDuWEp8//iBR0tl/OLYZwEGvfGOjVApR3 FGBcMkaipK/9lCInq2WvqWDmdeUgMd7Ttc9ankxoBB/48TeG4SdZog9ynvEcnSjD93GF kE1EKRx1mThsAT9NAuDAt6aj4AnjiBd2vDXJC+VrfFW+sGXJQHRWB2GAlDaWKK8JOrmW PtVw== X-Gm-Message-State: APjAAAVHHqCmfY7xNfqrpSktLAI6tVc8LwrYdEQwo1GB/rHKUbDDd/Mp Y3dwXyvkLlzl2nqvDCSUSzQ9G+ZddBVtkoCwwp2QEw== X-Google-Smtp-Source: APXvYqxmihDvQKDeTJwEWMIPBNcI86K1DIY4nnX7rUdDLp5/wdi7JNyrCrSTzwqnb4lvmla3Q4N4MNmCF2g2v7VE8NQ= X-Received: by 2002:aa7:c445:: with SMTP id n5mr893840edr.346.1580164450645; Mon, 27 Jan 2020 14:34:10 -0800 (PST) MIME-Version: 1.0 References: <20200123014627.71720-1-bgeffon@google.com> <20200124190625.257659-1-bgeffon@google.com> <87imkxxl5d.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87imkxxl5d.fsf@oldenburg2.str.redhat.com> From: Brian Geffon Date: Mon, 27 Jan 2020 14:33:44 -0800 Message-ID: Subject: Re: [PATCH v2] mm: Add MREMAP_DONTUNMAP to mremap(). To: Florian Weimer Cc: Andrew Morton , "Michael S . Tsirkin" , Arnd Bergmann , LKML , linux-mm , linux-api@vger.kernel.org, Andy Lutomirski , Andrea Arcangeli , Sonny Rao , Minchan Kim , Joel Fernandes , Yu Zhao , Jesse Barnes Content-Type: text/plain; charset="UTF-8" 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: Hi Florian, copy_vma will make a copy of the existing VMA leaving the old VMA unchanged, so the source keeps its existing protections, this is what makes it very useful along with userfaultfd. Thanks, Brian On Mon, Jan 27, 2020 at 2:13 AM Florian Weimer wrote: > > * Brian Geffon: > > > When remapping an anonymous, private mapping, if MREMAP_DONTUNMAP is > > set, the source mapping will not be removed. Instead it will be > > cleared as if a brand new anonymous, private mapping had been created > > atomically as part of the mremap() call. If a userfaultfd was watching > > the source, it will continue to watch the new mapping. For a mapping > > that is shared or not anonymous, MREMAP_DONTUNMAP will cause the > > mremap() call to fail. MREMAP_DONTUNMAP implies that MREMAP_FIXED is > > also used. The final result is two equally sized VMAs where the > > destination contains the PTEs of the source. > > What will be the protection flags of the source mapping? Will they > remain unchanged? Or PROT_NONE? > > Thanks, > Florian >