[Bug 8596] New: start-stop-daemon has race condition on --make-pidfile option

bugzilla at busybox.net bugzilla at busybox.net
Wed Jan 13 04:05:37 UTC 2016


https://bugs.busybox.net/show_bug.cgi?id=8596

            Bug ID: 8596
           Summary: start-stop-daemon has race condition on --make-pidfile
                    option
           Product: Busybox
           Version: 1.22.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: craig+busybox at mcqueen.id.au
                CC: busybox-cvs at busybox.net

For start-stop-daemon, when the --make-pidfile (-m) option is used, ideally the
PID file should be created before start-stop-daemon exits. But that is not the
case--the PID file is made by the background process at some undetermined time
before or after the foreground process exits.

This is a "race condition" if there is a subsequent process that needs to
access the PID file. For example, the 'watchdog' program that monitors a
process is running via its PID file. I have found that 'watchdog' program can
reboot my system because of such a race condition: It is monitoring a process
via its PID file, but the PID file is not yet created when 'watchdog' starts
running.

One fix is for the parent process to write the PID file, after getting the
child process' PID returned from the bb_daemon() call.

An alternative fix would be for the parent process to wait until it gets some
sort of signal from the child to indicate that the child has written the PID.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list