bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 0/3] AF_XDP Socket Creation Fixes
@ 2021-03-24 14:13 Ciara Loftus
  2021-03-24 14:13 ` [PATCH bpf 1/3] libbpf: ensure umem pointer is non-NULL before dereferencing Ciara Loftus
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ciara Loftus @ 2021-03-24 14:13 UTC (permalink / raw)
  To: netdev, bpf, magnus.karlsson, bjorn; +Cc: Ciara Loftus

This series fixes some issues around socket creation for AF_XDP.

Patch 1 fixes a potential NULL pointer dereference in
xsk_socket__create_shared.

Patch 2 ensures that the umem passed to xsk_socket__create(_shared)
remains unchanged in event of failure.

Patch 3 makes it possible for xsk_socket__create(_shared) to
succeed even if the rx and tx XDP rings have already been set up, by
ignoring the return value of the XDP_RX_RING/XDP_TX_RING setsockopt.
This removes a limitation which existed whereby a user could not retry
socket creation after a previous failed attempt.

It was chosen to solve the problem by ignoring the return values in
libbpf instead of modifying the setsockopt handling code in the kernel
in order to make it possible for the solution to be available across
all kernels, provided a new enough libbpf is available.

This series applies on commit 87d77e59d1ebc31850697341ab15ca013004b81b

Ciara Loftus (3):
  libbpf: ensure umem pointer is non-NULL before dereferencing
  libbpf: restore umem state after socket create failure
  libbpf: ignore return values of setsockopt for XDP rings.

 tools/lib/bpf/xsk.c | 66 +++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 29 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-26 15:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 14:13 [PATCH bpf 0/3] AF_XDP Socket Creation Fixes Ciara Loftus
2021-03-24 14:13 ` [PATCH bpf 1/3] libbpf: ensure umem pointer is non-NULL before dereferencing Ciara Loftus
2021-03-26  9:14   ` Magnus Karlsson
2021-03-24 14:13 ` [PATCH bpf 2/3] libbpf: restore umem state after socket create failure Ciara Loftus
2021-03-26  9:06   ` Magnus Karlsson
2021-03-26 14:56     ` Loftus, Ciara
2021-03-26 15:20       ` Magnus Karlsson
2021-03-24 14:13 ` [PATCH bpf 3/3] libbpf: ignore return values of setsockopt for XDP rings Ciara Loftus
2021-03-26  9:14   ` Magnus Karlsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).