[Fwd: avahi-daemon.service startup failure post kernel commit f396922d862a]

From: Mike Galbraith
Date: Wed Jun 13 2018 - 07:46:00 EST


Well, the folks at "To:" below apparently don't want bug reports from
non-subscribers (no mediation, simply rejected). Posting here simply
because it may save some other busy person a bisection.

-------- Forwarded Message --------
From: Mike Galbraith <efault@xxxxxx>
To: avahi@xxxxxxxxxxxxxxxxxxxxx
Subject: avahi-daemon.service startup failure post kernel commit
f396922d862a
Date: Wed, 13 Jun 2018 13:32:25 +0200

Greetings,

Service startup failure bisected to a kernel commit, but that commit
points the finger at userspace, ergo an attempt to report it. Let's
see if it bounces.

homer:~ # systemctl status avahi-daemon
â avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-06-13 09:49:58 CEST; 1min 54s ago
Process: 1930 ExecStart=/usr/sbin/avahi-daemon -s (code=exited, status=255)
Main PID: 1930 (code=exited, status=255)
Status: "avahi-daemon 0.6.32 exiting."

Jun 13 09:49:58 homer systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Jun 13 09:49:58 homer avahi-daemon[1930]: Loading service file /etc/avahi/services/sftp-ssh.service.
Jun 13 09:49:58 homer avahi-daemon[1930]: Loading service file /etc/avahi/services/ssh.service.
Jun 13 09:49:58 homer avahi-daemon[1930]: SO_REUSEADDR failed: Structure needs cleaning
Jun 13 09:49:58 homer avahi-daemon[1930]: SO_REUSEADDR failed: Structure needs cleaning
Jun 13 09:49:58 homer avahi-daemon[1930]: Failed to create server: No suitable network protocol available
Jun 13 09:49:58 homer avahi-daemon[1930]: avahi-daemon 0.6.32 exiting.
Jun 13 09:49:58 homer systemd[1]: avahi-daemon.service: Main process exited, code=exited, status=255/n/a
Jun 13 09:49:58 homer systemd[1]: avahi-daemon.service: Unit entered failed state.
Jun 13 09:49:58 homer systemd[1]: avahi-daemon.service: Failed with result 'exit-code'.
homer:~ #

f396922d862aa05b53ad740596652691a723ee23 is the first bad commit
commit f396922d862aa05b53ad740596652691a723ee23
Author: Maciej Åenczykowski <maze@xxxxxxxxxx>
Date: Sun Jun 3 10:47:05 2018 -0700

net: do not allow changing SO_REUSEADDR/SO_REUSEPORT on bound sockets

It is not safe to do so because such sockets are already in the
hash tables and changing these options can result in invalidating
the tb->fastreuse(port) caching.

This can have later far reaching consequences wrt. bind conflict checks
which rely on these caches (for optimization purposes).

Not to mention that you can currently end up with two identical
non-reuseport listening sockets bound to the same local ip:port
by clearing reuseport on them after they've already both been bound.

There is unfortunately no EISBOUND error or anything similar,
and EISCONN seems to be misleading for a bound-but-not-connected
socket, so use EUCLEAN 'Structure needs cleaning' which AFAICT
is the closest you can get to meaning 'socket in bad state'.
(although perhaps EINVAL wouldn't be a bad choice either?)

This does unfortunately run the risk of breaking buggy
userspace programs...

Signed-off-by: Maciej Åenczykowski <maze@xxxxxxxxxx>
Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
Change-Id: I77c2b3429b2fdf42671eee0fa7a8ba721c94963b
Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

:040000 040000 39b702bc132c8aa812fbd452822a7047331553a1 e0ed7194986fd828073702d5346a4f91fbd6ea01 M net