From 4c6c19083b0118c3c560aada5157e204a336e7c7 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Thu, 27 May 2021 18:34:00 +0300 Subject: [PATCH] Also check these ioctls --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index cf98fe3..f4e8b58 100644 --- a/main.c +++ b/main.c @@ -365,14 +365,16 @@ int main(int argc, char **argv) { .userspace_addr = (uint64_t) ram, .flags = 0 }; - ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion); + if (ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion) == -1) + abort(); region.slot = 1; region.guest_phys_addr = PROGSTART; region.memory_size = binlen; region.userspace_addr = (uint64_t) progmem; region.flags = KVM_MEM_READONLY; - ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion); + if (ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion) == -1) + abort(); vcpu = ioctl(vmfd, KVM_CREATE_VCPU, (unsigned long)0); const unsigned vcpulen = ioctl(kvm, KVM_GET_VCPU_MMAP_SIZE, NULL); -- 2.30.2