Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 6 Jan 2015 12:40:50 -0500
From: Rich Felker <>
Subject: Re: Possible bug in openlog()

On Mon, Jan 05, 2015 at 10:46:31AM -0500, Rich Felker wrote:
> On Mon, Jan 05, 2015 at 03:39:14PM +0200, Dima Krasner wrote:
> > Hi,
> > 
> > I think I found a bug in openlog() - it's racy. If syslogd is
> > started after openlog() is called, there's a small chance that the
> > socket will remain open, while connect() failed. Then, syslog() does
> > not call openlog() again, because it only checks whether the socket
> > file descriptor is valid.
> > 
> > Therefore, all syslog() messages are dropped silently and nothing
> > gets logged. I attached a fix.
> > 
> > Can you merge it or provide feedback, please?
> Did you observe this in practice? All accesses to log_fd seem to be
> made with the syslog lock held. If you think there's missing
> synchronization somewhere please elaborate.

Hm, I think I misunderstood. I misread the bug report as an internal
data race, but the actual problem is that the connect fails spuriously
if syslogd is not running at the time. This is unfortunate; I expected
connect with SOCK_DGRAM unix sockets to work like it does for UDP,
where it doesn't care if the destination port is open at the time of
the connect.

In that case the patch you provided might be the best solution. I'll
look over it again. Thanks for reporting it.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.