Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/nvmm Fail early if we're beyond the guest max ram.



details:   https://anonhg.NetBSD.org/src/rev/4838dff9a4f2
branches:  trunk
changeset: 449646:4838dff9a4f2
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Mar 14 19:10:27 2019 +0000

description:
Fail early if we're beyond the guest max ram.

diffstat:

 sys/dev/nvmm/nvmm.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 44e3696dcb03 -r 4838dff9a4f2 sys/dev/nvmm/nvmm.c
--- a/sys/dev/nvmm/nvmm.c       Thu Mar 14 19:10:04 2019 +0000
+++ b/sys/dev/nvmm/nvmm.c       Thu Mar 14 19:10:27 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmm.c,v 1.9 2019/03/07 15:22:21 maxv Exp $    */
+/*     $NetBSD: nvmm.c,v 1.10 2019/03/14 19:10:27 maxv Exp $   */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.9 2019/03/07 15:22:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.10 2019/03/14 19:10:27 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -490,6 +490,9 @@
                if (__predict_true(exit->reason != NVMM_EXIT_MEMORY)) {
                        break;
                }
+               if (exit->u.mem.gpa >= mach->gpa_end) {
+                       break;
+               }
                if (uvm_fault(&vm->vm_map, exit->u.mem.gpa, VM_PROT_ALL)) {
                        break;
                }



Home | Main Index | Thread Index | Old Index