Subject: Re: [PATCHv6 bpf] bpf: Move iterator functions into special init section

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Wed, 11 Nov 2020 09:37:38 -0300

Em Wed, Nov 11, 2020 at 12:26:29PM +0100, Daniel Borkmann escreveu:
> On 11/10/20 4:40 PM, Jiri Olsa wrote:
> > With upcoming changes to pahole, that change the way how and
> > which kernel functions are stored in BTF data, we need a way
> > to recognize iterator functions.
> > 
> > Iterator functions need to be in BTF data, but have no real
> > body and are currently placed in .init.text section, so they
> > are freed after kernel init and are filtered out of BTF data
> > because of that.
> > 
> > The solution is to place these functions under new section:
> >    .init.bpf.preserve_type
> > 
> > And add 2 new symbols to mark that area:
> >    __init_bpf_preserve_type_begin
> >    __init_bpf_preserve_type_end
> > 
> > The code in pahole responsible for picking up the functions will
> > be able to recognize functions from this section and add them to
> > the BTF data and filter out all other .init.text functions.
> > 
> > Cc: Arnaldo Carvalho de Melo <[email-masked]>
> > Suggested-by: Yonghong Song <[email-masked]>
> > Signed-off-by: Jiri Olsa <[email-masked]>
> 
> LGTM, applied, thanks! Also added a reference to the pahole commit

Applied to what branch? I'm trying to test it now :-)

- Arnaldo

> to the commit log so that this info doesn't get lost in the void
> plus carried over prior Acks given nothing changed logically in the
> patch.
> 
> P.s.: I've been wondering whether we also need to align the begin/end
> symbols via ALIGN_FUNCTION() in case ld might realign to a different
> boundary on later passes but this seems neither the case for .init.text
> right now, likely since it doesn't matter for kallsyms data in our
> particular case.

-- 

- Arnaldo