summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHengqi Chen <hengqi.chen@gmail.com>2025-10-02 22:39:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 12:04:19 +0200
commit40cfed5204200760113c5cc33bee7d8fe81759d2 (patch)
treec961160d25ca48018a053eb21cc1c2753480e1f4
parentd1158559315143e11bfaabcd4b2bea98c7ed1be9 (diff)
downloadlinux-40cfed5204200760113c5cc33bee7d8fe81759d2.tar.gz
linux-40cfed5204200760113c5cc33bee7d8fe81759d2.tar.bz2
linux-40cfed5204200760113c5cc33bee7d8fe81759d2.zip
LoongArch: BPF: Don't align trampoline size
commit a04731cbee6e981afa4263289a0c0059c8b2e7b9 upstream. Currently, arch_alloc_bpf_trampoline() use bpf_prog_pack_alloc() which will pack multiple trampolines into a huge page. So, no need to assume the trampoline size is page aligned. Cc: stable@vger.kernel.org Tested-by: Vincent Li <vincent.mc.li@gmail.com> 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>
-rw-r--r--arch/loongarch/net/bpf_jit.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
index a54c725bbee9..68b93ce5f382 100644
--- a/arch/loongarch/net/bpf_jit.c
+++ b/arch/loongarch/net/bpf_jit.c
@@ -1785,8 +1785,7 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
ret = __arch_prepare_bpf_trampoline(&ctx, &im, m, tlinks, func_addr, flags);
- /* Page align */
- return ret < 0 ? ret : round_up(ret * LOONGARCH_INSN_SIZE, PAGE_SIZE);
+ return ret < 0 ? ret : ret * LOONGARCH_INSN_SIZE;
}
struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)