summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-09 01:46:13 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-09 01:46:13 +0000
commit935f73c612486ca1431e2382cb65f125ad5d8bb6 (patch)
treecd3e6096645bb63ef018f1c87938f036e6292dc4 /pkg/sentry/mm
parentc587441315183789fdf62e9a767048b671bbd1d9 (diff)
parent0f75f7273d8c4ace73d93b6b00f81d53a5cf76ea (diff)
Merge release-20200323.0-98-g0f75f72 (automated)
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r--pkg/sentry/mm/address_space.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/sentry/mm/address_space.go b/pkg/sentry/mm/address_space.go
index 0332fc71c..5c667117c 100644
--- a/pkg/sentry/mm/address_space.go
+++ b/pkg/sentry/mm/address_space.go
@@ -201,8 +201,10 @@ func (mm *MemoryManager) mapASLocked(pseg pmaIterator, ar usermem.AddrRange, pre
if pma.needCOW {
perms.Write = false
}
- if err := mm.as.MapFile(pmaMapAR.Start, pma.file, pseg.fileRangeOf(pmaMapAR), perms, precommit); err != nil {
- return err
+ if perms.Any() { // MapFile precondition
+ if err := mm.as.MapFile(pmaMapAR.Start, pma.file, pseg.fileRangeOf(pmaMapAR), perms, precommit); err != nil {
+ return err
+ }
}
pseg = pseg.NextSegment()
}