Skip to content

Commit 9cb09e7

Browse files
Marc Zyngierbonzini
Marc Zyngier
authored andcommitted
KVM: Add a comment describing the /dev/kvm no_compat handling
Add a comment explaining the rational behind having both no_compat open and ioctl callbacks to fend off compat tasks. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent ed69a6c commit 9cb09e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

virt/kvm/kvm_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ static long kvm_vcpu_compat_ioctl(struct file *file, unsigned int ioctl,
122122
unsigned long arg);
123123
#define KVM_COMPAT(c) .compat_ioctl = (c)
124124
#else
125+
/*
126+
* For architectures that don't implement a compat infrastructure,
127+
* adopt a double line of defense:
128+
* - Prevent a compat task from opening /dev/kvm
129+
* - If the open has been done by a 64bit task, and the KVM fd
130+
* passed to a compat task, let the ioctls fail.
131+
*/
125132
static long kvm_no_compat_ioctl(struct file *file, unsigned int ioctl,
126133
unsigned long arg) { return -EINVAL; }
127134

0 commit comments

Comments
 (0)