]> git.baikalelectronics.ru Git - kernel.git/commit
objtool: Fix SLS validation for kcov tail-call replacement
authorPeter Zijlstra <peterz@infradead.org>
Wed, 23 Mar 2022 22:35:01 +0000 (23:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 May 2022 18:18:51 +0000 (20:18 +0200)
commit6fb5c1d82e12dde394a66259bbd408d31dab319e
treeed2534ef3b1184ffc2cf63ac6544a3810e308f01
parent1902e4d5fff4f2c7e04195ecca5f2c208175225b
objtool: Fix SLS validation for kcov tail-call replacement

[ Upstream commit 9b7202e930d0dd19aa7542b0fe953f9bcc660d84 ]

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

  2dc7a59ceb9f ("objtool: Handle __sanitize_cov*() tail calls")

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

  bd069c757edd ("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: bd069c757edd ("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>
tools/objtool/check.c