Re: [RFC PATCH bpf-next v2] bpf: Relax tracing prog recursive attach rules

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

 



> On Thu, Nov 23, 2023 at 03:25:33PM +0100, Jiri Olsa wrote:
> > +	link->prog->aux->attach_depth--;
>
> should we just set it to 0 ? the number is assigned from tgt_prog, so I think we'll
> endup with wrong up number here after detach (for both tgt_prog or kernel function)

> > +	if (tgt_prog) {
> > +		/* Bookkeeping for managing the prog attachment chain. */
> > +		tgt_prog->aux->follower_cnt++;
> > +		prog->aux->attach_depth = tgt_prog->aux->attach_depth + 1;
> > +	}
>
> missing cleanup/dec if the next bpf_trampoline_link_prog call fails?
> probably better move that accounting after that call

> > +	printf("  attach depth %d", info->attach_depth);
> > +
>
> I think we should print only if the value != 0 like we do for other fields

> > +		if (tgt_prog->type == prog->type &&
> > +			(prog_extension || prog->aux->follower_cnt > 0)) {
> > +			/*
> > +			 * To avoid potential call chain cycles, prevent attaching programs
> > +			 * of the same type. The only exception is standalone fentry/fexit
> > +			 * programs that themselves are not attachment targets.
> > +			 * That means:
> > +			 *  - Cannot attach followed fentry/fexit to another
> > +			 *    fentry/fexit program.
> > +			 *  - Cannot attach program extension to another extension.
>
> would be great to have tests for this

Agree on all points, thanks. Will post the updated version soon.




[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