lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 10 Aug 2012 12:36:22 +0200
From:	Florian Westphal <fw@...len.de>
To:	kvm@...r.kernel.org
Cc:	avi@...hat.com, linux-kernel@...r.kernel.org,
	Florian Westphal <fw@...len.de>
Subject: [PATCH] kvm: disable stealtime via reboot notifier to avoid mem corruption

else, we get memory corruption on reboot; found when tracking down
initramfs unpack error on initial reboot (with qemu-kvm -smp 2,
no problem with single-core).

problem with doing it via kvm_shutdown() is that this file
depends on CONFIG_KVM_CLOCK, also its not enough to call it for one
cpu only.

Signed-off-by: Florian Westphal <fw@...len.de>
---
 not subscribed, please CC on replies.
 Also, I don't know much about kvm or kexec, so its possible
 that i missed something.

 In any case, this seems to fix the initramfs corruption for me.
 patch is against virt/kvm/kvm.git.

 arch/x86/kernel/kvm.c      |    1 +
 arch/x86/kernel/kvmclock.c |    1 -
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index c1d61ee..1596cc8 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -354,6 +354,7 @@ static void kvm_pv_guest_cpu_reboot(void *unused)
 	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
 		wrmsrl(MSR_KVM_PV_EOI_EN, 0);
 	kvm_pv_disable_apf();
+	kvm_disable_steal_time();
 }
 
 static int kvm_pv_reboot_notify(struct notifier_block *nb,
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index f1b42b3..5a2fa7d 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -191,7 +191,6 @@ static void kvm_crash_shutdown(struct pt_regs *regs)
 static void kvm_shutdown(void)
 {
 	native_write_msr(msr_kvm_system_time, 0, 0);
-	kvm_disable_steal_time();
 	native_machine_shutdown();
 }
 
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ