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, 30 Apr 2024 16:26:33 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: "Abhishek Chauhan (ABC)" <quic_abchauha@...cinc.com>, 
 Martin KaFai Lau <martin.lau@...ux.dev>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: "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>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 bpf <bpf@...r.kernel.org>, 
 kernel@...cinc.com
Subject: Re: [RFC PATCH bpf-next v5 2/2] net: Add additional bit to support
 clockid_t timestamp type

Abhishek Chauhan (ABC) wrote:
> 
> 
> On 4/26/2024 4:50 PM, Martin KaFai Lau wrote:
> > On 4/26/24 11:46 AM, Abhishek Chauhan (ABC) wrote:
> >>>> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> >>>> index 591226dcde26..f195b31d6e75 100644
> >>>> --- a/net/ipv4/ip_output.c
> >>>> +++ b/net/ipv4/ip_output.c
> >>>> @@ -1457,7 +1457,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
> >>>>          skb->priority = (cork->tos != -1) ? cork->priority: READ_ONCE(sk->sk_priority);
> >>>>        skb->mark = cork->mark;
> >>>> -    skb->tstamp = cork->transmit_time;
> >>>> +    skb_set_tstamp_type_frm_clkid(skb, cork->transmit_time, sk->sk_clockid);
> >>> hmm... I think this will break for tcp. This sequence in particular:

Good catch, thanks!

> >>>
> >>> tcp_v4_timewait_ack()
> >>>    tcp_v4_send_ack()
> >>>      ip_send_unicast_reply()
> >>>        ip_push_pending_frames()
> >>>          ip_finish_skb()
> >>>            __ip_make_skb()
> >>>              /* sk_clockid is REAL but cork->transmit_time should be in mono */
> >>>              skb_set_tstamp_type_frm_clkid(skb, cork->transmit_time, sk->sk_clockid);;
> >>>
> >>> I think I hit it from time to time when running the test in this patch set.
> >>>
> >> do you think i need to check for protocol type here . since tcp uses Mono and the rest according to the new design is based on
> >> sk->sk_clockid
> >> if (iph->protocol == IPPROTO_TCP)
> >>     skb_set_tstamp_type_frm_clkid(skb, cork->transmit_time, CLOCK_MONOTONIC);
> >> else
> >>     skb_set_tstamp_type_frm_clkid(skb, cork->transmit_time, sk->sk_clockid);
> > 
> > Looks ok. iph->protocol is from sk->sk_protocol. I would defer to Willem input here.
> > 
> > There is at least one more place that needs this protocol check, __ip6_make_skb().
> 
> Sounds good. I will wait for Willem to comment here. 

This would be sk_is_tcp(sk).

I think we want to avoid special casing if we can. Note the if.

If TCP always uses monotonic, we could consider initializing
sk_clockid to CLOCK_MONONOTIC in tcp_init_sock.

I guess TCP logic currently entirely ignores sk_clockid. If we are to
start using this, then setsocktop SO_TXTIME must explicitly fail or
ignore for TCP sockets, or silently skip the write.

All of that is more complexity. Than is maybe warranted for this one
case. So no objections from me to special casing using sk_is_tcp(sk)
either.





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ