summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-04-08 18:40:46 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-08 18:42:05 -0700
commit0f75f7273d8c4ace73d93b6b00f81d53a5cf76ea (patch)
treebee8dc0e62ed1395da1817f643ecdc638eeafc07 /pkg/sentry
parent6dd5a1f3fe55daa8510b1ee5e3a59219aad92af6 (diff)
Don't call platform.AddressSpace.MapFile with no permissions.
PiperOrigin-RevId: 305598136
Diffstat (limited to 'pkg/sentry')
-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()
}