[Bug 1645324] [NEW] ebtables: Lock file handling has races

Launchpad Bug Tracker 1645324 at bugs.launchpad.net
Tue May 16 13:14:17 UTC 2017


You have been subscribed to a public bug by Eric Desrochers (slashd):

[Impact]

 * ebtables uses creation of a file with an exclusive flag
   as a lock to synchronize table modification when used
   with --concurrent parameter.

 * If ebtables crashes it will leave a stale lock file.
   This will prevent another copy of ebtables from running,
   and indirectly any other service that depends on ebtables
   will also be affected.

 * This change adds support for real locks that get
   cleaned up if a process exits or crashes.

[Test Case]

 * Test Case1:
   1. $ sudo touch /var/lib/ebtables/lock"
   2. $ sudo ebtables --concurrent -L
   3. ebtables can't acquire a lock

 * Test Case 2:
   1. $ while true; do /usr/sbin/ebtables --concurrent -L; done
   2. hard reboot VM
   3. likely that the lock file is present under /var/lib/ebtables
   4. libvird hanging, try to connect to qemu:///system


[Regression Potential] 

 * Normal Use:
   There is no regression potential during normal use and
   operation of ebtables.

 * Package Upgrade:
   There is a very very small regression potential during the package
   upgrade to the latest version. Once the package is upgraded that
   potential is gone. It is a very small potential because several
   things have to happen in a very small time frame and in an exact
   order since ebtables is not a resident program like a daemon:
     1. ebtables is launched during package upgrade AND
     2. new ebtables binary has not yet been written to disk AND
     3. it is launched with --concurent switch AND
     4. another ebtables with new binary is launched AND
     5. it is launched with --concurent switch AND
     6. the first ebtables copy hasn't exited yet AND
     7. both copies of ebtables are launched with a WRITE command AND
     8. both copies of ebtables are manipulating the same resource.
   Then one of the binaries could potentially fail, but once the old
   binary exits the potential is gone so subsequent re-runs of
   ebtables will succeed.

[Original Text]
libvirtd is hanging after startup due to ebtables lock file -from an earlier run- remains intact when the system reboots.
Same issue is happening than it is reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1290327 when the system boots.

After booting the system, It's not possible connect to the qemu-service.
- libvirt daemon tried to obtain a lock:
[pid 20966] read(24, "Trying to obtain lock /var/lib/e"..., 1024) = 45
[pid 20966] poll([{fd=22, events=POLLIN}, {fd=24, events=POLLIN}], 2, 4294967295) = 1 ([{fd=24, revents=POLLIN}])
[pid 20966] read(24, "Trying to obtain lock /var/lib/e"..., 1024) = 45
[pid 20966] poll([{fd=22, events=POLLIN}, {fd=24, events=POLLIN}], 2, 4294967295) = 1 ([{fd=24, revents=POLLIN}])
[pid 20966] read(24, "Trying to obtain lock /var/lib/e"..., 1024) = 45
[pid 20966] poll([{fd=22, events=POLLIN}, {fd=24, events=POLLIN}], 2, 4294967295^CProcess 20916 detached

- there was a file named 'lock' in /var/lib/ebtables directory with timestamp 14:54
- ebtables was configured:
* Ebtables support available, number of installed rules [ OK ]
(other nodes appeared to be in the same state from ebtables point of view, but without the lock file)
- I removed the lock file and libvirt started to work instantly - the lock obtain messages have disappeared from the trace and virsh commands are working
- at 14:54 the host was booting up. According to the logs, there were other reboots after that one, but the lock file remained intact (at least the timestamp was not updated).

Could you please suggest a solution to be sure that ebtables lock file
is removed during boot?

** Affects: ebtables (Ubuntu)
     Importance: Medium
     Assignee: Eric Desrochers (slashd)
         Status: In Progress

** Affects: ebtables (Ubuntu Trusty)
     Importance: Medium
     Assignee: Dragan S. (dragan-s)
         Status: In Progress

** Affects: ebtables (Ubuntu Zesty)
     Importance: Medium
     Assignee: Dragan S. (dragan-s)
         Status: Triaged

** Affects: ebtables (Ubuntu Artful)
     Importance: Medium
     Assignee: Eric Desrochers (slashd)
         Status: In Progress

** Affects: ebtables (Debian)
     Importance: Unknown
         Status: New


** Tags: patch sts-sru-needed
-- 
ebtables: Lock file handling has races
https://bugs.launchpad.net/bugs/1645324
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list