Re: [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 08, 2019 at 04:32:01PM -0700, Andrii Nakryiko wrote:
> On Tue, Oct 8, 2019 at 2:49 PM Daniel Borkmann <daniel@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx> 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@xxxxxx>
> > [...]
> > > > 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?

Yes, definitely.

Thanks,
Daniel



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux