]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - tools/objtool/check.c
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)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 19 Jul 2022 19:13:22 +0000 (16:13 -0300)
commit9509c1a91739fc8b5b70ec329ab5e6204013e93c
tree9c913ba69a2e8e83c657fd09cd373177c88ae214
parent9825672218a5dda5d1f471f21c96d786953d8c04
objtool: Fix SLS validation for kcov tail-call replacement

[ Upstream commit 7a53f408902d913cd541b4f8ad7dbcd4961f5b82 ]

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

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

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

  1cc1e4c8aab4 ("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: 1cc1e4c8aab4 ("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>
CVE-2022-29900
CVE-2022-29901
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
tools/objtool/check.c