gvisor/pkg
Jamie Liu f3723f8059 Call memmap.Mappable.Translate with more conservative usermem.AccessType.
MM.insertPMAsLocked() passes vma.maxPerms to memmap.Mappable.Translate
(although it unsets AccessType.Write if the vma is private). This
somewhat simplifies handling of pmas, since it means only COW-break
needs to replace existing pmas. However, it also means that a MAP_SHARED
mapping of a file opened O_RDWR dirties the file, regardless of the
mapping's permissions and whether or not the mapping is ever actually
written to with I/O that ignores permissions (e.g.
ptrace(PTRACE_POKEDATA)).

To fix this:

- Change the pma-getting path to request only the permissions that are
required for the calling access.

- Change memmap.Mappable.Translate to take requested permissions, and
return allowed permissions. This preserves the existing behavior in the
common cases where the memmap.Mappable isn't
fsutil.CachingInodeOperations and doesn't care if the translated
platform.File pages are written to.

- Change the MM.getPMAsLocked path to support permission upgrading of
pmas outside of copy-on-write.

PiperOrigin-RevId: 240196979
Change-Id: Ie0147c62c1fbc409467a6fa16269a413f3d7d571
2019-03-25 12:42:43 -07:00
..
abi Priority-inheritance futex implementation 2019-03-05 23:40:18 -08:00
amutex Remove license comments 2019-01-31 11:12:53 -08:00
atomicbitops Remove license comments 2019-01-31 11:12:53 -08:00
binary Remove license comments 2019-01-31 11:12:53 -08:00
bits Remove license comments 2019-01-31 11:12:53 -08:00
bpf Remove license comments 2019-01-31 11:12:53 -08:00
compressio Remove license comments 2019-01-31 11:12:53 -08:00
control Remove license comments 2019-01-31 11:12:53 -08:00
cpuid Automated rollback of changelist 234680481 2019-02-20 16:27:56 -08:00
dhcp Remove unused commit() function argument to Bind. 2019-03-05 14:53:34 -08:00
eventchannel Remove license comments 2019-01-31 11:12:53 -08:00
fd Keep FilePayloads open on server side until after RPC completed. 2019-02-08 10:51:24 -08:00
fdnotifier Remove license comments 2019-01-31 11:12:53 -08:00
gate Remove license comments 2019-01-31 11:12:53 -08:00
ilist Remove license comments 2019-01-31 11:12:53 -08:00
linewriter Remove license comments 2019-01-31 11:12:53 -08:00
log Remove license comments 2019-01-31 11:12:53 -08:00
metric Remove license comments 2019-01-31 11:12:53 -08:00
p9 Fix typo 2019-02-28 18:47:13 -08:00
rand Remove license comments 2019-01-31 11:12:53 -08:00
refs Remove license comments 2019-01-31 11:12:53 -08:00
seccomp Add profiling commands to runsc 2019-03-11 11:47:30 -07:00
secio Remove license comments 2019-01-31 11:12:53 -08:00
segment Remove license comments 2019-01-31 11:12:53 -08:00
sentry Call memmap.Mappable.Translate with more conservative usermem.AccessType. 2019-03-25 12:42:43 -07:00
sleep Remove license comments 2019-01-31 11:12:53 -08:00
state Remove license comments 2019-01-31 11:12:53 -08:00
syserr Implement IP_MULTICAST_LOOP. 2019-03-08 15:49:17 -08:00
syserror Priority-inheritance futex implementation 2019-03-05 23:40:18 -08:00
tcpip netstack: adjust the sequence number after trimming the packet 2019-03-20 09:58:10 -07:00
tmutex Remove license comments 2019-01-31 11:12:53 -08:00
unet Internal change. 2019-02-24 17:31:59 -08:00
urpc Internal change. 2019-02-08 14:14:14 -08:00
waiter Remove license comments 2019-01-31 11:12:53 -08:00