]> git.itanic.dy.fi Git - linux-stable/commit
x86/ibt,ftrace: Make function-graph play nice
authorPeter Zijlstra <peterz@infradead.org>
Wed, 14 Sep 2022 11:52:37 +0000 (14:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2022 10:38:33 +0000 (12:38 +0200)
commit4586df06a02049f4315c25b947c6dde2627c0d18
tree67f5c953e8c470b70e033dcf2d5f8e1e9c66e9cf
parent33015556a943d6cbb18c555925a54b8c0e46f521
x86/ibt,ftrace: Make function-graph play nice

commit e52fc2cf3f662828cc0d51c4b73bed73ad275fce upstream.

Return trampoline must not use indirect branch to return; while this
preserves the RSB, it is fundamentally incompatible with IBT. Instead
use a retpoline like ROP gadget that defeats IBT while not unbalancing
the RSB.

And since ftrace_stub is no longer a plain RET, don't use it to copy
from. Since RET is a trivial instruction, poke it directly.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154318.347296408@infradead.org
[cascardo: remove ENDBR]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
[OP: adjusted context for 5.10-stable]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/ftrace.c
arch/x86/kernel/ftrace_64.S