Re: [PATCH bpf-next v9 01/11] bpf: add fsession support

From: Menglong Dong

Date: Wed Jan 14 2026 - 21:05:38 EST


On 2026/1/15 02:56 Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> write:
> On Tue, Jan 13, 2026 at 6:11 PM Menglong Dong <menglong.dong@xxxxxxxxx> wrote:
> >
> > On 2026/1/14 09:22 Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> write:
> > > On Sat, Jan 10, 2026 at 6:11 AM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote:
> > > >
> > > > The fsession is something that similar to kprobe session. It allow to
> > > > attach a single BPF program to both the entry and the exit of the target
> > > > functions.
> > > >
> > [...]
> > > > --- a/kernel/bpf/btf.c
> > > > +++ b/kernel/bpf/btf.c
> > > > @@ -6107,6 +6107,7 @@ static int btf_validate_prog_ctx_type(struct bpf_verifier_log *log, const struct
> > > > case BPF_TRACE_FENTRY:
> > > > case BPF_TRACE_FEXIT:
> > > > case BPF_MODIFY_RETURN:
> > > > + case BPF_TRACE_FSESSION:
> > > > /* allow u64* as ctx */
> > > > if (btf_is_int(t) && t->size == 8)
> > > > return 0;
> > > > @@ -6704,6 +6705,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
> > > > fallthrough;
> > > > case BPF_LSM_CGROUP:
> > > > case BPF_TRACE_FEXIT:
> > > > + case BPF_TRACE_FSESSION:
> > >
> > > According to the comment below we make this exception due to LSM.
> > > FSESSION won't be using FSESSION programs, no? So this is not
> > > necessary?
> >
> > The comment describe the LSM case here, but the code
> > here is not only for LSM. It is also for FEXIT, which makes
> > sure that we can get the return value with "ctx[nr_args]".
> > So I think we still need it here, as we need to access the
> > return value with "ctx[nr_args]" too.
>
> please update the comment then as well

ACK

>
> >
> > >