Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4000155ybl; Mon, 27 Jan 2020 14:37:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwjYWu+mI/lmetUCFF7qVkBcUy4gxTAN7x9dhof9AjjfLRArKX4gfcxHzc5T5suRUyWCvH+ X-Received: by 2002:aca:cdd5:: with SMTP id d204mr966185oig.134.1580164654530; Mon, 27 Jan 2020 14:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580164654; cv=none; d=google.com; s=arc-20160816; b=oc/rOrTkFaeVuzHmaBR0h1s/2Evi9YYrpBaoDBNicaW/1J1/4IIWxmY61c89GyJhLJ 3keg2NfnBUSr8HiNuEVt1KOdZ/BiuFWFeHgIWn7NgaPzuNuhzJWCZYTl3pcUxMRcQknY a8yQd39f2RWlVEnW962Xn4TQTmLirwyU3+ugVDb87AQX+a832QErwYnav6SE+lqz3NJy xQvYQnRlMsjRVAW0WU10/i7cUv+tdYysHpBFAZFWXDR+BoZERDiJjnTo+mHGAvIgK3Vo IyAu2UmdvLieYHBVr2Yvw9pWLmwUkGcZc17SPYnjraens5Z0h56aT5xL5BUX9omHKNnR C4TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kff3NaTIW20pZaIb7KyxUJFhaAL5rAMZfCM5Cj65zKM=; b=dfSllHNqkFwf9VQSNmAYM7Wyrza/IakOb9/XQ4KUT9SUNpT0HQkEMp9Oql2KFSsLOe /AI1UiSNhLaMnTgwVwuYrr7WAcFtzutLeQoKSxNsAUedcfRQW/lEx2AsPXjKKrM9CQzz DmacIkWMlY/67JZc+c8VN0DpqWVBPD1qLvzbtKHxfRJe/HtkgzsSIqq+IquX4gFXVzEi GQW1uxKSXg3OUbTL6AaqsankYty+XB5GMRn/HkVYPANH/EIVBGYZzL0fHtbKMC0cieh0 jjC/EGGJVJwf58cYTDO1OlGV2ub8HCekL+aPUmbwVAJ/eBbOz3gh8t2b8R0patlD6pMU Za5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dcLteYXi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si8070213oti.153.2020.01.27.14.37.08; Mon, 27 Jan 2020 14:37:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dcLteYXi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbgA0WeO (ORCPT + 99 others); Mon, 27 Jan 2020 17:34:14 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:41022 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgA0WeO (ORCPT ); Mon, 27 Jan 2020 17:34:14 -0500 Received: by mail-ed1-f65.google.com with SMTP id c26so12507570eds.8 for ; Mon, 27 Jan 2020 14:34:11 -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=WQjchcdBHKD8aD2oMooeI9oZbxRFfJfgWwiZEpWfG0Vgirs2LO1E546CfusdWNE9Jz 2IXpZnA7PXs5BhzQBRjFQUrf9A7p0UZ7u5fDTP8/leBhz4kwm0cp5JKHwbbcpKexAt8Z duFqPLRhyf/jnOjo2MhHdTzfrQH22g5C4ndpHasdBEHV8m+k7TFL7Hj85ZQ4azLN5CEw Dua12ZdAI/2VHJulF+OrPEtYQkKLavmeJ91Ko6P80sRWAaJcv7TSUAWo3onXYNsfsLRa /YOsPjDS6YBXOqDmCG5p9R3VB/PB55GR6CcktbvSxKX87hyGl17riJE8I9hEgD9BFEkq w9PA== X-Gm-Message-State: APjAAAVwkQ+b6vfU/jNtzBWq2OO3wml0xSdJBCYfSLCG+AtRx10ZfGvi 6G0mZVplqvRgIx10effuYNZUM3C+Bvcf9PdLyISNgA== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >