From: Paolo Abeni <pabeni@redhat.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next 2/3] udp: avoid a cache miss on dequeue
Date: Thu, 01 Jun 2017 22:35:46 +0200 [thread overview]
Message-ID: <1496349346.2798.1.camel@redhat.com> (raw)
In-Reply-To: <CANn89iKznSPH9VogQEPSw4bLL8F_L_qj2ZY2M==VZ-O1u0xqiA@mail.gmail.com>
On Thu, 2017-06-01 at 09:40 -0700, Eric Dumazet wrote:
> On Thu, Jun 1, 2017 at 9:21 AM, Paolo Abeni <pabeni@redhat.com> wrote:
>
> > I'm sorry, I do not follow. I'm concerned about the secpath field (skb-
> > > sp), which is the only one that can be not NULL in
> >
> > __udp_queue_rcv_skb().
> >
> > If the secpath is not NULL, calling there secpath_reset() (or the to-
> > be-introduced skb_reset_head_state()), we will properly release it and
> > we will clear the field, too.
> >
> > Calling skb_release_head_state() in the same scenario, we release the
> > secpath, but we don't clear it. So if the packet is later dropped we
> > will get a double free, unless we add and use a specialized a
> > free_stateless_skb(), too.
>
> Then simply use secpath_reset() instead of secpath_put() from
> skb_release_head_state()
>
> Clearly having these subtle differences bring confusion, for very little gain.
>
> secpath_put() should be removed. Most of its callers simply set
> skb->sp back to NULL anyway.
To make the code robust we would have to NULL all the other fields
(nfct, nf_bridge, destructor, sk) that are currently not cleared in
skb_release_head_state(), elsewhere if one day, after some change, any
that fields become non-NULL in this code path we risk a double-free
after skb_release_head_state(), even if the code looks safe.
Will that be a little too invasive for this small use-case? Can't we
prefer a new helper or simply a secpath_reset() plus some appropriate
comments?
Thanks,
Paolo
next prev parent reply other threads:[~2017-06-01 20:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 15:27 [PATCH net-next 0/3] udp: reduce cache pressure Paolo Abeni
2017-05-29 15:27 ` [PATCH net-next 1/3] net: factor out a helper to decrement the skb refcount Paolo Abeni
2017-05-31 16:56 ` Eric Dumazet
2017-05-29 15:27 ` [PATCH net-next 2/3] udp: avoid a cache miss on dequeue Paolo Abeni
2017-05-31 17:00 ` Eric Dumazet
2017-06-01 10:39 ` Paolo Abeni
2017-06-01 15:58 ` Eric Dumazet
2017-06-01 16:21 ` Paolo Abeni
2017-06-01 16:40 ` Eric Dumazet
2017-06-01 20:35 ` Paolo Abeni [this message]
2017-06-01 20:50 ` Eric Dumazet
2017-05-29 15:27 ` [PATCH net-next 3/3] udp: try to avoid 2 " Paolo Abeni
2017-05-31 17:04 ` Eric Dumazet
2017-06-01 10:46 ` Paolo Abeni
2017-06-07 2:12 ` [lkp-robot] [udp] bc0d3d0639: apachebench.requests_per_second -21% regression kernel test robot
2017-05-31 16:47 ` [PATCH net-next 0/3] udp: reduce cache pressure David Miller
2017-05-31 16:52 ` Eric Dumazet
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=1496349346.2798.1.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@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 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).