Skip to content

Commit bcb1b6f

Browse files
Peter Zijlstraingomolnar
authored andcommitted
objtool: Correctly handle retpoline thunk calls
Just like JMP handling, convert a direct CALL to a retpoline thunk into a retpoline safe indirect CALL. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151259.567568238@infradead.org
1 parent 1192518 commit bcb1b6f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tools/objtool/check.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,18 @@ static int add_call_destinations(struct objtool_file *file)
10251025
dest_off);
10261026
return -1;
10271027
}
1028+
1029+
} else if (!strncmp(reloc->sym->name, "__x86_indirect_thunk_", 21)) {
1030+
/*
1031+
* Retpoline calls are really dynamic calls in
1032+
* disguise, so convert them accordingly.
1033+
*/
1034+
insn->type = INSN_CALL_DYNAMIC;
1035+
insn->retpoline_safe = true;
1036+
1037+
remove_insn_ops(insn);
1038+
continue;
1039+
10281040
} else
10291041
insn->call_dest = reloc->sym;
10301042

0 commit comments

Comments
 (0)