From: Ciara Loftus <ciara.loftus@intel.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org,
magnus.karlsson@intel.com, bjorn@kernel.org,
magnus.karlsson@gmail.com
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH v2 bpf 0/3] AF_XDP Socket Creation Fixes
Date: Fri, 26 Mar 2021 14:29:43 +0000 [thread overview]
Message-ID: <20210326142946.5263-1-ciara.loftus@intel.com> (raw)
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.
v1->v2:
* Simplified restoring the _save pointers as suggested by Magnus
Karlsson.
* Fixed the condition which determines whether to unmap umem rings
when socket create fails.
This series applies on commit 6032ebb54c60cae24329f6aba3ce0c1ca8ad6abe
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, 35 insertions(+), 31 deletions(-)
--
2.17.1
next reply other threads:[~2021-03-26 15:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 14:29 Ciara Loftus [this message]
2021-03-26 14:29 ` [PATCH v2 bpf 1/3] libbpf: ensure umem pointer is non-NULL before dereferencing Ciara Loftus
2021-03-26 14:29 ` [PATCH v2 bpf 2/3] libbpf: restore umem state after socket create failure Ciara Loftus
2021-03-26 14:29 ` [PATCH v2 bpf 3/3] libbpf: ignore return values of setsockopt for XDP rings Ciara Loftus
2021-03-27 2:27 ` Alexei Starovoitov
2021-03-29 8:41 ` Loftus, Ciara
2021-03-29 15:28 ` Alexei Starovoitov
2021-03-30 12:04 ` Loftus, Ciara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210326142946.5263-1-ciara.loftus@intel.com \
--to=ciara.loftus@intel.com \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=magnus.karlsson@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).