This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17144] New: syslog is not thread-safe if NO_SIGPIPE is not defined


https://sourceware.org/bugzilla/show_bug.cgi?id=17144

            Bug ID: 17144
           Summary: syslog is not thread-safe if NO_SIGPIPE is not defined
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: bugdal at aerifal dot cx
                CC: drepper.fsp at gmail dot com

The Linux wrapper for misc/syslog.c defines NO_SIGPIPE and defines send_flags
to MSG_NOSIGNAL so that SIGPIPE suppression is not needed. However if this file
is ever used for non-Linux systems, the SIGPIPE suppression it does via
sigaction is non-conforming to the POSIX requirement that syslog be
thread-safe.

MSG_NOSIGNAL was added to POSIX in the 2008 edition, so I think the
Linux-specific syslog.c should just be removed and instead the generic file
should either assume MSG_NOSIGNAL is available, or check for it directly with
#ifdef and have a thread-safe fallback if it's not defined. The thread-safe
fallback is easy:

1. Block SIGPIPE with the signal mask.
2. Perform the operation that might raise SIGPIPE.
3. Clear any pending SIGPIPE with sigtimedwait and a zero timeout.
4. Unblock SIGPIPE.

However I doubt it's needed. The offending code should probably just be
removed.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]