From: Igor Mammedov <imammedo@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mtosatti@redhat.com, eabatalov89@gmail.com
Subject: [PATCH] x86: kvmclock: zero initialize pvclock shared memory area
Date: Mon, 10 Jun 2013 18:31:11 +0200 [thread overview]
Message-ID: <1370881871-13130-1-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <bug-59521-28872@https.bugzilla.kernel.org/>
===
Could be the following an acceptable fix?
===
kernel might hung in pvclock_clocksource_read() due to
uninitialized memory might contain odd version value in
following cycle:
do {
version = __pvclock_read_cycles(src, &ret, &flags);
} while ((src->version & 1) || version != src->version);
if secondary kvmclock is accessed before it's registered with kvm.
Clear garbage in pvclock shared memory area right after it's
allocated to avoid this issue.
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=59521
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
arch/x86/kernel/kvmclock.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index d2c3812..3dd37eb 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -242,6 +242,7 @@ void __init kvmclock_init(void)
if (!mem)
return;
hv_clock = __va(mem);
+ memset(hv_clock, 0, size);
if (kvm_register_clock("boot clock")) {
hv_clock = NULL;
--
1.7.1
next parent reply other threads:[~2013-06-10 16:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-59521-28872@https.bugzilla.kernel.org/>
2013-06-10 16:31 ` Igor Mammedov [this message]
2013-06-10 20:19 ` [PATCH] x86: kvmclock: zero initialize pvclock shared memory area Marcelo Tosatti
2013-06-15 18:01 ` [PATCHv1] kvm guest: fix uninitialized kvmclock read by KVM guest Eugene Batalov
2013-06-18 22:21 ` Marcelo Tosatti
2013-06-19 13:05 ` Paolo Bonzini
[not found] ` <CAJF2t5sYHy9q9a7-fZauf1Z7_FkK1_DOP13GHji=8-vDUsnnsQ@mail.gmail.com>
2013-06-19 13:29 ` Paolo Bonzini
2013-06-20 8:30 ` Igor Mammedov
2013-06-20 8:35 ` Paolo Bonzini
2013-06-21 9:01 ` [PATCH 0/2 v2] x86: kvmclock: Prevent uninitialized per-cpu kvmclock usage Igor Mammedov
2013-06-21 9:01 ` [PATCH 1/2] x86: kvmclock: zero initialize pvclock shared memory area Igor Mammedov
2013-06-21 9:01 ` [PATCH 2/2] x86: kvmclock: register per-cpu kvmclock at earliest possible time Igor Mammedov
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=1370881871-13130-1-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=eabatalov89@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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).