summaryrefslogtreecommitdiffstats
path: root/tools/objtool/arch
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-06-24 11:41:02 +0200
committerPeter Zijlstra <peterz@infradead.org>2021-09-15 15:51:45 +0200
commitf56dae88a81fded66adf2bea9922d1d98d1da14f (patch)
tree3872145874915b709878911e16fe90c9ddef267b /tools/objtool/arch
parent8b946cc38e063f0f7bb67789478c38f6d7d457c9 (diff)
downloadlinux-f56dae88a81fded66adf2bea9922d1d98d1da14f.tar.bz2
objtool: Handle __sanitize_cov*() tail calls
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code. Fixes: 0f1441b44e82 ("objtool: Fix noinstr vs KCOV") Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Marco Elver <elver@google.com> Link: https://lore.kernel.org/r/20210624095147.818783799@infradead.org
Diffstat (limited to 'tools/objtool/arch')
-rw-r--r--tools/objtool/arch/x86/decode.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 3435a32afbd1..340a3dce94a0 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -659,6 +659,26 @@ const char *arch_nop_insn(int len)
return nops[len-1];
}
+#define BYTE_RET 0xC3
+
+const char *arch_ret_insn(int len)
+{
+ static const char ret[5][5] = {
+ { BYTE_RET },
+ { BYTE_RET, BYTES_NOP1 },
+ { BYTE_RET, BYTES_NOP2 },
+ { BYTE_RET, BYTES_NOP3 },
+ { BYTE_RET, BYTES_NOP4 },
+ };
+
+ if (len < 1 || len > 5) {
+ WARN("invalid RET size: %d\n", len);
+ return NULL;
+ }
+
+ return ret[len-1];
+}
+
/* asm/alternative.h ? */
#define ALTINSTR_FLAG_INV (1 << 15)