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-next>] [day] [month] [year] [list]
Message-Id: <20240425162556.83456-1-lulie@linux.alibaba.com>
Date: Fri, 26 Apr 2024 00:25:56 +0800
From: Philo Lu <lulie@...ux.alibaba.com>
To: netdev@...r.kernel.org
Cc: edumazet@...gle.com,
	rostedt@...dmis.org,
	mhiramat@...nel.org,
	mathieu.desnoyers@...icios.com,
	davem@...emloft.net,
	dsahern@...nel.org,
	kuba@...nel.org,
	pabeni@...hat.com,
	fred.cc@...baba-inc.com,
	xuanzhuo@...ux.alibaba.com
Subject: [PATCH net-next] tcp: add tracepoint for tcp_write_err()

This tracepoint can be used to trace tcp write error events, e.g.,
retransmit timeout. Though there is a tracepoint in sk_error_report(),
the value of sk->sk_err depends on sk->sk_err_soft, and we cannot easily
recognized errors from tcp_write_err().

Signed-off-by: Philo Lu <lulie@...ux.alibaba.com>
---
 include/trace/events/tcp.h | 7 +++++++
 net/ipv4/tcp_timer.c       | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 5c04a61a11c2c..0efb51dcb8a3f 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -195,6 +195,13 @@ DEFINE_EVENT(tcp_event_sk, tcp_rcv_space_adjust,
 	TP_ARGS(sk)
 );
 
+DEFINE_EVENT(tcp_event_sk, tcp_write_err,
+
+	TP_PROTO(struct sock *sk),
+
+	TP_ARGS(sk)
+);
+
 TRACE_EVENT(tcp_retransmit_synack,
 
 	TP_PROTO(const struct sock *sk, const struct request_sock *req),
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 976db57b95d40..ebba7e30d5534 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -19,6 +19,7 @@
  *		Jorge Cwik, <jorge@...er.satlink.net>
  */
 
+#include <trace/events/tcp.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <net/tcp.h>
@@ -73,6 +74,8 @@ u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when)
 
 static void tcp_write_err(struct sock *sk)
 {
+	trace_tcp_write_err(sk);
+
 	WRITE_ONCE(sk->sk_err, READ_ONCE(sk->sk_err_soft) ? : ETIMEDOUT);
 	sk_error_report(sk);
 
-- 
2.32.0.3.g01195cf9f


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ