[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bza=p1uiV0mHvzrbisSYS1s2Gnx4S2109eGjtP0Vhr_mbg@mail.gmail.com>
Date: Tue, 8 Oct 2019 16:32:01 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Quentin Monnet <quentin.monnet@...ronome.com>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs
On Tue, Oct 8, 2019 at 2:49 PM Daniel Borkmann <daniel@...earbox.net> wrote:
>
> On Mon, Oct 07, 2019 at 10:47:19AM -0700, Andrii Nakryiko wrote:
> > On Mon, Oct 7, 2019 at 2:43 AM Daniel Borkmann <daniel@...earbox.net> wrote:
> > > On Sun, Oct 06, 2019 at 08:07:36PM -0700, Andrii Nakryiko wrote:
> > > > Various small fixes to BPF helper documentation comments, enabling
> > > > automatic header generation with a list of BPF helpers.
> > > >
> > > > Signed-off-by: Andrii Nakryiko <andriin@...com>
> [...]
> > > I'm wondering whether it would simply be much better to always just use 'void *ctx'
> > > for everything that is BPF context as it may be just confusing to people why different
> > > types are chosen sometimes leading to buggy drive-by attempts to 'fix' them back into
> > > struct sk_buff * et al.
> >
> > I'm impartial on this issue. In some cases it might be helpful to
> > specify what is the expected type of the context, if it's only ever
> > one type, but there are lots of helpers that accept various contexts,
> > so for consistency its better to just have "void *context".
>
> I would favor consistency here to always have "void *context". One
> additional issue I could see happening otherwise on top of the 'fix'
> attempts is that if existing helpers get enabled for multiple program
> types and these have different BPF context, then it might be quite
> easy to forget converting struct __sk_buff * and whatnot to void * in
> the helper API doc, so the auto-generated BPF helpers will continue
> to have only the old type.
Ok, I can create a follow-up clean up patch changing all of them to
void *. There is also a weird singular case of having three
declarations of bpf_get_socket_cookie() with different contexts. I
assume I should just combine them into a single
declaration/description, right?
>
> Thanks,
> Daniel
Powered by blists - more mailing lists