]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool/klp: Fix reloc corruption in convert_reloc_sym_to_secsym()
authorJosh Poimboeuf <jpoimboe@kernel.org>
Thu, 30 Apr 2026 04:54:41 +0000 (21:54 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:02 +0000 (21:16 -0700)
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>
tools/objtool/klp-diff.c

index ca87bcb9afa34f27fc2fe5be8eff1506bc536724..463b6daa523414e15f70f8e4a630c5a56700e17f 100644 (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;
 }