Re: 319554f284dd ("inet: don't use sk_v6_rcv_saddr directly") causes bind port regression

From: Josef Bacik
Date: Tue Sep 12 2017 - 19:13:47 EST


First Iâm super sorry for the top post, Iâm at plumbers and I forgot to upload my muttrc to my new cloud instance, so Iâm screwed using outlook.

I have a completely untested, uncompiled patch that I think will fix the problem, would you mind giving it a go? Thanks,

Josef

On 9/12/17, 3:36 PM, "Laura Abbott" <labbott@xxxxxxxxxx> wrote:

Hi,

Fedora got a bug report
https://bugzilla.redhat.com/show_bug.cgi?id=1432684 of a regression with
automatic spice port
assignment. The libvirt team reduced this to the attached test
case run as follows:

In a separate terminal, qemu-kvm -vnc 127.0.0.1:0 to grab port 5900.
Then do this:

$ gcc bind-collision.c && ./a.out
bind: Address already in use
AF_INET check failed.
$ gcc -D CHECK_IPV6 bind-collision.c && ./a.out
AF_INET6 success
AF_INET success
$ gcc bind-collision.c && ./a.out
AF_INET success

Bisection showed this behavior to be caused by

commit 319554f284dda9f2737d09df82ba3610bd8ddea3
Author: Josef Bacik <jbacik@xxxxxx>
Date: Thu Jan 19 17:47:46 2017 -0500

inet: don't use sk_v6_rcv_saddr directly

When comparing two sockets we need to use inet6_rcv_saddr so we get
a NULL
sk_v6_rcv_saddr if the socket isn't AF_INET6, otherwise our
comparison function
can be wrong.

Fixes: 637bc8b ("inet: reset tb->fastreuseport when adding a
reuseport sk")
Signed-off-by: Josef Bacik <jbacik@xxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>


And reverting fixed both the standalone test case and the spice issue.

Any ideas?

Thanks,
Laura


Attachment: 0001-net-set-tb-fast_sk_family.patch
Description: 0001-net-set-tb-fast_sk_family.patch