KVM: Add compat ioctl for KVM_SET_SIGNAL_MASK
Subsystems (2)
PATCH 1/1 KVM: Add compat ioctl for KVM_SET_SIGNAL_MASK
KVM has an ioctl to define which signal mask should be used while running inside VCPU_RUN. At least for big endian systems, this mask is different on 32-bit and 64-bit systems (though the size is identical).
Add a compat wrapper that converts the mask to whatever the kernel accepts, allowing 32-bit kvm user space to set signal masks.
This patch fixes qemu with --enable-io-thread on ppc64 hosts when running 32-bit user land.
---
v1 -> v2:
- use compat_ptr
- only declare compat call with CONFIG_COMPAT
--- kernel/compat.c | 1 + virt/kvm/kvm_main.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletions(-)
kernel/compat.c +1 -0
@@ -882,6 +882,7 @@ sigset_from_compat (sigset_t *set, compat_sigset_t *compat)case 1 : set->sig[0 ] = compat->sig[0 ] | (((long )compat->sig[1 ]) <<32 ); } } +EXPORT_SYMBOL_GPL (sigset_from_compat); asmlinkage long compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
virt/kvm/kvm_main.c +51 -1
70 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Avi Kivity
AppliedQuoted 9 lines · Alexander Graf
KVM has an ioctl to define which signal mask should be used while running inside
VCPU_RUN. At least for big endian systems, this mask is different on 32-bit and 64-bit systems (though the size is identical).Add a compat wrapper that converts the mask to whatever the kernel accepts, allowing 32-bit kvm user space to set signal masks.
This patch fixes qemu with --enable-io-thread on ppc64 hosts when running 32-bit user land.
Applied, thanks.
Signature · 1 line
error compiling committee.c: too many arguments to function
Paolo Bonzini
maintainerQuoted 5 lines · Avi Kivity
Quoted 4 lines · Alexander Graf
KVM has an ioctl to define which signal mask should be used while running inside
VCPU_RUN. At least for big endian systems, this mask is different on 32-bit and 64-bit systems (though the size is identical).
Quoted 8 lines
Quoted 6 lines
Add a compat wrapper that converts the mask to whatever the kernel accepts,
allowing 32-bit kvm user space to set signal masks.This patch fixes qemu with --enable-io-thread on ppc64 hosts when running 32-bit user land.
Applied, thanks.
And here's the matching documentation change. Kunz-kunz, Alex. :)
-------------------------- 8< ----------------------------- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <[email protected]>
Date: Thu, 9 Jun 2011 17:48:50 +0200
Subject: [PATCH] KVM: fix documentation for KVM_SET_SIGNAL_MASK
The signal mask passed to KVM_SET_SIGNAL_MASK needs to be ABI-compatible with sigprocmask, so that functions operating on sigset_t can be used with it. Referring to the signal mask as an array of bytes is incorrect on big endian systems, fix it.
--- Documentation/kvm/api.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/kvm/api.txt +2 -2
@@ -464,8 +464,8 @@ signal mask. /* for KVM_SET_SIGNAL_MASK */ struct kvm_signal_mask { - __u32 len; - __u8 sigset[0]; + __u32 len; + unsigned long sigset[0]; }; 4.22 KVM_GET_FPU
Signature · 1 line
1.7.4.4
Quoted 22 lines · Paolo Bonzini
-------------------------- 8< ----------------------------- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <[email protected]>
Date: Thu, 9 Jun 2011 17:48:50 +0200
Subject: [PATCH] KVM: fix documentation forKVM_SET_SIGNAL_MASKThe signal mask passed to
KVM_SET_SIGNAL_MASKneeds to be ABI-compatible with sigprocmask, so that functions operating onsigset_tcan be used with it. Referring to the signal mask as an array of bytes is incorrect on big endian systems, fix it.Signed-off-by Paolo Bonzini <[email protected]>--- Documentation/kvm/api.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Documentation/kvm/api.txt +0
-0
Documentation/kvm/api.txt signal mask. · line 469
Quoted 8 lines
Documentation/kvm/api.txt +2
-2@@ -464,8 +464,8 @@ signal mask. /* for KVM_SET_SIGNAL_MASK */ struct kvm_signal_mask { - __u32 len; - __u8 sigset[0]; + __u32 len; + unsigned long sigset[0]; };
But that doesn't match the definition in kvm.h. If someone sets kvm_signal_mask::sigset[3], they'll get different answers if they look at the documentation or the code.
So it needs to be documented in English, not C.
(and not whitespace-damaged, either)
Signature · 1 line
error compiling committee.c: too many arguments to function