summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-kfree_skb-changed-in-6.11-rc1.patch
blob: 83b753994efa0761fab6647cf119f545c5f1fc8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 9706d0431c9cc4178db4cf630fee6f5f85f2543e Mon Sep 17 00:00:00 2001
From: Kienan Stewart <kstewart@efficios.com>
Date: Mon, 29 Jul 2024 14:01:18 +0000
Subject: [PATCH 1/6] Fix: kfree_skb changed in 6.11-rc1

See upstream commit:

    commit c53795d48ee8f385c6a9e394651e7ee914baaeba
    Author: Yan Zhai <yan@cloudflare.com>
    Date:   Mon Jun 17 11:09:04 2024 -0700

        net: add rx_sk to trace_kfree_skb

        skb does not include enough information to find out receiving
        sockets/services and netns/containers on packet drops. In theory
        skb->dev tells about netns, but it can get cleared/reused, e.g. by TCP
        stack for OOO packet lookup. Similarly, skb->sk often identifies a local
        sender, and tells nothing about a receiver.

        Allow passing an extra receiving socket to the tracepoint to improve
        the visibility on receiving drops.

Upstream-Status: Backport

Change-Id: I33c8ce1a48006456f198ab1592f733b55be01016
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 include/instrumentation/events/skb.h | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/instrumentation/events/skb.h b/include/instrumentation/events/skb.h
index edfda7ff..0b5a95dc 100644
--- a/include/instrumentation/events/skb.h
+++ b/include/instrumentation/events/skb.h
@@ -43,7 +43,25 @@ LTTNG_TRACEPOINT_ENUM(skb_drop_reason,
 )
 #endif
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,11,0))
+LTTNG_TRACEPOINT_EVENT_MAP(kfree_skb,
+
+	skb_kfree,
+
+	TP_PROTO(struct sk_buff *skb, void *location,
+		enum skb_drop_reason reason, struct sock *rx_sk),
+
+	TP_ARGS(skb, location, reason, rx_sk),
+
+	TP_FIELDS(
+		ctf_integer_hex(void *, skbaddr, skb)
+		ctf_integer_hex(void *, location, location)
+		ctf_integer_network(unsigned short, protocol, skb->protocol)
+		ctf_enum(skb_drop_reason, uint8_t, reason, reason)
+		ctf_integer_hex(void *, rx_skaddr, rx_sk)
+	)
+)
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0) \
 	|| LTTNG_KERNEL_RANGE(5,15,58, 5,16,0) \
 	|| LTTNG_RHEL_KERNEL_RANGE(5,14,0,70,0,0, 5,15,0,0,0,0) \
 	|| LTTNG_RHEL_KERNEL_RANGE(4,18,0,477,10,1, 4,19,0,0,0,0))
-- 
2.39.2