From fe3fc44da3ca47fa27d55294e6c31d51b6b5dc14 Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Fri, 22 Jun 2018 13:07:21 -0700 Subject: Handle mremap(old_size=0). PiperOrigin-RevId: 201729703 Change-Id: I486900b0c6ec59533b88da225a5829c474e35a70 --- pkg/sentry/memmap/memmap.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkg/sentry/memmap') 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 -- cgit v1.2.3