From: Patrick McHardy <kaber@trash.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>, Avi Kivity <avi@redhat.com>,
netfilter-devel@vger.kernel.org,
Marcelo Tosatti <mtosatti@redhat.com>,
nicolas prochazka <prochazka.nicolas@gmail.com>,
KVM list <kvm@vger.kernel.org>, netdev <netdev@vger.kernel.org>
Subject: Re: Possible netfilter-related memory corruption in 2.6.37
Date: Mon, 14 Feb 2011 17:24:37 +0100 [thread overview]
Message-ID: <4D595745.7070505@trash.net> (raw)
In-Reply-To: <1297698641.2996.38.camel@edumazet-laptop>
[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]
Am 14.02.2011 16:50, schrieb Eric Dumazet:
> Le lundi 14 février 2011 à 16:18 +0100, Jan Engelhardt a écrit :
>> On Monday 2011-02-14 16:11, Eric Dumazet wrote:
>>
>>> Le lundi 14 février 2011 à 16:58 +0200, Avi Kivity a écrit :
>>>> We see severe memory corruption in kvm while used in conjunction with
>>>> bridge/netfilter. Enabling slab debugging points the finger at a
>>>> netfilter chain invoked from the bridge code.
>>>>
>>>> Can someone take a look?
>>>>
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=27052
>>
>> Maybe looks familiar to https://lkml.org/lkml/2011/2/3/147
>
> Are you sure Jan ?
>
> IMHO it looks like in your case, a NULL ->hook() is called, from
> nf_iterate()
>
> BTW, list_for_each_continue_rcu() really should be converted to
> list_for_each_entry_continue_rcu()
>
> This is a bit ugly :
>
> list_for_each_continue_rcu(*i, head) {
> struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
>
> Also, I wonder if RCU rules are respected in nf_iterate().
> For example this line is really suspicious :
>
> *i = (*i)->prev;
Yeah, that definitely looks wrong. How about this instead?
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 640 bytes --]
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 1e00bf7..899b71c 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -133,6 +133,7 @@ unsigned int nf_iterate(struct list_head *head,
/* Optimization: we don't need to hold module
reference here, since function can't sleep. --RR */
+repeat:
verdict = elem->hook(hook, skb, indev, outdev, okfn);
if (verdict != NF_ACCEPT) {
#ifdef CONFIG_NETFILTER_DEBUG
@@ -145,7 +146,7 @@ unsigned int nf_iterate(struct list_head *head,
#endif
if (verdict != NF_REPEAT)
return verdict;
- *i = (*i)->prev;
+ goto repeat;
}
}
return NF_ACCEPT;
next prev parent reply other threads:[~2011-02-14 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 14:58 Possible netfilter-related memory corruption in 2.6.37 Avi Kivity
2011-02-14 15:11 ` Eric Dumazet
2011-02-14 15:18 ` Jan Engelhardt
2011-02-14 15:50 ` Eric Dumazet
2011-02-14 16:24 ` Patrick McHardy [this message]
2011-02-14 16:29 ` Eric Dumazet
2011-02-14 16:37 ` Patrick McHardy
2011-02-14 16:48 ` Eric Dumazet
2011-02-14 16:52 ` Patrick McHardy
2011-02-18 18:37 ` Patrick McHardy
2011-02-18 19:14 ` 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=4D595745.7070505@trash.net \
--to=kaber@trash.net \
--cc=avi@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=jengelh@medozas.de \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=prochazka.nicolas@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.