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]
Message-ID: <202210131400.RrsySNGd-lkp@intel.com>
Date:   Thu, 13 Oct 2022 21:48:31 +0800
From:   kernel test robot <lkp@...el.com>
To:     Isaku Yamahata <isaku.yamahata@...el.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [intel-tdx:kvm-upstream-workaround 124/352]
 arch/x86/kvm/mmu/mmu.c:6764:8: error: implicit declaration of function
 'kvm_vm_reserve_mem_attr' is invalid in C99

tree:   https://github.com/intel/tdx.git kvm-upstream-workaround
head:   c020b696a242a76a600c1dbb8c038ce2bdc97a8f
commit: 56ea417c7f9a8a2b779edeed43614dd6e404a995 [124/352] KVM: x86/tdp_mmu: implement MapGPA hypercall for TDX
config: i386-randconfig-a011
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel/tdx/commit/56ea417c7f9a8a2b779edeed43614dd6e404a995
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx kvm-upstream-workaround
        git checkout 56ea417c7f9a8a2b779edeed43614dd6e404a995
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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 errors (new ones prefixed by >>):

   arch/x86/kvm/mmu/mmu.c:6756:23: error: use of undeclared identifier 'KVM_MEM_ATTR_PRIVATE'
           attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED;
                                ^
   arch/x86/kvm/mmu/mmu.c:6756:46: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED'
           attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED;
                                                       ^
>> arch/x86/kvm/mmu/mmu.c:6764:8: error: implicit declaration of function 'kvm_vm_reserve_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           ret = kvm_vm_reserve_mem_attr(kvm, start, end);
                 ^
>> arch/x86/kvm/mmu/mmu.c:6774:15: error: implicit declaration of function 'kvm_vm_set_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm);
                                      ^
   arch/x86/kvm/mmu/mmu.c:6774:15: note: did you mean 'kvm_vm_reserve_mem_attr'?
   arch/x86/kvm/mmu/mmu.c:6764:8: note: 'kvm_vm_reserve_mem_attr' declared here
           ret = kvm_vm_reserve_mem_attr(kvm, start, end);
                 ^
   arch/x86/kvm/mmu/mmu.c:6776:15: error: implicit declaration of function 'kvm_vm_set_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, s), kvm);
                                      ^
   arch/x86/kvm/mmu/mmu.c:7197:22: error: no member named 'mem_attr_array' in 'struct kvm'
           XA_STATE(xas, &kvm->mem_attr_array, start);
                          ~~~  ^
   include/linux/xarray.h:1369:36: note: expanded from macro 'XA_STATE'
           struct xa_state name = __XA_STATE(array, index, 0, 0)
                                             ^~~~~
   include/linux/xarray.h:1348:8: note: expanded from macro '__XA_STATE'
           .xa = array,                                    \
                 ^~~~~
   arch/x86/kvm/mmu/mmu.c:7242:24: error: no member named 'mem_attr_array' in 'struct kvm'
           entry = xa_load(&kvm->mem_attr_array, start);
                            ~~~  ^
   arch/x86/kvm/mmu/mmu.c:7249:21: error: no member named 'mem_attr_array' in 'struct kvm'
                   if (xa_load(&kvm->mem_attr_array, gfn) != entry) {
                                ~~~  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   arch/x86/kvm/mmu/mmu.c:7249:21: error: no member named 'mem_attr_array' in 'struct kvm'
                   if (xa_load(&kvm->mem_attr_array, gfn) != entry) {
                                ~~~  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   arch/x86/kvm/mmu/mmu.c:7249:21: error: no member named 'mem_attr_array' in 'struct kvm'
                   if (xa_load(&kvm->mem_attr_array, gfn) != entry) {
                                ~~~  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   arch/x86/kvm/mmu/mmu.c:7302:22: error: use of undeclared identifier 'KVM_MEM_ATTR_PRIVATE'
           WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)),
                               ^
   arch/x86/kvm/mmu/mmu.c:7302:45: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED'
           WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)),
                                                      ^
   arch/x86/kvm/mmu/mmu.c:7293:6: warning: no previous prototype for function 'kvm_arch_update_mem_attr' [-Wmissing-prototypes]
   void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr,
        ^
   arch/x86/kvm/mmu/mmu.c:7293:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr,
   ^
   static 
   1 warning and 12 errors generated.


vim +/kvm_vm_reserve_mem_attr +6764 arch/x86/kvm/mmu/mmu.c

  6745	
  6746	int __kvm_mmu_map_gpa(struct kvm *kvm, gfn_t *startp, gfn_t end,
  6747			      bool map_private)
  6748	{
  6749		gfn_t start = *startp;
  6750		int attr;
  6751		int ret;
  6752	
  6753		if (!kvm_gfn_shared_mask(kvm))
  6754			return -EOPNOTSUPP;
  6755	
  6756		attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED;
  6757		start = start & ~kvm_gfn_shared_mask(kvm);
  6758		end = end & ~kvm_gfn_shared_mask(kvm);
  6759	
  6760		/*
  6761		 * To make the following kvm_vm_set_mem_attr() success within spinlock
  6762		 * without memory allocation.
  6763		 */
> 6764		ret = kvm_vm_reserve_mem_attr(kvm, start, end);
  6765		if (ret)
  6766			return ret;
  6767	
  6768		write_lock(&kvm->mmu_lock);
  6769		if (is_tdp_mmu_enabled(kvm)) {
  6770			gfn_t s = start;
  6771	
  6772			ret = kvm_tdp_mmu_map_gpa(kvm, &s, end, map_private);
  6773			if (!ret) {
> 6774				KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm);
  6775			} else if (ret == -EAGAIN) {
  6776				KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, s), kvm);
  6777				start = s;
  6778			}
  6779		} else {
  6780			ret = -EOPNOTSUPP;
  6781		}
  6782		write_unlock(&kvm->mmu_lock);
  6783	
  6784		if (ret == -EAGAIN) {
  6785			if (map_private)
  6786				*startp = kvm_gfn_private(kvm, start);
  6787			else
  6788				*startp = kvm_gfn_shared(kvm, start);
  6789		}
  6790		return ret;
  6791	}
  6792	EXPORT_SYMBOL_GPL(__kvm_mmu_map_gpa);
  6793	

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ