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  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:   Fri,  8 May 2020 19:58:46 +0000
From:   Kelly Littlepage <kelly@...ttlepage.com>
To:     kuba@...nel.org
Cc:     davem@...emloft.net, edumazet@...gle.com, iris@...chronos.com,
        kelly@...chronos.com, kuznet@....inr.ac.ru, maloney@...gle.com,
        netdev@...r.kernel.org, soheil@...gle.com,
        willemdebruijn.kernel@...il.com, yoshfuji@...ux-ipv6.org,
        Kelly Littlepage <kelly@...ttlepage.com>,
        Willem de Bruijn <willemb@...gle.com>
Subject: [PATCH v4] net: tcp: fix rx timestamp behavior for tcp_recvmsg

From: Kelly Littlepage <kelly@...chronos.com>

The stated intent of the original commit is to is to "return the timestamp
corresponding to the highest sequence number data returned." The current
implementation returns the timestamp for the last byte of the last fully
read skb, which is not necessarily the last byte in the recv buffer. This
patch converts behavior to the original definition, and to the behavior of
the previous draft versions of commit 98aaa913b4ed ("tcp: Extend
SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg") which also match this
behavior.

Fixes: 98aaa913b4ed ("tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg")
Co-developed-by: Iris Liu <iris@...chronos.com>
Signed-off-by: Iris Liu <iris@...chronos.com>
Signed-off-by: Kelly Littlepage <kelly@...chronos.com>
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Acked-by: Soheil Hassas Yeganeh <soheil@...gle.com>
Acked-by: Willem de Bruijn <willemb@...gle.com>
---
Sending from an alternative email given the compliance footer that's
unavoidably attached to all emails from my primary account. The patch
itself is unchanged.

 net/ipv4/tcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6d87de434377..e72bd651d21a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2154,13 +2154,15 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
 			tp->urg_data = 0;
 			tcp_fast_path_check(sk);
 		}
-		if (used + offset < skb->len)
-			continue;
 
 		if (TCP_SKB_CB(skb)->has_rxtstamp) {
 			tcp_update_recv_tstamps(skb, &tss);
 			cmsg_flags |= 2;
 		}
+
+		if (used + offset < skb->len)
+			continue;
+
 		if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
 			goto found_fin_ok;
 		if (!(flags & MSG_PEEK))
-- 
2.26.2

Powered by blists - more mailing lists