Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'objtool-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fixes from Ingo Molnar:
"Two objtool fixes:

- fix a bug that corrupts the code by mistakenly rewriting
conditional jumps

- fix another bug generating an incorrect ELF symbol table
during retpoline rewriting"

* tag 'objtool-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Only rewrite unconditional retpoline thunk calls
objtool: Fix .symtab_shndx handling for elf_create_undef_symbol()

+28 -1
+4
tools/objtool/arch/x86/decode.c
··· 747 747 748 748 list_for_each_entry(insn, &file->retpoline_call_list, call_node) { 749 749 750 + if (insn->type != INSN_JUMP_DYNAMIC && 751 + insn->type != INSN_CALL_DYNAMIC) 752 + continue; 753 + 750 754 if (!strcmp(insn->sec->name, ".text.__x86.indirect_thunk")) 751 755 continue; 752 756
+24 -1
tools/objtool/elf.c
··· 717 717 718 718 struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name) 719 719 { 720 - struct section *symtab; 720 + struct section *symtab, *symtab_shndx; 721 721 struct symbol *sym; 722 722 Elf_Data *data; 723 723 Elf_Scn *s; ··· 768 768 769 769 symtab->len += data->d_size; 770 770 symtab->changed = true; 771 + 772 + symtab_shndx = find_section_by_name(elf, ".symtab_shndx"); 773 + if (symtab_shndx) { 774 + s = elf_getscn(elf->elf, symtab_shndx->idx); 775 + if (!s) { 776 + WARN_ELF("elf_getscn"); 777 + return NULL; 778 + } 779 + 780 + data = elf_newdata(s); 781 + if (!data) { 782 + WARN_ELF("elf_newdata"); 783 + return NULL; 784 + } 785 + 786 + data->d_buf = &sym->sym.st_size; /* conveniently 0 */ 787 + data->d_size = sizeof(Elf32_Word); 788 + data->d_align = 4; 789 + data->d_type = ELF_T_WORD; 790 + 791 + symtab_shndx->len += 4; 792 + symtab_shndx->changed = true; 793 + } 771 794 772 795 sym->sec = find_section_by_index(elf, 0); 773 796