Skip to contentSkip to conversation

Fix recent bug in fib_semantics.c

TRIVIAL David Gibson 6 participants 12 messages Sep 17, 2004 – Sep 18, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Andrew, please apply:

When fib_create_info() allocates new hash tables, it neglects to initialize them. This leads to an oops during boot on at least machine I use. This patch addresses the problem.

net/ipv4/fib_semantics.c +5 -1
Index: working-2.6/net/ipv4/fib_semantics.c
===================================================================
@@ -604,8 +604,12 @@
 		if (!new_info_hash || !new_laddrhash) {
 			fib_hash_free(new_info_hash, bytes);
 			fib_hash_free(new_laddrhash, bytes);
-		} else
+		} else {
+			memset(new_info_hash, 0, bytes);
+			memset(new_laddrhash, 0, bytes);
+
 			fib_hash_move(new_info_hash, new_laddrhash, new_size);
+		}
 
 		if (!fib_hash_size)
 			goto failure;
Signature · 4 lines
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson
#1 lore raw
Quoted 7 lines · David Gibson

Andrew, please apply:

When fib_create_info() allocates new hash tables, it neglects to initialize them. This leads to an oops during boot on at least machine I use. This patch addresses the problem.

This may be the oops in fib_xxx I just saw on my Athlon64 box...

Jeff

maintainer
#2 lore raw
In reply to David Gibson

Thanks David, I'll push this upstream asap.

I can't believe in all the route testing I did I never triggered this on my sparc64 boxes, must have been lucky :(

#3 lore raw

I'm still OOPsing at boot in fib_disable_ip+21 from fib_netdev_event+63. Both e1000 and tg3 are effected. I have current linus bk as of time of this message.

It only occurs when Redhat goes through the scaning for new hardware phase during boot. Is RH loading the drivers in some special way during this phase? If I load the drivers manually after I'm booted they load ok. I'm running with the drivers as modules, I'll try switching to compiled in.

The change referenced in this thread is in my kernel:
fib_semantics.c, 604

                } else {
                        memset(new_info_hash, 0, bytes);
                        memset(new_laddrhash, 0, bytes);

                        fib_hash_move(new_info_hash, new_laddrhash, new_size);
                }
Quoted 13 lines · David S. Miller

Thanks David, I'll push this upstream asap.

I can't believe in all the route testing I did I never triggered this on my sparc64 boxes, must have been lucky :(

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Jon Smirl
[email protected]
#4 lore raw
Quoted 3 lines · Jon Smirl

I'm still OOPsing at boot in fib_disable_ip+21 from fib_netdev_event+63. Both e1000 and tg3 are effected. I have current linus bk as of time of this message.

Please post the complete error message.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw

I have verified that compiling the drivers in avoids the problem.

I'll boot again and get more of the error message. It's not making it to the logs so I am copying it by hand from the screen.

Quoted 12 lines · Herbert Xu
Quoted 3 lines · Jon Smirl

I'm still OOPsing at boot in fib_disable_ip+21 from fib_netdev_event+63. Both e1000 and tg3 are effected. I have current linus bk as of time of this message.

Please post the complete error message.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Signature · 2 lines
Jon Smirl
[email protected]
#6 lore raw
In reply to Herbert Xu

Call stack at failure:
e1000_exit_module
...pci calls...
e1000_remove
unregister_netdev
unregister_netdevice
notifier_call_chain
fib_netdev_event
fib_disable_ip
error_code

Rest of the info has scrolled off the screen.

The problem is when RH/Fedora is doing it's modprobe/rmmod to detect what hardware is in the system since that's the only thing that would be rmmod'ing e1000.

On the same system if I disable networking and boot, I can modprobe/rmmod the drivers without problem. So I'd conclude that RH is doing something special during it's probing phase, but I don't know enough about the RH init scripts to know what it is.

Quoted 12 lines · Herbert Xu
Quoted 3 lines · Jon Smirl

I'm still OOPsing at boot in fib_disable_ip+21 from fib_netdev_event+63. Both e1000 and tg3 are effected. I have current linus bk as of time of this message.

Please post the complete error message.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Signature · 2 lines
Jon Smirl
[email protected]
#7 lore raw
Quoted 10 lines · Jon Smirl

Call stack at failure:
e1000_exit_module
...pci calls...
e1000_remove
unregister_netdev
unregister_netdevice
notifier_call_chain
fib_netdev_event
fib_disable_ip
error_code

Thanks. The following bug is probably your problem.

Quoted 1 line

Rest of the info has scrolled off the screen.

You should be able to hit Shift-PageUp to scroll up.

There is a thinko in the allocation for the devindex hash. We're only giving it 8 elements when it should be 1<<8 elements.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

===== net/ipv4/fib_semantics.c 1.16 vs edited =====

net/ipv4/fib_semantics.c +3 -2
@@ -52,7 +52,8 @@
 static unsigned int fib_info_cnt;
 
 #define DEVINDEX_HASHBITS 8
-static struct hlist_head fib_info_devhash[DEVINDEX_HASHBITS];
+#define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
+static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE];
 
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
 
@@ -229,7 +230,7 @@
 
 static inline unsigned int fib_devindex_hashfn(unsigned int val)
 {
-	unsigned int mask = ((1U << DEVINDEX_HASHBITS) - 1);
+	unsigned int mask = DEVINDEX_HASHSIZE - 1;
 
 	return (val ^
 		(val >> DEVINDEX_HASHBITS) ^
#8 lore raw

Still getting the same fault with the patch. Someone else has this problem too. The full stack trace is in this thread....

[2.6.9-rc2-bk] Network-related panic on boot

Signature · 2 lines
Jon Smirl
[email protected]
maintainer
#9 lore raw
In reply to Herbert Xu
Quoted 1 line · On Sat, 18 Sep 2004 14:16:28 +1000 Herbert Xu <[email protected]>…

Thanks. The following bug is probably your problem.

Good catch on this fix, but really he's hitting the BUG_ON() in fib_sync_down() (I hate i386 backtraces, it's an art to decode them properly)

So if you rmmod() a device before any routes are ever created in ipv4, this triggers. I didn't think this was possible, but it is.

The fix is simple enough.

===== net/ipv4/fib_semantics.c 1.16 vs edited =====

net/ipv4/fib_semantics.c +1 -3
@@ -1040,9 +1040,7 @@
 	if (force)
 		scope = -1;
 
-	BUG_ON(!fib_info_laddrhash);
-
-	if (local) {
+	if (local && fib_info_laddrhash) {
 		unsigned int hash = fib_laddr_hashfn(local);
 		struct hlist_head *head = &fib_info_laddrhash[hash];
 		struct hlist_node *node;
#11 lore raw
In reply to David S. Miller
Quoted 5 lines · David S. Miller

On Sat, 18 Sep 2004 14:16:28 +1000

So if you rmmod() a device before any routes are ever created in ipv4, this triggers. I didn't think this was possible, but it is.

May have been exposed by LLTX. When i turned off LLTX on e1000 before seeing your fix, the oops disapeared.

cheers,
jamal