]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
samples/ftrace: Adjust LoongArch register restore order in direct calls
authorChenghao Duan <duanchenghao@kylinos.cn>
Wed, 31 Dec 2025 07:19:25 +0000 (15:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:50 +0000 (10:14 +0100)
commitc9d0f5a18bd7edc103a868405c809efec97fdb9f
tree105738c4e60dacb8722cbd2ffaf0d7e5fae1e769
parent2197c4c6bda54d9bfee556119856a252624741f4
samples/ftrace: Adjust LoongArch register restore order in direct calls

commit bb85d206be208bbf834883e948125a35ac59993a upstream.

Ensure that in the ftrace direct call logic, the CPU register state
(with ra = parent return address) is restored to the correct state after
the execution of the custom trampoline function and before returning to
the traced function. Additionally, guarantee the correctness of the jump
logic for jr t0 (traced function address).

Cc: stable@vger.kernel.org
Fixes: 9cdc3b6a299c ("LoongArch: ftrace: Add direct call support")
Reported-by: Youling Tang <tangyouling@kylinos.cn>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Chenghao Duan <duanchenghao@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
samples/ftrace/ftrace-direct-modify.c
samples/ftrace/ftrace-direct-multi-modify.c
samples/ftrace/ftrace-direct-multi.c
samples/ftrace/ftrace-direct-too.c
samples/ftrace/ftrace-direct.c