Bug in FreeS/WAN 2.03: unregister_netdevice: waiting for Godot?

Hugh Daniel <[email protected]> Thu, 06 Nov 2003 02:32:26 -0800
Newsgroups gmane.network.freeswan.user,gmane.network.freeswan.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----

  I have confirmed that a problem I have been seeing recently is a bug
in FreeS/WAN and not particularly in the kernel (I won't get into
design arguments here...).  The bug shows up with an infinite repeat
of a message like this from the kernel:

"""
Nov  5 23:53:48 ahost kernel: unregister_netdevice: waiting for eth1 to become free. Usage count = 2
"""

  The code that implements the kernel side of the problem is at
"net/core/dev.c" at about line 2670 or so, with quite the useful
comment explaining that your about to goto hell in a hand basket most
likely and nothing will help you much to avoid such fate.

  Whats happening is that FreeS/WAN has an open structure reference to
the device (for example "eth1" above) that is properly refcounted yet
it has not properly freed even though it has otherwise stopped using
the device.

  Here is how to duplicate the bug, first some host state info:

ahost$ cat /proc/version
Linux version 2.4.23-pre8 ([email protected]) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Mon Oct 27 17:40:23 PST 2003
ahost$ ipsec --version
Linux FreeS/WAN 2.03
See `ipsec --copyright' for copyright information.
ahost$ cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)
ahost$ 

  FreeS/WAN is configured as a module and so is the eth1 driver
(happens to to be orinoco_pci).

  Boot the system, config eth1 up(dhclient or static config), start
freeswan (ipsec setup start) (vanilla default shipped OE state config
files, not even a mod to the /etc/ipsec.conf file!), stop freeswan
(ipsec setup stop), then _try_ to unload the eth1 driver (rmmod
orinoco_pci).  Wait a couple of seconds and you will start to get
messages like the one quoted above, forever.

  The only way out of this mess is to reboot your Linux kernel and
system.  

  The fix is to figure out where in FreeS/WAN someone is forgetting to
free & un-refcount the device structure reference.  My guess is that
diff'ing aginst say 2.02 or 2.01 and looking for device structure
references will catch it, for someone who knows the code.

  There are various messages that come from the network drivers in
this case that are seem noise, resets and the like but only on the
orinoco likely due to the poorly documented chipset.  There are no
interesting or relevant log messages in either secure or messages,
esp. when using the e100 driver.

  I have confirmed that this bug works (fails...) with the e100 driver
as well as the orinoco_pci driver, and in exactly the same way.


  This bug is 'critical' for laptop users, as at various times a
laptop user needs to unload drivers (often done automatically during
the various run/standby/suspend/hibernate/run state transitions).

  There is no way for laptop users to script around this bug, once
FreeS/WAN is started (just loading the ipsec module is not enough to
trigger it, you need to bring FreeS/WAN 'up' on an interface) you
can't unload the interface module ever.

		||ugh Daniel
			<[email protected]>
			PGP2: 3C66 4D8B 3587 02A7  A4EA E763 F256 7999

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: For the matching public key, finger the Reply-To: address.

iQCVAwUBP6ojM1ZpdJR7FBQRAQG0CQP/UCG5sBTNnFUctOTFhCqgyjRmHWQsbzSV
HoUdcpJAlsOO0K4+l3+LkWImZFmLaTb7raTKJDdm4WoB0Q/nMiHF8GX/RqK/QlVn
eLGydHMVoz9IhWMvV1mYI/Shyk34mKgmS1KV3kbX/uj38sk62Zb8h7l3iarzwrZo
oFxZnWF3ps0=
=fATk
-----END PGP SIGNATURE-----