From: Eric Dumazet <eric.dumazet@gmail.com>
To: "\"Oleg A. Arkhangelsky\"" <sysoleg@yandex.ru>,
David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Joe Buehler <aspam@cox.net>
Subject: Re: kernel panic in fib_rules_lookup [2.6.27.7 vendor-patched]
Date: Sat, 23 Oct 2010 21:44:25 +0200 [thread overview]
Message-ID: <1287863065.2658.533.camel@edumazet-laptop> (raw)
In-Reply-To: <239681287855420@web159.yandex.ru>
Le samedi 23 octobre 2010 à 21:37 +0400, "Oleg A. Arkhangelsky" a
écrit :
> 23.10.2010, 20:36, "Eric Dumazet" <eric.dumazet@gmail.com>:
>
> > With a normal workload, on a dual cpu machine, a missing memory barrier
> > can stay un-noticed for quite a long time. The race window is so small
> > that probability for the bug might be 0.0000001 % or something like
> > that :(
>
> Eric, I'd like to remind you that I've faced the similar problem on simple x86.
>
> See http://kerneltrap.org/mailarchive/linux-netdev/2010/3/9/6271568
>
> Two main differences for our case:
>
> 1) There is no userspace workload (except for bgpd), no changes in interfaces
> 2) We are not using multiple routing tables
>
> This panic was pretty rare in our case (not more that 2 times per month).
>
> Currently we're running fine with disabled CONFIG_IP_MULTIPLE_TABLES.
>
Okay ;)
I believe I found a bug, but really cant understand how it can triggers
on your workload (and Joe one, of course)
Here is a patch against net-next-2.6 for testing, it probably can
backported to old kernels.
Thanks
[PATCH] fib: fix fib_nl_newrule()
Some panic reports in fib_rules_lookup() show a rule could have a NULL
pointer as a next pointer in the rules_list.
This can actually happen because of a bug in fib_nl_newrule() : It
checks if current rule is the destination of unresolved gotos. (Other
rules have gotos to this about to be inserted rule)
Problem is it does the resolution of the gotos before the rule is
inserted in the rules_list (and has a valid next pointer)
Fix this by moving the rules_list insertion before the changes on gotos.
A lockless reader can not any more follow a ctarget pointer, unless
destination is ready (has a valid next pointer)
Reported-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru>
Reported-by: Joe Buehler <aspam@cox.net>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/core/fib_rules.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 1bc3f25..12b43cc 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -373,6 +373,11 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
fib_rule_get(rule);
+ if (last)
+ list_add_rcu(&rule->list, &last->list);
+ else
+ list_add_rcu(&rule->list, &ops->rules_list);
+
if (ops->unresolved_rules) {
/*
* There are unresolved goto rules in the list, check if
@@ -395,11 +400,6 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (unresolved)
ops->unresolved_rules++;
- if (last)
- list_add_rcu(&rule->list, &last->list);
- else
- list_add_rcu(&rule->list, &ops->rules_list);
-
notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid);
flush_route_cache(ops);
rules_ops_put(ops);
next prev parent reply other threads:[~2010-10-23 19:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 17:14 kernel panic in fib_rules_lookup [2.6.27.7 vendor-patched] Joe Buehler
2010-10-12 17:40 ` Eric Dumazet
2010-10-13 11:18 ` Joe Buehler
2010-10-20 17:43 ` Joe Buehler
2010-10-20 22:05 ` Eric Dumazet
2010-10-22 20:30 ` Joe Buehler
2010-10-23 3:44 ` Eric Dumazet
2010-10-23 15:11 ` Eric Dumazet
2010-10-23 15:24 ` Eric Dumazet
2010-10-23 15:40 ` Joe Buehler
2010-10-23 16:07 ` Eric Dumazet
2010-10-23 15:33 ` Joe Buehler
2010-10-23 16:35 ` Eric Dumazet
2010-10-23 17:37 ` "Oleg A. Arkhangelsky"
2010-10-23 19:44 ` Eric Dumazet [this message]
2010-10-26 18:43 ` David Miller
2010-10-26 13:29 ` Joe Buehler
2010-10-26 13:36 ` Eric Dumazet
2010-10-26 13:53 ` Joe Buehler
2010-10-26 13:58 ` Eric Dumazet
2010-10-26 14:33 ` Eric Dumazet
2010-10-26 14:41 ` Joe Buehler
2010-10-27 21:01 ` Joe Buehler
2010-10-27 21:05 ` Eric Dumazet
2010-12-02 13:36 ` Joe Buehler
2010-12-02 14:04 ` 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=1287863065.2658.533.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=aspam@cox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sysoleg@yandex.ru \
/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