Content-Type: multipart/mixed; boundary="===============6180151328885636410==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 06/43] asm-generic: instrument usercopy in cacheflush.h Date: Wed, 15 Dec 2021 16:22:35 +0800 Message-ID: <202112151609.GqpX1iLK-lkp@intel.com> In-Reply-To: <20211214162050.660953-7-glider@google.com> List-Id: --===============6180151328885636410== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Alexander, I love your patch! Perhaps something to improve: [auto build test WARNING on tip/x86/mm] [also build test WARNING on linus/master v5.16-rc5] [cannot apply to tip/x86/core hnaz-mm/master next-20211214] [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] url: https://github.com/0day-ci/linux/commits/Alexander-Potapenko/Add-Ke= rnelMemorySanitizer-infrastructure/20211215-003033 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35fa745= 286ac44ee26ed100c2bd2553368ad193b config: x86_64-randconfig-s021-20211214 (https://download.01.org/0day-ci/ar= chive/20211215/202112151609.GqpX1iLK-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/0day-ci/linux/commit/a9bc41d306e2e13721a156914= 5cbfe7323a60aca git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Alexander-Potapenko/Add-KernelMemo= rySanitizer-infrastructure/20211215-003033 git checkout a9bc41d306e2e13721a1569145cbfe7323a60aca # save the config file to linux build tree mkdir build_dir make W=3D1 C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=3D= build_dir ARCH=3Dx86_64 SHELL=3D/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> mm/memory.c:5144:33: sparse: sparse: incorrect type in argument 1 (diffe= rent address spaces) @@ expected void [noderef] __user *to @@ got v= oid * @@ mm/memory.c:5144:33: sparse: expected void [noderef] __user *to mm/memory.c:5144:33: sparse: got void * >> mm/memory.c:5148:33: sparse: sparse: incorrect type in argument 2 (diffe= rent address spaces) @@ expected void const [noderef] __user *from @@ = got void * @@ mm/memory.c:5148:33: sparse: expected void const [noderef] __user *f= rom mm/memory.c:5148:33: sparse: got void * >> mm/memory.c:5148:33: sparse: sparse: incorrect type in argument 2 (diffe= rent address spaces) @@ expected void const [noderef] __user *from @@ = got void * @@ mm/memory.c:5148:33: sparse: expected void const [noderef] __user *f= rom mm/memory.c:5148:33: sparse: got void * mm/memory.c:332:9: sparse: sparse: incompatible types in conditional exp= ression (different base types): mm/memory.c:332:9: sparse: void mm/memory.c:332:9: sparse: int vim +5144 mm/memory.c 28b2ee20c7cba81 Rik van Riel 2008-07-23 5096 = 0ec76a110f432e9 David Howells 2006-09-27 5097 /* d3f5ffcacd15287 John Hubbard 2020-12-14 5098 * Access another p= rocess' address space as given in mm. 0ec76a110f432e9 David Howells 2006-09-27 5099 */ d3f5ffcacd15287 John Hubbard 2020-12-14 5100 int __access_remote= _vm(struct mm_struct *mm, unsigned long addr, void *buf, d3f5ffcacd15287 John Hubbard 2020-12-14 5101 int len, u= nsigned int gup_flags) 0ec76a110f432e9 David Howells 2006-09-27 5102 { 0ec76a110f432e9 David Howells 2006-09-27 5103 struct vm_area_str= uct *vma; 0ec76a110f432e9 David Howells 2006-09-27 5104 void *old_buf =3D = buf; 442486ec1096781 Lorenzo Stoakes 2016-10-13 5105 int write =3D gup_= flags & FOLL_WRITE; 0ec76a110f432e9 David Howells 2006-09-27 5106 = d8ed45c5dcd455f Michel Lespinasse 2020-06-08 5107 if (mmap_read_lock= _killable(mm)) 1e426fe28261b03 Konstantin Khlebnikov 2019-07-11 5108 return 0; 1e426fe28261b03 Konstantin Khlebnikov 2019-07-11 5109 = 183ff22bb6bd818 Simon Arlott 2007-10-20 5110 /* ignore errors, = just check how much was successfully transferred */ 0ec76a110f432e9 David Howells 2006-09-27 5111 while (len) { 0ec76a110f432e9 David Howells 2006-09-27 5112 int bytes, ret, o= ffset; 0ec76a110f432e9 David Howells 2006-09-27 5113 void *maddr; 28b2ee20c7cba81 Rik van Riel 2008-07-23 5114 struct page *page= =3D NULL; 0ec76a110f432e9 David Howells 2006-09-27 5115 = 64019a2e467a288 Peter Xu 2020-08-11 5116 ret =3D get_user_= pages_remote(mm, addr, 1, 5b56d49fc31dbb0 Lorenzo Stoakes 2016-12-14 5117 gup_flags, &pag= e, &vma, NULL); 28b2ee20c7cba81 Rik van Riel 2008-07-23 5118 if (ret <=3D 0) { dbffcd03d77a3fb Rik van Riel 2014-08-06 5119 #ifndef CONFIG_HAVE= _IOREMAP_PROT dbffcd03d77a3fb Rik van Riel 2014-08-06 5120 break; dbffcd03d77a3fb Rik van Riel 2014-08-06 5121 #else 28b2ee20c7cba81 Rik van Riel 2008-07-23 5122 /* 28b2ee20c7cba81 Rik van Riel 2008-07-23 5123 * Check if this= is a VM_IO | VM_PFNMAP VMA, which 28b2ee20c7cba81 Rik van Riel 2008-07-23 5124 * we can access= using slightly different code. 28b2ee20c7cba81 Rik van Riel 2008-07-23 5125 */ 3e418f9888463a8 Liam Howlett 2021-06-28 5126 vma =3D vma_look= up(mm, addr); 3e418f9888463a8 Liam Howlett 2021-06-28 5127 if (!vma) 28b2ee20c7cba81 Rik van Riel 2008-07-23 5128 break; 28b2ee20c7cba81 Rik van Riel 2008-07-23 5129 if (vma->vm_ops = && vma->vm_ops->access) 28b2ee20c7cba81 Rik van Riel 2008-07-23 5130 ret =3D vma->vm= _ops->access(vma, addr, buf, 28b2ee20c7cba81 Rik van Riel 2008-07-23 5131 len, write= ); 0ec76a110f432e9 David Howells 2006-09-27 5132 if (ret <=3D 0) 0ec76a110f432e9 David Howells 2006-09-27 5133 break; 28b2ee20c7cba81 Rik van Riel 2008-07-23 5134 bytes =3D ret; dbffcd03d77a3fb Rik van Riel 2014-08-06 5135 #endif 28b2ee20c7cba81 Rik van Riel 2008-07-23 5136 } else { 0ec76a110f432e9 David Howells 2006-09-27 5137 bytes =3D len; 0ec76a110f432e9 David Howells 2006-09-27 5138 offset =3D addr = & (PAGE_SIZE-1); 0ec76a110f432e9 David Howells 2006-09-27 5139 if (bytes > PAGE= _SIZE-offset) 0ec76a110f432e9 David Howells 2006-09-27 5140 bytes =3D PAGE_= SIZE-offset; 0ec76a110f432e9 David Howells 2006-09-27 5141 = 0ec76a110f432e9 David Howells 2006-09-27 5142 maddr =3D kmap(p= age); 0ec76a110f432e9 David Howells 2006-09-27 5143 if (write) { 0ec76a110f432e9 David Howells 2006-09-27 @5144 copy_to_user_pa= ge(vma, page, addr, 0ec76a110f432e9 David Howells 2006-09-27 5145 maddr + off= set, buf, bytes); 0ec76a110f432e9 David Howells 2006-09-27 5146 set_page_dirty_= lock(page); 0ec76a110f432e9 David Howells 2006-09-27 5147 } else { 0ec76a110f432e9 David Howells 2006-09-27 @5148 copy_from_user_= page(vma, page, addr, 0ec76a110f432e9 David Howells 2006-09-27 5149 buf, madd= r + offset, bytes); 0ec76a110f432e9 David Howells 2006-09-27 5150 } 0ec76a110f432e9 David Howells 2006-09-27 5151 kunmap(page); 09cbfeaf1a5a67b Kirill A. Shutemov 2016-04-01 5152 put_page(page); 28b2ee20c7cba81 Rik van Riel 2008-07-23 5153 } 0ec76a110f432e9 David Howells 2006-09-27 5154 len -=3D bytes; 0ec76a110f432e9 David Howells 2006-09-27 5155 buf +=3D bytes; 0ec76a110f432e9 David Howells 2006-09-27 5156 addr +=3D bytes; 0ec76a110f432e9 David Howells 2006-09-27 5157 } d8ed45c5dcd455f Michel Lespinasse 2020-06-08 5158 mmap_read_unlock(m= m); 0ec76a110f432e9 David Howells 2006-09-27 5159 = 0ec76a110f432e9 David Howells 2006-09-27 5160 return buf - old_b= uf; 0ec76a110f432e9 David Howells 2006-09-27 5161 } 03252919b798910 Andi Kleen 2008-01-30 5162 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============6180151328885636410==--