Re: [POC 20/23] module/livepatch: Relocate local variables in the module loaded when the livepatch is being loaded

From: kbuild test robot
Date: Sat Jan 18 2020 - 05:30:44 EST


Hi Petr,

I love your patch! Yet something to improve:

[auto build test ERROR on jeyu/modules-next]
[also build test ERROR on kselftest/next tip/x86/core linus/master v5.5-rc6 next-20200117]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Petr-Mladek/livepatch-Split-livepatch-module-per-object/20200118-090135
base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
config: mips-32r2_defconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

kernel/module.c: In function 'apply_relocations':
>> kernel/module.c:2418:10: error: implicit declaration of function 'klp_resolve_symbols'; did you mean 'resolve_symbol'? [-Werror=implicit-function-declaration]
err = klp_resolve_symbols(info->sechdrs, i, mod);
^~~~~~~~~~~~~~~~~~~
resolve_symbol
cc1: some warnings being treated as errors

vim +2418 kernel/module.c

2398
2399 static int apply_relocations(struct module *mod, const struct load_info *info)
2400 {
2401 unsigned int i;
2402 int err = 0;
2403
2404 /* Now do relocations. */
2405 for (i = 1; i < info->hdr->e_shnum; i++) {
2406 unsigned int infosec = info->sechdrs[i].sh_info;
2407
2408 /* Not a valid relocation section? */
2409 if (infosec >= info->hdr->e_shnum)
2410 continue;
2411
2412 /* Don't bother with non-allocated sections */
2413 if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC))
2414 continue;
2415
2416 /* Livepatch need to resolve static symbols. */
2417 if (info->sechdrs[i].sh_flags & SHF_RELA_LIVEPATCH) {
> 2418 err = klp_resolve_symbols(info->sechdrs, i, mod);
2419 if (err < 0)
2420 break;
2421 err = apply_relocate_add(info->sechdrs, info->strtab,
2422 info->index.sym, i, mod);
2423 } else if (info->sechdrs[i].sh_type == SHT_REL) {
2424 err = apply_relocate(info->sechdrs, info->strtab,
2425 info->index.sym, i, mod);
2426 } else if (info->sechdrs[i].sh_type == SHT_RELA) {
2427 err = apply_relocate_add(info->sechdrs, info->strtab,
2428 info->index.sym, i, mod);
2429 }
2430 if (err < 0)
2431 break;
2432 }
2433 return err;
2434 }
2435

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip