]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: support fsession for bpf_session_is_return
authorMenglong Dong <menglong8.dong@gmail.com>
Sat, 24 Jan 2026 06:19:59 +0000 (14:19 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 25 Jan 2026 02:49:36 +0000 (18:49 -0800)
commit27d89baa6da8e5e546585c53a959176d1302d46e
treef178ab25c80a0d7b6ce4c8e6b649c0f26fffee2d
parent8fe4dc4f6456b3d2c9e6f8aeb1f978b7bff0f6c8
bpf: support fsession for bpf_session_is_return

If fsession exists, we will use the bit (1 << BPF_TRAMP_IS_RETURN_SHIFT)
in ((u64 *)ctx)[-1] to store the "is_return" flag.

The logic of bpf_session_is_return() for fsession is implemented in the
verifier by inline following code:

  bool bpf_session_is_return(void *ctx)
  {
      return (((u64 *)ctx)[-1] >> BPF_TRAMP_IS_RETURN_SHIFT) & 1;
  }

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Co-developed-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/20260124062008.8657-5-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c