From: Daniel Borkmann <daniel@iogearbox.net>
To: Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Cc: John Fastabend <john.fastabend@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>
Subject: Re: [PATCH net-next] xdp: implement xdp_redirect_map for generic XDP
Date: Wed, 06 Sep 2017 19:02:49 +0200 [thread overview]
Message-ID: <59B02A39.4060603@iogearbox.net> (raw)
In-Reply-To: <59B02127.5020904@iogearbox.net>
On 09/06/2017 06:24 PM, Daniel Borkmann wrote:
[...]
> Otherwise it looks good, but note that it also doesn't really
> resolve the issue you mention wrt stale map pointers by the
> way. This would need a different way to clear out the pointers
> from redirect_info, I'm thinking when we have devmap dismantle
> time after RCU grace period we should check whether there are
> still stale pointers from this map around and clear them under
> disabled preemption, but need to brainstorm a bit more on that
> first.
Scratch that approach, doesn't work. So thinking bit more on
this, what we could do here is the following: verifier knows
we called bpf_xdp_redirect_map() helper, so it could do a small
insn rewrite in the sense that it fills R4 with a pointer to
the bpf_prog. We have that at verification time anyway and R4
is allowed to be populated since we scratch it per convention.
Then, the helper would store the prog pointer in struct redirect_info.
Later in xdp_do_*_redirect() we check whether the redirect_info's
prog pointer is the same as passed xdp_prog pointer, and if
that's the case then all good, since the prog holds a ref on
the map anyway, if they are not equal in the unlikely case, it
means stale pointer, so we bail out right there. That would
work imo, will see to code it up and check it out.
next prev parent reply other threads:[~2017-09-06 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 15:26 [PATCH net-next] xdp: implement xdp_redirect_map for generic XDP Jesper Dangaard Brouer
2017-09-06 15:44 ` Andy Gospodarek
2017-09-06 16:01 ` Jesper Dangaard Brouer
2017-09-06 16:24 ` Daniel Borkmann
2017-09-06 17:02 ` Daniel Borkmann [this message]
2017-09-06 18:18 ` Jesper Dangaard Brouer
2017-09-06 18:42 ` John Fastabend
2017-09-06 18:51 ` Daniel Borkmann
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=59B02A39.4060603@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=andy@greyhouse.net \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.