Skip to content

Commit bcb1b6f

Browse files
Peter ZijlstraIngo Molnar
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) <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 1192518 commit bcb1b6f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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)