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>] [day] [month] [year] [list]
Date:   Sun, 1 Nov 2020 15:50:42 +0800
From:   kernel test robot <lkp@...el.com>
To:     Aaron Lewis <aaronlewis@...gle.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Oliver Upton <oupton@...gle.com>,
        Alexander Graf <graf@...zon.com>
Subject: arch/x86/kvm/vmx/vmx.c:6696:17: warning: variable 'msr_bitmap' set
 but not used

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c2dc4c073fb71b50904493657a7622b481b346e3
commit: 476c9bd8e997b495524500cd82471e59b3aac20e KVM: x86: Prepare MSR bitmaps for userspace tracked MSRs
date:   5 weeks ago
config: i386-randconfig-r015-20201101 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=476c9bd8e997b495524500cd82471e59b3aac20e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 476c9bd8e997b495524500cd82471e59b3aac20e
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   arch/x86/kvm/vmx/vmx.c: In function 'vmx_create_vcpu':
>> arch/x86/kvm/vmx/vmx.c:6696:17: warning: variable 'msr_bitmap' set but not used [-Wunused-but-set-variable]
    6696 |  unsigned long *msr_bitmap;
         |                 ^~~~~~~~~~

vim +/msr_bitmap +6696 arch/x86/kvm/vmx/vmx.c

cb61de2f4819b2 arch/x86/kvm/vmx.c     Sean Christopherson 2018-09-26  6692  
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6693  static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6694  {
4183683918efc3 arch/x86/kvm/vmx/vmx.c Ben Gardon          2019-02-11  6695  	struct vcpu_vmx *vmx;
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03 @6696  	unsigned long *msr_bitmap;
34109c0476f10c arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6697  	int i, cpu, err;
12b58f4ed2a1b9 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-08-15  6698  
a9dd6f09d7e54d arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6699  	BUILD_BUG_ON(offsetof(struct vcpu_vmx, vcpu) != 0);
a9dd6f09d7e54d arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6700  	vmx = to_vmx(vcpu);
d9a710e5fc4941 arch/x86/kvm/vmx/vmx.c Wanpeng Li          2019-07-22  6701  
b666a4b697397f arch/x86/kvm/vmx/vmx.c Marc Orr            2018-11-06  6702  	err = -ENOMEM;
b666a4b697397f arch/x86/kvm/vmx/vmx.c Marc Orr            2018-11-06  6703  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6704  	vmx->vpid = allocate_vpid();
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6705  
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6706  	/*
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6707  	 * If PML is turned on, failure on enabling PML just results in failure
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6708  	 * of creating the vcpu, therefore we can simplify PML logic (by
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6709  	 * avoiding dealing with cases, such as enabling PML partially on vcpus
67b0ae43df179f arch/x86/kvm/vmx/vmx.c Miaohe Lin          2019-12-11  6710  	 * for the guest), etc.
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6711  	 */
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6712  	if (enable_pml) {
4183683918efc3 arch/x86/kvm/vmx/vmx.c Ben Gardon          2019-02-11  6713  		vmx->pml_pg = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6714  		if (!vmx->pml_pg)
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6715  			goto free_vpid;
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6716  	}
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6717  
14a61b642de9e5 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6718  	BUILD_BUG_ON(ARRAY_SIZE(vmx_uret_msrs_list) != MAX_NR_USER_RETURN_MSRS);
36be0b9deb2316 arch/x86/kvm/vmx.c     Paolo Bonzini       2014-02-24  6719  
14a61b642de9e5 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6720  	for (i = 0; i < ARRAY_SIZE(vmx_uret_msrs_list); ++i) {
14a61b642de9e5 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6721  		u32 index = vmx_uret_msrs_list[i];
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6722  		u32 data_low, data_high;
fbc18007382cb9 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6723  		int j = vmx->nr_uret_msrs;
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6724  
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6725  		if (rdmsr_safe(index, &data_low, &data_high) < 0)
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6726  			continue;
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6727  		if (wrmsr_safe(index, data_low, data_high) < 0)
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6728  			continue;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6729  
802145c56a0445 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6730  		vmx->guest_uret_msrs[j].slot = i;
eb3db1b1378882 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6731  		vmx->guest_uret_msrs[j].data = 0;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6732  		switch (index) {
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6733  		case MSR_IA32_TSX_CTRL:
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6734  			/*
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6735  			 * No need to pass TSX_CTRL_CPUID_CLEAR through, so
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6736  			 * let's avoid changing CPUID bits under the host
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6737  			 * kernel's feet.
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6738  			 */
eb3db1b1378882 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6739  			vmx->guest_uret_msrs[j].mask = ~(u64)TSX_CTRL_CPUID_CLEAR;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6740  			break;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6741  		default:
eb3db1b1378882 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6742  			vmx->guest_uret_msrs[j].mask = -1ull;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6743  			break;
46f4f0aabc61bf arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2019-11-21  6744  		}
fbc18007382cb9 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2020-09-23  6745  		++vmx->nr_uret_msrs;
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6746  	}
4be53410262468 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6747  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6748  	err = alloc_loaded_vmcs(&vmx->vmcs01);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6749  	if (err < 0)
7d73710d9ca256 arch/x86/kvm/vmx/vmx.c Jim Mattson         2019-12-03  6750  		goto free_pml;
21feb4eb64e21f arch/x86/kvm/vmx.c     Arthur Chunqi Li    2013-07-15  6751  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6752  	msr_bitmap = vmx->vmcs01.msr_bitmap;
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6753  	vmx_disable_intercept_for_msr(vcpu, MSR_IA32_TSC, MSR_TYPE_R);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6754  	vmx_disable_intercept_for_msr(vcpu, MSR_FS_BASE, MSR_TYPE_RW);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6755  	vmx_disable_intercept_for_msr(vcpu, MSR_GS_BASE, MSR_TYPE_RW);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6756  	vmx_disable_intercept_for_msr(vcpu, MSR_KERNEL_GS_BASE, MSR_TYPE_RW);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6757  	vmx_disable_intercept_for_msr(vcpu, MSR_IA32_SYSENTER_CS, MSR_TYPE_RW);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6758  	vmx_disable_intercept_for_msr(vcpu, MSR_IA32_SYSENTER_ESP, MSR_TYPE_RW);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6759  	vmx_disable_intercept_for_msr(vcpu, MSR_IA32_SYSENTER_EIP, MSR_TYPE_RW);
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6760  	if (kvm_cstate_in_guest(vcpu->kvm)) {
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6761  		vmx_disable_intercept_for_msr(vcpu, MSR_CORE_C1_RES, MSR_TYPE_R);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6762  		vmx_disable_intercept_for_msr(vcpu, MSR_CORE_C3_RESIDENCY, MSR_TYPE_R);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6763  		vmx_disable_intercept_for_msr(vcpu, MSR_CORE_C6_RESIDENCY, MSR_TYPE_R);
476c9bd8e997b4 arch/x86/kvm/vmx/vmx.c Aaron Lewis         2020-09-25  6764  		vmx_disable_intercept_for_msr(vcpu, MSR_CORE_C7_RESIDENCY, MSR_TYPE_R);
b51700632e0e53 arch/x86/kvm/vmx/vmx.c Wanpeng Li          2019-05-21  6765  	}
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6766  	vmx->msr_bitmap_mode = 0;
ff651cb613b4cc arch/x86/kvm/vmx.c     Wincy Van           2014-12-11  6767  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6768  	vmx->loaded_vmcs = &vmx->vmcs01;
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6769  	cpu = get_cpu();
34109c0476f10c arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6770  	vmx_vcpu_load(vcpu, cpu);
34109c0476f10c arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6771  	vcpu->cpu = cpu;
1b84292bea00c0 arch/x86/kvm/vmx/vmx.c Xiaoyao Li          2019-10-20  6772  	init_vmcs(vmx);
34109c0476f10c arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6773  	vmx_vcpu_put(vcpu);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6774  	put_cpu();
34109c0476f10c arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6775  	if (cpu_need_virtualize_apic_accesses(vcpu)) {
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6776  		err = alloc_apic_access_page(vcpu->kvm);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6777  		if (err)
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6778  			goto free_vmcs;
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6779  	}
3af18d9c5fe95a arch/x86/kvm/vmx.c     Wincy Van           2015-02-03  6780  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6781  	if (enable_ept && !enable_unrestricted_guest) {
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6782  		err = init_rmode_identity_map(vcpu->kvm);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6783  		if (err)
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6784  			goto free_vmcs;
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6785  	}
4704d0befb0721 arch/x86/kvm/vmx.c     Nadav Har'El        2011-05-25  6786  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6787  	if (nested)
b9757a4b6f4656 arch/x86/kvm/vmx/vmx.c Chenyi Qiang        2020-08-28  6788  		memcpy(&vmx->nested.msrs, &vmcs_config.nested, sizeof(vmx->nested.msrs));
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6789  	else
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6790  		memset(&vmx->nested.msrs, 0, sizeof(vmx->nested.msrs));
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6791  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6792  	vmx->nested.posted_intr_nv = -1;
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6793  	vmx->nested.current_vmptr = -1ull;
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6794  
bab0c318ba3da3 arch/x86/kvm/vmx/vmx.c Paolo Bonzini       2020-02-11  6795  	vcpu->arch.microcode_version = 0x100000000ULL;
32ad73db7fc5fe arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-20  6796  	vmx->msr_ia32_feature_control_valid_bits = FEAT_CTL_LOCKED;
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6797  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6798  	/*
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6799  	 * Enforce invariant: pi_desc.nv is always either POSTED_INTR_VECTOR
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6800  	 * or POSTED_INTR_WAKEUP_VECTOR.
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6801  	 */
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6802  	vmx->pi_desc.nv = POSTED_INTR_VECTOR;
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6803  	vmx->pi_desc.sn = 1;
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6804  
53963a70ac268c arch/x86/kvm/vmx/vmx.c Lan Tianyu          2018-12-06  6805  	vmx->ept_pointer = INVALID_PAGE;
53963a70ac268c arch/x86/kvm/vmx/vmx.c Lan Tianyu          2018-12-06  6806  
a9dd6f09d7e54d arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6807  	return 0;
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6808  
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6809  free_vmcs:
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6810  	free_loaded_vmcs(vmx->loaded_vmcs);
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6811  free_pml:
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6812  	vmx_destroy_pml_buffer(vmx);
987b2594ed5d12 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6813  free_vpid:
55d2375e58a61b arch/x86/kvm/vmx/vmx.c Sean Christopherson 2018-12-03  6814  	free_vpid(vmx->vpid);
a9dd6f09d7e54d arch/x86/kvm/vmx/vmx.c Sean Christopherson 2019-12-18  6815  	return err;
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6816  }
bd18bffca35397 arch/x86/kvm/vmx.c     Sean Christopherson 2018-08-22  6817  

:::::: The code at line 6696 was first introduced by commit
:::::: 55d2375e58a61be072431dd3d3c8a320f4a4a01b KVM: nVMX: Move nested code to dedicated files

:::::: TO: Sean Christopherson <sean.j.christopherson@...el.com>
:::::: CC: Paolo Bonzini <pbonzini@...hat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (30487 bytes)

Powered by blists - more mailing lists