/linux-6.6.21/arch/powerpc/kernel/ |
D | module_64.c | 208 const Elf64_Shdr *sechdrs) in get_stubs_size() argument 216 if (sechdrs[i].sh_type == SHT_RELA) { in get_stubs_size() 219 (void *)sechdrs[i].sh_addr, in get_stubs_size() 220 sechdrs[i].sh_size / sizeof(Elf64_Rela)); in get_stubs_size() 227 sort((void *)sechdrs[i].sh_addr, in get_stubs_size() 228 sechdrs[i].sh_size / sizeof(Elf64_Rela), in get_stubs_size() 231 relocs += count_relocs((void *)sechdrs[i].sh_addr, in get_stubs_size() 232 sechdrs[i].sh_size in get_stubs_size() 236 relocs += count_relocs((void *)sechdrs[i].sh_addr, in get_stubs_size() 237 sechdrs[i].sh_size in get_stubs_size() [all …]
|
D | module_32.c | 74 const Elf32_Shdr *sechdrs, in get_plt_size() argument 86 if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != NULL) in get_plt_size() 91 if (strstr(secstrings + sechdrs[i].sh_name, ".debug")) in get_plt_size() 94 if (sechdrs[i].sh_type == SHT_RELA) { in get_plt_size() 97 (void *)hdr + sechdrs[i].sh_offset, in get_plt_size() 98 sechdrs[i].sh_size / sizeof(Elf32_Rela)); in get_plt_size() 105 sort((void *)hdr + sechdrs[i].sh_offset, in get_plt_size() 106 sechdrs[i].sh_size / sizeof(Elf32_Rela), in get_plt_size() 110 + sechdrs[i].sh_offset, in get_plt_size() 111 sechdrs[i].sh_size in get_plt_size() [all …]
|
D | module.c | 23 const Elf_Shdr *sechdrs, in find_section() argument 29 secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; in find_section() 31 if (strcmp(secstrings+sechdrs[i].sh_name, name) == 0) in find_section() 32 return &sechdrs[i]; in find_section() 37 const Elf_Shdr *sechdrs, struct module *me) in module_finalize() argument 42 rc = module_finalize_ftrace(me, sechdrs); in module_finalize() 47 sect = find_section(hdr, sechdrs, "__ftr_fixup"); in module_finalize() 53 sect = find_section(hdr, sechdrs, "__mmu_ftr_fixup"); in module_finalize() 60 sect = find_section(hdr, sechdrs, "__fw_ftr_fixup"); in module_finalize() 68 sect = find_section(hdr, sechdrs, ".opd"); in module_finalize() [all …]
|
/linux-6.6.21/arch/mips/kernel/ |
D | vpe.c | 183 Elf_Shdr *sechdrs, const char *secstrings) in layout_sections() argument 197 sechdrs[i].sh_entsize = ~0UL; in layout_sections() 201 Elf_Shdr *s = &sechdrs[i]; in layout_sections() 424 static int apply_relocations(Elf32_Shdr *sechdrs, in apply_relocations() argument 430 Elf32_Rel *rel = (void *) sechdrs[relsec].sh_addr; in apply_relocations() 437 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocations() 441 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocations() 444 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocations() 476 static void simplify_symbols(Elf_Shdr *sechdrs, in simplify_symbols() argument 482 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; in simplify_symbols() [all …]
|
/linux-6.6.21/arch/m68k/kernel/ |
D | module.c | 22 int apply_relocate(Elf32_Shdr *sechdrs, in apply_relocate() argument 29 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate() 34 sechdrs[relsec].sh_info); in apply_relocate() 35 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate() 37 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate() 41 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocate() 62 int apply_relocate_add(Elf32_Shdr *sechdrs, in apply_relocate_add() argument 69 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 74 sechdrs[relsec].sh_info); in apply_relocate_add() 75 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/loongarch/kernel/ |
D | module-sections.c | 12 Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val) in module_emit_got_entry() argument 16 struct got_entry *got = get_got_entry(val, sechdrs, got_sec); in module_emit_got_entry() 22 got = (struct got_entry *)sechdrs[got_sec->shndx].sh_addr; in module_emit_got_entry() 38 Elf_Addr module_emit_plt_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val) in module_emit_plt_entry() argument 43 struct plt_entry *plt = get_plt_entry(val, sechdrs, plt_sec, plt_idx_sec); in module_emit_plt_entry() 52 plt = (struct plt_entry *)sechdrs[plt_sec->shndx].sh_addr; in module_emit_plt_entry() 54 plt_idx = (struct plt_idx_entry *)sechdrs[plt_idx_sec->shndx].sh_addr; in module_emit_plt_entry() 104 int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 114 if (!strcmp(secstrings + sechdrs[i].sh_name, ".got")) in module_frob_arch_sections() 116 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".plt")) in module_frob_arch_sections() [all …]
|
D | module.c | 105 Elf_Shdr *sechdrs, u32 *location, Elf_Addr v, in apply_r_larch_sop_push_plt_pcrel() argument 111 v = module_emit_plt_entry(mod, sechdrs, v); in apply_r_larch_sop_push_plt_pcrel() 114 v = module_emit_plt_entry(mod, sechdrs, v); in apply_r_larch_sop_push_plt_pcrel() 279 Elf_Shdr *sechdrs, u32 *location, Elf_Addr v, in apply_r_larch_b26() argument 286 v = module_emit_plt_entry(mod, sechdrs, v); in apply_r_larch_b26() 289 v = module_emit_plt_entry(mod, sechdrs, v); in apply_r_larch_b26() 347 Elf_Shdr *sechdrs, u32 *location, Elf_Addr v, in apply_r_larch_got_pc() argument 350 Elf_Addr got = module_emit_got_entry(mod, sechdrs, v); in apply_r_larch_got_pc() 421 int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, in apply_relocate_add() argument 433 Elf_Rela *rel = (void *) sechdrs[relsec].sh_addr; in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/sparc/kernel/ |
D | module.c | 56 Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 65 for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) { in module_frob_arch_sections() 71 sym = (Elf_Sym *)sechdrs[symidx].sh_addr; in module_frob_arch_sections() 72 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; in module_frob_arch_sections() 74 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { in module_frob_arch_sections() 83 int apply_relocate_add(Elf_Shdr *sechdrs, in apply_relocate_add() argument 90 Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 95 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate_add() 99 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate_add() 109 sym = (Elf_Sym *)sechdrs[symindex].sh_addr in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/arc/kernel/ |
D | module.c | 26 int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 45 int apply_relocate_add(Elf32_Shdr *sechdrs, in apply_relocate_add() argument 52 Elf32_Rela *rel_entry = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 61 tgtsec = sechdrs[relsec].sh_info; in apply_relocate_add() 62 tgt_addr = sechdrs[tgtsec].sh_addr; in apply_relocate_add() 63 sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr; in apply_relocate_add() 64 n = sechdrs[relsec].sh_size / sizeof(*rel_entry); in apply_relocate_add() 67 module->arch.secstr + sechdrs[tgtsec].sh_name, tgt_addr); in apply_relocate_add() 86 s = module->arch.secstr + sechdrs[sym_entry->st_shndx].sh_name; in apply_relocate_add() 114 if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0) in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/x86/kernel/ |
D | module.c | 91 int apply_relocate(Elf32_Shdr *sechdrs, in apply_relocate() argument 98 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate() 103 relsec, sechdrs[relsec].sh_info); in apply_relocate() 104 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate() 106 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate() 110 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocate() 132 static int __write_relocate_add(Elf64_Shdr *sechdrs, in __write_relocate_add() argument 141 Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; in __write_relocate_add() 149 relsec, sechdrs[relsec].sh_info); in __write_relocate_add() 150 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in __write_relocate_add() [all …]
|
/linux-6.6.21/kernel/ |
D | kexec_file.c | 108 vfree(pi->sechdrs); in kimage_file_post_load_cleanup() 109 pi->sechdrs = NULL; in kimage_file_post_load_cleanup() 813 const Elf_Shdr *sechdrs; in kexec_purgatory_setup_kbuf() local 819 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf() 824 if (!(sechdrs[i].sh_flags & SHF_ALLOC)) in kexec_purgatory_setup_kbuf() 827 align = sechdrs[i].sh_addralign; in kexec_purgatory_setup_kbuf() 828 if (sechdrs[i].sh_type != SHT_NOBITS) { in kexec_purgatory_setup_kbuf() 832 kbuf->bufsz += sechdrs[i].sh_size; in kexec_purgatory_setup_kbuf() 837 bss_sz += sechdrs[i].sh_size; in kexec_purgatory_setup_kbuf() 877 Elf_Shdr *sechdrs; in kexec_purgatory_setup_sechdrs() local [all …]
|
/linux-6.6.21/arch/hexagon/kernel/ |
D | module.c | 27 int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 37 secstrings + sechdrs[i].sh_name); in module_frob_arch_sections() 38 if (strcmp(secstrings + sechdrs[i].sh_name, ".plt") == 0) in module_frob_arch_sections() 40 if (strcmp(secstrings + sechdrs[i].sh_name, ".got.plt") == 0) in module_frob_arch_sections() 42 if (strcmp(secstrings + sechdrs[i].sh_name, ".rela.plt") == 0) in module_frob_arch_sections() 67 int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, in apply_relocate_add() argument 75 unsigned int nrelocs = sechdrs[relsec].sh_size / sizeof(Elf32_Rela); in apply_relocate_add() 76 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 77 Elf32_Word sym_info = sechdrs[relsec].sh_info; in apply_relocate_add() 78 Elf32_Sym *sym_base = (Elf32_Sym *) sechdrs[symindex].sh_addr; in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/sh/kernel/ |
D | module.c | 24 int apply_relocate_add(Elf32_Shdr *sechdrs, in apply_relocate_add() argument 31 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 38 sechdrs[relsec].sh_info); in apply_relocate_add() 39 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate_add() 41 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate_add() 45 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocate_add() 91 const Elf_Shdr *sechdrs, in module_finalize() argument 96 ret |= module_dwarf_finalize(hdr, sechdrs, me); in module_finalize()
|
/linux-6.6.21/arch/arm64/kernel/ |
D | module-plts.c | 69 u64 module_emit_plt_entry(struct module *mod, Elf64_Shdr *sechdrs, in module_emit_plt_entry() argument 75 struct plt_entry *plt = (struct plt_entry *)sechdrs[pltsec->plt_shndx].sh_addr; in module_emit_plt_entry() 101 u64 module_emit_veneer_for_adrp(struct module *mod, Elf64_Shdr *sechdrs, in module_emit_veneer_for_adrp() argument 106 struct plt_entry *plt = (struct plt_entry *)sechdrs[pltsec->plt_shndx].sh_addr; in module_emit_veneer_for_adrp() 281 int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 295 if (!strcmp(secstrings + sechdrs[i].sh_name, ".plt")) in module_frob_arch_sections() 297 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt")) in module_frob_arch_sections() 299 else if (!strcmp(secstrings + sechdrs[i].sh_name, in module_frob_arch_sections() 301 tramp = sechdrs + i; in module_frob_arch_sections() 302 else if (sechdrs[i].sh_type == SHT_SYMTAB) in module_frob_arch_sections() [all …]
|
/linux-6.6.21/arch/microblaze/kernel/ |
D | module.c | 18 int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, in apply_relocate_add() argument 23 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 29 relsec, sechdrs[relsec].sh_info); in apply_relocate_add() 31 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { in apply_relocate_add() 33 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + in apply_relocate_add() 35 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + in apply_relocate_add() 91 int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, in module_finalize() argument
|
/linux-6.6.21/kernel/module/ |
D | livepatch.c | 33 size = sizeof(*info->sechdrs) * info->hdr->e_shnum; in copy_module_elf() 34 mod->klp_info->sechdrs = kmemdup(info->sechdrs, size, GFP_KERNEL); in copy_module_elf() 35 if (!mod->klp_info->sechdrs) { in copy_module_elf() 41 size = info->sechdrs[info->hdr->e_shstrndx].sh_size; in copy_module_elf() 58 mod->klp_info->sechdrs[symndx].sh_addr = (unsigned long)mod->core_kallsyms.symtab; in copy_module_elf() 63 kfree(mod->klp_info->sechdrs); in copy_module_elf() 71 kfree(mod->klp_info->sechdrs); in free_module_elf()
|
D | debug_kmemleak.c | 22 if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) || in kmemleak_load_module() 23 !(info->sechdrs[i].sh_flags & SHF_WRITE) || in kmemleak_load_module() 24 (info->sechdrs[i].sh_flags & SHF_EXECINSTR)) in kmemleak_load_module() 27 kmemleak_scan_area((void *)info->sechdrs[i].sh_addr, in kmemleak_load_module() 28 info->sechdrs[i].sh_size, GFP_KERNEL); in kmemleak_load_module()
|
/linux-6.6.21/arch/loongarch/include/asm/ |
D | module.h | 43 Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val); 44 Elf_Addr module_emit_plt_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val); 68 static inline int get_plt_idx(unsigned long val, Elf_Shdr *sechdrs, const struct mod_section *sec) in get_plt_idx() argument 71 struct plt_idx_entry *plt_idx = (struct plt_idx_entry *)sechdrs[sec->shndx].sh_addr; in get_plt_idx() 82 Elf_Shdr *sechdrs, in get_plt_entry() argument 86 int plt_idx = get_plt_idx(val, sechdrs, sec_plt_idx); in get_plt_entry() 87 struct plt_entry *plt = (struct plt_entry *)sechdrs[sec_plt->shndx].sh_addr; in get_plt_entry() 96 Elf_Shdr *sechdrs, in get_got_entry() argument 100 struct got_entry *got = (struct got_entry *)sechdrs[sec->shndx].sh_addr; in get_got_entry()
|
/linux-6.6.21/arch/openrisc/kernel/ |
D | module.c | 16 int apply_relocate_add(Elf32_Shdr *sechdrs, in apply_relocate_add() argument 23 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 29 sechdrs[relsec].sh_info); in apply_relocate_add() 30 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate_add() 32 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate_add() 37 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocate_add()
|
/linux-6.6.21/arch/parisc/kernel/ |
D | module.c | 280 CONST Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 294 const Elf_Rela *rels = (void *)sechdrs[i].sh_addr; in module_frob_arch_sections() 295 unsigned long nrels = sechdrs[i].sh_size / sizeof(*rels); in module_frob_arch_sections() 298 if (strncmp(secstrings + sechdrs[i].sh_name, in module_frob_arch_sections() 302 if (sechdrs[i].sh_type != SHT_RELA) in module_frob_arch_sections() 322 s = sechdrs[i].sh_info; in module_frob_arch_sections() 501 int apply_relocate_add(Elf_Shdr *sechdrs, in apply_relocate_add() argument 508 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 515 unsigned int targetsec = sechdrs[relsec].sh_info; in apply_relocate_add() 521 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocate_add() [all …]
|
/linux-6.6.21/include/linux/ |
D | moduleloader.h | 21 Elf_Shdr *sechdrs, 55 int apply_relocate(Elf_Shdr *sechdrs, 61 static inline int apply_relocate(Elf_Shdr *sechdrs, in apply_relocate() argument 78 int apply_relocate_add(Elf_Shdr *sechdrs, 94 void clear_relocate_add(Elf_Shdr *sechdrs, 101 static inline int apply_relocate_add(Elf_Shdr *sechdrs, in apply_relocate_add() argument 115 const Elf_Shdr *sechdrs,
|
/linux-6.6.21/arch/nios2/kernel/ |
D | module.c | 43 int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, in apply_relocate_add() argument 48 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 51 sechdrs[relsec].sh_info); in apply_relocate_add() 53 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { in apply_relocate_add() 57 = ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocate_add() 62 = ((Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocate_add() 132 int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, in module_finalize() argument
|
/linux-6.6.21/arch/riscv/kernel/ |
D | module-sections.c | 90 int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, in module_frob_arch_sections() argument 101 if (!strcmp(secstrings + sechdrs[i].sh_name, ".plt")) in module_frob_arch_sections() 102 mod->arch.plt.shdr = sechdrs + i; in module_frob_arch_sections() 103 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".got")) in module_frob_arch_sections() 104 mod->arch.got.shdr = sechdrs + i; in module_frob_arch_sections() 105 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".got.plt")) in module_frob_arch_sections() 106 mod->arch.got_plt.shdr = sechdrs + i; in module_frob_arch_sections() 124 Elf_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset; in module_frob_arch_sections() 125 int num_rela = sechdrs[i].sh_size / sizeof(Elf_Rela); in module_frob_arch_sections() 126 Elf_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info; in module_frob_arch_sections() [all …]
|
/linux-6.6.21/arch/alpha/kernel/ |
D | module.c | 64 module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs, in module_frob_arch_sections() argument 72 esechdrs = sechdrs + hdr->e_shnum; in module_frob_arch_sections() 78 for (s = sechdrs; s < esechdrs; ++s) in module_frob_arch_sections() 83 me->arch.gotsecindex = s - sechdrs; in module_frob_arch_sections() 110 for (s = sechdrs; s < esechdrs; ++s) in module_frob_arch_sections() 133 apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, in apply_relocate_add() argument 137 Elf64_Rela *rela = (void *)sechdrs[relsec].sh_addr; in apply_relocate_add() 138 unsigned long i, n = sechdrs[relsec].sh_size / sizeof(*rela); in apply_relocate_add() 144 sechdrs[relsec].sh_info); in apply_relocate_add() 146 base = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr; in apply_relocate_add() [all …]
|
/linux-6.6.21/arch/arm64/include/asm/ |
D | module.h | 24 u64 module_emit_plt_entry(struct module *mod, Elf64_Shdr *sechdrs, 28 u64 module_emit_veneer_for_adrp(struct module *mod, Elf64_Shdr *sechdrs, 55 const Elf_Shdr *sechdrs, in find_section() argument 59 const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; in find_section() 61 for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { in find_section()
|