Re: TCP-MD5 checksum failure on x86_64 SMP

Stephen Hemminger
2010-05-07T17:15:05Z

On Fri, 07 May 2010 07:32:09 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le jeudi 06 mai 2010 à 22:04 -0700, David Miller a écrit :
> > From: Eric Dumazet <eric.dumazet@gmail.com>
>
> > > This code should be completely rewritten for linux-2.6.35, its very ugly
> > > and over complex, yet it is not scalable.
> > >
> > > It could use true percpu data, with no central lock or refcount.
> >
> > Yes I've always disliked the way the TCP MD5 pool stuff is coded, it's
> > frankly crap and this is like the 5th major bug that had to get fixed
> > in it. :-)
> >
> > But let's fix this as simply as possible in net-2.6 and -stable, so Eric
> > let me know when you have a tested patch for me to apply.
>
> There are so many things ...
>
> I am comtemplating commit aa133076
>
> __tcp_alloc_md5sig_pool() now do a :
>
> p = kzalloc(sizeof(*p), sk->sk_allocation);
>
> But later call :
>
> hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
>
> (GFP_KERNEL allocations for sure)
>
>
> tcp_v4_parse_md5_keys() also use :
>
> p = kzalloc(sizeof(*p), sk->sk_allocation);
>
> right after a (possibly sleeping) copy_from_user()
>
> Oh well...
>
>
> I'll test the already suggested patch before official submission,
> thanks.

Forget the per cpu data; the pool should just be scrapped.

The only reason the pool exists is that the crypto hash state which
should just be moved into the md5_info (88 bytes). The pseudo
header can just be generated on the stack before passing to the crypto
code.