summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-03 18:07:59 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-03 18:07:59 +0000
commitfcaa9421355cf770cf47c792388e25700b802e05 (patch)
treecbc2a3267b4f5f1594de7ab0689d53d47ef88b12 /pkg/sentry/mm
parentceb0d792f328d1fc0692197d8856a43c3936a571 (diff)
parent8e926e3f74cef3d04b37c6a68ba5de966e9d9839 (diff)
Merge 8e926e3f (automated)
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r--pkg/sentry/mm/syscalls.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/mm/syscalls.go b/pkg/sentry/mm/syscalls.go
index 0368c6794..af1e53f5d 100644
--- a/pkg/sentry/mm/syscalls.go
+++ b/pkg/sentry/mm/syscalls.go
@@ -470,6 +470,16 @@ func (mm *MemoryManager) MRemap(ctx context.Context, oldAddr usermem.Addr, oldSi
return 0, syserror.EINVAL
}
+ // Check that the new region is valid.
+ _, err := mm.findAvailableLocked(newSize, findAvailableOpts{
+ Addr: newAddr,
+ Fixed: true,
+ Unmap: true,
+ })
+ if err != nil {
+ return 0, err
+ }
+
// Unmap any mappings at the destination.
mm.unmapLocked(ctx, newAR)