- Fix potential segfault from too small MSR_COUNT (#528901)
This commit is contained in:
parent
05392e2b17
commit
7238c68414
|
@ -0,0 +1,67 @@
|
||||||
|
From 3ea6ac6fde5cd46d5d8593a493a75eb29e2ccc9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eduardo Habkost <ehabkost@redhat.com>
|
||||||
|
Date: Wed, 14 Oct 2009 15:02:27 -0300
|
||||||
|
Subject: [PATCH] fix MSR_COUNT for kvm_arch_save_regs()
|
||||||
|
|
||||||
|
A new register was added to the load/save list on commit
|
||||||
|
d283d5a65a2bdcc570065267be21848bd6fe3d78, but MSR_COUNT was not updated, leading
|
||||||
|
to potential stack corruption on kvm_arch_save_regs().
|
||||||
|
|
||||||
|
The following registers are saved by kvm_arch_save_regs():
|
||||||
|
|
||||||
|
1) MSR_IA32_SYSENTER_CS
|
||||||
|
2) MSR_IA32_SYSENTER_ESP
|
||||||
|
3) MSR_IA32_SYSENTER_EIP
|
||||||
|
4) MSR_STAR
|
||||||
|
5) MSR_IA32_TSC
|
||||||
|
6) MSR_VM_HSAVE_PA
|
||||||
|
7) MSR_CSTAR (x86_64 only)
|
||||||
|
8) MSR_KERNELGSBASE (x86_64 only)
|
||||||
|
9) MSR_FMASK (x86_64 only)
|
||||||
|
10) MSR_LSTAR (x86_64 only)
|
||||||
|
|
||||||
|
(cherry picked from commit e7e5448ba387adc20be1cf08411a5b526d684299)
|
||||||
|
|
||||||
|
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||||
|
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
|
||||||
|
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
|
||||||
|
Fedora-patch: qemu-fix-msr-count-potential-segfault.patch
|
||||||
|
---
|
||||||
|
qemu-kvm-x86.c | 6 ++++--
|
||||||
|
1 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
|
||||||
|
index 8e0f0b2..89fe77c 100644
|
||||||
|
--- a/qemu-kvm-x86.c
|
||||||
|
+++ b/qemu-kvm-x86.c
|
||||||
|
@@ -116,9 +116,9 @@ static int get_msr_entry(struct kvm_msr_entry *entry, CPUState *env)
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_X86_64
|
||||||
|
-#define MSR_COUNT 9
|
||||||
|
+#define MSR_COUNT 10
|
||||||
|
#else
|
||||||
|
-#define MSR_COUNT 5
|
||||||
|
+#define MSR_COUNT 6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void set_v8086_seg(struct kvm_segment *lhs, const SegmentCache *rhs)
|
||||||
|
@@ -260,6 +260,7 @@ void kvm_arch_load_regs(CPUState *env)
|
||||||
|
|
||||||
|
/* msrs */
|
||||||
|
n = 0;
|
||||||
|
+ /* Remember to increase MSR_COUNT if you add new registers below */
|
||||||
|
set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_CS, env->sysenter_cs);
|
||||||
|
set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_ESP, env->sysenter_esp);
|
||||||
|
set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
|
||||||
|
@@ -435,6 +436,7 @@ void kvm_arch_save_regs(CPUState *env)
|
||||||
|
|
||||||
|
/* msrs */
|
||||||
|
n = 0;
|
||||||
|
+ /* Remember to increase MSR_COUNT if you add new registers below */
|
||||||
|
msrs[n++].index = MSR_IA32_SYSENTER_CS;
|
||||||
|
msrs[n++].index = MSR_IA32_SYSENTER_ESP;
|
||||||
|
msrs[n++].index = MSR_IA32_SYSENTER_EIP;
|
||||||
|
--
|
||||||
|
1.6.2.5
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Summary: QEMU is a FAST! processor emulator
|
Summary: QEMU is a FAST! processor emulator
|
||||||
Name: qemu
|
Name: qemu
|
||||||
Version: 0.10.6
|
Version: 0.10.6
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
# Epoch because we pushed a qemu-1.0 package
|
# Epoch because we pushed a qemu-1.0 package
|
||||||
Epoch: 2
|
Epoch: 2
|
||||||
License: GPLv2+ and LGPLv2+ and BSD
|
License: GPLv2+ and LGPLv2+ and BSD
|
||||||
|
@ -37,6 +37,7 @@ Patch16: qemu-ppc-on-ppc.patch
|
||||||
Patch17: qemu-use-statfs-to-determine-huge-page-size.patch
|
Patch17: qemu-use-statfs-to-determine-huge-page-size.patch
|
||||||
Patch18: qemu-allow-pulseaudio-to-be-the-default.patch
|
Patch18: qemu-allow-pulseaudio-to-be-the-default.patch
|
||||||
Patch19: qemu-fix-virtio-net-gso-support.patch
|
Patch19: qemu-fix-virtio-net-gso-support.patch
|
||||||
|
Patch20: qemu-fix-msr-count-potential-segfault.patch
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
|
BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
|
||||||
|
@ -243,6 +244,7 @@ such as kvmtrace and kvm_stat.
|
||||||
%patch17 -p1
|
%patch17 -p1
|
||||||
%patch18 -p1
|
%patch18 -p1
|
||||||
%patch19 -p1
|
%patch19 -p1
|
||||||
|
%patch20 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# systems like rhel build system does not have a recent enough linker so
|
# systems like rhel build system does not have a recent enough linker so
|
||||||
|
@ -485,6 +487,9 @@ fi
|
||||||
%{_mandir}/man1/qemu-img.1*
|
%{_mandir}/man1/qemu-img.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 19 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10.6-8
|
||||||
|
- Fix potential segfault from too small MSR_COUNT (#528901)
|
||||||
|
|
||||||
* Mon Oct 5 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10.6-7
|
* Mon Oct 5 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10.6-7
|
||||||
- Use rtl8029 PXE rom for ne2k_pci, not ne (#526243)
|
- Use rtl8029 PXE rom for ne2k_pci, not ne (#526243)
|
||||||
- Also, replace the etherboot-zroms-kvm pkg requires with file-based requires
|
- Also, replace the etherboot-zroms-kvm pkg requires with file-based requires
|
||||||
|
|
Loading…
Reference in New Issue