From: Dave Wiltshire <david.wiltshire@gmx.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
eparis@redhat.com, edumazet@google.com
Subject: Re: [PATCH 1/3] skbuff: Update truesize in pskb_expand_head
Date: Thu, 13 Jun 2013 09:35:03 +1000 [thread overview]
Message-ID: <20130612233503.GB10989@linux-rbgc.site> (raw)
In-Reply-To: <1371028618.3252.57.camel@edumazet-glaptop>
On Wed, Jun 12, 2013 at 02:16:58AM -0700, Eric Dumazet wrote:
> On Wed, 2013-06-12 at 19:05 +1000, Dave Wiltshire wrote:
> > Some call sites to pskb_expand_head subsequently update the skb truesize
> > and others don't (even with non-zero arguments). This is likely a memory
> > audit leak. Fixed this up by moving the memory accounting to the
> > skbuff.c file and removing it from the calling sites.
>
> Ouch.
>
> Sorry, you cannot do that.
>
> skb->truesize is really complex, because there is a strong relation
> between skb->truesize and memory accounting on sockets.
>
Firstly, from my cover letter: "Perhaps I don't understand something,
but I thought it best to generate the change and then ask. So is this
correct?". But secondly, I understand that the only reason for truesize
is for memory accounting on sockets. Indeed that's why I thought this
was incorrect. Something being complex is not a good reason not to do
it.
> So pskb_expand_head() should not touch skb->truesize.
>
> Only callers can do that when needed, and if possible.
>
> An example of very careful truesize manipulation can be found in
> tcp_tso_segment()
>
Perhaps I'm still missing something but I don't think tcp_tso_segment is
a very good example of truesize in skbuffs. That function is reassigning
already allocated memory between different skbuffs, and also it doesn't
touch pskb_expand_head. I don't see how that is similar to calling
pskb_expand_head with non-zero parameters (thus increasing the size of a
skbuff) and _not_ updating truesize as occurs, for instance, in
drivers/atm/solos-pci.c in the function psend.
Now this is a little used driver so perhaps it doesn't matter. But I'm
not sure if this is happening in other places thus meaning that memory
accounting on sockets isn't being performed correctly. Which is the
reason I suggested this as a fix.
Dave W
next prev parent reply other threads:[~2013-06-12 23:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 9:05 [PATCH 0/3] skbuff: pskb_expand_head changes Dave Wiltshire
2013-06-12 9:05 ` [PATCH 1/3] skbuff: Update truesize in pskb_expand_head Dave Wiltshire
2013-06-12 9:16 ` Eric Dumazet
2013-06-12 23:35 ` Dave Wiltshire [this message]
2013-06-13 5:38 ` 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=20130612233503.GB10989@linux-rbgc.site \
--to=david.wiltshire@gmx.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eparis@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®