chiark / gitweb /
memfd: map unsealed files as MAP_SHARED
authorDavid Herrmann <dh.herrmann@gmail.com>
Mon, 18 Aug 2014 11:05:48 +0000 (13:05 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Mon, 18 Aug 2014 11:05:48 +0000 (13:05 +0200)
commit23972f4244f7609658c2a17f85508d50e4739990
treeecc7b9895abf0c193cae5bf2deb6dcdfe8b77c04
parentc7dab73a5fa6e775813765fe925caaa7c4e549fa
memfd: map unsealed files as MAP_SHARED

We need to map sealed files as MAP_PRIVATE so far as the kernel treats
MAP_SHARED as writable mapping (you can run mprotect(PROT_WRITE) at any
time on those). However, unsealed files must be mapped as MAP_SHARED.
Otherwise, we never end up writing to the real file.
src/shared/memfd.c