lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 13 Jun 2023 12:00:44 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net, 
	andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org, yhs@...com, 
	john.fastabend@...il.com, kpsingh@...nel.org, haoluo@...gle.com, 
	jolsa@...nel.org, netdev@...r.kernel.org
Subject: Re: [RFC bpf-next 6/7] selftests/bpf: extend xdp_metadata with devtx kfuncs

On Tue, Jun 13, 2023 at 7:48 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> On Mon, Jun 12, 2023 at 7:26 PM Stanislav Fomichev <sdf@...gle.com> wrote:
> >
> > Attach kfuncs that request and report TX timestamp via ringbuf.
> > Confirm on the userspace side that the program has triggered
> > and the timestamp is non-zero.
> >
> > Also make sure devtx_frame has a sensible pointers and data.
> >
> > Cc: netdev@...r.kernel.org
> > Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
>
> > +SEC("fentry/devtx_sb")
> > +int BPF_PROG(devtx_sb, const struct devtx_frame *frame)
> > +{
> > +       int ret;
> > +
> > +       ret = verify_frame(frame);
> > +       if (ret < 0)
> > +               __sync_add_and_fetch(&pkts_fail_tx, 1);
>
> intend to return in these error cases? in this and following patch

Yeah, let's do it.

> > +
> > +       ret = bpf_devtx_sb_request_timestamp(frame);
> > +       if (ret < 0)
> > +               __sync_add_and_fetch(&pkts_fail_tx, 1);
> > +
> > +       return 0;
> > +}
> > +
> > +SEC("fentry/devtx_cp")
> > +int BPF_PROG(devtx_cp, const struct devtx_frame *frame)
> > +{
> > +       struct devtx_sample *sample;
> > +       int ret;
> > +
> > +       ret = verify_frame(frame);
> > +       if (ret < 0)
> > +               __sync_add_and_fetch(&pkts_fail_tx, 1);
> > +
> > +       sample = bpf_ringbuf_reserve(&tx_compl_buf, sizeof(*sample), 0);
> > +       if (!sample)
> > +               return 0;
>
> return non-zero?

Can't return non-zero from fentry :-( The userspace verifies that
pkts_fail_tx stays zero, so that should be enough.


> > +
> > +       sample->timestamp_retval = bpf_devtx_cp_timestamp(frame, &sample->timestamp);
> > +
> > +       bpf_ringbuf_submit(sample, 0);
> > +
> > +       return 0;
> > +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ