From: Johannes Berg <johannes@sipsolutions.net>
To: David Miller <davem@davemloft.net>
Cc: herbert@gondor.apana.org.au, mb@bu3sch.de,
netdev@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: Re: mac80211 truesize bugs
Date: Thu, 01 May 2008 14:05:24 +0200 [thread overview]
Message-ID: <1209643524.3904.5.camel@johannes.berg> (raw)
In-Reply-To: <20080501.034950.261408566.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]
> That makes more sense, good catch Herbert.
>
> I guess it's the pskb_expand_head() calls done by net/mac80211/tx.c
> I suspect we'll need to orphan early in order to accomodate these
> adjustments, otherwise socket memory buffer allocations will
> be corrupted.
>
> Once that is cured, I think we can detect this better, by adding a
> carefully constructed assertion to pskb_expand_head(). Basically, the
> idea is, if "nhead" or "ntail" are non-zero, and there is a socket
> still attached to the SKB, print a warning message.
I'm confused now. I added this patch:
--- everything.orig/net/core/skbuff.c 2008-05-01 13:21:52.000000000 +0200
+++ everything/net/core/skbuff.c 2008-05-01 13:29:57.000000000 +0200
@@ -683,6 +683,14 @@ int pskb_expand_head(struct sk_buff *skb
if (!data)
goto nodata;
+ if (unlikely((nhead || ntail) && skb->sk)) {
+ printk(KERN_ERR "SKB BUG: Illegal pskb expand (%d:%d) "
+ "with socket attached\n",
+ nhead, ntail);
+ dump_stack();
+ } else
+ skb->truesize = size + sizeof(struct sk_buff);
+
/* Copy only real data... and, alas, header. This should be
* optimized for the cases when header is void. */
#ifdef NET_SKBUFF_DATA_USES_OFFSET
--- everything.orig/net/mac80211/tx.c 2008-05-01 13:01:09.000000000 +0200
+++ everything/net/mac80211/tx.c 2008-05-01 13:16:50.000000000 +0200
@@ -1279,6 +1279,8 @@ int ieee80211_master_start_xmit(struct s
int headroom;
int ret;
+ skb_orphan(skb);
+
if (info->flags & IEEE80211_TX_CTL_READY_FOR_TX) {
/*
* We set the IEEE80211_TX_CTL_READY_FOR_TX bit in all skbs
@@ -1581,6 +1583,7 @@ int ieee80211_subif_start_xmit(struct sk
* us broadcast frames. */
if (head_need > 0 || skb_cloned(skb)) {
+ skb_orphan(skb);
#if 0
printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes "
"of headroom\n", dev->name, head_need);
and the assertion never triggers, however I get a number of bugs like this:
SKB BUG: Invalid truesize (4294963740) len=44, sizeof(sk_buff)=176, skb=0xeecb6620
and definitely cannot explain that number (-3556).
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2008-05-01 12:06 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-01 2:02 mac80211 truesize bugs Johannes Berg
2008-05-01 8:58 ` Michael Buesch
2008-05-01 9:08 ` Johannes Berg
2008-05-01 9:20 ` David Miller
2008-05-01 9:32 ` Johannes Berg
2008-05-01 9:43 ` David Miller
2008-05-01 9:48 ` Johannes Berg
2008-05-01 9:56 ` David Miller
2008-05-01 10:08 ` Johannes Berg
2008-05-01 10:32 ` David Miller
2008-05-01 10:45 ` Johannes Berg
2008-05-01 10:36 ` Herbert Xu
2008-05-01 10:49 ` David Miller
2008-05-01 10:53 ` David Miller
2008-05-01 10:58 ` Johannes Berg
2008-05-01 11:03 ` Herbert Xu
2008-05-02 20:38 ` Johannes Berg
2008-05-02 23:33 ` David Miller
2008-05-03 9:37 ` Johannes Berg
2008-05-03 14:25 ` Johannes Berg
2008-05-13 3:17 ` David Miller
2008-05-13 20:39 ` John W. Linville
2008-05-13 20:59 ` Johannes Berg
2008-05-13 21:12 ` Tomas Winkler
2008-05-13 21:37 ` Johannes Berg
2008-05-13 22:09 ` David Miller
2008-05-03 11:52 ` Johannes Berg
2008-05-04 1:03 ` David Miller
2008-05-04 1:42 ` Johannes Berg
2008-05-04 2:02 ` Herbert Xu
2008-05-04 2:08 ` Johannes Berg
2008-05-04 2:12 ` Herbert Xu
2008-05-04 2:22 ` Johannes Berg
2008-05-04 3:16 ` Herbert Xu
2008-05-04 8:47 ` Johannes Berg
2008-05-04 9:14 ` Johannes Berg
2008-05-04 9:44 ` Herbert Xu
2008-05-04 9:52 ` Johannes Berg
2008-05-04 11:25 ` Johannes Berg
2008-05-04 12:28 ` Johannes Berg
2008-05-04 12:45 ` Herbert Xu
2008-05-04 12:48 ` Johannes Berg
2008-05-04 12:52 ` Johannes Berg
2008-05-04 12:56 ` Herbert Xu
2008-05-04 13:00 ` Johannes Berg
2008-05-04 14:06 ` Johannes Berg
2008-05-04 16:03 ` Johannes Berg
2008-05-04 17:47 ` Johannes Berg
2008-05-04 22:45 ` David Miller
2008-05-04 22:48 ` Johannes Berg
2008-05-04 22:38 ` David Miller
2008-05-04 2:09 ` Johannes Berg
2008-05-03 12:38 ` Johannes Berg
2008-05-03 12:59 ` Herbert Xu
2008-05-03 16:03 ` Johannes Berg
2008-05-03 22:56 ` Johannes Berg
2008-05-03 23:07 ` David Miller
2008-05-03 23:15 ` Johannes Berg
2008-05-01 11:02 ` Herbert Xu
2008-05-01 11:38 ` Johannes Berg
2008-05-03 23:24 ` Johannes Berg
2008-05-03 23:32 ` David Miller
2008-05-03 23:43 ` Johannes Berg
2008-05-01 11:49 ` Johannes Berg
2008-05-01 12:05 ` Johannes Berg [this message]
2008-05-01 9:32 ` Michael Buesch
2008-05-01 9:34 ` Johannes Berg
2008-05-04 1:55 ` frame status API? (was: mac80211 truesize bugs) Johannes Berg
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=1209643524.3904.5.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-wireless@vger.kernel.org \
--cc=mb@bu3sch.de \
--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