objtool/klp: Fix reloc corruption in convert_reloc_sym_to_secsym()

Use the section symbol's index instead of the old symbol's index when
updating the ELF relocation entry in convert_reloc_sym_to_secsym().

Found by Sashiko review.

Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
This commit is contained in:
Josh Poimboeuf
2026-04-29 21:54:41 -07:00
parent 51e1dfce24
commit 5f49ec82b9

View File

@@ -975,7 +975,7 @@ static int convert_reloc_sym_to_secsym(struct elf *elf, struct reloc *reloc)
return -1;
reloc->sym = sec->sym;
set_reloc_sym(elf, reloc, sym->idx);
set_reloc_sym(elf, reloc, sec->sym->idx);
set_reloc_addend(elf, reloc, sym->offset + reloc_addend(reloc));
return 0;
}