diff mbox series

[net-next] net: use %px to print skb address in trace_netif_receive_skb

Message ID 20210709051710.15831-1-xiyou.wangcong@gmail.com
State Superseded
Headers show
Series [net-next] net: use %px to print skb address in trace_netif_receive_skb | expand

Commit Message

Cong Wang July 9, 2021, 5:17 a.m. UTC
From: Qitao Xu <qitao.xu@bytedance.com>

The print format of skb adress in tracepoint class net_dev_template
is changed to %px from %p, because we want to use skb address
as a quick way to identify a packet.

Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Qitao Xu <qitao.xu@bytedance.com>
---
 include/trace/events/net.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller July 9, 2021, 8:16 a.m. UTC | #1
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu,  8 Jul 2021 22:17:08 -0700

> From: Qitao Xu <qitao.xu@bytedance.com>
> 
> The print format of skb adress in tracepoint class net_dev_template
> is changed to %px from %p, because we want to use skb address
> as a quick way to identify a packet.
> 
> Reviewed-by: Cong Wang <cong.wang@bytedance.com>
> Signed-off-by: Qitao Xu <qitao.xu@bytedance.com>

Aren't we not supposed to leak kernel addresses to userspace?
David Miller July 9, 2021, 7:18 p.m. UTC | #2
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 9 Jul 2021 11:59:43 -0700

> On Fri, Jul 9, 2021 at 1:16 AM David Miller <davem@davemloft.net> wrote:
>>
>> From: Cong Wang <xiyou.wangcong@gmail.com>
>> Date: Thu,  8 Jul 2021 22:17:08 -0700
>>
>> > From: Qitao Xu <qitao.xu@bytedance.com>
>> >
>> > The print format of skb adress in tracepoint class net_dev_template
>> > is changed to %px from %p, because we want to use skb address
>> > as a quick way to identify a packet.
>> >
>> > Reviewed-by: Cong Wang <cong.wang@bytedance.com>
>> > Signed-off-by: Qitao Xu <qitao.xu@bytedance.com>
>>
>> Aren't we not supposed to leak kernel addresses to userspace?
> 
> Right, but trace ring buffer is only accessible to privileged users,
> so leaking it to root is not a problem.

Please explain this in your commit msgs and resubmit.

Thank you.
diff mbox series

Patch

diff --git a/include/trace/events/net.h b/include/trace/events/net.h
index 2399073c3afc..78c448c6ab4c 100644
--- a/include/trace/events/net.h
+++ b/include/trace/events/net.h
@@ -136,7 +136,7 @@  DECLARE_EVENT_CLASS(net_dev_template,
 		__assign_str(name, skb->dev->name);
 	),
 
-	TP_printk("dev=%s skbaddr=%p len=%u",
+	TP_printk("dev=%s skbaddr=%px len=%u",
 		__get_str(name), __entry->skbaddr, __entry->len)
 )