net: fix call location in kfree_skb_list_reason
authorJesper Dangaard Brouer <brouer@redhat.com>
Fri, 13 Jan 2023 13:51:59 +0000 (14:51 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 17 Jan 2023 09:27:29 +0000 (10:27 +0100)
commita4650da2a2d6150a8ff1ea36fde9f6a26cf5fda3
treef619fd670d4f7b8813c5cdca3f224a0259b04276
parent501543b4fff0ff70bde28a829eb8835081ccef2f
net: fix call location in kfree_skb_list_reason

The SKB drop reason uses __builtin_return_address(0) to give the call
"location" to trace_kfree_skb() tracepoint skb:kfree_skb.

To keep this stable for compilers kfree_skb_reason() is annotated with
__fix_address (noinline __noclone) as fixed in commit c205cc7534a9
("net: skb: prevent the split of kfree_skb_reason() by gcc").

The function kfree_skb_list_reason() invoke kfree_skb_reason(), which
cause the __builtin_return_address(0) "location" to report the
unexpected address of kfree_skb_list_reason.

Example output from 'perf script':
 kpktgend_0  1337 [000]    81.002597: skb:kfree_skb: skbaddr=0xffff888144824700 protocol=2048 location=kfree_skb_list_reason+0x1e reason: QDISC_DROP

Patch creates an __always_inline __kfree_skb_reason() helper call that
is called from both kfree_skb_list() and kfree_skb_list_reason().
Suggestions for solutions that shares code better are welcome.

As preparation for next patch move __kfree_skb() invocation out of
this helper function.

Reviewed-by: Saeed Mahameed <saeed@kernel.org>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/skbuff.c