From: Bhaskar Dutta <bhaskie@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>, netdev@vger.kernel.org
Subject: Re: TCP-MD5 checksum failure on x86_64 SMP
Date: Wed, 5 May 2010 23:33:59 +0530 [thread overview]
Message-ID: <g2p571fb4001005051103w67e1b9ddn3e8f7feb84d0559@mail.gmail.com> (raw)
In-Reply-To: <20100504101301.5f4dd9c2@nehalam>
On Tue, May 4, 2010 at 10:43 PM, Stephen Hemminger
<shemminger@vyatta.com> wrote:
>
> On Tue, 4 May 2010 22:38:49 +0530
> Bhaskar Dutta <bhaskie@gmail.com> wrote:
>
> > On Tue, May 4, 2010 at 9:42 PM, Stephen Hemminger <shemminger@vyatta.com> wrote:
> > > On Tue, 4 May 2010 19:58:32 +0530
> > > Bhaskar Dutta <bhaskie@gmail.com> wrote:
> > >
> > >> On Tue, May 4, 2010 at 5:02 PM, Ben Hutchings <bhutchings@solarflare.com> wrote:
> > >> > On Tue, 2010-05-04 at 09:00 +0530, Bhaskar Dutta wrote:
> > >> >> Hi,
> > >> >>
> > >> >> I am observing intermittent TCP-MD5 checksum failures
> > >> >> (CONFIG_TCP_MD5SIG) on kernel 2.6.31 while talking to a BGP router.
> > >> >>
> > >> >> The problem is only seen in multi-core 64 bit machines.
> > >> >> Is there any known bug in the per_cpu_ptr implementation (I am aware
> > >> >> that the percpu allocator has been re-implemented in 2.6.33) that
> > >> >> might cause a corruption in 64 bit SMP machines?
> > >> >>
> > >> >> Any pointers would be appreciated.
> > >> >
> > >> > There was another recent report of incorrect MD5 signatures in
> > >> > <http://thread.gmane.org/gmane.linux.network/159556>, but without any
> > >> > response.
> > >> >
> > >> > Ben.
> > >> >
> > >>
> > >> I found another thread posted back in Jan 2007 with a similar bug
> > >> (x86_64 on 2.6.20) but no replies to that as well.
> > >> http://lkml.org/lkml/2007/1/20/56
> > >
> > > 2.6.20 had lots of other MD5 bugs. Your problem might be related to
> > > GRO. MD5 may not handle multi-fragment packets.
> > > --
> >
> > I am getting the issue on 2.6.31 and 2.6.28 (gro infrastructure was
> > added in 2.6.29).
> > Also, both segmentation offloading as well as receive offloading
> > (gso/gro) are turned off.
> >
> > Moreover outgoing TCP packets are the ones with the corrupt checksums.
> > Both tcpdump on my local machine and the BGP router on the other side
> > complain of the bad checksums with the same packet.
> >
> > I am trying to figure out if there is something in the per-cpu
> > implementation that might be causing a corruption (SMP and x86_64) but
> > I am not really getting anywhere.
>
> I seriously doubt the per-cpu stuff is the issue.
>
> > I am trying to reproduce the bad checksums with the latest kernel
> > sources since it has a new implementation of the percpu allocator.
>
> First turn off all offload settings on the device (TSO,GSO,SG,CSUM)
> then check that size of the bad packets. Are they fragmented or
> just simple linear packets?
>
> --
Hi,
TSO, GSO and SG are already turned off.
rx/tx checksumming is on, but that shouldn't matter, right?
# ethtool -k eth0
Offload parameters for eth0:
rx-checksumming: on
tx-checksumming: on
scatter-gather: off
tcp segmentation offload: off
udp fragmentation offload: off
generic segmentation offload: off
The bad packets are very small in size, most have no data at all (<300 bytes).
After adding some logs to kernel 2.6.31-12, it seems that
tcp_v4_md5_hash_skb (function that calculates the md5 hash) is
(might?) getting corrupt.
The tcp4_pseudohdr (bp = &hp->md5_blk.ip4) structure's saddr, daddr
and len fields get modified to different values towards the end of the
tcp_v4_md5_hash_skb function whenever there is a checksum error.
The tcp4_pseudohdr (bp) is within the tcp_md5sig_pool (hp), which is
filled up by tcp_get_md5sig_pool (which calls per_cpu_ptr).
Using a local copy of the tcp4_pseudohdr in the same function
tcp_v4_md5_hash_skb (copied all fields from the original
tcp4_pseudohdr within the tcp_md5sig_pool) and calculating the md5
checksum with the local tcp4_pseudohdr seems to solve the issue
(don't see bad packets for a hours in load tests, and without the
change I can see them instantaneously in the load tests).
I am still unable to figure out how this is happening. Please let me
know if you have any pointers.
Thanks a lot!
Bhaskar
next prev parent reply other threads:[~2010-05-05 18:04 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <i2h571fb4001005031027y4a58c4dtfd28ddcdc08d8401@mail.gmail.com>
2010-05-04 3:30 ` TCP-MD5 checksum failure on x86_64 SMP Bhaskar Dutta
2010-05-04 11:32 ` Ben Hutchings
2010-05-04 14:28 ` Bhaskar Dutta
2010-05-04 16:12 ` Stephen Hemminger
2010-05-04 17:08 ` Bhaskar Dutta
2010-05-04 17:13 ` Stephen Hemminger
2010-05-05 18:03 ` Bhaskar Dutta [this message]
2010-05-05 18:53 ` Eric Dumazet
2010-05-06 11:55 ` Bhaskar Dutta
2010-05-06 12:06 ` Eric Dumazet
2010-05-07 5:04 ` David Miller
2010-05-07 5:32 ` Eric Dumazet
2010-05-07 17:14 ` Stephen Hemminger
2010-05-07 17:21 ` Eric Dumazet
2010-05-07 17:36 ` Stephen Hemminger
2010-05-07 21:40 ` Eric Dumazet
2010-05-10 14:55 ` Bijay Singh
2010-05-10 15:18 ` Eric Dumazet
2010-05-10 17:27 ` Bijay Singh
2010-05-11 4:08 ` Bijay Singh
2010-05-11 6:27 ` Eric Dumazet
2010-05-11 8:23 ` Bijay Singh
2010-05-11 20:50 ` Eric Dumazet
2010-05-12 3:20 ` Eric Dumazet
2010-05-12 22:22 ` Stephen Hemminger
2010-05-12 22:24 ` David Miller
2010-05-16 19:53 ` Eric Dumazet
2010-05-16 20:48 ` Eric Dumazet
2010-05-17 3:49 ` Bijay Singh
2010-05-17 5:03 ` Eric Dumazet
2010-05-17 17:22 ` Stephen Hemminger
2010-05-17 20:42 ` Stephen Hemminger
2010-05-17 21:04 ` [PATCH] tcp: tcp_synack_options() fix Eric Dumazet
2010-05-18 5:35 ` David Miller
2010-05-16 7:30 ` TCP-MD5 checksum failure on x86_64 SMP David Miller
2010-05-07 8:46 ` Lars Eggert
2010-05-07 8:55 ` Eric Dumazet
2010-05-07 9:12 ` David Miller
2010-05-07 5:39 ` Eric Dumazet
2010-05-07 8:00 ` Eric Dumazet
2010-05-07 8:59 ` Bhaskar Dutta
2010-05-07 9:37 ` Eric Dumazet
2010-05-07 10:50 ` Bhaskar Dutta
2010-05-07 15:18 ` Eric Dumazet
2010-05-07 15:44 ` Eric Dumazet
2010-05-07 21:18 ` Eric Dumazet
2010-05-16 7:37 ` David Miller
2010-05-16 7:35 ` 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=g2p571fb4001005051103w67e1b9ddn3e8f7feb84d0559@mail.gmail.com \
--to=bhaskie@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).