From 12247ad0df0f583b7811a4afe2c90756be3d342b Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 13 Dec 2022 09:31:53 +0100 Subject: [PATCH] update to Ubuntu-6.1.0-1.1 from upcoming 23.04 lunar repo Signed-off-by: Thomas Lamprecht --- ...-accept-an-alternate-timestamp-strin.patch | 37 ++-- ...ides-for-missing-ACS-capabilities-4..patch | 8 +- ...-default-dynamic-halt-polling-growth.patch | 2 +- ...de-unregister_netdevice-refcount-lea.patch | 4 +- ...rate-split-BTF-type-info-per-default.patch | 2 +- ...r-em_sysexit-should-update-ctxt-mode.patch | 31 ---- ...update-the-emulation-mode-after-rsm.patch} | 2 +- ...-introduce-emulator_recalc_and_set_m.patch | 158 ------------------ ...smm-add-structs-for-KVM-s-smram-lay.patch} | 12 +- ...smm-use-smram-structs-in-the-common.patch} | 32 ++-- ...smm-use-smram-struct-for-32-bit-smr.patch} | 10 +- ...-update-the-emulation-mode-after-CR0.patch | 49 ------ ...smm-use-smram-struct-for-64-bit-smr.patch} | 10 +- ... 0014-KVM-x86-SVM-use-smram-structs.patch} | 12 +- ...-save-SVM-state-to-SMRAM-when-VM-is.patch} | 4 +- ...smm-preserve-interrupt-shadow-in-SM.patch} | 28 ++-- submodules/ubuntu-kernel | 2 +- 17 files changed, 78 insertions(+), 325 deletions(-) delete mode 100644 patches/kernel/0009-KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch rename patches/kernel/{0011-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch => 0009-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch} (96%) delete mode 100644 patches/kernel/0010-KVM-x86-emulator-introduce-emulator_recalc_and_set_m.patch rename patches/kernel/{0013-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch => 0010-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch} (96%) rename patches/kernel/{0014-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch => 0011-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch} (88%) rename patches/kernel/{0015-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch => 0012-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch} (96%) delete mode 100644 patches/kernel/0012-KVM-x86-emulator-update-the-emulation-mode-after-CR0.patch rename patches/kernel/{0016-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch => 0013-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch} (96%) rename patches/kernel/{0017-KVM-x86-SVM-use-smram-structs.patch => 0014-KVM-x86-SVM-use-smram-structs.patch} (90%) rename patches/kernel/{0018-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch => 0015-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch} (92%) rename patches/kernel/{0019-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch => 0016-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch} (87%) diff --git a/patches/kernel/0001-Make-mkcompile_h-accept-an-alternate-timestamp-strin.patch b/patches/kernel/0001-Make-mkcompile_h-accept-an-alternate-timestamp-strin.patch index 4b5dfd5..e56f466 100644 --- a/patches/kernel/0001-Make-mkcompile_h-accept-an-alternate-timestamp-strin.patch +++ b/patches/kernel/0001-Make-mkcompile_h-accept-an-alternate-timestamp-strin.patch @@ -17,28 +17,19 @@ $KBUILD_BUILD_TIMESTAMP. Signed-off-by: Fabian Grünbichler Signed-off-by: Thomas Lamprecht --- - scripts/mkcompile_h | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) + init/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h -index ca40a5258c87..6ae930a732f0 100755 ---- a/scripts/mkcompile_h -+++ b/scripts/mkcompile_h -@@ -23,10 +23,14 @@ else - VERSION=$KBUILD_BUILD_VERSION - fi +diff --git a/init/Makefile b/init/Makefile +index 8316c23bead2..e99b8de4a93a 100644 +--- a/init/Makefile ++++ b/init/Makefile +@@ -29,7 +29,7 @@ preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC + preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT --if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then -- TIMESTAMP=`date` -+if [ -z "$KBUILD_BUILD_VERSION_TIMESTAMP" ]; then -+ if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then -+ TIMESTAMP=`date` -+ else -+ TIMESTAMP=$KBUILD_BUILD_TIMESTAMP -+ fi - else -- TIMESTAMP=$KBUILD_BUILD_TIMESTAMP -+ TIMESTAMP=$KBUILD_BUILD_VERSION_TIMESTAMP - fi - if test -z "$KBUILD_BUILD_USER"; then - LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/') + build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) +-build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) ++build-timestamp = $(or $(KBUILD_BUILD_VERSION_TIMESTAMP), $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) + + # Maximum length of UTS_VERSION is 64 chars + filechk_uts_version = \ diff --git a/patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch b/patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch index 0dfc42e..a5c1097 100644 --- a/patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch +++ b/patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch @@ -55,10 +55,10 @@ Signed-off-by: Thomas Lamprecht 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 ff56a4fe3f95..100342e59f45 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -4098,6 +4098,15 @@ +@@ -4155,6 +4155,15 @@ Also, it enforces the PCI Local Bus spec rule that those bits should be 0 in system reset events (useful for kexec/kdump cases). @@ -75,7 +75,7 @@ index 18417e6e26d2..20b6f2687d67 100644 Safety option to keep boot IRQs enabled. This should never be necessary. diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index acf45f1f7264..7ab01acebf99 100644 +index db9ec6b90839..8cd5aaddc7fd 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -194,6 +194,106 @@ static int __init pci_apply_final_quirks(void) @@ -185,7 +185,7 @@ index acf45f1f7264..7ab01acebf99 100644 /* * Decoding should be disabled for a PCI device during BAR sizing to avoid * conflict. But doing so may cause problems on host bridge and perhaps other -@@ -4928,6 +5028,8 @@ static const struct pci_dev_acs_enabled { +@@ -4939,6 +5039,8 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_CAVIUM, 0xA060, pci_quirk_mf_endpoint_acs }, /* APM X-Gene */ { PCI_VENDOR_ID_AMCC, 0xE004, pci_quirk_xgene_acs }, diff --git a/patches/kernel/0004-kvm-disable-default-dynamic-halt-polling-growth.patch b/patches/kernel/0004-kvm-disable-default-dynamic-halt-polling-growth.patch index 2f2b6d6..93252eb 100644 --- a/patches/kernel/0004-kvm-disable-default-dynamic-halt-polling-growth.patch +++ b/patches/kernel/0004-kvm-disable-default-dynamic-halt-polling-growth.patch @@ -13,7 +13,7 @@ Signed-off-by: Thomas Lamprecht 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 fab4d3790578..adae153354c2 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -79,7 +79,7 @@ module_param(halt_poll_ns, uint, 0644); diff --git a/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch b/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch index bc5ad8a..efb3160 100644 --- a/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch +++ b/patches/kernel/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch @@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c -index ecaeb3ef8e5c..81f117f43bbe 100644 +index 3be256051e99..e79b1695a4cb 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) +@@ -10273,7 +10273,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) { diff --git a/patches/kernel/0006-do-not-generate-split-BTF-type-info-per-default.patch b/patches/kernel/0006-do-not-generate-split-BTF-type-info-per-default.patch index 1fc4906..5f60762 100644 --- a/patches/kernel/0006-do-not-generate-split-BTF-type-info-per-default.patch +++ b/patches/kernel/0006-do-not-generate-split-BTF-type-info-per-default.patch @@ -14,7 +14,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 8c31c98f0bfc..470b78cd0134 100644 +index 3638b3424be5..43172078db03 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -365,7 +365,7 @@ config PAHOLE_HAS_BTF_TAG diff --git a/patches/kernel/0009-KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch b/patches/kernel/0009-KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch deleted file mode 100644 index a8a9b3d..0000000 --- a/patches/kernel/0009-KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Levitsky -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 -Signed-off-by: Thomas Lamprecht ---- - 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; diff --git a/patches/kernel/0011-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch b/patches/kernel/0009-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch similarity index 96% rename from patches/kernel/0011-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch rename to patches/kernel/0009-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch index 5db7ad5..9c225a8 100644 --- a/patches/kernel/0011-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch +++ b/patches/kernel/0009-KVM-x86-emulator-update-the-emulation-mode-after-rsm.patch @@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 9d0268879590..2e064461c236 100644 +index 4a43261d25a2..4f7f5117ec7a 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) diff --git a/patches/kernel/0010-KVM-x86-emulator-introduce-emulator_recalc_and_set_m.patch b/patches/kernel/0010-KVM-x86-emulator-introduce-emulator_recalc_and_set_m.patch deleted file mode 100644 index f8222e7..0000000 --- a/patches/kernel/0010-KVM-x86-emulator-introduce-emulator_recalc_and_set_m.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Levitsky -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 -Signed-off-by: Thomas Lamprecht ---- - 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; - diff --git a/patches/kernel/0013-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch b/patches/kernel/0010-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch similarity index 96% rename from patches/kernel/0013-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch rename to patches/kernel/0010-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch index b0aa90b..546eee7 100644 --- a/patches/kernel/0013-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch +++ b/patches/kernel/0010-KVM-x86-emulator-smm-add-structs-for-KVM-s-smram-lay.patch @@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht 3 files changed, 225 insertions(+) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 9106a4d4b9f0..497cf9e08cc7 100644 +index 4f7f5117ec7a..470dd4453b01 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; } @@ -31,7 +31,7 @@ index 9106a4d4b9f0..497cf9e08cc7 100644 + __check_smram64_offsets(); +} diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h -index 8dff25d267b7..0eb13204bbc2 100644 +index 89246446d6aa..dd0ae61e44a1 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -13,6 +13,7 @@ @@ -42,7 +42,7 @@ index 8dff25d267b7..0eb13204bbc2 100644 #include "fpu.h" struct x86_emulate_ctxt; -@@ -481,6 +482,223 @@ enum x86_intercept { +@@ -503,6 +504,223 @@ enum x86_intercept { nr_x86_intercepts }; @@ -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 acca85b10545..20aec64e3521 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); +@@ -13730,6 +13730,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit); static int __init kvm_x86_init(void) { kvm_mmu_x86_module_init(); diff --git a/patches/kernel/0014-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch b/patches/kernel/0011-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch similarity index 88% rename from patches/kernel/0014-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch rename to patches/kernel/0011-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch index 4fd533f..6a46cc5 100644 --- a/patches/kernel/0014-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch +++ b/patches/kernel/0011-KVM-x86-emulator-smm-use-smram-structs-in-the-common.patch @@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index 19c04412f6e1..cff765545738 100644 +index f05ebaa26f0f..6885f3839e25 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h -@@ -202,6 +202,7 @@ typedef enum exit_fastpath_completion fastpath_t; +@@ -204,6 +204,7 @@ typedef enum exit_fastpath_completion fastpath_t; struct x86_emulate_ctxt; struct x86_exception; @@ -28,7 +28,7 @@ index 19c04412f6e1..cff765545738 100644 enum x86_intercept; enum x86_intercept_stage; -@@ -1552,8 +1553,8 @@ struct kvm_x86_ops { +@@ -1613,8 +1614,8 @@ struct kvm_x86_ops { void (*setup_mce)(struct kvm_vcpu *vcpu); int (*smi_allowed)(struct kvm_vcpu *vcpu, bool for_injection); @@ -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 470dd4453b01..7294dffa794a 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, @@ -84,7 +84,7 @@ index 497cf9e08cc7..d0a70517e042 100644 if (ret != X86EMUL_CONTINUE) goto emulate_shutdown; diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h -index 0eb13204bbc2..04ac0cef8b57 100644 +index dd0ae61e44a1..76c0b8e7890b 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -19,6 +19,7 @@ @@ -95,7 +95,7 @@ index 0eb13204bbc2..04ac0cef8b57 100644 struct x86_exception { u8 vector; -@@ -235,7 +236,7 @@ struct x86_emulate_ops { +@@ -236,7 +237,7 @@ struct x86_emulate_ops { unsigned (*get_hflags)(struct x86_emulate_ctxt *ctxt); void (*exiting_smm)(struct x86_emulate_ctxt *ctxt); @@ -105,10 +105,10 @@ index 0eb13204bbc2..04ac0cef8b57 100644 int (*set_xcr)(struct x86_emulate_ctxt *ctxt, u32 index, u64 xcr); }; diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c -index 92b30b4937fc..f7f58c4cf341 100644 +index ce362e88a567..45c4def86cd3 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c -@@ -4308,12 +4308,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) +@@ -4385,12 +4385,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) return 1; } @@ -124,7 +124,7 @@ index 92b30b4937fc..f7f58c4cf341 100644 if (!is_guest_mode(vcpu)) return 0; -@@ -4355,7 +4357,7 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate) +@@ -4432,7 +4434,7 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate) return 0; } @@ -133,7 +133,7 @@ index 92b30b4937fc..f7f58c4cf341 100644 { struct vcpu_svm *svm = to_svm(vcpu); struct kvm_host_map map, map_save; -@@ -4363,6 +4365,8 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) +@@ -4440,6 +4442,8 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) struct vmcb *vmcb12; int ret; @@ -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 63247c57c72c..4319f65181f7 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) +@@ -7914,7 +7914,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) +@@ -7935,7 +7935,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 20aec64e3521..94c29391b065 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) +@@ -8186,9 +8186,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) +@@ -10246,25 +10246,25 @@ static void enter_smm(struct kvm_vcpu *vcpu) struct kvm_segment cs, ds; struct desc_ptr dt; unsigned long cr0; diff --git a/patches/kernel/0015-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch b/patches/kernel/0012-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch similarity index 96% rename from patches/kernel/0015-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch rename to patches/kernel/0012-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch index a3aa51e..40234cf 100644 --- a/patches/kernel/0015-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch +++ b/patches/kernel/0012-KVM-x86-emulator-smm-use-smram-struct-for-32-bit-smr.patch @@ -15,7 +15,7 @@ Signed-off-by: Thomas Lamprecht 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 7294dffa794a..65d82292ccec 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 94c29391b065..579a1cb6a7c8 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) +@@ -10100,22 +10100,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) +@@ -10136,54 +10132,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) +@@ -10254,7 +10243,7 @@ static void enter_smm(struct kvm_vcpu *vcpu) enter_smm_save_state_64(vcpu, (char *)&smram); else #endif diff --git a/patches/kernel/0012-KVM-x86-emulator-update-the-emulation-mode-after-CR0.patch b/patches/kernel/0012-KVM-x86-emulator-update-the-emulation-mode-after-CR0.patch deleted file mode 100644 index a29ff2f..0000000 --- a/patches/kernel/0012-KVM-x86-emulator-update-the-emulation-mode-after-CR0.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Levitsky -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 -Signed-off-by: Thomas Lamprecht ---- - 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; - } - diff --git a/patches/kernel/0016-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch b/patches/kernel/0013-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch similarity index 96% rename from patches/kernel/0016-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch rename to patches/kernel/0013-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch index 90a68e6..aa962a5 100644 --- a/patches/kernel/0016-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch +++ b/patches/kernel/0013-KVM-x86-emulator-smm-use-smram-struct-for-64-bit-smr.patch @@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht 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 65d82292ccec..03f9e5aa036e 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 579a1cb6a7c8..7a4d86f9bdcd 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, +@@ -10115,20 +10115,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 +@@ -10176,57 +10173,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) +@@ -10240,7 +10231,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)) diff --git a/patches/kernel/0017-KVM-x86-SVM-use-smram-structs.patch b/patches/kernel/0014-KVM-x86-SVM-use-smram-structs.patch similarity index 90% rename from patches/kernel/0017-KVM-x86-SVM-use-smram-structs.patch rename to patches/kernel/0014-KVM-x86-SVM-use-smram-structs.patch index c139da6..0cbb708 100644 --- a/patches/kernel/0017-KVM-x86-SVM-use-smram-structs.patch +++ b/patches/kernel/0014-KVM-x86-SVM-use-smram-structs.patch @@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index cff765545738..143cd0b5d593 100644 +index 6885f3839e25..f5b82b6f4f84 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h -@@ -2044,12 +2044,6 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) +@@ -2090,12 +2090,6 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) #endif } @@ -34,10 +34,10 @@ index cff765545738..143cd0b5d593 100644 int memslot_rmap_alloc(struct kvm_memory_slot *slot, unsigned long npages); diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c -index f7f58c4cf341..20f90c596d6a 100644 +index 45c4def86cd3..bfacbef667d7 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c -@@ -4314,15 +4314,11 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram) +@@ -4391,15 +4391,11 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram) struct kvm_host_map map_save; int ret; @@ -55,7 +55,7 @@ index f7f58c4cf341..20f90c596d6a 100644 svm->vmcb->save.rax = vcpu->arch.regs[VCPU_REGS_RAX]; svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP]; -@@ -4361,28 +4357,23 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram) +@@ -4438,28 +4434,23 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram) { struct vcpu_svm *svm = to_svm(vcpu); struct kvm_host_map map, map_save; @@ -87,7 +87,7 @@ index f7f58c4cf341..20f90c596d6a 100644 return 1; ret = 1; -@@ -4408,7 +4399,7 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram) +@@ -4485,7 +4476,7 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram) vmcb12 = map.hva; nested_copy_vmcb_control_to_cache(svm, &vmcb12->control); nested_copy_vmcb_save_to_cache(svm, &vmcb12->save); diff --git a/patches/kernel/0018-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch b/patches/kernel/0015-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch similarity index 92% rename from patches/kernel/0018-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch rename to patches/kernel/0015-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch index 589ba2c..fedb9bd 100644 --- a/patches/kernel/0018-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch +++ b/patches/kernel/0015-KVM-x86-SVM-don-t-save-SVM-state-to-SMRAM-when-VM-is.patch @@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht 1 file changed, 9 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c -index 20f90c596d6a..c816783737b0 100644 +index bfacbef667d7..6b02f99fe70c 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c -@@ -4317,6 +4317,15 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram) +@@ -4394,6 +4394,15 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram) if (!is_guest_mode(vcpu)) return 0; diff --git a/patches/kernel/0019-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch b/patches/kernel/0016-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch similarity index 87% rename from patches/kernel/0019-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch rename to patches/kernel/0016-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch index 1d47f95..7248b78 100644 --- a/patches/kernel/0019-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch +++ b/patches/kernel/0016-KVM-x86-emulator-smm-preserve-interrupt-shadow-in-SM.patch @@ -30,7 +30,7 @@ Signed-off-by: Thomas Lamprecht 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 03f9e5aa036e..bb008a5be539 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, @@ -72,10 +72,10 @@ index a31af03e050e..51d98622c8fc 100644 } #endif diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h -index 04ac0cef8b57..d5707b3f254c 100644 +index 76c0b8e7890b..a7313add0f2a 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h -@@ -233,6 +233,7 @@ struct x86_emulate_ops { +@@ -234,6 +234,7 @@ struct x86_emulate_ops { bool (*guest_has_rdpid)(struct x86_emulate_ctxt *ctxt); void (*set_nmi_mask)(struct x86_emulate_ctxt *ctxt, bool masked); @@ -83,7 +83,7 @@ index 04ac0cef8b57..d5707b3f254c 100644 unsigned (*get_hflags)(struct x86_emulate_ctxt *ctxt); void (*exiting_smm)(struct x86_emulate_ctxt *ctxt); -@@ -496,7 +497,8 @@ struct kvm_smram_state_32 { +@@ -518,7 +519,8 @@ struct kvm_smram_state_32 { u32 reserved1[62]; u32 smbase; u32 smm_revision; @@ -93,7 +93,7 @@ index 04ac0cef8b57..d5707b3f254c 100644 u32 cr4; /* CR4 is not present in Intel/AMD SMRAM image */ u32 reserved3[5]; -@@ -544,6 +546,7 @@ static inline void __check_smram32_offsets(void) +@@ -566,6 +568,7 @@ static inline void __check_smram32_offsets(void) __CHECK_SMRAM32_OFFSET(smbase, 0xFEF8); __CHECK_SMRAM32_OFFSET(smm_revision, 0xFEFC); __CHECK_SMRAM32_OFFSET(reserved2, 0xFF00); @@ -101,7 +101,7 @@ index 04ac0cef8b57..d5707b3f254c 100644 __CHECK_SMRAM32_OFFSET(cr4, 0xFF14); __CHECK_SMRAM32_OFFSET(reserved3, 0xFF18); __CHECK_SMRAM32_OFFSET(ds, 0xFF2C); -@@ -603,7 +606,7 @@ struct kvm_smram_state_64 { +@@ -625,7 +628,7 @@ struct kvm_smram_state_64 { u64 io_restart_rsi; u64 io_restart_rdi; u32 io_restart_dword; @@ -110,7 +110,7 @@ index 04ac0cef8b57..d5707b3f254c 100644 u8 io_inst_restart; u8 auto_hlt_restart; u8 reserved2[6]; -@@ -641,7 +644,6 @@ struct kvm_smram_state_64 { +@@ -663,7 +666,6 @@ struct kvm_smram_state_64 { u64 gprs[16]; /* GPRS in a reversed "natural" X86 order (R15/R14/../RCX/RAX.) */ }; @@ -118,7 +118,7 @@ index 04ac0cef8b57..d5707b3f254c 100644 static inline void __check_smram64_offsets(void) { #define __CHECK_SMRAM64_OFFSET(field, offset) \ -@@ -662,7 +664,7 @@ static inline void __check_smram64_offsets(void) +@@ -684,7 +686,7 @@ static inline void __check_smram64_offsets(void) __CHECK_SMRAM64_OFFSET(io_restart_rsi, 0xFEB0); __CHECK_SMRAM64_OFFSET(io_restart_rdi, 0xFEB8); __CHECK_SMRAM64_OFFSET(io_restart_dword, 0xFEC0); @@ -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 7a4d86f9bdcd..609829ec1d13 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) +@@ -8173,6 +8173,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 = { +@@ -8253,6 +8258,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 +@@ -10170,6 +10176,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 +@@ -10218,6 +10226,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) +@@ -10254,6 +10264,8 @@ static void enter_smm(struct kvm_vcpu *vcpu) kvm_set_rflags(vcpu, X86_EFLAGS_FIXED); kvm_rip_write(vcpu, 0x8000); diff --git a/submodules/ubuntu-kernel b/submodules/ubuntu-kernel index f339955..6d4b27c 160000 --- a/submodules/ubuntu-kernel +++ b/submodules/ubuntu-kernel @@ -1 +1 @@ -Subproject commit f3399550edbaa36451c7b22b8e184118a0684ae1 +Subproject commit 6d4b27ce7d9029ff0c1e8a58d8bf95b0b3769a3a