From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [RFC PATCH v3 09/13] module: Move kallsyms support into a separate file
Date: Sat, 29 Jan 2022 06:56:47 +0800 [thread overview]
Message-ID: <202201290605.RGByo8yC-lkp@intel.com> (raw)
In-Reply-To: <20220128203934.600247-10-atomlin@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 32537 bytes --]
Hi Aaron,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on a97ac8cb24a3c3ad74794adb83717ef1605d1b47]
url: https://github.com/0day-ci/linux/commits/Aaron-Tomlin/module-core-code-clean-up/20220129-044218
base: a97ac8cb24a3c3ad74794adb83717ef1605d1b47
config: nds32-allnoconfig (https://download.01.org/0day-ci/archive/20220129/202201290605.RGByo8yC-lkp(a)intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.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/0day-ci/linux/commit/fd6ae2d3fa439baa614e32c58b4c2f0dd0faa186
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aaron-Tomlin/module-core-code-clean-up/20220129-044218
git checkout fd6ae2d3fa439baa614e32c58b4c2f0dd0faa186
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash kernel/module/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
kernel/module/kallsyms.c: In function 'is_exported':
>> kernel/module/kallsyms.c:31:54: error: invalid use of undefined type 'const struct module'
31 | ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms);
| ^~
kernel/module/kallsyms.c:31:65: error: invalid use of undefined type 'const struct module'
31 | ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms);
| ^~
kernel/module/kallsyms.c:31:77: error: invalid use of undefined type 'const struct module'
31 | ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms);
| ^~
kernel/module/kallsyms.c: In function 'layout_symtab':
>> kernel/module/kallsyms.c:119:51: error: invalid use of undefined type 'struct module'
119 | symsect->sh_entsize = get_offset(mod, &mod->init_layout.size, symsect,
| ^~
>> kernel/module/kallsyms.c:128:31: error: implicit declaration of function 'is_livepatch_module' [-Werror=implicit-function-declaration]
128 | if (i == 0 || is_livepatch_module(mod) ||
| ^~~~~~~~~~~~~~~~~~~
In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/linux/list.h:9,
from include/linux/module.h:12,
from kernel/module/kallsyms.c:8:
kernel/module/kallsyms.c:137:34: error: invalid use of undefined type 'struct module'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~
include/uapi/linux/const.h:32:44: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:137:25: note: in expansion of macro 'ALIGN'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~~~~
kernel/module/kallsyms.c:137:34: error: invalid use of undefined type 'struct module'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:137:25: note: in expansion of macro 'ALIGN'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~~~~
kernel/module/kallsyms.c:137:34: error: invalid use of undefined type 'struct module'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~
include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:137:25: note: in expansion of macro 'ALIGN'
137 | info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
| ^~~~~
kernel/module/kallsyms.c:138:28: error: invalid use of undefined type 'struct module'
138 | info->stroffs = mod->core_layout.size = info->symoffs + ndst * sizeof(Elf_Sym);
| ^~
kernel/module/kallsyms.c:139:12: error: invalid use of undefined type 'struct module'
139 | mod->core_layout.size += strtab_size;
| ^~
kernel/module/kallsyms.c:140:34: error: invalid use of undefined type 'struct module'
140 | info->core_typeoffs = mod->core_layout.size;
| ^~
kernel/module/kallsyms.c:141:12: error: invalid use of undefined type 'struct module'
141 | mod->core_layout.size += ndst * sizeof(char);
| ^~
kernel/module/kallsyms.c:142:12: error: invalid use of undefined type 'struct module'
142 | mod->core_layout.size = debug_align(mod->core_layout.size);
| ^~
>> kernel/module/kallsyms.c:142:33: error: implicit declaration of function 'debug_align' [-Werror=implicit-function-declaration]
142 | mod->core_layout.size = debug_align(mod->core_layout.size);
| ^~~~~~~~~~~
kernel/module/kallsyms.c:142:48: error: invalid use of undefined type 'struct module'
142 | mod->core_layout.size = debug_align(mod->core_layout.size);
| ^~
kernel/module/kallsyms.c:146:51: error: invalid use of undefined type 'struct module'
146 | strsect->sh_entsize = get_offset(mod, &mod->init_layout.size, strsect,
| ^~
kernel/module/kallsyms.c:151:12: error: invalid use of undefined type 'struct module'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~
In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/linux/list.h:9,
from include/linux/module.h:12,
from kernel/module/kallsyms.c:8:
kernel/module/kallsyms.c:151:42: error: invalid use of undefined type 'struct module'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~
include/uapi/linux/const.h:32:44: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:151:33: note: in expansion of macro 'ALIGN'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~~~~
kernel/module/kallsyms.c:151:42: error: invalid use of undefined type 'struct module'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:151:33: note: in expansion of macro 'ALIGN'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~~~~
>> kernel/module/kallsyms.c:152:51: error: invalid application of '__alignof__' to incomplete type 'struct mod_kallsyms'
152 | __alignof__(struct mod_kallsyms));
| ^~~~~~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:151:33: note: in expansion of macro 'ALIGN'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~~~~
kernel/module/kallsyms.c:151:42: error: invalid use of undefined type 'struct module'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~
include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:151:33: note: in expansion of macro 'ALIGN'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~~~~
>> kernel/module/kallsyms.c:152:51: error: invalid application of '__alignof__' to incomplete type 'struct mod_kallsyms'
152 | __alignof__(struct mod_kallsyms));
| ^~~~~~
include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/module/kallsyms.c:151:33: note: in expansion of macro 'ALIGN'
151 | mod->init_layout.size = ALIGN(mod->init_layout.size,
| ^~~~~
kernel/module/kallsyms.c:153:42: error: invalid use of undefined type 'struct module'
153 | info->mod_kallsyms_init_off = mod->init_layout.size;
| ^~
kernel/module/kallsyms.c:154:12: error: invalid use of undefined type 'struct module'
154 | mod->init_layout.size += sizeof(struct mod_kallsyms);
| ^~
>> kernel/module/kallsyms.c:154:41: error: invalid application of 'sizeof' to incomplete type 'struct mod_kallsyms'
154 | mod->init_layout.size += sizeof(struct mod_kallsyms);
| ^~~~~~
kernel/module/kallsyms.c:155:34: error: invalid use of undefined type 'struct module'
155 | info->init_typeoffs = mod->init_layout.size;
| ^~
kernel/module/kallsyms.c:156:12: error: invalid use of undefined type 'struct module'
156 | mod->init_layout.size += nsrc * sizeof(char);
| ^~
kernel/module/kallsyms.c:157:12: error: invalid use of undefined type 'struct module'
157 | mod->init_layout.size = debug_align(mod->init_layout.size);
| ^~
kernel/module/kallsyms.c:157:48: error: invalid use of undefined type 'struct module'
157 | mod->init_layout.size = debug_align(mod->init_layout.size);
| ^~
kernel/module/kallsyms.c: In function 'add_kallsyms':
kernel/module/kallsyms.c:174:12: error: invalid use of undefined type 'struct module'
174 | mod->kallsyms = mod->init_layout.base + info->mod_kallsyms_init_off;
| ^~
kernel/module/kallsyms.c:174:28: error: invalid use of undefined type 'struct module'
174 | mod->kallsyms = mod->init_layout.base + info->mod_kallsyms_init_off;
| ^~
kernel/module/kallsyms.c:176:12: error: invalid use of undefined type 'struct module'
176 | mod->kallsyms->symtab = (void *)symsec->sh_addr;
| ^~
kernel/module/kallsyms.c:177:12: error: invalid use of undefined type 'struct module'
177 | mod->kallsyms->num_symtab = symsec->sh_size / sizeof(Elf_Sym);
| ^~
kernel/module/kallsyms.c:179:12: error: invalid use of undefined type 'struct module'
179 | mod->kallsyms->strtab = (void *)info->sechdrs[info->index.str].sh_addr;
| ^~
kernel/module/kallsyms.c:180:12: error: invalid use of undefined type 'struct module'
180 | mod->kallsyms->typetab = mod->init_layout.base + info->init_typeoffs;
| ^~
kernel/module/kallsyms.c:180:37: error: invalid use of undefined type 'struct module'
180 | mod->kallsyms->typetab = mod->init_layout.base + info->init_typeoffs;
| ^~
kernel/module/kallsyms.c:186:12: error: invalid use of undefined type 'struct module'
186 | mod->core_kallsyms.symtab = dst = mod->core_layout.base + info->symoffs;
| ^~
kernel/module/kallsyms.c:186:46: error: invalid use of undefined type 'struct module'
186 | mod->core_kallsyms.symtab = dst = mod->core_layout.base + info->symoffs;
| ^~
kernel/module/kallsyms.c:187:12: error: invalid use of undefined type 'struct module'
187 | mod->core_kallsyms.strtab = s = mod->core_layout.base + info->stroffs;
| ^~
kernel/module/kallsyms.c:187:44: error: invalid use of undefined type 'struct module'
187 | mod->core_kallsyms.strtab = s = mod->core_layout.base + info->stroffs;
| ^~
kernel/module/kallsyms.c:188:12: error: invalid use of undefined type 'struct module'
188 | mod->core_kallsyms.typetab = mod->core_layout.base + info->core_typeoffs;
| ^~
kernel/module/kallsyms.c:188:41: error: invalid use of undefined type 'struct module'
188 | mod->core_kallsyms.typetab = mod->core_layout.base + info->core_typeoffs;
| ^~
kernel/module/kallsyms.c:189:18: error: invalid use of undefined type 'struct module'
189 | src = mod->kallsyms->symtab;
| ^~
kernel/module/kallsyms.c:190:35: error: invalid use of undefined type 'struct module'
190 | for (ndst = i = 0; i < mod->kallsyms->num_symtab; i++) {
| ^~
kernel/module/kallsyms.c:191:20: error: invalid use of undefined type 'struct module'
191 | mod->kallsyms->typetab[i] = elf_type(src + i, info);
| ^~
kernel/module/kallsyms.c:195:28: error: invalid use of undefined type 'struct module'
195 | mod->core_kallsyms.typetab[ndst] =
| ^~
kernel/module/kallsyms.c:196:32: error: invalid use of undefined type 'struct module'
196 | mod->kallsyms->typetab[i];
| ^~
kernel/module/kallsyms.c:198:54: error: invalid use of undefined type 'struct module'
198 | dst[ndst++].st_name = s - mod->core_kallsyms.strtab;
| ^~
kernel/module/kallsyms.c:199:45: error: invalid use of undefined type 'struct module'
199 | s += strscpy(s, &mod->kallsyms->strtab[src[i].st_name],
| ^~
kernel/module/kallsyms.c:203:12: error: invalid use of undefined type 'struct module'
203 | mod->core_kallsyms.num_symtab = ndst;
| ^~
kernel/module/kallsyms.c: At top level:
>> kernel/module/kallsyms.c:239:48: warning: 'struct mod_kallsyms' declared inside parameter list will not be visible outside of this definition or declaration
239 | static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum)
| ^~~~~~~~~~~~
kernel/module/kallsyms.c: In function 'kallsyms_symbol_name':
>> kernel/module/kallsyms.c:241:24: error: invalid use of undefined type 'struct mod_kallsyms'
241 | return kallsyms->strtab + kallsyms->symtab[symnum].st_name;
| ^~
kernel/module/kallsyms.c:241:43: error: invalid use of undefined type 'struct mod_kallsyms'
241 | return kallsyms->strtab + kallsyms->symtab[symnum].st_name;
| ^~
>> kernel/module/kallsyms.c:239:85: warning: parameter 'symnum' set but not used [-Wunused-but-set-parameter]
239 | static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum)
| ~~~~~~~~~~~~~^~~~~~
In file included from include/linux/rbtree.h:24,
from include/linux/mm_types.h:10,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from kernel/module/kallsyms.c:8:
kernel/module/kallsyms.c: In function 'find_kallsyms_symbol':
kernel/module/kallsyms.c:255:66: error: invalid use of undefined type 'struct module'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~
include/linux/rcupdate.h:391:17: note: in definition of macro '__rcu_dereference_check'
391 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:619:34: note: in expansion of macro 'rcu_dereference_sched_check'
619 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:41: note: in expansion of macro 'rcu_dereference_sched'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:66: error: invalid use of undefined type 'struct module'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~
include/linux/rcupdate.h:391:38: note: in definition of macro '__rcu_dereference_check'
391 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:619:34: note: in expansion of macro 'rcu_dereference_sched_check'
619 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:41: note: in expansion of macro 'rcu_dereference_sched'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from <command-line>:
kernel/module/kallsyms.c:255:66: error: invalid use of undefined type 'struct module'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~
include/linux/compiler_types.h:326:23: note: in definition of macro '__compiletime_assert'
326 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:346:9: note: in expansion of macro '_compiletime_assert'
346 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~
include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
49 | compiletime_assert_rwonce_type(x); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:391:50: note: in expansion of macro 'READ_ONCE'
391 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^~~~~~~~~
include/linux/rcupdate.h:563:9: note: in expansion of macro '__rcu_dereference_check'
563 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:619:34: note: in expansion of macro 'rcu_dereference_sched_check'
619 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:41: note: in expansion of macro 'rcu_dereference_sched'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:66: error: invalid use of undefined type 'struct module'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~
include/linux/compiler_types.h:326:23: note: in definition of macro '__compiletime_assert'
326 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:346:9: note: in expansion of macro '_compiletime_assert'
346 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~
include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
49 | compiletime_assert_rwonce_type(x); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:391:50: note: in expansion of macro 'READ_ONCE'
391 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^~~~~~~~~
include/linux/rcupdate.h:563:9: note: in expansion of macro '__rcu_dereference_check'
563 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:619:34: note: in expansion of macro 'rcu_dereference_sched_check'
619 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:41: note: in expansion of macro 'rcu_dereference_sched'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~~~~~~~~~~~~~~~~~~~~
kernel/module/kallsyms.c:255:66: error: invalid use of undefined type 'struct module'
255 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
| ^~
include/linux/compiler_types.h:326:23: note: in definition of macro '__compiletime_assert'
326 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:346:9: note: in expansion of macro '_compiletime_assert'
..
vim +31 kernel/module/kallsyms.c
22
23 static int is_exported(const char *name, unsigned long value,
24 const struct module *mod)
25 {
26 const struct kernel_symbol *ks;
27
28 if (!mod)
29 ks = lookup_exported_symbol(name, __start___ksymtab, __stop___ksymtab);
30 else
> 31 ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms);
32
33 return ks != NULL && kernel_symbol_value(ks) == value;
34 }
35
36 /* As per nm */
37 static char elf_type(const Elf_Sym *sym, const struct load_info *info)
38 {
39 const Elf_Shdr *sechdrs = info->sechdrs;
40
41 if (ELF_ST_BIND(sym->st_info) == STB_WEAK) {
42 if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT)
43 return 'v';
44 else
45 return 'w';
46 }
47 if (sym->st_shndx == SHN_UNDEF)
48 return 'U';
49 if (sym->st_shndx == SHN_ABS || sym->st_shndx == info->index.pcpu)
50 return 'a';
51 if (sym->st_shndx >= SHN_LORESERVE)
52 return '?';
53 if (sechdrs[sym->st_shndx].sh_flags & SHF_EXECINSTR)
54 return 't';
55 if (sechdrs[sym->st_shndx].sh_flags & SHF_ALLOC
56 && sechdrs[sym->st_shndx].sh_type != SHT_NOBITS) {
57 if (!(sechdrs[sym->st_shndx].sh_flags & SHF_WRITE))
58 return 'r';
59 else if (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)
60 return 'g';
61 else
62 return 'd';
63 }
64 if (sechdrs[sym->st_shndx].sh_type == SHT_NOBITS) {
65 if (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)
66 return 's';
67 else
68 return 'b';
69 }
70 if (strstarts(info->secstrings + sechdrs[sym->st_shndx].sh_name,
71 ".debug")) {
72 return 'n';
73 }
74 return '?';
75 }
76
77 static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs,
78 unsigned int shnum, unsigned int pcpundx)
79 {
80 const Elf_Shdr *sec;
81
82 if (src->st_shndx == SHN_UNDEF
83 || src->st_shndx >= shnum
84 || !src->st_name)
85 return false;
86
87 #ifdef CONFIG_KALLSYMS_ALL
88 if (src->st_shndx == pcpundx)
89 return true;
90 #endif
91
92 sec = sechdrs + src->st_shndx;
93 if (!(sec->sh_flags & SHF_ALLOC)
94 #ifndef CONFIG_KALLSYMS_ALL
95 || !(sec->sh_flags & SHF_EXECINSTR)
96 #endif
97 || (sec->sh_entsize & INIT_OFFSET_MASK))
98 return false;
99
100 return true;
101 }
102
103 /*
104 * We only allocate and copy the strings needed by the parts of symtab
105 * we keep. This is simple, but has the effect of making multiple
106 * copies of duplicates. We could be more sophisticated, see
107 * linux-kernel thread starting with
108 * <73defb5e4bca04a6431392cc341112b1@localhost>.
109 */
110 void layout_symtab(struct module *mod, struct load_info *info)
111 {
112 Elf_Shdr *symsect = info->sechdrs + info->index.sym;
113 Elf_Shdr *strsect = info->sechdrs + info->index.str;
114 const Elf_Sym *src;
115 unsigned int i, nsrc, ndst, strtab_size = 0;
116
117 /* Put symbol section at end of init part of module. */
118 symsect->sh_flags |= SHF_ALLOC;
> 119 symsect->sh_entsize = get_offset(mod, &mod->init_layout.size, symsect,
120 info->index.sym) | INIT_OFFSET_MASK;
121 pr_debug("\t%s\n", info->secstrings + symsect->sh_name);
122
123 src = (void *)info->hdr + symsect->sh_offset;
124 nsrc = symsect->sh_size / sizeof(*src);
125
126 /* Compute total space required for the core symbols' strtab. */
127 for (ndst = i = 0; i < nsrc; i++) {
> 128 if (i == 0 || is_livepatch_module(mod) ||
129 is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum,
130 info->index.pcpu)) {
131 strtab_size += strlen(&info->strtab[src[i].st_name])+1;
132 ndst++;
133 }
134 }
135
136 /* Append room for core symbols at end of core part. */
137 info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
138 info->stroffs = mod->core_layout.size = info->symoffs + ndst * sizeof(Elf_Sym);
139 mod->core_layout.size += strtab_size;
140 info->core_typeoffs = mod->core_layout.size;
141 mod->core_layout.size += ndst * sizeof(char);
> 142 mod->core_layout.size = debug_align(mod->core_layout.size);
143
144 /* Put string table section at end of init part of module. */
145 strsect->sh_flags |= SHF_ALLOC;
146 strsect->sh_entsize = get_offset(mod, &mod->init_layout.size, strsect,
147 info->index.str) | INIT_OFFSET_MASK;
148 pr_debug("\t%s\n", info->secstrings + strsect->sh_name);
149
150 /* We'll tack temporary mod_kallsyms on the end. */
151 mod->init_layout.size = ALIGN(mod->init_layout.size,
> 152 __alignof__(struct mod_kallsyms));
153 info->mod_kallsyms_init_off = mod->init_layout.size;
> 154 mod->init_layout.size += sizeof(struct mod_kallsyms);
155 info->init_typeoffs = mod->init_layout.size;
156 mod->init_layout.size += nsrc * sizeof(char);
157 mod->init_layout.size = debug_align(mod->init_layout.size);
158 }
159
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next prev parent reply other threads:[~2022-01-28 22:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 20:39 [RFC PATCH v3 00/13] module: core code clean up Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 01/13] module: Move all into module/ Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 02/13] module: Simple refactor in preparation for split Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 03/13] module: Move livepatch support to a separate file Aaron Tomlin
2022-01-29 7:27 ` Joe Perches
2022-01-28 20:39 ` [RFC PATCH v3 04/13] module: Move latched RB-tree " Aaron Tomlin
2022-01-28 21:55 ` kernel test robot
2022-01-28 20:39 ` [RFC PATCH v3 05/13] module: Move arch strict rwx " Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 06/13] module: Move " Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 07/13] module: Move extra signature support out of core code Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 08/13] module: Move kmemleak support to a separate file Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 09/13] module: Move kallsyms support into " Aaron Tomlin
2022-01-28 22:56 ` kernel test robot [this message]
2022-01-29 6:52 ` kernel test robot
2022-01-28 20:39 ` [RFC PATCH v3 10/13] module: Move procfs " Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 11/13] module: Move sysfs " Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 12/13] module: Move kdb_modules list out of core code Aaron Tomlin
2022-01-28 20:39 ` [RFC PATCH v3 13/13] module: Move version support into a separate file Aaron Tomlin
2022-01-28 22:36 ` kernel test robot
2022-01-28 22:22 ` [RFC PATCH v3 00/13] module: core code clean up Oleksandr Natalenko
-- strict thread matches above, loose matches on Subject: below --
2022-01-28 20:26 Aaron Tomlin
2022-01-28 20:26 ` [RFC PATCH v3 09/13] module: Move kallsyms support into a separate file Aaron Tomlin
2022-01-28 13:23 [RFC PATCH v3 00/13] module: core code clean up Aaron Tomlin
2022-01-28 13:23 ` [RFC PATCH v3 09/13] module: Move kallsyms support into a separate file Aaron Tomlin
2022-01-28 12:50 [RFC PATCH v3 00/13] module: core code clean up Aaron Tomlin
2022-01-28 12:50 ` [RFC PATCH v3 09/13] module: Move kallsyms support into a separate file Aaron Tomlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202201290605.RGByo8yC-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.