summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bruning <max@joyent.com>2011-08-11 08:33:15 -0700
committerMax Bruning <max@joyent.com>2011-08-11 08:33:15 -0700
commit9c7ad59df4f8356c3e771f5d55d604013ade9389 (patch)
tree7c29f250ef81f2366c95d685957a04dec20a0fc3
parent9f54119bdf8b68482bc8f7437edd04e58ba6be44 (diff)
downloadillumos-kvm-9c7ad59df4f8356c3e771f5d55d604013ade9389.tar.gz
HVM-553 Qemu isn't cleaning up properly on kvm_run failure with errno 22 (EINVAL)
-rw-r--r--kvm_x86.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kvm_x86.c b/kvm_x86.c
index a56e468..a993206 100644
--- a/kvm_x86.c
+++ b/kvm_x86.c
@@ -57,6 +57,7 @@
extern caddr_t smmap64(caddr_t addr, size_t len, int prot, int flags,
int fd, off_t pos);
+extern int memcntl(caddr_t, size_t, int, caddr_t, int, int);
extern int lwp_sigmask(int, uint_t, uint_t, uint_t, uint_t);
extern uint64_t cpu_freq_hz;
@@ -4924,6 +4925,10 @@ kvm_arch_prepare_memory_region(struct kvm *kvm,
* pages in the map. We'll touch the pages so they get
* allocated here.
*/
+ i = memcntl(userspace_addr, (size_t)(npages * PAGESIZE),
+ MC_LOCK, 0, PROT_READ | PROT_WRITE, 0);
+ if (i != 0)
+ return (i);
for (i = 0; i < npages; i++) {
if (copyout(empty_zero_page, userspace_addr +
(i * PAGESIZE), sizeof (empty_zero_page))) {