public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* skb allocation size question
@ 2010-09-01 18:51 Aaron Williams
  2010-09-01 19:04 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Williams @ 2010-09-01 18:51 UTC (permalink / raw)
  To: netdev

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?

-Aaron Williams

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: skb allocation size question
  2010-09-01 18:51 skb allocation size question Aaron Williams
@ 2010-09-01 19:04 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2010-09-01 19:04 UTC (permalink / raw)
  To: Aaron Williams; +Cc: netdev

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.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-01 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01 18:51 skb allocation size question Aaron Williams
2010-09-01 19:04 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox