From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: [PATCH] KVM: x86: Deny PIT creation on the absence of in-kernel irqchip support
Date: Wed, 14 Dec 2011 16:51:59 +0100 [thread overview]
Message-ID: <4EE8C61F.8050200@siemens.com> (raw)
Failing to do this allowed user space to crash the host by creating a
PIT without in-kernel IRQ controllers and routes in place:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000128
IP: [<ffffffffa10f6280>] kvm_set_irq+0x30/0x170 [kvm]
...
Call Trace:
[<ffffffffa11228c1>] pit_do_work+0x51/0xd0 [kvm]
[<ffffffff81071431>] process_one_work+0x111/0x4d0
[<ffffffff81071bb2>] worker_thread+0x152/0x340
[<ffffffff81075c8e>] kthread+0x7e/0x90
[<ffffffff815a4474>] kernel_thread_helper+0x4/0x10
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Stable material as well.
arch/x86/kvm/x86.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 23c93fe..7137a84 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3152,6 +3152,9 @@ long kvm_arch_vm_ioctl(struct file *filp,
goto out;
create_pit:
mutex_lock(&kvm->slots_lock);
+ r = -ENXIO;
+ if (!irqchip_in_kernel(kvm))
+ goto create_pit_unlock;
r = -EEXIST;
if (kvm->arch.vpit)
goto create_pit_unlock;
--
1.7.3.4
next reply other threads:[~2011-12-14 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 15:51 Jan Kiszka [this message]
2011-12-14 17:38 ` [PATCH] KVM: x86: Deny PIT creation on the absence of in-kernel irqchip support Jan Kiszka
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=4EE8C61F.8050200@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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;
as well as URLs for NNTP newsgroup(s).