FAILED: patch "[PATCH] LoongArch: BPF: Enhance the bpf_arch_text_poke() function" failed to apply to 6.18-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 73721d8676771c6c7b06d4e636cc053fc76afefd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026010547-passenger-getting-5dde@gregkh' --subject-prefix 'PATCH 6.18.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 73721d8676771c6c7b06d4e636cc053fc76afefd Mon Sep 17 00:00:00 2001
From: Chenghao Duan <[email protected]>
Date: Wed, 31 Dec 2025 15:19:21 +0800
Subject: [PATCH] LoongArch: BPF: Enhance the bpf_arch_text_poke() function
Enhance the bpf_arch_text_poke() function to enable accurate location of BPF program entry points.
When modifying the entry point of a BPF program, skip the "move t0, ra" instruction to ensure the correct logic and copy of the jump address.
arch/loongarch/net/bpf_jit.c +16 -1
@@ -1309,15 +1309,30 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, {int ret;bool is_call; +unsigned long size =0 ; +unsigned long offset =0 ; +void *image =NULL ; +char namebuf[KSYM_NAME_LEN ];u32 old_insns[LOONGARCH_LONG_JUMP_NINSNS ] = {[0 ...4 ] =INSN_NOP };u32 new_insns[LOONGARCH_LONG_JUMP_NINSNS ] = {[0 ...4 ] =INSN_NOP };/* Only poking bpf text is supported. Since kernel function entry * is set up by ftrace, we rely on ftrace to poke kernel functions. */ -if (!is_bpf_text_address ((unsigned long )ip)) +if (!__bpf_address_lookup ((unsigned long )ip, &size, &offset, namebuf))return -ENOTSUPP ; + image = ip - offset; + +/* zero offset means we're poking bpf prog entry */ +if (offset ==0 ) { +/* skip to the nop instruction in bpf prog entry: +* move t0, ra +* nop +*/ + ip = image +LOONGARCH_INSN_SIZE ; + } + is_call = old_t ==BPF_MOD_CALL ; ret =emit_jump_or_nops (old_addr, ip, old_insns, is_call);if (ret)
Hi, Greg,
Please use:
https://lore.kernel.org/loongarch/[email protected]/T/#u
Huacai
Quoted 74 lines
-----原始邮件-----
发件人: [email protected]
发送时间:2026-01-05 20:59:48 (星期一)
收件人: [email protected], [email protected]
抄送: [email protected]
主题: FAILED: patch "[PATCH] LoongArch: BPF: Enhance thebpf_arch_text_poke()function" failed to apply to 6.18-stable treeThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkoutFETCH_HEAD
git cherry-pick -x73721d8676771c6c7b06d4e636cc053fc76afefd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026010547-passenger-getting-5dde@gregkh' --subject-prefix 'PATCH 6.18.y' HEAD^..Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
73721d8676771c6c7b06d4e636cc053fc76afefdMon Sep 17 00:00:00 2001
From: Chenghao Duan <[email protected]>
Date: Wed, 31 Dec 2025 15:19:21 +0800
Subject: [PATCH] LoongArch: BPF: Enhance thebpf_arch_text_poke()functionEnhance the
bpf_arch_text_poke()function to enable accurate location of BPF program entry points.When modifying the entry point of a BPF program, skip the "move t0, ra" instruction to ensure the correct logic and copy of the jump address.
Fixes 677e6123e3d2 ("LoongArch: BPF: Disable trampoline for kernel module function trace")Signed-off-by Chenghao Duan <[email protected]>Signed-off-by Huacai Chen <[email protected]>arch/loongarch/net/bpf_jit.c +9
-1@@ -1309,15 +1309,30 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, {int ret;bool is_call; +unsigned long size =0 ; +unsigned long offset =0 ; +void *image =NULL ; +char namebuf[KSYM_NAME_LEN ];u32 old_insns[LOONGARCH_LONG_JUMP_NINSNS ] = {[0 ...4 ] =INSN_NOP };u32 new_insns[LOONGARCH_LONG_JUMP_NINSNS ] = {[0 ...4 ] =INSN_NOP };/* Only poking bpf text is supported. Since kernel function entry * is set up by ftrace, we rely on ftrace to poke kernel functions. */ -if (!is_bpf_text_address ((unsigned long )ip)) +if (!__bpf_address_lookup ((unsigned long )ip, &size, &offset, namebuf))return -ENOTSUPP ; + image = ip - offset; + +/* zero offset means we're poking bpf prog entry */ +if (offset ==0 ) {
arch/loongarch/net/bpf_jit.c int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, · line 1338
Quoted 10 lines
arch/loongarch/net/bpf_jit.c +7
-0+/* skip to the nop instruction in bpf prog entry: +* move t0, ra +* nop +*/ + ip = image +LOONGARCH_INSN_SIZE ; + } + is_call = old_t ==BPF_MOD_CALL ; ret =emit_jump_or_nops (old_addr, ip, old_insns, is_call);if (ret)
本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.