objtool: Handle __sanitize_cov*() tail calls
commit f56dae88a81fded66adf2bea9922d1d98d1da14f upstream.
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>
[bwh: Backported to 5.10:
- objtool doesn't have any mcount handling
- Write the NOPs as hex literals since we can't use <asm/nops.h>]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
9d7ec2418a
commit
acc0be56b4
@@ -586,6 +586,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, 0x90 },
|
||||
{ BYTE_RET, 0x66, 0x90 },
|
||||
{ BYTE_RET, 0x0f, 0x1f, 0x00 },
|
||||
{ BYTE_RET, 0x0f, 0x1f, 0x40, 0x00 },
|
||||
};
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user