mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
objtool: Check for missing annotation entries in read_annotate()
Add a sanity check to make sure none of the relocations for the .discard.annotate_insn section have gone missing. Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
This commit is contained in:
@@ -2293,6 +2293,11 @@ static int read_annotate(struct objtool_file *file,
|
||||
sec->sh.sh_entsize = 8;
|
||||
}
|
||||
|
||||
if (sec_num_entries(sec) != sec_num_entries(sec->rsec)) {
|
||||
ERROR("bad .discard.annotate_insn section: missing relocs");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for_each_reloc(sec->rsec, reloc) {
|
||||
type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4);
|
||||
type = bswap_if_needed(file->elf, type);
|
||||
|
||||
Reference in New Issue
Block a user