Bug 219 - syslog socket is opened after chroot
syslog socket is opened after chroot
Product: unbound
Classification: Unclassified
Component: server
All Linux
: P2 normal
Assigned To: unbound team
Depends on:
  Show dependency treegraph
Reported: 2008-11-19 15:55 CET by Adam Tkac
Modified: 2008-12-11 09:16 CET (History)
1 user (show)

See Also:

proposed patch (989 bytes, patch)
2008-11-19 15:57 CET, Adam Tkac
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Tkac 2008-11-19 15:55:44 CET
Syslog socket is opened after chroot(2) call thus /dev/log socket has to exist inside chroot. Better will be open syslog socket before chroot.

openlog() function is called before chroot() but GNU libc opens syslog socket "ondemand" so socket is not opened before first syslog() call. Current scenario:


so log is not opened if /dev/log doesn't exist in chroot. Attached patch fixes the problem - starting message is logged before chroot().

This bug is similar to http://www.nlnetlabs.nl/bugs/show_bug.cgi?id=199
Comment 1 Adam Tkac 2008-11-19 15:56:31 CET
Both 1.0.2 and 1.1.0 versions have this problem
Comment 2 Adam Tkac 2008-11-19 15:57:53 CET
Created attachment 92 [details]
proposed patch
Comment 3 Wouter Wijngaards 2008-11-19 16:42:59 CET
I did not know that it was opened on demand.
Thank you for the report and patch.
Comment 4 Wouter Wijngaards 2008-11-19 16:47:03 CET
created 1.1.0 version tag.
Comment 5 Wouter Wijngaards 2008-11-19 17:05:36 CET
Fixed as you suggest.

Did not remove the 'start of service' message. It is as close as possible to where service is really available. It is printed when sockets are opened, and service is either already available from other threads, or is the very next thing to happen.

A new message is printed to open the syslog, only when using syslog().
unbound: [30522:0] info: open syslog, startup in progress
Comment 6 Adam Tkac 2008-11-19 17:11:36 CET
Thanks much, I looked into SVN and patch looks fine
Comment 7 Wouter Wijngaards 2008-12-11 09:16:35 CET
Fixed using LOG_NDELAY, patch thanks to Tamas Tevesz.