[PATCH 2/2] bpf: support new commands BPF_LINK_{CREATE,UPDATE}

Paul Chaignon paul.chaignon at gmail.com
Sat Apr 18 13:24:06 UTC 2020


On Tue, Apr 14, 2020 at 01:35:42AM +0300, Dmitry V. Levin wrote:
> On Mon, Apr 13, 2020 at 11:28:21AM +0200, Paul Chaignon wrote:
> [...]
> > +BEGIN_BPF_CMD_DECODER(BPF_LINK_UPDATE)
> > +{
> > +	PRINT_FIELD_FD("{link_update={", attr, link_fd, tcp);
> > +	PRINT_FIELD_FD(", ", attr, new_prog_fd, tcp);
> > +	PRINT_FIELD_FLAGS(", ", attr, flags, bpf_attach_flags,
> > +			  "BPF_F_???");
> > +	PRINT_FIELD_FD(", ", attr, old_prog_fd, tcp);
> > +	tprints("}");
> > +}
> > +END_BPF_CMD_DECODER(RVAL_DECODED)
> 
> include/uapi/linux/bpf.h claims that old_prog_fd is specified only if
> BPF_F_REPLACE flag is set in flags, and kernel/bpf/syscall.c indeed
> looks at old_prog_fd only if BPF_F_REPLACE is set.
> 
> Do you think it makes sense to mirror the kernel and print old_prog_fd
> only if BPF_F_REPLACE is set in flags?

Sorry for the late answer, I missed your email.

Yes, that makes sense.  I actually noticed the same while working on the
syzkaller update.  I'll send a v2.

Paul

> 
> 
> -- 
> ldv
> -- 
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel


More information about the Strace-devel mailing list