[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiNcEu+xFxKH=jba42DEp_yGMcywEsrbLBgpGmZxAGV-g@mail.gmail.com>
Date: Tue, 22 Sep 2020 09:25:04 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Peter Xu <peterx@...hat.com>, Jann Horn <jannh@...gle.com>,
Linux-MM <linux-mm@...ck.org>,
kernel list <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jan Kara <jack@...e.cz>, Michal Hocko <mhocko@...e.com>,
Kirill Tkhai <ktkhai@...tuozzo.com>,
Kirill Shutemov <kirill@...temov.name>,
Hugh Dickins <hughd@...gle.com>,
Christoph Hellwig <hch@....de>,
Andrea Arcangeli <aarcange@...hat.com>,
John Hubbard <jhubbard@...dia.com>,
Oleg Nesterov <oleg@...hat.com>,
Leon Romanovsky <leonro@...dia.com>
Subject: Re: [PATCH 1/5] mm: Introduce mm_struct.has_pinned
On Tue, Sep 22, 2020 at 8:56 AM Jason Gunthorpe <jgg@...pe.ca> 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
Powered by blists - more mailing lists