lkml.org 
[lkml]   [2020]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/5] mm: Introduce mm_struct.has_pinned
On Tue, Sep 22, 2020 at 8:56 AM Jason Gunthorpe <jgg@ziepe.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

\
 
 \ /
  Last update: 2020-09-22 18:32    [W:0.112 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site