• Home
  • Raw
  • Download

Lines Matching refs:mod

24 		       const struct module *mod)  in is_exported()  argument
28 if (!mod) in is_exported()
31 ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms); in is_exported()
110 void layout_symtab(struct module *mod, struct load_info *info) in layout_symtab() argument
119 symsect->sh_entsize = module_get_offset(mod, &mod->init_layout.size, symsect, in layout_symtab()
128 if (i == 0 || is_livepatch_module(mod) || in layout_symtab()
137 info->symoffs = ALIGN(mod->data_layout.size, symsect->sh_addralign ?: 1); in layout_symtab()
138 info->stroffs = mod->data_layout.size = info->symoffs + ndst * sizeof(Elf_Sym); in layout_symtab()
139 mod->data_layout.size += strtab_size; in layout_symtab()
141 info->core_typeoffs = mod->data_layout.size; in layout_symtab()
142 mod->data_layout.size += ndst * sizeof(char); in layout_symtab()
143 mod->data_layout.size = strict_align(mod->data_layout.size); in layout_symtab()
147 strsect->sh_entsize = module_get_offset(mod, &mod->init_layout.size, strsect, in layout_symtab()
152 mod->init_layout.size = ALIGN(mod->init_layout.size, in layout_symtab()
154 info->mod_kallsyms_init_off = mod->init_layout.size; in layout_symtab()
155 mod->init_layout.size += sizeof(struct mod_kallsyms); in layout_symtab()
156 info->init_typeoffs = mod->init_layout.size; in layout_symtab()
157 mod->init_layout.size += nsrc * sizeof(char); in layout_symtab()
158 mod->init_layout.size = strict_align(mod->init_layout.size); in layout_symtab()
166 void add_kallsyms(struct module *mod, const struct load_info *info) in add_kallsyms() argument
176 mod->kallsyms = (void __rcu *)mod->init_layout.base + in add_kallsyms()
181 rcu_dereference(mod->kallsyms)->symtab = (void *)symsec->sh_addr; in add_kallsyms()
182 rcu_dereference(mod->kallsyms)->num_symtab = symsec->sh_size / sizeof(Elf_Sym); in add_kallsyms()
184 rcu_dereference(mod->kallsyms)->strtab = in add_kallsyms()
186 rcu_dereference(mod->kallsyms)->typetab = mod->init_layout.base + info->init_typeoffs; in add_kallsyms()
192 mod->core_kallsyms.symtab = dst = mod->data_layout.base + info->symoffs; in add_kallsyms()
193 mod->core_kallsyms.strtab = s = mod->data_layout.base + info->stroffs; in add_kallsyms()
194 mod->core_kallsyms.typetab = mod->data_layout.base + info->core_typeoffs; in add_kallsyms()
196 src = rcu_dereference(mod->kallsyms)->symtab; in add_kallsyms()
197 for (ndst = i = 0; i < rcu_dereference(mod->kallsyms)->num_symtab; i++) { in add_kallsyms()
198 rcu_dereference(mod->kallsyms)->typetab[i] = elf_type(src + i, info); in add_kallsyms()
199 if (i == 0 || is_livepatch_module(mod) || in add_kallsyms()
204 mod->core_kallsyms.typetab[ndst] = in add_kallsyms()
205 rcu_dereference(mod->kallsyms)->typetab[i]; in add_kallsyms()
207 dst[ndst++].st_name = s - mod->core_kallsyms.strtab; in add_kallsyms()
209 &rcu_dereference(mod->kallsyms)->strtab[src[i].st_name], in add_kallsyms()
218 mod->core_kallsyms.num_symtab = ndst; in add_kallsyms()
222 void init_build_id(struct module *mod, const struct load_info *info) in init_build_id() argument
230 !build_id_parse_buf((void *)sechdr->sh_addr, mod->build_id, in init_build_id()
236 void init_build_id(struct module *mod, const struct load_info *info) in init_build_id() argument
262 static const char *find_kallsyms_symbol(struct module *mod, in find_kallsyms_symbol() argument
269 struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); in find_kallsyms_symbol()
272 if (within_module_init(addr, mod)) in find_kallsyms_symbol()
273 nextval = (unsigned long)mod->init_layout.base + mod->init_layout.text_size; in find_kallsyms_symbol()
275 nextval = (unsigned long)mod->core_layout.base + mod->core_layout.text_size; in find_kallsyms_symbol()
317 void * __weak dereference_module_function_descriptor(struct module *mod, in dereference_module_function_descriptor() argument
335 struct module *mod; in module_address_lookup() local
338 mod = __module_address(addr); in module_address_lookup()
339 if (mod) { in module_address_lookup()
341 *modname = mod->name; in module_address_lookup()
344 *modbuildid = mod->build_id; in module_address_lookup()
350 ret = find_kallsyms_symbol(mod, addr, size, offset); in module_address_lookup()
364 struct module *mod; in lookup_module_symbol_name() local
367 list_for_each_entry_rcu(mod, &modules, list) { in lookup_module_symbol_name()
368 if (mod->state == MODULE_STATE_UNFORMED) in lookup_module_symbol_name()
370 if (within_module(addr, mod)) { in lookup_module_symbol_name()
373 sym = find_kallsyms_symbol(mod, addr, NULL, NULL); in lookup_module_symbol_name()
390 struct module *mod; in lookup_module_symbol_attrs() local
393 list_for_each_entry_rcu(mod, &modules, list) { in lookup_module_symbol_attrs()
394 if (mod->state == MODULE_STATE_UNFORMED) in lookup_module_symbol_attrs()
396 if (within_module(addr, mod)) { in lookup_module_symbol_attrs()
399 sym = find_kallsyms_symbol(mod, addr, size, offset); in lookup_module_symbol_attrs()
403 strscpy(modname, mod->name, MODULE_NAME_LEN); in lookup_module_symbol_attrs()
418 struct module *mod; in module_get_kallsym() local
421 list_for_each_entry_rcu(mod, &modules, list) { in module_get_kallsym()
424 if (mod->state == MODULE_STATE_UNFORMED) in module_get_kallsym()
426 kallsyms = rcu_dereference_sched(mod->kallsyms); in module_get_kallsym()
433 strscpy(module_name, mod->name, MODULE_NAME_LEN); in module_get_kallsym()
434 *exported = is_exported(name, *value, mod); in module_get_kallsym()
445 unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name) in find_kallsyms_symbol_value() argument
448 struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); in find_kallsyms_symbol_value()
462 struct module *mod; in __module_kallsyms_lookup_name() local
467 mod = find_module_all(name, colon - name, false); in __module_kallsyms_lookup_name()
468 if (mod) in __module_kallsyms_lookup_name()
469 return find_kallsyms_symbol_value(mod, colon + 1); in __module_kallsyms_lookup_name()
473 list_for_each_entry_rcu(mod, &modules, list) { in __module_kallsyms_lookup_name()
476 if (mod->state == MODULE_STATE_UNFORMED) in __module_kallsyms_lookup_name()
478 ret = find_kallsyms_symbol_value(mod, name); in __module_kallsyms_lookup_name()
501 struct module *mod; in module_kallsyms_on_each_symbol() local
506 list_for_each_entry(mod, &modules, list) { in module_kallsyms_on_each_symbol()
509 if (mod->state == MODULE_STATE_UNFORMED) in module_kallsyms_on_each_symbol()
514 kallsyms = rcu_dereference_sched(mod->kallsyms); in module_kallsyms_on_each_symbol()
524 mod, kallsyms_symbol_value(sym)); in module_kallsyms_on_each_symbol()