[Bug 6758] New: vsyslog not thread-safe

bugzilla at busybox.net bugzilla at busybox.net
Mon Jan 6 17:24:08 UTC 2014


           Summary: vsyslog not thread-safe
           Product: uClibc
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: Threads
        AssignedTo: unassigned at uclibc.org
        ReportedBy: crayor at crayor.com
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0

stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4);

Sadly, the above line of syslog.c module is not thread-safe. ctime_r() shall be
My application crashed in uClibc with a segfault (in asctime/memcpy) when one
thread does libc_fork() while another thread uses vsyslog() even though
vsyslog() is protected by a mutex by the application.

I am compiling for ARM and configured uClibc for using LinuxThreads. I am using but the bug seems to exist in all newer versions up to the latest
library version (I looked at master branch and 0.9.33 via the source-code 
browsing website).

The proposed solution is to replace the line by something like this:

char time_str[26];
stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime_r(&now, time_str) +


Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the uClibc-cvs mailing list