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]
Message-ID: <65f35e00a83c0_2132294f5@willemb.c.googlers.com.notmuch>
Date: Thu, 14 Mar 2024 16:28:48 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Martin KaFai Lau <martin.lau@...ux.dev>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
 "Abhishek Chauhan (ABC)" <quic_abchauha@...cinc.com>
Cc: kernel@...cinc.com, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 Andrew Halaney <ahalaney@...hat.com>, 
 Martin KaFai Lau <martin.lau@...nel.org>, 
 bpf <bpf@...r.kernel.org>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 Alexei Starovoitov <ast@...nel.org>, 
 Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH net-next v4] net: Re-use and set mono_delivery_time bit
 for userspace tstamp packets

Martin KaFai Lau wrote:
> On 3/14/24 2:49 AM, Willem de Bruijn wrote:
> >> The two bits could potentially only encode the delivery time that is allowed to
> >> be forwarded without reset. 0 could mean refering back to sk_clockid and don't
> >> forward. The final consumer of the forwarded skb->tstamp is the qdisc which
> >> currently only has mono and tai.
> > 
> > So the followinng meaning of bit pair
> > { skb->mono_delivery_time, skb->user_delivery_time } ?
> >   
> > - { 0, 0 } legacy skb->tstamp: realtime on rx
> > - { 1, 0 } skb->tstamp is mono: existing behavior of mono_delivery_time bit
> > - { 0, 1 } skb->tstamp is tai: analogous to mono case
> > - { 1, 1 } skb->tstamp defined by skb->sk->sk_clockid
> 
> I was thinking only forward mono and tai until it is clearer how other clocks 
> will be useful for forwarding between e/ingress. By resetting all skb->tstamp 
> other than mono and tai, { 0, 0 } at ingress will mean realtime on rx and { 0, 0 
> } at egress will mean go look skb->sk->sk_clockid.
> 
> I do like your scheme such that it is much clearer what is in skb->tstamp 
> without depending on other bits like tc_at_ingress or not.
> 
> "{ 0, 1 } skb->tstamp is tai: analogous to mono case" can probably be dropped 
> for now until bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_TAI) is needed.
> Otherwise, it is mostly a duplicate of "{ 1, 1 } skb->tstamp defined by 
> skb->sk->sk_clockid".
> 
> The bpf_convert_tstamp_{read,write} and the helper bpf_skb_set_tstamp need to be 
> changed to handle the new "user_delivery_time" bit anyway, e.g. 
> bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_MONO) needs to clear the 
> "user_delivery_time" bit.
> 
> I think the "struct inet_frag_queue" also needs a new "user_delivery_time" 
> field. "mono_delivery_time" is already in there.
> 
> It may as well be cleaner to combine mono_delivery_time and user_delivery_time 
> into a 2 bits field like:
> 
> struct sk_buff {
> 	__u8 tstamp_type:2;
> };
> 
> enum {
> 	SKB_TSTAMP_TYPE_RX_REAL = 0, /* A RX (receive) time in real */
> 	SKB_TSTAMP_TYPE_TX_MONO = 1, /* A TX (delivery) time in mono */
> 
> 	/* A TX (delivery) time and its clock is in skb->sk->sk_clockid.
> 	 *
> 	 * BPF_SKB_TSTAMP_DELIVERY_USER should be added
> 	 * such that reading __sk_buff->tstamp_type will match the
> 	 * SKB_TSTAMP_TYPE_TX_USER.
> 	 *
> 	 * The bpf program can learn the clockid by
> 	 * reading skb->sk->sk_clockid.
> 	 *
> 	 * bpf_skb_set_tstamp(BPF_SKB_TSTAMP_DELIVERY_USER)
> 	 * should be disallowed for now until the use case
> 	 * is more clear. Potentially, we could allow it
> 	 * in the future as long as
> 	 * the sock_flag(sk, SOCK_TXTIME) is true at that moment.
> 	 */
> 	SKB_TSTAMP_TYPE_TX_USER = 2,
> 
> 	/* UNUSED_FOR_FUTURE = 3, */
> };
> 
> It will have more code churns in the first patch to rename 
> s/mono_delivery_time/tstamp_type/.
> 
> wdyt?

I asked for such code churn in the original patch. We then decided to
leave the variable name as is, as the churn was significant.

Long term, it is obviously cleaner.

I don't have a strong opinion. If doing this, let's at least make it
two separate patches, one that is a NOOP rename only.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ