Skip to content

Conversation

@kernel-patches-bot
Copy link

Pull request for series with
subject: ftrace: host klp and bpf trampoline together
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=646640

@kernel-patches-bot
Copy link
Author

Master branch: dafd0f8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646640
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 330eb2a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646640
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 330eb2a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: f7dd4cf
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: b7aedac
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: f175ece
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 741e74b to ed8793a Compare June 2, 2022 23:32
@kernel-patches-bot
Copy link
Author

Master branch: f913ad6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from ed8793a to 4c03c38 Compare June 3, 2022 18:36
@kernel-patches-bot
Copy link
Author

Master branch: 4349680
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 02f4afe
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 7d16380 to d61ca15 Compare June 3, 2022 21:57
@kernel-patches-bot
Copy link
Author

Master branch: d352bd8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from d61ca15 to 7879fa0 Compare June 7, 2022 17:40
@kernel-patches-bot
Copy link
Author

Master branch: d352bd8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: c49a44b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 2e7049c to 14f80a1 Compare June 14, 2022 15:14
@kernel-patches-bot
Copy link
Author

Master branch: fc386ba
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 14f80a1 to 31f3899 Compare June 14, 2022 20:14
@kernel-patches-bot
Copy link
Author

Master branch: 9327035
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 31f3899 to 20817aa Compare June 14, 2022 20:24
@kernel-patches-bot
Copy link
Author

Master branch: 3831cd1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 20817aa to 82bacc0 Compare June 14, 2022 23:23
@kernel-patches-bot
Copy link
Author

Master branch: de5bb43
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 82bacc0 to 250b86c Compare June 16, 2022 01:19
@kernel-patches-bot
Copy link
Author

Master branch: de5bb43
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 250b86c to 35b866d Compare June 16, 2022 18:07
@kernel-patches-bot
Copy link
Author

Master branch: 3e6fe5c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 35b866d to c47a4c6 Compare June 16, 2022 23:30
@kernel-patches-bot
Copy link
Author

Master branch: 88bf185
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from c47a4c6 to 74d3d54 Compare June 17, 2022 02:41
Kernel Patches Daemon and others added 3 commits June 16, 2022 21:46
This enables users of ftrace_direct_multi to specify the flags based on
the actual use case. For example, some users may not set flag IPMODIFY.

Signed-off-by: Song Liu <song@kernel.org>
This is similar to modify_ftrace_direct_multi, but does not acquire
direct_mutex. This is useful when direct_mutex is already locked by the
user.

Signed-off-by: Song Liu <song@kernel.org>
@kernel-patches-bot
Copy link
Author

Master branch: 4429bdc
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=646972
version: 2

liu-song-6 and others added 3 commits June 16, 2022 21:46
live patch and BPF trampoline (kfunc/kretfunc in bpftrace) are important
features for modern systems. Currently, it is not possible to use live
patch and BPF trampoline on the same kernel function at the same time.
This is because of the resitriction that only one ftrace_ops with flag
FTRACE_OPS_FL_IPMODIFY on the same kernel function.

BPF trampoline uses direct ftrace_ops, which assumes IPMODIFY. However,
not all direct ftrace_ops would overwrite the actual function. This means
it is possible to have a non-IPMODIFY direct ftrace_ops to share the same
kernel function with an IPMODIFY ftrace_ops.

Introduce FTRACE_OPS_FL_SHARE_IPMODIFY, which allows the direct ftrace_ops
to share with IPMODIFY ftrace_ops. With FTRACE_OPS_FL_SHARE_IPMODIFY flag
set, the direct ftrace_ops would call the target function picked by the
IPMODIFY ftrace_ops.

Comment "IPMODIFY, DIRECT, and SHARE_IPMODIFY" in include/linux/ftrace.h
contains more information about how SHARE_IPMODIFY interacts with IPMODIFY
and DIRECT flags.

Signed-off-by: Song Liu <song@kernel.org>
Currently we call the original function by using the absolute address
given at the JIT generation. That's not usable when having trampoline
attached to multiple functions, or the target address changes dynamically
(in case of live patch). In such cases we need to take the return address
from the stack.

Adding support to retrieve the original function address from the stack
by adding new BPF_TRAMP_F_ORIG_STACK flag for arch_prepare_bpf_trampoline
function.

Basically we take the return address of the 'fentry' call:

   function + 0: call fentry    # stores 'function + 5' address on stack
   function + 5: ...

The 'function + 5' address will be used as the address for the
original function to call.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
This allows bpf trampoline to trace kernel functions with live patch.
Also, move bpf trampoline to *_ftrace_direct_multi APIs, which allows
setting different flags of ftrace_ops.

Signed-off-by: Song Liu <song@kernel.org>
@kernel-patches-bot kernel-patches-bot force-pushed the series/646640=>bpf-next branch from 74d3d54 to 52d2df9 Compare June 17, 2022 04:46
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=646972 expired. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/646640=>bpf-next branch June 19, 2022 15:24
kernel-patches-daemon-bpf-rc bot pushed a commit that referenced this pull request Nov 22, 2025
Puranjay Mohan says:

====================
bpf: arm64: Indirect jumps

Changes in v1->v2:
v1: https://lore.kernel.org/all/20251117004656.33292-1-puranjay@kernel.org/
- Dropped patch 3 that was ignoring relocations for .jumptables. LLVM
  has been fixed to not emit relocations for .jumptables, so this patch
  is not needed.
- Added Reviewed-by: Anton Protopopov <a.s.protopopov@gmail.com>

This set adds the support of indirect jumps to the arm64 JIT. It
involves calling bpf_prog_update_insn_ptrs() to support instructions
array map. The second piece is supporting BPF_JMP|BPF_X|BPF_JA, SRC=0,
DST=Rx, off=0, imm=0 instruction that is trivial to implement on arm64.

The final patch enables selftests on arm64:

 [root@localhost bpf]# ./test_progs-cpuv4 -a "*gotox*"
 #20/1    bpf_gotox/one-switch:OK
 #20/2    bpf_gotox/one-switch-non-zero-sec-offset:OK
 #20/3    bpf_gotox/two-switches:OK
 #20/4    bpf_gotox/big-jump-table:OK
 #20/5    bpf_gotox/static-global:OK
 #20/6    bpf_gotox/nonstatic-global:OK
 #20/7    bpf_gotox/other-sec:OK
 #20/8    bpf_gotox/static-global-other-sec:OK
 #20/9    bpf_gotox/nonstatic-global-other-sec:OK
 #20/10   bpf_gotox/one-jump-two-maps:OK
 #20/11   bpf_gotox/one-map-two-jumps:OK
 #20      bpf_gotox:OK
 #537/1   verifier_gotox/jump_table_ok:OK
 #537/2   verifier_gotox/jump_table_reserved_field_src_reg:OK
 #537/3   verifier_gotox/jump_table_reserved_field_non_zero_off:OK
 #537/4   verifier_gotox/jump_table_reserved_field_non_zero_imm:OK
 #537/5   verifier_gotox/jump_table_no_jump_table:OK
 #537/6   verifier_gotox/jump_table_incorrect_dst_reg_type:OK
 #537/7   verifier_gotox/jump_table_invalid_read_size_u32:OK
 #537/8   verifier_gotox/jump_table_invalid_read_size_u16:OK
 #537/9   verifier_gotox/jump_table_invalid_read_size_u8:OK
 #537/10  verifier_gotox/jump_table_misaligned_access:OK
 #537/11  verifier_gotox/jump_table_invalid_mem_acceess_pos:OK
 #537/12  verifier_gotox/jump_table_invalid_mem_acceess_neg:OK
 #537/13  verifier_gotox/jump_table_add_sub_ok:OK
 #537/14  verifier_gotox/jump_table_no_writes:OK
 #537/15  verifier_gotox/jump_table_use_reg_r0:OK
 #537/16  verifier_gotox/jump_table_use_reg_r1:OK
 #537/17  verifier_gotox/jump_table_use_reg_r2:OK
 #537/18  verifier_gotox/jump_table_use_reg_r3:OK
 #537/19  verifier_gotox/jump_table_use_reg_r4:OK
 #537/20  verifier_gotox/jump_table_use_reg_r5:OK
 #537/21  verifier_gotox/jump_table_use_reg_r6:OK
 #537/22  verifier_gotox/jump_table_use_reg_r7:OK
 #537/23  verifier_gotox/jump_table_use_reg_r8:OK
 #537/24  verifier_gotox/jump_table_use_reg_r9:OK
 #537/25  verifier_gotox/jump_table_outside_subprog:OK
 #537/26  verifier_gotox/jump_table_contains_non_unique_values:OK
 #537     verifier_gotox:OK
 Summary: 2/37 PASSED, 0 SKIPPED, 0 FAILED
====================

Link: https://patch.msgid.link/20251117130732.11107-1-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants