summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Rosenfeld <hans.rosenfeld@joyent.com>2018-07-05 15:42:17 +0000
committerHans Rosenfeld <hans.rosenfeld@joyent.com>2018-07-05 17:59:24 +0200
commiteebde15ca4eb2442e9bbce950bbf9782b60ec1a5 (patch)
tree69897570d698177e262d8897512368f0850e55fd
parent17296045b06634567568b1654a46c22c764d76e9 (diff)
downloadillumos-joyent-eebde15ca4eb2442e9bbce950bbf9782b60ec1a5.tar.gz
OS-7062 bhyve: return EINVAL for allocations > max_page_get
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/uts/i86pc/io/vmm/vmm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr/src/uts/i86pc/io/vmm/vmm.c b/usr/src/uts/i86pc/io/vmm/vmm.c
index 2370da62d2..0f722facb0 100644
--- a/usr/src/uts/i86pc/io/vmm/vmm.c
+++ b/usr/src/uts/i86pc/io/vmm/vmm.c
@@ -760,12 +760,21 @@ vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem)
struct mem_seg *seg;
vm_object_t obj;
+#ifndef __FreeBSD__
+ extern pgcnt_t get_max_page_get(void);
+#endif
+
if (ident < 0 || ident >= VM_MAX_MEMSEGS)
return (EINVAL);
if (len == 0 || (len & PAGE_MASK))
return (EINVAL);
+#ifndef __FreeBSD__
+ if (len > ptob(get_max_page_get()))
+ return (EINVAL);
+#endif
+
seg = &vm->mem_segs[ident];
if (seg->object != NULL) {
if (seg->len == len && seg->sysmem == sysmem)