objtool: Handle __sanitize_cov*() tail calls

[ Upstream commit f56dae88a81fded66adf2bea9922d1d98d1da14f ]

Turns out the compilers also generate tail calls to __sanitize_cov*(),
make sure to also patch those out in noinstr code.

Fixes: 0f1441b44e ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Peter Zijlstra
2021-06-24 11:41:02 +02:00
committed by Greg Kroah-Hartman
parent c8a2b96d75
commit d9b17a030a
3 changed files with 105 additions and 74 deletions

View File

@@ -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)