public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Aaron Williams <awilliams@atheros.com>
Cc: netdev@vger.kernel.org
Subject: Re: skb allocation size question
Date: Wed, 01 Sep 2010 21:04:45 +0200	[thread overview]
Message-ID: <1283367885.2484.16.camel@edumazet-laptop> (raw)
In-Reply-To: <201009011151.02639.awilliams@atheros.com>

Le mercredi 01 septembre 2010 à 11:51 -0700, Aaron Williams a écrit :
> Hi,
> 
> I have been trying to track down an issue in one of our drivers with SKB 
> allocation and in my research I came across something that seems a bit 
> strange. In __alloc_skb, a block for the data allocates size + sizeof(struct 
> skb_shared_info) bytes, yet skb->truesize is set to size + sizeof(struct 
> sk_buff). Is there a reason for this discrepancy?

Hi Aaron

Not really. We also could add in truesize the sizeof(struct
skb_shared_info).

Including sizeof(struct sk_buff) is enough to prevent a malicious user
filling kernel memory with skb of one byte of payload.

Problem is, adding this extra overhead could slowdown some applications,
using too small RCVBUF / SNDBUF settings.




      reply	other threads:[~2010-09-01 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01 18:51 skb allocation size question Aaron Williams
2010-09-01 19:04 ` Eric Dumazet [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=1283367885.2484.16.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=awilliams@atheros.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