diff options
author | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-07-12 12:19:02 +0000 |
---|---|---|
committer | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-07-12 13:01:29 +0000 |
commit | 52b23dd769a5fb97e9d1ae1c891b7ba6e15532a1 (patch) | |
tree | 6165839af2603d94c3ae11b980b718381c3a6821 | |
parent | 867bd44cdfb775ad6bfc14a0acdc49b1f0d82e99 (diff) | |
download | illumos-joyent-52b23dd769a5fb97e9d1ae1c891b7ba6e15532a1.tar.gz |
OS-7061 bhyve: set MAP_NORESERVE when mmap'ing guest memory
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: Patrick Mooney <patrick.mooney@joyent.com>
-rw-r--r-- | usr/src/lib/libvmmapi/common/vmmapi.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr/src/lib/libvmmapi/common/vmmapi.c b/usr/src/lib/libvmmapi/common/vmmapi.c index 7ded3a82b5..c34bb60de6 100644 --- a/usr/src/lib/libvmmapi/common/vmmapi.c +++ b/usr/src/lib/libvmmapi/common/vmmapi.c @@ -455,6 +455,14 @@ vm_setup_memory(struct vmctx *ctx, size_t memsize, enum vm_mmap_style vms) */ len = VM_MMAP_GUARD_SIZE + objsize + VM_MMAP_GUARD_SIZE; flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE | MAP_ALIGNED_SUPER; +#ifndef __FreeBSD__ + /* + * There is no need to reserve swap for the guest physical memory and + * guard regions. Actual memory is allocated and mapped later through + * vm_alloc_memseg() and setup_memory_segment(). + */ + flags |= MAP_NORESERVE; +#endif ptr = mmap(NULL, len, PROT_NONE, flags, -1, 0); if (ptr == MAP_FAILED) return (-1); |