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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 4 Jul 2023 15:36:32 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Jörn-Thorben Hinz <jthinz@...lbox.tu-berlin.de>
Cc:     John Fastabend <john.fastabend@...il.com>, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        linux-kselftest@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Shuah Khan <shuah@...nel.org>,
        Willem de Bruijn <willemb@...gle.com>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        Arnd Bergmann <arnd@...nel.org>
Subject: Re: [PATCH 0/2] bpf, net: Allow setting SO_TIMESTAMPING* from BPF

> On Mon, 2023-07-03 at 14:25 -0700, John Fastabend wrote:
> > Jörn-Thorben Hinz wrote:
> > > BPF applications, e.g., a TCP congestion control, might benefit
> > > from
> > > precise packet timestamps. These timestamps are already available
> > > in
> > > __sk_buff and bpf_sock_ops, but could not be requested: A BPF
> > > program
> > > was not allowed to set SO_TIMESTAMPING* on a socket. This change
> > > enables
> > > BPF programs to actively request the generation of timestamps from
> > > a
> > > stream socket.
> > >
> > > To reuse the setget_sockopt BPF prog test for
> > > bpf_{get,set}sockopt(SO_TIMESTAMPING_NEW), also implement the
> > > missing
> > > getsockopt(SO_TIMESTAMPING_NEW) in the network stack.
> > >
> > > I reckon the way I added getsockopt(SO_TIMESTAMPING_NEW) causes an
> > > API
> > > change: For existing users that set SO_TIMESTAMPING_NEW but queried
> > > SO_TIMESTAMPING_OLD afterwards, it would now look as if no
> > > timestamping
> > > flags have been set. Is this an acceptable change? If not, I’m
> > > happy to
> > > change getsockopt() to only be strict about the newly-implemented
> > > getsockopt(SO_TIMESTAMPING_NEW), or not distinguish between
> > > SO_TIMESTAMPING_NEW and SO_TIMESTAMPING_OLD at all.
> >
> > Yeah, I think it would be best if we keep the old behavior and let
> > SO_TIMESTAMPING_OLD return timestamps for both new/old. It looks
> > like it should be relatively easy to implement?
> Alright, I guessed that would be preferred.
>
> Yes, if there is no objection to making the added
> getsockopt(SO_TIMESTAMPING_NEW) this tiny bit more “strict”, it’s just
> a matter of modifying the if inserted in sk_getsockopt(). (And, well,
> in the other case I would even remove this if.)

The difference is in the struct that is returned, on 32-bit platforms.
Both calls should always be allowed? See also
put_cmsg_scm_timestamping64 vs put_cmsg_scm_timestamping.

For the second patch: the _OLD/_NEW was introduced to work around
limitations on 32-bit platforms. This is intended to be transparent to
users, by defining SO_TIMESTAMPING accordingly.

Can the new BPF code always enforce the 64-bit version, that is, only
implement the _NEW variants? And perhaps just call it SO_TIMESTAMPING
directly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ