* [PATCH net v3] xdp: xdp_mem_allocator can be NULL in trace_mem_connect().
@ 2022-03-09 22:13 Sebastian Andrzej Siewior
2022-03-11 0:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-03-09 22:13 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Toke Høiland-Jørgensen, netdev, bpf, Alexei Starovoitov,
Andrii Nakryiko, Daniel Borkmann, David S. Miller, Ingo Molnar,
Jesper Dangaard Brouer, John Fastabend, KP Singh,
Martin KaFai Lau, Song Liu, Steven Rostedt, Thomas Gleixner,
Yonghong Song
Since the commit mentioned below __xdp_reg_mem_model() can return a NULL
pointer. This pointer is dereferenced in trace_mem_connect() which leads
to segfault.
The trace points (mem_connect + mem_disconnect) were put in place to
pair connect/disconnect using the IDs. The ID is only assigned if
__xdp_reg_mem_model() does not return NULL. That connect trace point is
of no use if there is no ID.
Skip that connect trace point if xdp_alloc is NULL.
[ Toke Høiland-Jørgensen delivered the reasoning for skipping the trace
point ]
Fixes: 4a48ef70b93b8 ("xdp: Allow registering memory model without rxq reference")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
v2…v3:
- Use trace_mem_connect_enabled() as suggested by Steven Rostedt.
v1…v2:
- Instead letting the trace point deal with a NULL pointer, skip the
trace point.
net/core/xdp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/xdp.c b/net/core/xdp.c
index 7aba355049862..73fae16264e10 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -357,7 +357,8 @@ int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq,
if (IS_ERR(xdp_alloc))
return PTR_ERR(xdp_alloc);
- trace_mem_connect(xdp_alloc, xdp_rxq);
+ if (trace_mem_connect_enabled() && xdp_alloc)
+ trace_mem_connect(xdp_alloc, xdp_rxq);
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net v3] xdp: xdp_mem_allocator can be NULL in trace_mem_connect().
2022-03-09 22:13 [PATCH net v3] xdp: xdp_mem_allocator can be NULL in trace_mem_connect() Sebastian Andrzej Siewior
@ 2022-03-11 0:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-11 0:20 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: kuba, toke, netdev, bpf, ast, andrii, daniel, davem, mingo, hawk,
john.fastabend, kpsingh, kafai, songliubraving, rostedt, tglx,
yhs
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 9 Mar 2022 23:13:45 +0100 you wrote:
> Since the commit mentioned below __xdp_reg_mem_model() can return a NULL
> pointer. This pointer is dereferenced in trace_mem_connect() which leads
> to segfault.
>
> The trace points (mem_connect + mem_disconnect) were put in place to
> pair connect/disconnect using the IDs. The ID is only assigned if
> __xdp_reg_mem_model() does not return NULL. That connect trace point is
> of no use if there is no ID.
>
> [...]
Here is the summary with links:
- [net,v3] xdp: xdp_mem_allocator can be NULL in trace_mem_connect().
https://git.kernel.org/netdev/net/c/e0ae713023a9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-11 0:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09 22:13 [PATCH net v3] xdp: xdp_mem_allocator can be NULL in trace_mem_connect() Sebastian Andrzej Siewior
2022-03-11 0:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox