linux-stable/tools/objtool
Peter Zijlstra 01986c7dbf objtool: Fix SLS validation for kcov tail-call replacement
[ Upstream commit 7a53f40890 ]

Since not all compilers have a function attribute to disable KCOV
instrumentation, objtool can rewrite KCOV instrumentation in noinstr
functions as per commit:

  f56dae88a8 ("objtool: Handle __sanitize_cov*() tail calls")

However, this has subtle interaction with the SLS validation from
commit:

  1cc1e4c8aa ("objtool: Add straight-line-speculation validation")

In that when a tail-call instrucion is replaced with a RET an
additional INT3 instruction is also written, but is not represented in
the decoded instruction stream.

This then leads to false positive missing INT3 objtool warnings in
noinstr code.

Instead of adding additional struct instruction objects, mark the RET
instruction with retpoline_safe to suppress the warning (since we know
there really is an INT3).

Fixes: 1cc1e4c8aa ("objtool: Add straight-line-speculation validation")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220323230712.GA8939@worktop.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-15 20:18:51 +02:00
..
arch/x86 objtool: Add straight-line-speculation validation 2022-05-15 20:18:50 +02:00
Documentation objtool: Support stack layout changes in alternatives 2021-01-14 09:53:54 -06:00
include/objtool objtool: Add straight-line-speculation validation 2022-05-15 20:18:50 +02:00
.gitignore objtool: Rework header include paths 2021-01-13 18:13:14 -06:00
Build objtool: Enable compilation of objtool for all architectures 2020-05-20 09:17:28 -05:00
builtin-check.c objtool: Add straight-line-speculation validation 2022-05-15 20:18:50 +02:00
builtin-orc.c objtool: Collate parse_options() users 2021-03-06 12:44:23 +01:00
check.c objtool: Fix SLS validation for kcov tail-call replacement 2022-05-15 20:18:51 +02:00
elf.c objtool: Fix type of reloc::addend 2022-05-09 09:14:44 +02:00
Makefile objtool: Refactor ORC section generation 2021-01-14 09:53:42 -06:00
objtool.c Objtool updates in this cycle were: 2021-04-28 12:53:24 -07:00
orc_dump.c x86/unwind/orc: Change REG_SP_INDIRECT 2021-02-10 20:53:51 +01:00
orc_gen.c objtool: Remove redundant 'len' field from struct section 2021-10-05 12:03:21 -07:00
special.c objtool: Remove redundant 'len' field from struct section 2021-10-05 12:03:21 -07:00
sync-check.sh Merge branch 'x86/cpu' into WIP.x86/core, to merge the NOP changes & resolve a semantic conflict 2021-04-02 12:36:30 +02:00
weak.c objtool: Refactor ORC section generation 2021-01-14 09:53:42 -06:00