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 (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: use %px to print skb address in trace_netif_receive_skb | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: mingo@redhat.com rostedt@goodmis.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 10 this patch: 10
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning CHECK: Alignment should match open parenthesis WARNING: 'adress' may be misspelled - perhaps 'address'?
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/header_inline success Link

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?
Cong Wang July 9, 2021, 6:59 p.m. UTC | #2
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.

Thanks.
David Miller July 9, 2021, 7:18 p.m. UTC | #3
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)
 )