Skip to contentSkip to conversation

unaligned access in ipvv6_rcv, nf_ip6_checksum, tcp_error, __ipv6_addr_type, fib6_lookup_1

BUG 2.6.18 Harald Welte 2 participants 4 messages Sep 30, 2006 – Oct 10, 2006 1 message not in the archive

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

Hi!

I've just built 2.6.18 on a sparc64 box (Ultra 5) using gcc-3.3.5 (debian woody). After booting the kernel, I get tons of unaligned access messages related to various bits of the IPv6 code:

Kernel unaligned access at TPC[10022cf0] ipv6_rcv+0xb8/0x320 [ipv6] Kernel unaligned access at TPC[10023800] __ipv6_addr_type+0x8/0x140 [ipv6] Kernel unaligned access at TPC[1002fd64] fib6_lookup_1+0x2c/0x120 [ipv6] Kernel unaligned access at TPC[10093878] tcp_error+0x40/0x2c0 [nf_conntrack] Kernel unaligned access at TPC[1004ce54] nf_ip6_checksum+0x13c/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce58] nf_ip6_checksum+0x140/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce60] nf_ip6_checksum+0x148/0x1c0 [ipv6]

As I'm not really familiar at all with sparc assembly, the usual "look at objectdump, try to see what it does, look at corresponding source code" strategy doesn't work for me in this case.

There could be 7 different bugs, but I think it's more likely that some common data structure is misaligned and thus causes unaligned accesses all over the place.

I've put the ipv6.ko and nf_conntrack.ko modules online at
http://people.netfilter.org/laforge/tmp/2618_bug/

This could be a known issue, but I couldn't find any reference to it on netdev, sparclinux or via google.

Any assistance is appreciated, thanks!

Signature · 3 lines
- Harald Welte <[email protected]>          	        http://gnumonks.org/
============================================================================
We all know Linux is great...it does infinite loops in 5 seconds. -- Linus
maintainer
#1 lore raw

From: Harald Welte <[email protected]>
Date: Sat, 30 Sep 2006 22:20:40 +0200

Quoted 7 lines

Kernel unaligned access at TPC[10022cf0] ipv6_rcv+0xb8/0x320 [ipv6] Kernel unaligned access at TPC[10023800] __ipv6_addr_type+0x8/0x140 [ipv6] Kernel unaligned access at TPC[1002fd64] fib6_lookup_1+0x2c/0x120 [ipv6] Kernel unaligned access at TPC[10093878] tcp_error+0x40/0x2c0 [nf_conntrack] Kernel unaligned access at TPC[1004ce54] nf_ip6_checksum+0x13c/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce58] nf_ip6_checksum+0x140/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce60] nf_ip6_checksum+0x148/0x1c0 [ipv6]

Thanks Harald, I'll take a look when I get back from Seattle sunday night. For the time being you can simply comment out the printk statement in arch/sparc64/kernel/unaligned.c if this stuff is filling up your logs.

maintainer
#2 lore raw
In reply to Harald Welte

From: Harald Welte <[email protected]>
Date: Sat, 30 Sep 2006 22:20:40 +0200

Quoted 7 lines

Kernel unaligned access at TPC[10022cf0] ipv6_rcv+0xb8/0x320 [ipv6] Kernel unaligned access at TPC[10023800] __ipv6_addr_type+0x8/0x140 [ipv6] Kernel unaligned access at TPC[1002fd64] fib6_lookup_1+0x2c/0x120 [ipv6] Kernel unaligned access at TPC[10093878] tcp_error+0x40/0x2c0 [nf_conntrack] Kernel unaligned access at TPC[1004ce54] nf_ip6_checksum+0x13c/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce58] nf_ip6_checksum+0x140/0x1c0 [ipv6] Kernel unaligned access at TPC[1004ce60] nf_ip6_checksum+0x148/0x1c0 [ipv6]

I think for all of these cases the IPv6 header is not 4-byte aligned in the SKB. The first case is simply ipv6_hdr->version which GCC turns into a load of the first 4 byte word of the headers, then a mask+compare. And this is fine becasue due to the "struct in6_addr", gcc may assume that the ipv6 header struct is at least 4 bytes aligned since in6_addr contains an array of u32[]'s.

What kind of input path is this packet coming from? Is it using some kind of encapsulation? It's odd for it to not be 4 byte aligned, you would get the same kind of unaligned accesses for an ipv4 header if it were misaligned like this.

maintainer
#4 lore raw
In reply to a message not in the archive

From: Harald Welte <[email protected]>
Date: Tue, 10 Oct 2006 18:28:03 +0200

Quoted 5 lines

The NIC in use is a tulip:
eth1: Digital DS21143 Tulip rev 65 at 000001ff00002000, 00:40:C7:97:6B:0D, IRQ 15.

Since there is no other tulip nic (only 3c59x and sunhme) in that box, it might be a tulip driver bug.

I don't see anything interesting in the tulip driver after scanning it's RX buffer handling code.

Let's at least see if my theory is at least correct. Can you run the following little debug patch?

It will print about 40 messages indicating the pointer value for the ipv6 header in ipv6_rcv(). This way we can see if it's really misaligned.

net/ipv6/ip6_input.c +8 -0
index 6b8e6d7..f08e5cd 100644
@@ -90,6 +90,14 @@ int ipv6_rcv(struct sk_buff *skb, struct
 		goto err;
 
 	hdr = skb->nh.ipv6h;
+#if 1
+	{
+		static int times = 0;
+
+		if (++times < 40)
+			printk("DEBUG: ipv6 header [%p]\n", hdr);
+	}
+#endif
 
 	if (hdr->version != 6)
 		goto err;