From e33b7a76dacaa704133703554d4680bc91eb2c30 Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: May 23 2023 15:00:44 +0000 Subject: KVM: x86: emulator: em_sysexit should update ctxt->mode (git-fixes). --- diff --git a/patches.suse/KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch b/patches.suse/KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch new file mode 100644 index 0000000..8eebcb5 --- /dev/null +++ b/patches.suse/KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch @@ -0,0 +1,39 @@ +Patch-mainline: v6.1-rc4 +Git-commit: 5015bb89b58225f97df6ac44383e7e8c8662c8c9 +References: git-fixes +From: Maxim Levitsky +Date: Tue, 25 Oct 2022 15:47:28 +0300 +Subject: [PATCH] KVM: x86: emulator: em_sysexit should update ctxt->mode + +SYSEXIT is one of the instructions that can change the +processor mode, thus ctxt->mode should be updated after it. + +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 +Message-Id: <20221025124741.228045-11-mlevitsk@redhat.com> +Cc: stable@vger.kernel.org +Signed-off-by: Paolo Bonzini +Signed-off-by: Juergen Gross +--- + 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 3b27622d4642..261732957431 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; +-- +2.35.3 + diff --git a/series.conf b/series.conf index a652cdb..09faccc 100644 --- a/series.conf +++ b/series.conf @@ -63145,6 +63145,7 @@ patches.suse/scsi-qla2xxx-Use-transport-defined-speed-mask-for-su.patch patches.suse/usb-dwc3-gadget-Stop-processing-more-requests-on-IMI.patch patches.suse/usb-dwc3-gadget-Don-t-set-IMI-for-no_interrupt.patch + patches.suse/KVM-x86-emulator-em_sysexit-should-update-ctxt-mode.patch patches.suse/NFSv4.1-Handle-RECLAIM_COMPLETE-trunking-errors.patch patches.suse/NFSv4.1-We-must-always-send-RECLAIM_COMPLETE-after-a.patch patches.suse/NFSv4.2-Fixup-CLONE-dest-file-size-for-zero-length-c.patch