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:   Thu, 13 Oct 2022 21:48:21 +0800
From:   kernel test robot <lkp@...el.com>
To:     Chao Peng <chao.p.peng@...ux.intel.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Isaku Yamahata <isaku.yamahata@...el.com>
Subject: [intel-tdx:kvm-upstream-workaround 61/352]
 arch/x86/kvm/mmu/mmu.c:6908:22: error: no member named 'mem_attr_array' in
 'struct kvm'

Hi Chao,

FYI, the error/warning still remains.

tree:   https://github.com/intel/tdx.git kvm-upstream-workaround
head:   c020b696a242a76a600c1dbb8c038ce2bdc97a8f
commit: fab0f69e33de02a86f43e8ed45f22163db4ec4a0 [61/352] KVM: Update lpage info when private/shared memory are mixed
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/fab0f69e33de02a86f43e8ed45f22163db4ec4a0
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx kvm-upstream-workaround
        git checkout fab0f69e33de02a86f43e8ed45f22163db4ec4a0
        # 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 error/warnings (new ones prefixed by >>):

>> arch/x86/kvm/mmu/mmu.c:6908: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:6914:14: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED'
           if (attr == KVM_MEM_ATTR_SHARED) {
                       ^
>> arch/x86/kvm/mmu/mmu.c:6914:14: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED'
>> arch/x86/kvm/mmu/mmu.c:6914:14: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED'
>> arch/x86/kvm/mmu/mmu.c:6999: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:6999: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:6991: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:6991: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 6 errors generated.


vim +6908 arch/x86/kvm/mmu/mmu.c

  6904	
  6905	static bool mem_attr_is_mixed(struct kvm *kvm, unsigned int attr,
  6906				      gfn_t start, gfn_t end)
  6907	{
> 6908		XA_STATE(xas, &kvm->mem_attr_array, start);
  6909		gfn_t gfn = start;
  6910		void *entry;
  6911		bool shared, private;
  6912		bool mixed = false;
  6913	
> 6914		if (attr == KVM_MEM_ATTR_SHARED) {
  6915			shared = true;
  6916			private = false;
  6917		} else {
  6918			shared = false;
  6919			private = true;
  6920		}
  6921	
  6922		rcu_read_lock();
  6923		entry = xas_load(&xas);
  6924		while (gfn < end) {
  6925			if (xas_retry(&xas, entry))
  6926				continue;
  6927	
  6928			KVM_BUG_ON(gfn != xas.xa_index, kvm);
  6929	
  6930			if (entry)
  6931				private = true;
  6932			else
  6933				shared = true;
  6934	
  6935			if (private && shared) {
  6936				mixed = true;
  6937				goto out;
  6938			}
  6939	
  6940			entry = xas_next(&xas);
  6941			gfn++;
  6942		}
  6943	out:
  6944		rcu_read_unlock();
  6945		return mixed;
  6946	}
  6947	
  6948	static inline void update_mixed(struct kvm_lpage_info *linfo, bool mixed)
  6949	{
  6950		if (mixed)
  6951			linfo->disallow_lpage |= KVM_LPAGE_PRIVATE_SHARED_MIXED;
  6952		else
  6953			linfo->disallow_lpage &= ~KVM_LPAGE_PRIVATE_SHARED_MIXED;
  6954	}
  6955	
  6956	static void update_mem_lpage_info(struct kvm *kvm,
  6957					  struct kvm_memory_slot *slot,
  6958					  unsigned int attr,
  6959					  gfn_t start, gfn_t end)
  6960	{
  6961		unsigned long lpage_start, lpage_end;
  6962		unsigned long gfn, pages, mask;
  6963		int level;
  6964	
  6965		for (level = PG_LEVEL_2M; level <= KVM_MAX_HUGEPAGE_LEVEL; level++) {
  6966			pages = KVM_PAGES_PER_HPAGE(level);
  6967			mask = ~(pages - 1);
  6968			lpage_start = start & mask;
  6969			lpage_end = (end - 1) & mask;
  6970	
  6971			/*
  6972			 * We only need to scan the head and tail page, for middle pages
  6973			 * we know they are not mixed.
  6974			 */
  6975			update_mixed(lpage_info_slot(lpage_start, slot, level),
  6976				     mem_attr_is_mixed(kvm, attr, lpage_start,
  6977								  lpage_start + pages));
  6978	
  6979			if (lpage_start == lpage_end)
  6980				return;
  6981	
  6982			for (gfn = lpage_start + pages; gfn < lpage_end; gfn += pages)
  6983				update_mixed(lpage_info_slot(gfn, slot, level), false);
  6984	
  6985			update_mixed(lpage_info_slot(lpage_end, slot, level),
  6986				     mem_attr_is_mixed(kvm, attr, lpage_end,
  6987								  lpage_end + pages));
  6988		}
  6989	}
  6990	
> 6991	void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr,
  6992				      gfn_t start, gfn_t end)
  6993	{
  6994		struct kvm_memory_slot *slot;
  6995		struct kvm_memslots *slots;
  6996		struct kvm_memslot_iter iter;
  6997		int i;
  6998	
> 6999		WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)),

-- 
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