Bug 811997 - race condition in radvd pidfile creation
Summary: race condition in radvd pidfile creation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: radvd
Version: 16
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL: http://lists.litech.org/pipermail/rad...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-12 13:36 UTC by Petr Pisar
Modified: 2012-04-24 14:52 UTC (History)
3 users (show)

Fixed In Version: radvd-1.8.2-3.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of: 664783
Environment:
Last Closed: 2012-04-18 22:52:29 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Petr Pisar 2012-04-12 13:36:01 UTC
+++ This bug was initially created as a clone of Bug #664783 +++

radvd uses daemonize() to daemonize itself, then creates its pidfile afterwards. This means that the process that exec'ed radvd will get back control before the pidfile has been created and/or populated, which could lead to a race condition.

This creates a problem for libvirt, which attempts to run an instance of radvd and determine its pid (for later termination) by immediately reading the pidfile. The pidfile isn't yet created when libvirtd gets back control after waitpid'ing for the radvd process, so it fails to learn the pid.

Instead of using daemonize() and creating the pidfile from the child process, radvd should do the fork manually, then create the pidfile in the parent, prior to exiting.

[...]

--- Additional comment from ppisar on 2012-04-12 11:32:45 GMT ---

Upstream has fixed this issue by using libdaemon with the following patch set:

commit 1cda2ef33f505be34e690d1b7a1e5eac632819af
Author: Petr Písař <ppisar>
Date:   Wed Apr 11 13:52:24 2012 +0200

    Use pkg-config to discover libdaemon

commit 4ff814023cf62e59a6048a2cc57c62e0664d3c56
Author: Petr Písař <ppisar>
Date:   Thu Apr 5 15:24:22 2012 +0200

    Use libdaemon for daemonization
    
    The libc daemon(3) function suffers from race bewtween exiting parent
    and saving PID into a file.
    
    Using libdaemon library one can avoid this race and can simplify PID
    file manipulation.
    
    The only difference against older implementation is, the PID file will
    be inspected, created, and removed only if daemonization is requested.

--- Additional comment from ppisar on 2012-04-12 13:22:08 GMT ---

Created attachment 577068 [details]
Reproducer

Use positional arguments to select executable, timeout, and PID file location.
-----

All Fedoras are affected.

Comment 1 Petr Pisar 2012-04-12 14:49:29 UTC
Fixed as radvd-1.8.5-3.fc18 in F18.

Comment 2 Fedora Update System 2012-04-12 14:58:10 UTC
radvd-1.8.5-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/radvd-1.8.5-2.fc17

Comment 3 Fedora Update System 2012-04-12 16:11:28 UTC
radvd-1.8.2-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/radvd-1.8.2-3.fc16

Comment 4 Fedora Update System 2012-04-12 16:19:09 UTC
radvd-1.8.2-3.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/radvd-1.8.2-3.fc15

Comment 5 Fedora Update System 2012-04-13 06:11:02 UTC
Package radvd-1.8.5-2.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing radvd-1.8.5-2.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-5770/radvd-1.8.5-2.fc17
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-04-18 22:52:29 UTC
radvd-1.8.5-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2012-04-24 14:50:58 UTC
radvd-1.8.2-3.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2012-04-24 14:52:48 UTC
radvd-1.8.2-3.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.