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: <20240528143420.742611-1-talycb8@gmail.com>
Date: Tue, 28 May 2024 17:34:20 +0300
From: Tal Yacobi <talycb8@...il.com>
To: jk@...econstruct.com.au,
	matt@...econstruct.com.au,
	rostedt@...dmis.org,
	mhiramat@...nel.org,
	mathieu.desnoyers@...icios.com,
	talycb8@...il.com
Cc: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org
Subject: [PATCH] mctp i2c: Add rx trace

mctp-i2c rx implementation doesn't call
__i2c_transfer which calls the i2c reply trace function.

Add an mctp_reply trace function that will be used instead.

Signed-off-by: Tal Yacobi <talycb8@...il.com>
---
 drivers/net/mctp/mctp-i2c.c |  3 +++
 include/trace/events/mctp.h | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index b37a9e4bade4..22754f4e4a8d 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -24,6 +24,7 @@
 #include <linux/if_arp.h>
 #include <net/mctp.h>
 #include <net/mctpdevice.h>
+#include <trace/events/mctp.h>
 
 /* byte_count is limited to u8 */
 #define MCTP_I2C_MAXBLOCK 255
@@ -312,6 +313,8 @@ static int mctp_i2c_recv(struct mctp_i2c_dev *midev)
 		return -ENOMEM;
 	}
 
+	trace_mctp_reply(midev->rx_buffer, recvlen);
+
 	skb->protocol = htons(ETH_P_MCTP);
 	skb_put_data(skb, midev->rx_buffer, recvlen);
 	skb_reset_mac_header(skb);
diff --git a/include/trace/events/mctp.h b/include/trace/events/mctp.h
index 165cf25f77a7..d115c353dff9 100644
--- a/include/trace/events/mctp.h
+++ b/include/trace/events/mctp.h
@@ -73,6 +73,22 @@ TRACE_EVENT(mctp_key_release,
 	)
 );
 
+TRACE_EVENT(mctp_reply,
+	TP_PROTO(const u8 *rx_buffer, const size_t recvlen),
+	TP_ARGS(rx_buffer, recvlen),
+	TP_STRUCT__entry(
+		__field(__u16, len)
+		__dynamic_array(__u8, buf, recvlen)),
+	TP_fast_assign(
+		__entry->len = (__u16) recvlen;
+		memcpy(__get_dynamic_array(buf), rx_buffer, recvlen);
+	),
+	TP_printk("l=%u [%*phD]",
+		__entry->len,
+		__entry->len, __get_dynamic_array(buf)
+	)
+);
+
 #endif
 
 #include <trace/define_trace.h>
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ