lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Oct 2022 15:36:54 +0800
From:   kernel test robot <lkp@...el.com>
To:     Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Cc:     oe-kbuild-all@...ts.linux.dev, mlevitsk@...hat.com,
        seanjc@...gle.com
Subject: Re: [PATCH 04/10] KVM: x86: do not go through ctxt->ops when
 emulating rsm

Hi Paolo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kvm/queue]
[also build test WARNING on mst-vhost/linux-next linus/master v6.1-rc2 next-20221028]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20221028-005156
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20221027164944.3031588-5-pbonzini%40redhat.com
patch subject: [PATCH 04/10] KVM: x86: do not go through ctxt->ops when emulating rsm
config: i386-allyesconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/9842725ac4bb9443d9b94d8c67d5e55ca3f5ab2b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20221028-005156
        git checkout 9842725ac4bb9443d9b94d8c67d5e55ca3f5ab2b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kvm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   arch/x86/kvm/smm.c: In function 'emulator_leave_smm':
>> arch/x86/kvm/smm.c:503:33: warning: unused variable 'efer' [-Wunused-variable]
     503 |         unsigned long cr0, cr4, efer;
         |                                 ^~~~
>> arch/x86/kvm/smm.c:503:28: warning: unused variable 'cr4' [-Wunused-variable]
     503 |         unsigned long cr0, cr4, efer;
         |                            ^~~


vim +/efer +503 arch/x86/kvm/smm.c

e2881deb76e87c Paolo Bonzini 2022-10-27  499  
e2881deb76e87c Paolo Bonzini 2022-10-27  500  int emulator_leave_smm(struct x86_emulate_ctxt *ctxt)
e2881deb76e87c Paolo Bonzini 2022-10-27  501  {
e2881deb76e87c Paolo Bonzini 2022-10-27  502  	struct kvm_vcpu *vcpu = ctxt->vcpu;
e2881deb76e87c Paolo Bonzini 2022-10-27 @503  	unsigned long cr0, cr4, efer;
e2881deb76e87c Paolo Bonzini 2022-10-27  504  	char buf[512];
e2881deb76e87c Paolo Bonzini 2022-10-27  505  	u64 smbase;
e2881deb76e87c Paolo Bonzini 2022-10-27  506  	int ret;
e2881deb76e87c Paolo Bonzini 2022-10-27  507  
9842725ac4bb94 Paolo Bonzini 2022-10-27  508  	smbase = vcpu->arch.smbase;
e2881deb76e87c Paolo Bonzini 2022-10-27  509  
9842725ac4bb94 Paolo Bonzini 2022-10-27  510  	ret = kvm_vcpu_read_guest(vcpu, smbase + 0xfe00, buf, sizeof(buf));
9842725ac4bb94 Paolo Bonzini 2022-10-27  511  	if (ret < 0)
e2881deb76e87c Paolo Bonzini 2022-10-27  512  		return X86EMUL_UNHANDLEABLE;
e2881deb76e87c Paolo Bonzini 2022-10-27  513  
9842725ac4bb94 Paolo Bonzini 2022-10-27  514  	if ((vcpu->arch.hflags & HF_SMM_INSIDE_NMI_MASK) == 0)
9842725ac4bb94 Paolo Bonzini 2022-10-27  515  		static_call(kvm_x86_set_nmi_mask)(vcpu, false);
e2881deb76e87c Paolo Bonzini 2022-10-27  516  
e2881deb76e87c Paolo Bonzini 2022-10-27  517  	kvm_smm_changed(vcpu, false);
e2881deb76e87c Paolo Bonzini 2022-10-27  518  
e2881deb76e87c Paolo Bonzini 2022-10-27  519  	/*
e2881deb76e87c Paolo Bonzini 2022-10-27  520  	 * Get back to real mode, to prepare a safe state in which to load
e2881deb76e87c Paolo Bonzini 2022-10-27  521  	 * CR0/CR3/CR4/EFER.  It's all a bit more complicated if the vCPU
e2881deb76e87c Paolo Bonzini 2022-10-27  522  	 * supports long mode.
e2881deb76e87c Paolo Bonzini 2022-10-27  523  	 */
9842725ac4bb94 Paolo Bonzini 2022-10-27  524  #ifdef CONFIG_X86_64
9842725ac4bb94 Paolo Bonzini 2022-10-27  525  	if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
9842725ac4bb94 Paolo Bonzini 2022-10-27  526  		struct kvm_segment cs_desc;
e2881deb76e87c Paolo Bonzini 2022-10-27  527  
e2881deb76e87c Paolo Bonzini 2022-10-27  528  		/* Zero CR4.PCIDE before CR0.PG.  */
9842725ac4bb94 Paolo Bonzini 2022-10-27  529  		cr4 = kvm_read_cr4(vcpu);
e2881deb76e87c Paolo Bonzini 2022-10-27  530  		if (cr4 & X86_CR4_PCIDE)
9842725ac4bb94 Paolo Bonzini 2022-10-27  531  			kvm_set_cr4(vcpu, cr4 & ~X86_CR4_PCIDE);
e2881deb76e87c Paolo Bonzini 2022-10-27  532  
e2881deb76e87c Paolo Bonzini 2022-10-27  533  		/* A 32-bit code segment is required to clear EFER.LMA.  */
e2881deb76e87c Paolo Bonzini 2022-10-27  534  		memset(&cs_desc, 0, sizeof(cs_desc));
e2881deb76e87c Paolo Bonzini 2022-10-27  535  		cs_desc.type = 0xb;
9842725ac4bb94 Paolo Bonzini 2022-10-27  536  		cs_desc.s = cs_desc.g = cs_desc.present = 1;
9842725ac4bb94 Paolo Bonzini 2022-10-27  537  		kvm_set_segment(vcpu, &cs_desc, VCPU_SREG_CS);
e2881deb76e87c Paolo Bonzini 2022-10-27  538  	}
9842725ac4bb94 Paolo Bonzini 2022-10-27  539  #endif
e2881deb76e87c Paolo Bonzini 2022-10-27  540  
e2881deb76e87c Paolo Bonzini 2022-10-27  541  	/* For the 64-bit case, this will clear EFER.LMA.  */
9842725ac4bb94 Paolo Bonzini 2022-10-27  542  	cr0 = kvm_read_cr0(vcpu);
e2881deb76e87c Paolo Bonzini 2022-10-27  543  	if (cr0 & X86_CR0_PE)
9842725ac4bb94 Paolo Bonzini 2022-10-27  544  		kvm_set_cr0(vcpu, cr0 & ~(X86_CR0_PG | X86_CR0_PE));
e2881deb76e87c Paolo Bonzini 2022-10-27  545  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (285962 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ