aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-03-07 06:05:38 -0500
committerAvi Kivity <avi@qumranet.com>2007-05-03 03:52:24 -0400
commit07c45a366d89f8eaec5d9890e810171b408f9a52 (patch)
tree2f54f8c4ba795a1432ee6ac2e8042a472b87550a /drivers
parent1961d276c877b99f5f16aaf36377c75e0e191c3a (diff)
KVM: Allow kernel to select size of mmap() buffer
This allows us to store offsets in the kernel/user kvm_run area, and be sure that userspace has them mapped. As offsets can be outside the kvm_run struct, userspace has no way of knowing how much to mmap. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index df85f5f65489..cba0b87c34e4 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2436,7 +2436,7 @@ static long kvm_dev_ioctl(struct file *filp,
2436 unsigned int ioctl, unsigned long arg) 2436 unsigned int ioctl, unsigned long arg)
2437{ 2437{
2438 void __user *argp = (void __user *)arg; 2438 void __user *argp = (void __user *)arg;
2439 int r = -EINVAL; 2439 long r = -EINVAL;
2440 2440
2441 switch (ioctl) { 2441 switch (ioctl) {
2442 case KVM_GET_API_VERSION: 2442 case KVM_GET_API_VERSION:
@@ -2478,6 +2478,12 @@ static long kvm_dev_ioctl(struct file *filp,
2478 */ 2478 */
2479 r = 0; 2479 r = 0;
2480 break; 2480 break;
2481 case KVM_GET_VCPU_MMAP_SIZE:
2482 r = -EINVAL;
2483 if (arg)
2484 goto out;
2485 r = PAGE_SIZE;
2486 break;
2481 default: 2487 default:
2482 ; 2488 ;
2483 } 2489 }