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:   Sat, 28 Jan 2023 20:03:22 +0800
From:   kernel test robot <lkp@...el.com>
To:     "GuoRui.Yu" <GuoRui.Yu@...ux.alibaba.com>,
        linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
        konrad.wilk@...cle.com, linux-coco@...ts.linux.dev
Cc:     oe-kbuild-all@...ts.linux.dev, GuoRui.Yu@...ux.alibaba.com,
        robin.murphy@....com
Subject: Re: [PATCH 2/4] swiotlb: Add a new cc-swiotlb implementation for
 Confidential VMs

Hi GuoRui.Yu",

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on joro-iommu/next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.2-rc5 next-20230127]
[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/GuoRui-Yu/swiotlb-Add-a-new-cc-swiotlb-implementation-for-Confidential-VMs/20230128-181154
patch link:    https://lore.kernel.org/r/20230128083254.86012-3-GuoRui.Yu%40linux.alibaba.com
patch subject: [PATCH 2/4] swiotlb: Add a new cc-swiotlb implementation for Confidential VMs
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230128/202301281925.XYfOkJnF-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
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-lab-lkp/linux/commit/9345d2c75b5994cec46ad0abf12f01ed91742e81
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review GuoRui-Yu/swiotlb-Add-a-new-cc-swiotlb-implementation-for-Confidential-VMs/20230128-181154
        git checkout 9345d2c75b5994cec46ad0abf12f01ed91742e81
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash kernel/dma/

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

   kernel/dma/cc-swiotlb.c: In function 'swiotlb_bounce':
>> kernel/dma/cc-swiotlb.c:174:32: warning: variable 'tlb_end' set but not used [-Wunused-but-set-variable]
     174 |         phys_addr_t orig_addr, tlb_end, slot_start, slot_end = tlb_addr ;
         |                                ^~~~~~~
   kernel/dma/cc-swiotlb.c: At top level:
>> kernel/dma/cc-swiotlb.c:492:13: warning: no previous prototype for 'swiotlb_hint_cpus' [-Wmissing-prototypes]
     492 | void __init swiotlb_hint_cpus(int cpus) {}
         |             ^~~~~~~~~~~~~~~~~


vim +/tlb_end +174 kernel/dma/cc-swiotlb.c

   167	
   168	/*
   169	 * Bounce: copy the swiotlb buffer from or back to the original dma location
   170	 */
   171	void swiotlb_bounce(struct device *dev, phys_addr_t tlb_addr, size_t size,
   172				   enum dma_data_direction dir)
   173	{
 > 174		phys_addr_t orig_addr, tlb_end, slot_start, slot_end = tlb_addr ;
   175		struct io_tlb_mem *mem = dev->dma_io_tlb_mem;
   176		struct io_tlb_slot *slot;
   177		unsigned long pfn;
   178		void *backing_addr;
   179		size_t alloc_size;
   180	
   181		slot = xa_find_after(mem->mapping, (unsigned long*)&slot_end, ULONG_MAX, XA_PRESENT);
   182		if (!slot) {
   183			dev_WARN_ONCE(dev, 1, "TLB buffer not found.\n");
   184			return;
   185		}
   186	
   187		orig_addr = slot->orig_addr;
   188		alloc_size = slot->alloc_size;
   189		slot_start = slot_end - slot->orig_size;
   190		tlb_end = tlb_addr + size;
   191	
   192		pfn = PFN_DOWN(orig_addr);
   193		if (PageHighMem(pfn_to_page(pfn))) {
   194			dev_WARN_ONCE(dev, 1, "Unexpected high memory.\n");
   195			return;
   196		}
   197	
   198		if (size > alloc_size) {
   199			dev_WARN_ONCE(dev, 1,
   200				"Buffer overflow detected. Allocation size: %zu. Mapping size: %zu.\n",
   201				alloc_size, size);
   202			size = alloc_size;
   203		}
   204	
   205		backing_addr = slot->va + (tlb_addr - slot_start);
   206	
   207		if (dir == DMA_TO_DEVICE) {
   208			memcpy(backing_addr, phys_to_virt(orig_addr), size);
   209		} else {
   210			memcpy(phys_to_virt(orig_addr), backing_addr, size);
   211		}
   212	}
   213	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ