]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: BPF: Sign extend kfunc call arguments
authorHengqi Chen <hengqi.chen@gmail.com>
Wed, 31 Dec 2025 07:19:20 +0000 (15:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:51 +0000 (10:14 +0100)
commit0d666db731e95890e0eda7ea61bc925fd2be90c6
tree5d9972796c107089a46b07d40e29e3ba7e30eb4a
parentfcaafcc27ba5b327065a3b025fe3587613f12f11
LoongArch: BPF: Sign extend kfunc call arguments

commit 3f5a238f24d7b75f9efe324d3539ad388f58536e upstream.

The kfunc calls are native calls so they should follow LoongArch calling
conventions. Sign extend its arguments properly to avoid kernel panic.
This is done by adding a new emit_abi_ext() helper. The emit_abi_ext()
helper performs extension in place meaning a value already store in the
target register (Note: this is different from the existing sign_extend()
helper and thus we can't reuse it).

Cc: stable@vger.kernel.org
Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support")
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/net/bpf_jit.c
arch/loongarch/net/bpf_jit.h