Thread (4 messages) 4 messages, 4 authors, 2021-08-12

Re: [PATCH v1 0/7] Remove in-tree usage of MAP_DENYWRITE

From: "Andy Lutomirski" <luto@kernel.org>
Date: 2021-08-12 18:02:12
Also in: linux-api, linux-fsdevel, linux-mm, lkml

Possibly related (same subject, not in this thread)


On Thu, Aug 12, 2021, at 10:48 AM, Eric W. Biederman wrote:
"Andy Lutomirski" [off-list ref] writes:
I had a blind spot, and Florian Weimer made a very reasonable request.
Apparently userspace for shared libraires uses MAP_PRIVATE.

So we almost don't care if the library is overwritten.  We loose some
efficiency and apparently there are some corner cases like the library
being extended past the end of the exiting file that are problematic.

Given that MAP_PRIVATE for shared libraries is our strategy for handling
writes to shared libraries perhaps we just need to use MAP_POPULATE or a
new related flag (perhaps MAP_PRIVATE_NOW) that just makes certain that
everything mapped from the executable is guaranteed to be visible from
the time of the mmap, and any changes from the filesystem side after
that are guaranteed to cause a copy on write.

Once we get that figured out we could consider getting rid of deny-write
entirely.
Are all of the CoW bits in good enough shape for this to work without just immediately CoWing the whole file?  In principle, write(2) to a file should be able to notice that it needs to CoW some pages, but I doubt that this actually works.

--Andy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help