From: Paolo Bonzini <pbonzini@redhat.com>
To: Marc Zyngier <maz@kernel.org>
Cc: "Christian Borntraeger" <borntraeger@de.ibm.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
kvm-devel <kvm@vger.kernel.org>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"James Morse" <james.morse@arm.com>,
"Julien Thierry" <julien.thierry.kdev@gmail.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"James Hogan" <jhogan@kernel.org>,
"Paul Mackerras" <paulus@ozlabs.org>,
"Janosch Frank" <frankja@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Wanpeng Li" <wanpengli@tencent.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>
Subject: Re: [PATCH] KVM: Forbid /dev/kvm being opened by a compat task when CONFIG_KVM_COMPAT=n
Date: Fri, 15 Nov 2019 10:14:11 +0100 [thread overview]
Message-ID: <86751a20-ae3a-2e47-0783-8f35bffdc5ac@redhat.com> (raw)
In-Reply-To: <4a9380afe118031c77be53112d73d5d4@www.loen.fr>
On 14/11/19 14:22, Marc Zyngier wrote:
>
> From 34bfc68752253c3da3e59072b137d1a4a85bc005 Mon Sep 17 00:00:00 2001
> From: Marc Zyngier <maz@kernel.org>
> Date: Thu, 14 Nov 2019 13:17:39 +0000
> Subject: [PATCH] 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 <maz@kernel.org>
> ---
> virt/kvm/kvm_main.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 1243e48dc717..722f2b1d4672 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -120,6 +120,13 @@ static long kvm_vcpu_compat_ioctl(struct file
> *file, unsigned int ioctl,
> unsigned long arg);
> #define KVM_COMPAT(c) .compat_ioctl = (c)
> #else
> +/*
> + * For architectures that don't implement a compat infrastructure,
> + * adopt a double line of defense:
> + * - Prevent a compat task from opening /dev/kvm
> + * - If the open has been done by a 64bit task, and the KVM fd
> + * passed to a compat task, let the ioctls fail.
> + */
> static long kvm_no_compat_ioctl(struct file *file, unsigned int ioctl,
> unsigned long arg) { return -EINVAL; }
>
> --
> 2.20.1
Queued, thanks!
Paolo
prev parent reply other threads:[~2019-11-15 9:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 16:05 [PATCH] KVM: Forbid /dev/kvm being opened by a compat task when CONFIG_KVM_COMPAT=n Marc Zyngier
2019-11-13 16:12 ` Paolo Bonzini
2019-11-13 18:43 ` Christian Borntraeger
2019-11-13 21:23 ` Peter Maydell
2019-11-14 8:15 ` Marc Zyngier
2019-11-14 8:20 ` Christian Borntraeger
2019-11-14 12:12 ` Paolo Bonzini
2019-11-14 13:22 ` Marc Zyngier
2019-11-14 13:28 ` Peter Maydell
2019-11-15 9:53 ` Paolo Bonzini
2019-11-15 9:14 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86751a20-ae3a-2e47-0783-8f35bffdc5ac@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=james.morse@arm.com \
--cc=jhogan@kernel.org \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=maz@kernel.org \
--cc=paulus@ozlabs.org \
--cc=peter.maydell@linaro.org \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=suzuki.poulose@arm.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox