summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-02-01 00:51:04 +0300
committerAlexei Starovoitov <ast@kernel.org>2026-02-01 00:51:12 +0300
commit4bebb99140c7b6ee6d894c40557f938804fa8693 (patch)
treefb974d4bed19b12af274bc4568e45f1ef0e7bc5a /include
parentf0b5b3d6b56f8717e255406366d81bbcd3631660 (diff)
parent7f10da2133b18b0f1bc02d58671883537e212279 (diff)
downloadlinux-4bebb99140c7b6ee6d894c40557f938804fa8693.tar.xz
Merge branch 'bpf-arm64-add-fsession-support'
Leon Hwang says: ==================== Similar to commit 98770bd4e6df ("bpf,x86: add fsession support for x86_64"), add fsession support on arm64. Patch #1 adds bpf_jit_supports_fsession() to prevent fsession loading on architectures that do not implement fsession support. Patch #2 implements fsession support in the arm64 BPF JIT trampoline. Patch #3 enables the relevant selftests on arm64, including get_func_ip, and get_func_args. All enabled tests pass on arm64: cd tools/testing/selftests/bpf ./test_progs -t fsession #136/1 fsession_test/fsession_test:OK #136/2 fsession_test/fsession_reattach:OK #136/3 fsession_test/fsession_cookie:OK #136 fsession_test:OK Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED ./test_progs -t get_func #138 get_func_args_test:OK #139 get_func_ip_test:OK Summary: 2/0 PASSED, 0 SKIPPED, 0 FAILED Changes: v4 -> v5: * Address comment from Alexei: * Rename helper bpf_link_prog_session_cookie() to bpf_prog_calls_session_cookie(). * v4: https://lore.kernel.org/bpf/20260129154953.66915-1-leon.hwang@linux.dev/ v3 -> v4: * Add a log when !bpf_jit_supports_fsession() in patch #1 (per AI). * v3: https://lore.kernel.org/bpf/20260129142536.48637-1-leon.hwang@linux.dev/ v2 -> v3: * Fix typo in subject and patch message of patch #1 (per AI and Chris). * Collect Acked-by, and Tested-by from Puranjay, thanks. * v2: https://lore.kernel.org/bpf/20260128150112.8873-1-leon.hwang@linux.dev/ v1 -> v2: * Add bpf_jit_supports_fsession(). * v1: https://lore.kernel.org/bpf/20260127163344.92819-1-leon.hwang@linux.dev/ ==================== Link: https://patch.msgid.link/20260131144950.16294-1-leon.hwang@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bpf.h7
-rw-r--r--include/linux/filter.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3b0ceb759075..cd9b96434904 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2196,13 +2196,18 @@ static inline int bpf_fsession_cnt(struct bpf_tramp_links *links)
return cnt;
}
+static inline bool bpf_prog_calls_session_cookie(struct bpf_tramp_link *link)
+{
+ return link->link.prog->call_session_cookie;
+}
+
static inline int bpf_fsession_cookie_cnt(struct bpf_tramp_links *links)
{
struct bpf_tramp_links fentries = links[BPF_TRAMP_FENTRY];
int cnt = 0;
for (int i = 0; i < links[BPF_TRAMP_FENTRY].nr_links; i++) {
- if (fentries.links[i]->link.prog->call_session_cookie)
+ if (bpf_prog_calls_session_cookie(fentries.links[i]))
cnt++;
}
diff --git a/include/linux/filter.h b/include/linux/filter.h
index fd54fed8f95f..4e1cb4f91f49 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -1167,6 +1167,7 @@ bool bpf_jit_supports_arena(void);
bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena);
bool bpf_jit_supports_private_stack(void);
bool bpf_jit_supports_timed_may_goto(void);
+bool bpf_jit_supports_fsession(void);
u64 bpf_arch_uaddress_limit(void);
void arch_bpf_stack_walk(bool (*consume_fn)(void *cookie, u64 ip, u64 sp, u64 bp), void *cookie);
u64 arch_bpf_timed_may_goto(void);