summaryrefslogtreecommitdiff
path: root/tools/objtool
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-03-26 18:12:03 +0300
committerIngo Molnar <mingo@kernel.org>2021-04-02 13:42:54 +0300
commitbcb1b6ff39da7e8a6a986eb08126fba2b5e13c32 (patch)
tree8dde0d202326af69b041138399e562d72e2bae5f /tools/objtool
parent119251855f9adf9421cb5eb409933092141ab2c7 (diff)
downloadlinux-bcb1b6ff39da7e8a6a986eb08126fba2b5e13c32.tar.xz
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
Diffstat (limited to 'tools/objtool')
-rw-r--r--tools/objtool/check.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index d45f0181f133..519af4be7018 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1025,6 +1025,18 @@ static int add_call_destinations(struct objtool_file *file)
dest_off);
return -1;
}
+
+ } else if (!strncmp(reloc->sym->name, "__x86_indirect_thunk_", 21)) {
+ /*
+ * Retpoline calls are really dynamic calls in
+ * disguise, so convert them accordingly.
+ */
+ insn->type = INSN_CALL_DYNAMIC;
+ insn->retpoline_safe = true;
+
+ remove_insn_ops(insn);
+ continue;
+
} else
insn->call_dest = reloc->sym;