Compare commits
6 Commits
master
...
pve-kernel
Author | SHA1 | Date | |
---|---|---|---|
|
35fcdb4df4 | ||
|
d9c8122ccc | ||
|
1d6ab3c1ca | ||
|
16f4d03eb4 | ||
|
0141ea157c | ||
|
0ffb6ba51a |
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,6 +1,6 @@
|
||||
[submodule "submodules/zfsonlinux"]
|
||||
path = submodules/zfsonlinux
|
||||
url = ../zfsonlinux
|
||||
[submodule "submodules/ubuntu-kinetic"]
|
||||
[submodule "submodules/ubuntu-kernel"]
|
||||
path = submodules/ubuntu-kernel
|
||||
url = ../mirror_ubuntu-kernels
|
||||
|
4
Makefile
4
Makefile
@ -4,9 +4,9 @@ KERNEL_MIN=19
|
||||
KERNEL_PATCHLEVEL=17
|
||||
# increment KREL if the ABI changes (abicheck target in debian/rules)
|
||||
# rebuild packages with new KREL and run 'make abiupdate'
|
||||
KREL=1
|
||||
KREL=2
|
||||
|
||||
PKGREL=1
|
||||
PKGREL=2
|
||||
|
||||
KERNEL_MAJMIN=$(KERNEL_MAJ).$(KERNEL_MIN)
|
||||
KERNEL_VER=$(KERNEL_MAJMIN).$(KERNEL_PATCHLEVEL)
|
||||
|
27057
abi-prev-5.19.17-1-pve
27057
abi-prev-5.19.17-1-pve
File diff suppressed because it is too large
Load Diff
27059
abi-prev-5.19.17-2-pve
Normal file
27059
abi-prev-5.19.17-2-pve
Normal file
File diff suppressed because it is too large
Load Diff
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -1,3 +1,13 @@
|
||||
pve-kernel (5.19.17-2) bullseye; urgency=medium
|
||||
|
||||
* update submodule to Ubuntu-5.19.0-31.32
|
||||
|
||||
* bump ABI to 5.19.17-2
|
||||
|
||||
* note that this is likely the last release for Proxmox's 5.19 based kernel
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 28 Jan 2023 16:40:25 +0100
|
||||
|
||||
pve-kernel (5.19.17-1) bullseye; urgency=medium
|
||||
|
||||
* update to Ubuntu-5.19.0-24.25
|
||||
|
@ -55,7 +55,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
2 files changed, 111 insertions(+)
|
||||
|
||||
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
|
||||
index 18417e6e26d2..20b6f2687d67 100644
|
||||
index 364f1d6f4be4..02df36670b1f 100644
|
||||
--- a/Documentation/admin-guide/kernel-parameters.txt
|
||||
+++ b/Documentation/admin-guide/kernel-parameters.txt
|
||||
@@ -4098,6 +4098,15 @@
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
|
||||
index c56861ed0e38..3ba11c5e7acd 100644
|
||||
index 27712d129f61..b609a08f1f52 100644
|
||||
--- a/virt/kvm/kvm_main.c
|
||||
+++ b/virt/kvm/kvm_main.c
|
||||
@@ -79,7 +79,7 @@ module_param(halt_poll_ns, uint, 0644);
|
||||
|
@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/net/core/dev.c b/net/core/dev.c
|
||||
index ecaeb3ef8e5c..81f117f43bbe 100644
|
||||
index 887e44dc2f2e..08578ddbb60e 100644
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -10268,7 +10268,7 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list)
|
||||
@@ -10272,7 +10272,7 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list)
|
||||
if (time_after(jiffies, warning_time +
|
||||
READ_ONCE(netdev_unregister_timeout_secs) * HZ)) {
|
||||
list_for_each_entry(dev, list, todo_list) {
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 3 Aug 2022 18:50:00 +0300
|
||||
Subject: [PATCH] KVM: x86: emulator: em_sysexit should update ctxt->mode
|
||||
|
||||
This is one of the instructions that can change the
|
||||
processor mode.
|
||||
|
||||
Note that this is likely a benign bug, because the only problematic
|
||||
mode change is from 32 bit to 64 bit which can lead to truncation of RIP,
|
||||
and it is not possible to do with sysexit,
|
||||
since sysexit running in 32 bit mode will be limited to 32 bit version.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
arch/x86/kvm/emulate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 695a5d159de8..4aacaa379274 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2876,6 +2876,7 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt)
|
||||
ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS);
|
||||
|
||||
ctxt->_eip = rdx;
|
||||
+ ctxt->mode = usermode;
|
||||
*reg_write(ctxt, VCPU_REGS_RSP) = rcx;
|
||||
|
||||
return X86EMUL_CONTINUE;
|
@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 9d0268879590..2e064461c236 100644
|
||||
index 533203fc424f..c19e782ecc54 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2654,6 +2654,11 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
|
@ -1,158 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 3 Aug 2022 18:50:01 +0300
|
||||
Subject: [PATCH] KVM: x86: emulator: introduce emulator_recalc_and_set_mode
|
||||
|
||||
Some instructions update the cpu execution mode, which needs
|
||||
to update the emulation mode.
|
||||
|
||||
Extract this code, and make assign_eip_far use it.
|
||||
|
||||
assign_eip_far now reads CS, instead of getting it via a parameter,
|
||||
which is ok, because callers always assign CS to the
|
||||
same value before calling it.
|
||||
|
||||
No functional change is intended.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
arch/x86/kvm/emulate.c | 85 ++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 57 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 4aacaa379274..9d0268879590 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -794,8 +794,7 @@ static int linearize(struct x86_emulate_ctxt *ctxt,
|
||||
ctxt->mode, linear);
|
||||
}
|
||||
|
||||
-static inline int assign_eip(struct x86_emulate_ctxt *ctxt, ulong dst,
|
||||
- enum x86emul_mode mode)
|
||||
+static inline int assign_eip(struct x86_emulate_ctxt *ctxt, ulong dst)
|
||||
{
|
||||
ulong linear;
|
||||
int rc;
|
||||
@@ -805,41 +804,71 @@ static inline int assign_eip(struct x86_emulate_ctxt *ctxt, ulong dst,
|
||||
|
||||
if (ctxt->op_bytes != sizeof(unsigned long))
|
||||
addr.ea = dst & ((1UL << (ctxt->op_bytes << 3)) - 1);
|
||||
- rc = __linearize(ctxt, addr, &max_size, 1, false, true, mode, &linear);
|
||||
+ rc = __linearize(ctxt, addr, &max_size, 1, false, true, ctxt->mode, &linear);
|
||||
if (rc == X86EMUL_CONTINUE)
|
||||
ctxt->_eip = addr.ea;
|
||||
return rc;
|
||||
}
|
||||
|
||||
+static inline int emulator_recalc_and_set_mode(struct x86_emulate_ctxt *ctxt)
|
||||
+{
|
||||
+ u64 efer;
|
||||
+ struct desc_struct cs;
|
||||
+ u16 selector;
|
||||
+ u32 base3;
|
||||
+
|
||||
+ ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
|
||||
+
|
||||
+ if (!ctxt->ops->get_cr(ctxt, 0) & X86_CR0_PE) {
|
||||
+ /* Real mode. cpu must not have long mode active */
|
||||
+ if (efer & EFER_LMA)
|
||||
+ return X86EMUL_UNHANDLEABLE;
|
||||
+ ctxt->mode = X86EMUL_MODE_REAL;
|
||||
+ return X86EMUL_CONTINUE;
|
||||
+ }
|
||||
+
|
||||
+ if (ctxt->eflags & X86_EFLAGS_VM) {
|
||||
+ /* Protected/VM86 mode. cpu must not have long mode active */
|
||||
+ if (efer & EFER_LMA)
|
||||
+ return X86EMUL_UNHANDLEABLE;
|
||||
+ ctxt->mode = X86EMUL_MODE_VM86;
|
||||
+ return X86EMUL_CONTINUE;
|
||||
+ }
|
||||
+
|
||||
+ if (!ctxt->ops->get_segment(ctxt, &selector, &cs, &base3, VCPU_SREG_CS))
|
||||
+ return X86EMUL_UNHANDLEABLE;
|
||||
+
|
||||
+ if (efer & EFER_LMA) {
|
||||
+ if (cs.l) {
|
||||
+ /* Proper long mode */
|
||||
+ ctxt->mode = X86EMUL_MODE_PROT64;
|
||||
+ } else if (cs.d) {
|
||||
+ /* 32 bit compatibility mode*/
|
||||
+ ctxt->mode = X86EMUL_MODE_PROT32;
|
||||
+ } else {
|
||||
+ ctxt->mode = X86EMUL_MODE_PROT16;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Legacy 32 bit / 16 bit mode */
|
||||
+ ctxt->mode = cs.d ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;
|
||||
+ }
|
||||
+
|
||||
+ return X86EMUL_CONTINUE;
|
||||
+}
|
||||
+
|
||||
static inline int assign_eip_near(struct x86_emulate_ctxt *ctxt, ulong dst)
|
||||
{
|
||||
- return assign_eip(ctxt, dst, ctxt->mode);
|
||||
+ return assign_eip(ctxt, dst);
|
||||
}
|
||||
|
||||
-static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst,
|
||||
- const struct desc_struct *cs_desc)
|
||||
+static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst)
|
||||
{
|
||||
- enum x86emul_mode mode = ctxt->mode;
|
||||
- int rc;
|
||||
+ int rc = emulator_recalc_and_set_mode(ctxt);
|
||||
|
||||
-#ifdef CONFIG_X86_64
|
||||
- if (ctxt->mode >= X86EMUL_MODE_PROT16) {
|
||||
- if (cs_desc->l) {
|
||||
- u64 efer = 0;
|
||||
+ if (rc != X86EMUL_CONTINUE)
|
||||
+ return rc;
|
||||
|
||||
- ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
|
||||
- if (efer & EFER_LMA)
|
||||
- mode = X86EMUL_MODE_PROT64;
|
||||
- } else
|
||||
- mode = X86EMUL_MODE_PROT32; /* temporary value */
|
||||
- }
|
||||
-#endif
|
||||
- if (mode == X86EMUL_MODE_PROT16 || mode == X86EMUL_MODE_PROT32)
|
||||
- mode = cs_desc->d ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;
|
||||
- rc = assign_eip(ctxt, dst, mode);
|
||||
- if (rc == X86EMUL_CONTINUE)
|
||||
- ctxt->mode = mode;
|
||||
- return rc;
|
||||
+ return assign_eip(ctxt, dst);
|
||||
}
|
||||
|
||||
static inline int jmp_rel(struct x86_emulate_ctxt *ctxt, int rel)
|
||||
@@ -2172,7 +2201,7 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return rc;
|
||||
|
||||
- rc = assign_eip_far(ctxt, ctxt->src.val, &new_desc);
|
||||
+ rc = assign_eip_far(ctxt, ctxt->src.val);
|
||||
/* Error handling is not implemented. */
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return X86EMUL_UNHANDLEABLE;
|
||||
@@ -2250,7 +2279,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
|
||||
&new_desc);
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return rc;
|
||||
- rc = assign_eip_far(ctxt, eip, &new_desc);
|
||||
+ rc = assign_eip_far(ctxt, eip);
|
||||
/* Error handling is not implemented. */
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return X86EMUL_UNHANDLEABLE;
|
||||
@@ -3470,7 +3499,7 @@ static int em_call_far(struct x86_emulate_ctxt *ctxt)
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return rc;
|
||||
|
||||
- rc = assign_eip_far(ctxt, ctxt->src.val, &new_desc);
|
||||
+ rc = assign_eip_far(ctxt, ctxt->src.val);
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
goto fail;
|
||||
|
@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
3 files changed, 225 insertions(+)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 9106a4d4b9f0..497cf9e08cc7 100644
|
||||
index c19e782ecc54..48173cb63f7a 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -5854,3 +5854,9 @@ bool emulator_can_use_gpa(struct x86_emulate_ctxt *ctxt)
|
||||
@@ -5856,3 +5856,9 @@ bool emulator_can_use_gpa(struct x86_emulate_ctxt *ctxt)
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -267,10 +267,10 @@ index 8dff25d267b7..0eb13204bbc2 100644
|
||||
#if defined(CONFIG_X86_32)
|
||||
#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index a8575f37ced4..6a22f8933b23 100644
|
||||
index b3e72a86184e..8e6e85720242 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -13187,6 +13187,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit);
|
||||
@@ -13273,6 +13273,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit);
|
||||
static int __init kvm_x86_init(void)
|
||||
{
|
||||
kvm_mmu_x86_module_init();
|
@ -40,7 +40,7 @@ index 19c04412f6e1..cff765545738 100644
|
||||
|
||||
int (*mem_enc_ioctl)(struct kvm *kvm, void __user *argp);
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 497cf9e08cc7..d0a70517e042 100644
|
||||
index 48173cb63f7a..66fb9420842c 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2582,16 +2582,18 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt,
|
||||
@ -143,10 +143,10 @@ index 92b30b4937fc..f7f58c4cf341 100644
|
||||
return 0;
|
||||
|
||||
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
|
||||
index 98526e708f32..f3a0b4f0b9d5 100644
|
||||
index eecf8a45446d..017fe8873620 100644
|
||||
--- a/arch/x86/kvm/vmx/vmx.c
|
||||
+++ b/arch/x86/kvm/vmx/vmx.c
|
||||
@@ -7734,7 +7734,7 @@ static int vmx_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
@@ -7738,7 +7738,7 @@ static int vmx_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
return !is_smm(vcpu);
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ index 98526e708f32..f3a0b4f0b9d5 100644
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
|
||||
@@ -7748,7 +7748,7 @@ static int vmx_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
@@ -7752,7 +7752,7 @@ static int vmx_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -165,10 +165,10 @@ index 98526e708f32..f3a0b4f0b9d5 100644
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
int ret;
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 6a22f8933b23..e4cffaeddc2c 100644
|
||||
index 8e6e85720242..ebd4315080cd 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -7877,9 +7877,9 @@ static void emulator_exiting_smm(struct x86_emulate_ctxt *ctxt)
|
||||
@@ -7943,9 +7943,9 @@ static void emulator_exiting_smm(struct x86_emulate_ctxt *ctxt)
|
||||
}
|
||||
|
||||
static int emulator_leave_smm(struct x86_emulate_ctxt *ctxt,
|
||||
@ -180,7 +180,7 @@ index 6a22f8933b23..e4cffaeddc2c 100644
|
||||
}
|
||||
|
||||
static void emulator_triple_fault(struct x86_emulate_ctxt *ctxt)
|
||||
@@ -9788,25 +9788,25 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9872,25 +9872,25 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
struct kvm_segment cs, ds;
|
||||
struct desc_ptr dt;
|
||||
unsigned long cr0;
|
@ -15,7 +15,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
2 files changed, 60 insertions(+), 96 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index d0a70517e042..9aef34e5053b 100644
|
||||
index 66fb9420842c..aa60533d9d29 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2359,25 +2359,17 @@ static void rsm_set_desc_flags(struct desc_struct *desc, u32 flags)
|
||||
@ -145,10 +145,10 @@ index d0a70517e042..9aef34e5053b 100644
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
goto emulate_shutdown;
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index e4cffaeddc2c..0169f80e880e 100644
|
||||
index ebd4315080cd..87c8021e542c 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -9642,22 +9642,18 @@ static u32 enter_smm_get_segment_flags(struct kvm_segment *seg)
|
||||
@@ -9726,22 +9726,18 @@ static u32 enter_smm_get_segment_flags(struct kvm_segment *seg)
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ index e4cffaeddc2c..0169f80e880e 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9678,54 +9674,47 @@ static void enter_smm_save_seg_64(struct kvm_vcpu *vcpu, char *buf, int n)
|
||||
@@ -9762,54 +9758,47 @@ static void enter_smm_save_seg_64(struct kvm_vcpu *vcpu, char *buf, int n)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -257,7 +257,7 @@ index e4cffaeddc2c..0169f80e880e 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9796,7 +9785,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9880,7 +9869,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
enter_smm_save_state_64(vcpu, (char *)&smram);
|
||||
else
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Wed, 3 Aug 2022 18:50:03 +0300
|
||||
Subject: [PATCH] KVM: x86: emulator: update the emulation mode after CR0 write
|
||||
|
||||
CR0.PE toggles real/protected mode, thus its update
|
||||
should update the emulation mode.
|
||||
|
||||
This is likely a benign bug because there is no writeback
|
||||
of state, other than the RIP increment, and when toggling
|
||||
CR0.PE, the CPU has to execute code from a very low memory address.
|
||||
|
||||
Also CR0.PG toggle when EFER.LMA is set, toggles the long mode.
|
||||
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
arch/x86/kvm/emulate.c | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 2e064461c236..9106a4d4b9f0 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -3646,11 +3646,23 @@ static int em_movbe(struct x86_emulate_ctxt *ctxt)
|
||||
|
||||
static int em_cr_write(struct x86_emulate_ctxt *ctxt)
|
||||
{
|
||||
- if (ctxt->ops->set_cr(ctxt, ctxt->modrm_reg, ctxt->src.val))
|
||||
+ int cr_num = ctxt->modrm_reg;
|
||||
+ int r;
|
||||
+
|
||||
+ if (ctxt->ops->set_cr(ctxt, cr_num, ctxt->src.val))
|
||||
return emulate_gp(ctxt, 0);
|
||||
|
||||
/* Disable writeback. */
|
||||
ctxt->dst.type = OP_NONE;
|
||||
+
|
||||
+ if (cr_num == 0) {
|
||||
+ /* CR0 write might have updated CR0.PE and/or CR0.PG
|
||||
+ * which can affect the cpu execution mode */
|
||||
+ r = emulator_recalc_and_set_mode(ctxt);
|
||||
+ if (r != X86EMUL_CONTINUE)
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
return X86EMUL_CONTINUE;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
2 files changed, 62 insertions(+), 101 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index 9aef34e5053b..a31af03e050e 100644
|
||||
index aa60533d9d29..5480b23112e3 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2373,24 +2373,16 @@ static void rsm_load_seg_32(struct x86_emulate_ctxt *ctxt,
|
||||
@ -154,10 +154,10 @@ index 9aef34e5053b..a31af03e050e 100644
|
||||
#endif
|
||||
ret = rsm_load_state_32(ctxt, &smram.smram32);
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 0169f80e880e..2fd19d44ec55 100644
|
||||
index 87c8021e542c..ada063ab8ae9 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -9657,20 +9657,17 @@ static void enter_smm_save_seg_32(struct kvm_vcpu *vcpu,
|
||||
@@ -9741,20 +9741,17 @@ static void enter_smm_save_seg_32(struct kvm_vcpu *vcpu,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@ -185,7 +185,7 @@ index 0169f80e880e..2fd19d44ec55 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9718,57 +9715,51 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9802,57 +9799,51 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@ -268,7 +268,7 @@ index 0169f80e880e..2fd19d44ec55 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9782,7 +9773,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9866,7 +9857,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
memset(smram.bytes, 0, sizeof(smram.bytes));
|
||||
#ifdef CONFIG_X86_64
|
||||
if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
|
@ -30,7 +30,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
3 files changed, 32 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
|
||||
index a31af03e050e..51d98622c8fc 100644
|
||||
index 5480b23112e3..4c9c9844d38f 100644
|
||||
--- a/arch/x86/kvm/emulate.c
|
||||
+++ b/arch/x86/kvm/emulate.c
|
||||
@@ -2435,7 +2435,7 @@ static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt,
|
||||
@ -128,10 +128,10 @@ index 04ac0cef8b57..d5707b3f254c 100644
|
||||
__CHECK_SMRAM64_OFFSET(auto_hlt_restart, 0xFEC9);
|
||||
__CHECK_SMRAM64_OFFSET(reserved2, 0xFECA);
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 2fd19d44ec55..6c61a53c2523 100644
|
||||
index ada063ab8ae9..4050b34806ac 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -7864,6 +7864,11 @@ static void emulator_set_nmi_mask(struct x86_emulate_ctxt *ctxt, bool masked)
|
||||
@@ -7930,6 +7930,11 @@ static void emulator_set_nmi_mask(struct x86_emulate_ctxt *ctxt, bool masked)
|
||||
static_call(kvm_x86_set_nmi_mask)(emul_to_vcpu(ctxt), masked);
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ index 2fd19d44ec55..6c61a53c2523 100644
|
||||
static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt)
|
||||
{
|
||||
return emul_to_vcpu(ctxt)->arch.hflags;
|
||||
@@ -7935,6 +7940,7 @@ static const struct x86_emulate_ops emulate_ops = {
|
||||
@@ -8001,6 +8006,7 @@ static const struct x86_emulate_ops emulate_ops = {
|
||||
.guest_has_fxsr = emulator_guest_has_fxsr,
|
||||
.guest_has_rdpid = emulator_guest_has_rdpid,
|
||||
.set_nmi_mask = emulator_set_nmi_mask,
|
||||
@ -151,7 +151,7 @@ index 2fd19d44ec55..6c61a53c2523 100644
|
||||
.get_hflags = emulator_get_hflags,
|
||||
.exiting_smm = emulator_exiting_smm,
|
||||
.leave_smm = emulator_leave_smm,
|
||||
@@ -9712,6 +9718,8 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9796,6 +9802,8 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
smram->cr4 = kvm_read_cr4(vcpu);
|
||||
smram->smm_revision = 0x00020000;
|
||||
smram->smbase = vcpu->arch.smbase;
|
||||
@ -160,7 +160,7 @@ index 2fd19d44ec55..6c61a53c2523 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9760,6 +9768,8 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9844,6 +9852,8 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
enter_smm_save_seg_64(vcpu, &smram->ds, VCPU_SREG_DS);
|
||||
enter_smm_save_seg_64(vcpu, &smram->fs, VCPU_SREG_FS);
|
||||
enter_smm_save_seg_64(vcpu, &smram->gs, VCPU_SREG_GS);
|
||||
@ -169,7 +169,7 @@ index 2fd19d44ec55..6c61a53c2523 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9796,6 +9806,8 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9880,6 +9890,8 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
|
||||
kvm_rip_write(vcpu, 0x8000);
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f3399550edbaa36451c7b22b8e184118a0684ae1
|
||||
Subproject commit 545d5996cbb9a74ea34f7bb0636e5af8ae950896
|
@ -1 +1 @@
|
||||
Subproject commit 796e3f981ff4670411f7da2eadd944e4bfc2ff2a
|
||||
Subproject commit 5ea8a38968ee2cc9e50b3a66819b5520f46eb660
|
Loading…
Reference in New Issue
Block a user