The following commit has been merged into the x86/core branch of tip:

Commit-ID:     db9d1dd670d7f3f146c654f289f20968af6a12de
Gitweb:        
https://git.kernel.org/tip/db9d1dd670d7f3f146c654f289f20968af6a12de
Author:        Peter Zijlstra <pet...@infradead.org>
AuthorDate:    Fri, 26 Mar 2021 16:12:03 +01:00
Committer:     Borislav Petkov <b...@suse.de>
CommitterDate: Thu, 01 Apr 2021 11:34:01 +02:00

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) <pet...@infradead.org>
Signed-off-by: Borislav Petkov <b...@suse.de>
Reviewed-by: Miroslav Benes <mbe...@suse.cz>
Link: https://lkml.kernel.org/r/20210326151259.567568...@infradead.org
---
 tools/objtool/check.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index d45f018..519af4b 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;
 

Reply via email to