tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 5acd9952f95fb4b7da6d09a3be39195a80845eb6 commit: 3f6821aa147b6e6fe07e8b35999724518b74a632 [10436/11962] KVM: x86: Forcibly leave nested if RSM to L2 hits shutdown config: i386-randconfig-141-20240914 (https://download.01.org/0day-ci/archive/20240914/202409141449.UcocWbNb-lkp@xxxxxxxxx/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202409141449.UcocWbNb-lkp@xxxxxxxxx/ New smatch warnings: arch/x86/kvm/smm.c:651 emulator_leave_smm() warn: inconsistent indenting Old smatch warnings: arch/x86/kvm/smm.c:300 enter_smm() warn: inconsistent indenting vim +651 arch/x86/kvm/smm.c 625 626 /* 627 * FIXME: When resuming L2 (a.k.a. guest mode), the transition to guest 628 * mode should happen _after_ loading state from SMRAM. However, KVM 629 * piggybacks the nested VM-Enter flows (which is wrong for many other 630 * reasons), and so nSVM/nVMX would clobber state that is loaded from 631 * SMRAM and from the VMCS/VMCB. 632 */ 633 if (kvm_x86_call(leave_smm)(vcpu, &smram)) 634 return X86EMUL_UNHANDLEABLE; 635 636 #ifdef CONFIG_X86_64 637 if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) 638 ret = rsm_load_state_64(ctxt, &smram.smram64); 639 else 640 #endif 641 ret = rsm_load_state_32(ctxt, &smram.smram32); 642 643 /* 644 * If RSM fails and triggers shutdown, architecturally the shutdown 645 * occurs *before* the transition to guest mode. But due to KVM's 646 * flawed handling of RSM to L2 (see above), the vCPU may already be 647 * in_guest_mode(). Force the vCPU out of guest mode before delivering 648 * the shutdown, so that L1 enters shutdown instead of seeing a VM-Exit 649 * that architecturally shouldn't be possible. 650 */ > 651 if (ret != X86EMUL_CONTINUE && is_guest_mode(vcpu)) -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki