From: Krzysztof Halasa <khc@pm.waw.pl>
To: David Miller <davem@davemloft.net>
Cc: kuznet@ms2.inr.ac.ru, netdev@vger.kernel.org
Subject: Re: [PATCH] NET: fix kernel panic from no dev->hard_header_len space
Date: Wed, 02 Aug 2006 23:11:52 +0200 [thread overview]
Message-ID: <m3y7u6q1uv.fsf@defiant.localdomain> (raw)
In-Reply-To: <20060801.173843.35018003.davem@davemloft.net> (David Miller's message of "Tue, 01 Aug 2006 17:38:43 -0700 (PDT)")
David Miller <davem@davemloft.net> writes:
> I think Alexey is saying that setting ->hard_header() creates an
> agreement between the device and IP that IP will make sure
> that dev->hard_header_len bytes are available in the header
> area.
I think I now understand it: hard_header_len is guaranteed while
calling hard_header() (because the check is done just before the call)
but not elsewhere, particularly not in hard_start_xmit().
dev->hard_header being NULL or not doesn't change anything.
I think hard_start_xmit() can be called without calling hard_header()
first, for example with things like PF_PACKET. This way the
hard_header_len check is skipped.
It looks it needs to be audited. I think either:
a) dev->hard_header_len must be eliminated completely and skb allocations
have to assume some sane amount of header space (32 bytes or so), or
b) all dev->hard_header() and dev->hard_start_xmit() calling paths must
be checked to contain at least dev->hard_header_len header space, or
c) dev->hard_header_len must be clearly marked as advisory, no core
code changes (all drivers must be audited and fixed).
d) another idea?
What do you prefer?
a) would IMHO the best code quality, reallocations where they are needed
and no strange semantics which can be easily broken by accident
(nobody would count on nonexistent hard_header_len either).
Fast path would not need to reallocate skb data, though the check
would still be in place.
We could test it by reducing "default" header space to zero,
possibly a "hacking" kernel config option may be useful?
b) my patch is the starting point but I'm not sure it's practical.
c) IMHO the worst by all means.
I think I could do a) in a couple of weeks so that it could go into
2.6.19.
Back to my patch. I understand the part about ip_output() is ok
for 2.6.18, isn't it?
What about the psched_mtu() thing? While it's not kernel panic,
I think we should fix it. I'm not sure it should return dev->mtu +
dev->hard_header_len or just dev->mtu, though.
--
Krzysztof Halasa
next prev parent reply other threads:[~2006-08-02 21:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-27 13:56 [PATCH] NET: fix kernel panic from no dev->hard_header_len space Krzysztof Halasa
2006-07-27 16:43 ` Alexey Kuznetsov
2006-07-27 17:28 ` Krzysztof Halasa
2006-07-28 14:11 ` Krzysztof Halasa
2006-07-30 16:40 ` Krzysztof Halasa
2006-07-30 22:30 ` David Miller
2006-07-31 15:39 ` Alexey Kuznetsov
[not found] ` <m3r701zgku.fsf@defiant.localdomain>
2006-07-31 20:23 ` David Miller
2006-08-01 1:04 ` Krzysztof Halasa
2006-08-01 1:13 ` David Miller
2006-08-01 1:56 ` Krzysztof Halasa
2006-08-01 19:54 ` Alexey Kuznetsov
2006-08-02 0:24 ` Krzysztof Halasa
2006-08-02 0:38 ` David Miller
2006-08-02 21:11 ` Krzysztof Halasa [this message]
2006-07-31 20:24 ` David Miller
2006-08-01 20:25 ` Alexey Kuznetsov
2006-08-02 0:42 ` Krzysztof Halasa
2006-08-02 0:48 ` David Miller
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=m3y7u6q1uv.fsf@defiant.localdomain \
--to=khc@pm.waw.pl \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--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