summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/memmap
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2018-06-22 13:07:21 -0700
committerShentubot <shentubot@google.com>2018-06-22 13:08:38 -0700
commitfe3fc44da3ca47fa27d55294e6c31d51b6b5dc14 (patch)
tree3e32a0ffd421911c871764019a09490e1b467a0f /pkg/sentry/memmap
parent5d45f88f2c2840123e2f5ec2e45ac6d5b5a5729f (diff)
Handle mremap(old_size=0).
PiperOrigin-RevId: 201729703 Change-Id: I486900b0c6ec59533b88da225a5829c474e35a70
Diffstat (limited to 'pkg/sentry/memmap')
-rw-r--r--pkg/sentry/memmap/memmap.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/sentry/memmap/memmap.go b/pkg/sentry/memmap/memmap.go
index 72986cbb9..cdc5f2b27 100644
--- a/pkg/sentry/memmap/memmap.go
+++ b/pkg/sentry/memmap/memmap.go
@@ -49,13 +49,14 @@ type Mappable interface {
// CopyMapping notifies the Mappable of an attempt to copy a mapping in ms
// from srcAR to dstAR. For most Mappables, this is equivalent to
- // AddMapping.
+ // AddMapping. Note that it is possible that srcAR.Length() != dstAR.Length(),
+ // and also that srcAR.Length() == 0.
//
// CopyMapping is only called when a mapping is copied within a given
// MappingSpace; it is analogous to Linux's vm_operations_struct::mremap.
//
- // Preconditions: offset+dstAR.Length() does not overflow. The mapping at
- // srcAR must exist.
+ // Preconditions: offset+srcAR.Length() and offset+dstAR.Length() do not
+ // overflow. The mapping at srcAR must exist.
CopyMapping(ctx context.Context, ms MappingSpace, srcAR, dstAR usermem.AddrRange, offset uint64) error
// Translate returns the Mappable's current mappings for at least the range