Lines Matching refs:mod
25 const struct module *mod) in is_exported() argument
29 if (!mod) in is_exported()
32 ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms); in is_exported()
113 void layout_symtab(struct module *mod, struct load_info *info) in layout_symtab() argument
119 struct module_memory *mod_mem_data = &mod->mem[MOD_DATA]; in layout_symtab()
120 struct module_memory *mod_mem_init_data = &mod->mem[MOD_INIT_DATA]; in layout_symtab()
124 symsect->sh_entsize = module_get_offset_and_type(mod, MOD_INIT_DATA, in layout_symtab()
133 if (i == 0 || is_livepatch_module(mod) || in layout_symtab()
151 strsect->sh_entsize = module_get_offset_and_type(mod, MOD_INIT_DATA, in layout_symtab()
170 void add_kallsyms(struct module *mod, const struct load_info *info) in add_kallsyms() argument
178 void *data_base = mod->mem[MOD_DATA].base; in add_kallsyms()
179 void *init_data_base = mod->mem[MOD_INIT_DATA].base; in add_kallsyms()
182 mod->kallsyms = (void __rcu *)init_data_base + in add_kallsyms()
187 rcu_dereference(mod->kallsyms)->symtab = (void *)symsec->sh_addr; in add_kallsyms()
188 rcu_dereference(mod->kallsyms)->num_symtab = symsec->sh_size / sizeof(Elf_Sym); in add_kallsyms()
190 rcu_dereference(mod->kallsyms)->strtab = in add_kallsyms()
192 rcu_dereference(mod->kallsyms)->typetab = init_data_base + info->init_typeoffs; in add_kallsyms()
198 mod->core_kallsyms.symtab = dst = data_base + info->symoffs; in add_kallsyms()
199 mod->core_kallsyms.strtab = s = data_base + info->stroffs; in add_kallsyms()
200 mod->core_kallsyms.typetab = data_base + info->core_typeoffs; in add_kallsyms()
202 src = rcu_dereference(mod->kallsyms)->symtab; in add_kallsyms()
203 for (ndst = i = 0; i < rcu_dereference(mod->kallsyms)->num_symtab; i++) { in add_kallsyms()
204 rcu_dereference(mod->kallsyms)->typetab[i] = elf_type(src + i, info); in add_kallsyms()
205 if (i == 0 || is_livepatch_module(mod) || in add_kallsyms()
210 mod->core_kallsyms.typetab[ndst] = in add_kallsyms()
211 rcu_dereference(mod->kallsyms)->typetab[i]; in add_kallsyms()
213 dst[ndst++].st_name = s - mod->core_kallsyms.strtab; in add_kallsyms()
215 &rcu_dereference(mod->kallsyms)->strtab[src[i].st_name], in add_kallsyms()
224 mod->core_kallsyms.num_symtab = ndst; in add_kallsyms()
228 void init_build_id(struct module *mod, const struct load_info *info) in init_build_id() argument
236 !build_id_parse_buf((void *)sechdr->sh_addr, mod->build_id, in init_build_id()
242 void init_build_id(struct module *mod, const struct load_info *info) in init_build_id() argument
256 static const char *find_kallsyms_symbol(struct module *mod, in find_kallsyms_symbol() argument
263 struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); in find_kallsyms_symbol()
267 if (within_module_init(addr, mod)) in find_kallsyms_symbol()
268 mod_mem = &mod->mem[MOD_INIT_TEXT]; in find_kallsyms_symbol()
270 mod_mem = &mod->mem[MOD_TEXT]; in find_kallsyms_symbol()
314 void * __weak dereference_module_function_descriptor(struct module *mod, in dereference_module_function_descriptor() argument
332 struct module *mod; in module_address_lookup() local
335 mod = __module_address(addr); in module_address_lookup()
336 if (mod) { in module_address_lookup()
338 *modname = mod->name; in module_address_lookup()
341 *modbuildid = mod->build_id; in module_address_lookup()
347 ret = find_kallsyms_symbol(mod, addr, size, offset); in module_address_lookup()
361 struct module *mod; in lookup_module_symbol_name() local
364 list_for_each_entry_rcu(mod, &modules, list) { in lookup_module_symbol_name()
365 if (mod->state == MODULE_STATE_UNFORMED) in lookup_module_symbol_name()
367 if (within_module(addr, mod)) { in lookup_module_symbol_name()
370 sym = find_kallsyms_symbol(mod, addr, NULL, NULL); in lookup_module_symbol_name()
387 struct module *mod; in module_get_kallsym() local
390 list_for_each_entry_rcu(mod, &modules, list) { in module_get_kallsym()
393 if (mod->state == MODULE_STATE_UNFORMED) in module_get_kallsym()
395 kallsyms = rcu_dereference_sched(mod->kallsyms); in module_get_kallsym()
402 strscpy(module_name, mod->name, MODULE_NAME_LEN); in module_get_kallsym()
403 *exported = is_exported(name, *value, mod); in module_get_kallsym()
414 static unsigned long __find_kallsyms_symbol_value(struct module *mod, const char *name) in __find_kallsyms_symbol_value() argument
417 struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); in __find_kallsyms_symbol_value()
431 struct module *mod; in __module_kallsyms_lookup_name() local
436 mod = find_module_all(name, colon - name, false); in __module_kallsyms_lookup_name()
437 if (mod) in __module_kallsyms_lookup_name()
438 return __find_kallsyms_symbol_value(mod, colon + 1); in __module_kallsyms_lookup_name()
442 list_for_each_entry_rcu(mod, &modules, list) { in __module_kallsyms_lookup_name()
445 if (mod->state == MODULE_STATE_UNFORMED) in __module_kallsyms_lookup_name()
447 ret = __find_kallsyms_symbol_value(mod, name); in __module_kallsyms_lookup_name()
466 unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name) in find_kallsyms_symbol_value() argument
471 ret = __find_kallsyms_symbol_value(mod, name); in find_kallsyms_symbol_value()
480 struct module *mod; in module_kallsyms_on_each_symbol() local
485 list_for_each_entry(mod, &modules, list) { in module_kallsyms_on_each_symbol()
488 if (mod->state == MODULE_STATE_UNFORMED) in module_kallsyms_on_each_symbol()
491 if (modname && strcmp(modname, mod->name)) in module_kallsyms_on_each_symbol()
496 kallsyms = rcu_dereference_sched(mod->kallsyms); in module_kallsyms_on_each_symbol()