diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-07 17:46:01 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-07 17:46:01 (GMT) |
commit | 23b50ae8e91c864d5ef800ca97fd23384502b822 (patch) | |
tree | 8fbe2fdb1649b11ce180d6d3013519e790e3e0d2 | |
parent | feecaba38bc334308c557f51c8b34a7e036d704b (diff) |
Suffixed ELF PLT entries with "@plt" in symbol names.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | plugins/elf/helper_arm.c | 25 |
2 files changed, 16 insertions, 14 deletions
@@ -1,5 +1,10 @@ 18-01-07 Cyrille Bagard <nocbos@gmail.com> + * plugins/elf/helper_arm.c: + Suffix ELF PLT entries with "@plt" in symbol names. + +18-01-07 Cyrille Bagard <nocbos@gmail.com> + * src/analysis/db/cdb.c: Fix a bug when reading the compressed database. diff --git a/plugins/elf/helper_arm.c b/plugins/elf/helper_arm.c index 737e4ac..a037469 100644 --- a/plugins/elf/helper_arm.c +++ b/plugins/elf/helper_arm.c @@ -94,9 +94,7 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, off_t index; /* Indice de la portion visée */ elf_sym sym; /* Définition complète */ const char *name; /* Nom du symbole trouvé */ - - - + char *plt_name; /* Adaptation de l'étiquette */ virt_t virt; /* Adresse en mémoire virtuelle*/ virt_t final_virt; /* Adresse virtuelle retenue */ bool status; /* Bilan d'une opération */ @@ -105,13 +103,8 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, GBinSymbol *symbol; /* Nouveau symbole construit */ mrange_t range; /* Couverture mémoire associée */ - - - result = true; - - get_elf_section_content(format, relxxx, &rel_start, &rel_size, NULL); base = G_BIN_FORMAT(format); @@ -127,25 +120,25 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, continue; name = get_elf_symbol_name(format, dynsym, dynstr, index); + if (name == NULL) - { - /* FIXME */ name = "unknown"; - } + + asprintf(&plt_name, "%s@plt", name); switch (ELF_REL_TYPE(format, reloc)) { case R_ARM_JUMP_SLOT: virt = ELF_SYM(format, sym, st_value); - if (virt == 0) continue; + if (virt == 0) goto lears_next; final_virt = virt & ~0x1; status = g_exe_format_translate_address_into_vmpa(G_EXE_FORMAT(format), final_virt, &addr); - if (!status) continue; + if (!status) goto lears_next; - routine = try_to_demangle_routine(name); + routine = try_to_demangle_routine(plt_name); symbol = G_BIN_SYMBOL(routine); init_mrange(&range, &addr, 0); @@ -166,6 +159,10 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, if (symbol != NULL) g_binary_format_add_symbol(base, symbol); + lears_next: + + free(plt_name); + } return result; |