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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 94326C4363D for ; Tue, 22 Sep 2020 16:31:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 03B6D2399A for ; Tue, 22 Sep 2020 16:31:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Ykybzvgs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03B6D2399A 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 49AB16B0099; Tue, 22 Sep 2020 12:31:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44C596B009B; Tue, 22 Sep 2020 12:31:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 312F06B009D; Tue, 22 Sep 2020 12:31:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 1BE186B0099 for ; Tue, 22 Sep 2020 12:31:29 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D9169824999B for ; Tue, 22 Sep 2020 16:31:28 +0000 (UTC) X-FDA: 77291237856.13.chalk57_2d060812714f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id B094918140B69 for ; Tue, 22 Sep 2020 16:31:28 +0000 (UTC) X-HE-Tag: chalk57_2d060812714f X-Filterd-Recvd-Size: 4767 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 16:31:28 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id u21so14672625ljl.6 for ; Tue, 22 Sep 2020 09:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DFpj/fnUMBVQLv0uLvE3QXIgKUcQAnB9yQv3L++wgJU=; b=YkybzvgsCHqPgIFq6Rud8tyuaqdZr9vGTAyZxsIiWRVexRhWCRrS+v9oNSbrCu4xIR 8UcTYJaVaI/Gu3cfE/F1I43yvPFkhcJBS/XIFCWtBjzB7SQ6lY7UOhuCPISzX1jLKYxR 39zZRGKf5CbJwSqWpkH7pq/5qL2nGedfUDJHI= 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=DFpj/fnUMBVQLv0uLvE3QXIgKUcQAnB9yQv3L++wgJU=; b=DX9zbcIdBRMvTEpIS9JAOg1kZCXVqoSmzgDp5UXl9D9AOpxj1woGKD7MqB/53qyOFi yiYiIuqZFylDdERQytd7qruzHsH9FZ8qnpn1xCNwgaR3/Qni+BHe+CdKK1Xe9TZPObyr TqK9ywPfbYOgfRQHGVHHYIJ1Om6mOBQ8Yq2RH4u76epkYd739D9Y/cFGV6s1gg8yp5/A feQP8CmoOWWqrzzQ+hLfJG5Go/eRjQ9A7O+XLZMeaYq57VZdX6nO4mKFobCc6FoRZFvx hZ7TeYfNPcB4dvNvFCrS2TDv4v4qbh7o9CwkQUGKSIF7zIJdqGUlm3F2xg+jOZGaZqe2 GMWw== X-Gm-Message-State: AOAM531EqYXauJ6+FMCCWEUYTjITZIvJMAFQAN28DrulsxHjZBfPGwaY KvWIrSE7/hb7lIGr2qi1L/HOQ/9Qw8DB3g== X-Google-Smtp-Source: ABdhPJyqgiRgdPZoX5kVZQaYADZn+djvzUbM4Bofl9CQu5bnkKMlSL1/X+Jvcxyy5aHB6wGQ8zNf3g== X-Received: by 2002:a2e:80c3:: with SMTP id r3mr353420ljg.167.1600792286055; Tue, 22 Sep 2020 09:31:26 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id d18sm3625837lfm.178.2020.09.22.09.31.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Sep 2020 09:31:23 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id a15so14694431ljk.2 for ; Tue, 22 Sep 2020 09:31:22 -0700 (PDT) X-Received: by 2002:a05:651c:104c:: with SMTP id x12mr1929758ljm.285.1600792282400; Tue, 22 Sep 2020 09:31:22 -0700 (PDT) MIME-Version: 1.0 References: <20200921211744.24758-1-peterx@redhat.com> <20200921211744.24758-2-peterx@redhat.com> <20200921223004.GB19098@xz-x1> <20200922115436.GG8409@ziepe.ca> <20200922142802.GC19098@xz-x1> <20200922155604.GA731578@ziepe.ca> In-Reply-To: <20200922155604.GA731578@ziepe.ca> From: Linus Torvalds Date: Tue, 22 Sep 2020 09:25:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned To: Jason Gunthorpe Cc: Peter Xu , Jann Horn , Linux-MM , kernel list , Andrew Morton , Jan Kara , Michal Hocko , Kirill Tkhai , Kirill Shutemov , Hugh Dickins , Christoph Hellwig , Andrea Arcangeli , John Hubbard , Oleg Nesterov , Leon Romanovsky 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: On Tue, Sep 22, 2020 at 8:56 AM Jason Gunthorpe wrote: > > I thought MAP_PRIVATE without PROT_WRITE was nonsensical, MAP_PRIVATE without PROT_WRITE is very common. It's what happens for every executable mapping, for example. And no, it's not the same as MAP_SHARED, for a couple of simple reasons. It does end up being similar for all the *normal* cases, but there are various cases where it isn't. - mprotect() and friends. MAP_PRIVATE is fixed, but it might have been writable in the past, and it might become writable in the future. - breakpoints and ptrace. This will punch through even a non-writable mapping and force a COW (since that's the whole point: executables are not writable, but to do a SW breakpoint you have to write to the page) So no, MAP_PRIVATE is not nonsensical without PROT_WRITE, and it's not even remotely unusual. Linus