[Bug 220151] [libc] syslog() thread unsafety: mutex lock leak

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jun 20 09:46:27 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220151

            Bug ID: 220151
           Summary: [libc] syslog() thread unsafety: mutex lock leak
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: eugen at freebsd.org

Hi!

Our [v]syslog() implementation in src/lib/libc/gen/syslog.c
tries to be thread-safe and uses "syslog_mutex".

It may lock this mutex then call blocking system calls like sendto().
If a thread owning this mutex is pthread_cancel()'d in process,
the mutex stays UMUTEX_CONTESTED and every other thread calling [v]syslog()
deadlocks.

I can reproduce this with net/mpd5 daemon reliably within some seconds
from the beginning of my stress test involving RADIUS so mpd5 runs
multi-threaded.

This problem seems to be root cause of multiple complaints
about mpd5 being unstable under FreeBSD 9.x+ version (PR: 186114, 214482).

There is a patch by Konstantin Belousov solving this problem attached to the PR
186114: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=183537

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list