From: Stephen Hemminger <stephen@networkplumber.org>
To: Joe Stringer <joe@wand.net.nz>
Cc: netdev@vger.kernel.org, daniel@iogearbox.net
Subject: Re: [PATCHv2 iproute2 master] bpf: Fix race condition with map pinning
Date: Tue, 24 Sep 2019 12:32:12 -0700 [thread overview]
Message-ID: <20190924123212.44d7835d@hermes.lan> (raw)
In-Reply-To: <20190920020447.29119-1-joe@wand.net.nz>
On Thu, 19 Sep 2019 19:04:47 -0700
Joe Stringer <joe@wand.net.nz> wrote:
> If two processes attempt to invoke bpf_map_attach() at the same time,
> then they will both create maps, then the first will successfully pin
> the map to the filesystem and the second will not pin the map, but will
> continue operating with a reference to its own copy of the map. As a
> result, the sharing of the same map will be broken from the two programs
> that were concurrently loaded via loaders using this library.
>
> Fix this by adding a retry in the case where the pinning fails because
> the map already exists on the filesystem. In that case, re-attempt
> opening a fd to the map on the filesystem as it shows that another
> program already created and pinned a map at that location.
>
> Signed-off-by: Joe Stringer <joe@wand.net.nz>
Thanks, I put this in as last patch for 5.3.
prev parent reply other threads:[~2019-09-24 19:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 2:04 [PATCHv2 iproute2 master] bpf: Fix race condition with map pinning Joe Stringer
2019-09-24 19:32 ` Stephen Hemminger [this message]
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=20190924123212.44d7835d@hermes.lan \
--to=stephen@networkplumber.org \
--cc=daniel@iogearbox.net \
--cc=joe@wand.net.nz \
--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).