Content-Type: multipart/mixed; boundary="===============1028184225787959699==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 05/43] asm: x86: instrument usercopy in get_user() and __put_user_size() Date: Wed, 15 Dec 2021 07:04:19 +0800 Message-ID: <202112150600.6pOrfh9n-lkp@intel.com> In-Reply-To: <20211214162050.660953-6-glider@google.com> List-Id: --===============1028184225787959699== 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-20211213] [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/202112150600.6pOrfh9n-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/3209eff1f0c7f4de1f9685c46= 92c7ad79e8f225b 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 3209eff1f0c7f4de1f9685c4692c7ad79e8f225b # 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 arch/x86/mm/ kernel/ mm/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) arch/x86/mm/fault.c:152:29: sparse: sparse: incorrect type in argument 1= (different address spaces) @@ expected void const volatile [noderef] _= _user *ptr @@ got unsigned char *[assigned] instr @@ arch/x86/mm/fault.c:152:29: sparse: expected void const volatile [no= deref] __user *ptr arch/x86/mm/fault.c:152:29: sparse: got unsigned char *[assigned] in= str >> arch/x86/mm/fault.c:152:29: sparse: sparse: incorrect type in argument 2= (different address spaces) @@ expected void const [noderef] __user *fr= om @@ got unsigned char *[assigned] instr @@ arch/x86/mm/fault.c:152:29: sparse: expected void const [noderef] __= user *from arch/x86/mm/fault.c:152:29: sparse: got unsigned char *[assigned] in= str >> arch/x86/mm/fault.c:152:29: sparse: sparse: incorrect type in argument 2= (different address spaces) @@ expected void const [noderef] __user *fr= om @@ got unsigned char *[assigned] instr @@ arch/x86/mm/fault.c:152:29: sparse: expected void const [noderef] __= user *from arch/x86/mm/fault.c:152:29: sparse: got unsigned char *[assigned] in= str vim +152 arch/x86/mm/fault.c d24df8ecf9b6f8 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 119 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 120 st= atic int 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 121 is= _prefetch(struct pt_regs *regs, unsigned long error_code, unsigned long add= r) 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 122 { 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 123 u= nsigned char *max_instr; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 124 u= nsigned char *instr; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 125 i= nt prefetch =3D 0; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 126 = d24df8ecf9b6f8 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 127 /= * Erratum #91 affects AMD K8, pre-NPT CPUs */ d24df8ecf9b6f8 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 128 i= f (!is_amd_k8_pre_npt()) d24df8ecf9b6f8 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 129 = return 0; d24df8ecf9b6f8 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 130 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 131 /* 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 132 = * If it was a exec (instruction fetch) fault on NX page, then 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 133 = * do not ignore the fault: 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 134 = */ 1067f030994c69 arch/x86/mm/fault.c Ricardo Neri 2017-10-27 135 i= f (error_code & X86_PF_INSTR) 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 136 = return 0; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 137 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 138 i= nstr =3D (void *)convert_ip_to_linear(current, regs); 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 139 m= ax_instr =3D instr + 15; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 140 = 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 141 /* 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 142 = * This code has historically always bailed out if IP points to a 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 143 = * not-present page (e.g. due to a race). No one has ever 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 144 = * complained about this. 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 145 = */ 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 146 p= agefault_disable(); 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 147 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 148 w= hile (instr < max_instr) { 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 149 = unsigned char opcode; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 150 = 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 151 = if (user_mode(regs)) { 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 @152 = if (get_user(opcode, instr)) 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 153 = break; 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 154 = } else { 25f12ae45fc193 arch/x86/mm/fault.c Christoph Hellwig 2020-06-17 155 = if (get_kernel_nofault(opcode, instr)) 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 156 = break; 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 157 } 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 158 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 159 = instr++; 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 160 = 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 161 = if (!check_prefetch_opcode(regs, instr, opcode, &prefetch)) 107a03678cac0d arch/x86/mm/fault.c Ingo Molnar 2009-02-20 162 = break; ^1da177e4c3f41 arch/x86_64/mm/fault.c Linus Torvalds 2005-04-16 163 } 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 164 = 35f1c89b0cce24 arch/x86/mm/fault.c Andy Lutomirski 2021-02-09 165 p= agefault_enable(); ^1da177e4c3f41 arch/x86_64/mm/fault.c Linus Torvalds 2005-04-16 166 r= eturn prefetch; ^1da177e4c3f41 arch/x86_64/mm/fault.c Linus Torvalds 2005-04-16 167 } ^1da177e4c3f41 arch/x86_64/mm/fault.c Linus Torvalds 2005-04-16 168 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org --===============1028184225787959699==--