[Bug 6758] New: vsyslog not thread-safe
bugzilla at busybox.net
bugzilla at busybox.net
Mon Jan 6 17:24:08 UTC 2014
https://bugs.busybox.net/show_bug.cgi?id=6758
Summary: vsyslog not thread-safe
Product: uClibc
Version: 0.9.30.1
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
used.
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
0.9.30.1 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) +
4);
Cheers,
crayor
--
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