Re: [PATCH bpf-next 2/4] bpf, x64: Fix tailcall hierarchy

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

 



On Fri, Jan 5, 2024 at 4:18 PM John Fastabend <john.fastabend@xxxxxxxxx> wrote:
>
> > > -       if (!bpf_prog_map_compatible(map, prog)) {
> > > +       if (!bpf_prog_map_compatible(map, prog) || prog->aux->func_cnt) {
> > >                 bpf_prog_put(prog);
> > >                 return ERR_PTR(-EINVAL);
> > >         }
> > >
> > > This will stop stack growth, but it will break a few existing tests.
> > > I feel it's a price worth paying.
> > >
> > > John, Daniel,
> > >
> > > do you see anything breaking on cilium side if we disallow
> > > progs with subprogs to be inserted in prog_array ?
> >
> > FWIW tetragon should be ok with this.. we use few subprograms in
> > hubble, but most of them are not called from tail called programs
>
> We actually do this in some of the l7 parsers where we try to use
> subprogs as much as possible but still use prog_array for calls
> that might end up being recursive.

So you do tail_call into a prog that has subprogs. Ok.
Any pointers to a code? (Just for my own education)

Anyway, we need to come up with something better.

I've been trying to play with a few ideas on how to propagate %rax
back from subprog into caller, since frame layout is known, but
struggling to x86 asm it.
Roughly:
RESTORE_TAIL_CALL_CNT
emit_call
copy from already dead stack area back into tail_call_cnt of this frame.
Since IRQs on x86 are using different stack it should be ok?

If I'm wrong about stack usage and dead stack can be scratched
the emit_return() can store ttc into %rdx and after emit_call we
take it from there.





[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