Content-Type: multipart/mixed; boundary="===============0085022412734745787==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [RFC PATCH 09/12] module: Move kallsyms support into a separate file Date: Wed, 29 Dec 2021 11:53:43 +0800 Message-ID: <202112291156.o8nytvqf-lkp@intel.com> In-Reply-To: <20211228213041.1356334-10-atomlin@redhat.com> List-Id: --===============0085022412734745787== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Aaron, [FYI, it's a private test report for your RFC patch.] [auto build test WARNING on jeyu/modules-next] [also build test WARNING on v5.16-rc7 next-20211224] [cannot apply to linus/master] [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/Aaron-Tomlin/module-Move-a= ll-into-module/20211229-063051 base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modu= les-next config: alpha-randconfig-s032-20211228 (https://download.01.org/0day-ci/arc= hive/20211229/202112291156.o8nytvqf-lkp(a)intel.com/config) compiler: alpha-linux-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/0day-ci/linux/commit/dca0a654ac33ddd67bc916d2b= 906e610d94d9dfc git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Aaron-Tomlin/module-Move-all-into-= module/20211229-063051 git checkout dca0a654ac33ddd67bc916d2b906e610d94d9dfc # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=3Dbuild_dir ARCH=3Da= lpha 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 >>) kernel/module/kallsyms.c: note: in included file: include/linux/module.h:380:3: sparse: sparse: symbol 'mod_tree' was not = declared. Should it be static? >> kernel/module/kallsyms.c:178:23: sparse: sparse: incorrect type in assig= nment (different address spaces) @@ expected struct mod_kallsyms [noder= ef] __rcu *kallsyms @@ got void * @@ kernel/module/kallsyms.c:178:23: sparse: expected struct mod_kallsym= s [noderef] __rcu *kallsyms kernel/module/kallsyms.c:178:23: sparse: got void * >> kernel/module/kallsyms.c:180:12: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:181:12: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:183:12: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:184:12: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:193:18: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:194:35: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:195:20: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:200:32: sparse: sparse: dereference of noderef = expression kernel/module/kallsyms.c:203:45: sparse: sparse: dereference of noderef = expression vim +178 kernel/module/kallsyms.c 163 = 164 /* 165 * We use the full symtab and strtab which layout_symtab arranged to 166 * be appended to the init section. Later we switch to the cut-down 167 * core-only ones. 168 */ 169 void add_kallsyms(struct module *mod, const struct load_info *info) 170 { 171 unsigned int i, ndst; 172 const Elf_Sym *src; 173 Elf_Sym *dst; 174 char *s; 175 Elf_Shdr *symsec =3D &info->sechdrs[info->index.sym]; 176 = 177 /* Set up to point into init section. */ > 178 mod->kallsyms =3D mod->init_layout.base + info->mod_kallsyms_init_o= ff; 179 = > 180 mod->kallsyms->symtab =3D (void *)symsec->sh_addr; 181 mod->kallsyms->num_symtab =3D symsec->sh_size / sizeof(Elf_Sym); 182 /* Make sure we get permanent strtab: don't use info->strtab. */ 183 mod->kallsyms->strtab =3D (void *)info->sechdrs[info->index.str].sh= _addr; 184 mod->kallsyms->typetab =3D mod->init_layout.base + info->init_typeo= ffs; 185 = 186 /* 187 * Now populate the cut down core kallsyms for after init 188 * and set types up while we still have access to sections. 189 */ 190 mod->core_kallsyms.symtab =3D dst =3D mod->core_layout.base + info-= >symoffs; 191 mod->core_kallsyms.strtab =3D s =3D mod->core_layout.base + info->s= troffs; 192 mod->core_kallsyms.typetab =3D mod->core_layout.base + info->core_t= ypeoffs; 193 src =3D mod->kallsyms->symtab; 194 for (ndst =3D i =3D 0; i < mod->kallsyms->num_symtab; i++) { 195 mod->kallsyms->typetab[i] =3D elf_type(src + i, info); 196 if (i =3D=3D 0 || is_livepatch_module(mod) || 197 is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum, 198 info->index.pcpu)) { 199 mod->core_kallsyms.typetab[ndst] =3D 200 mod->kallsyms->typetab[i]; 201 dst[ndst] =3D src[i]; 202 dst[ndst++].st_name =3D s - mod->core_kallsyms.strtab; 203 s +=3D strlcpy(s, &mod->kallsyms->strtab[src[i].st_name], 204 KSYM_NAME_LEN) + 1; 205 } 206 } 207 mod->core_kallsyms.num_symtab =3D ndst; 208 } 209 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0085022412734745787==--