[asterisk-bugs] [Asterisk 0011116]: [patch] *BSD mutex lock issue
noreply at bugs.digium.com
noreply at bugs.digium.com
Tue May 20 07:43:22 CDT 2008
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=11116
======================================================================
Reported By: ys
Assigned To: russell
======================================================================
Project: Asterisk
Issue ID: 11116
Category: Core/Portability
Reproducibility: sometimes
Severity: minor
Priority: normal
Status: assigned
Asterisk Version: 1.6.0-beta8
SVN Branch (only for SVN checkouts, not tarball releases): 1.4
SVN Revision (number only!): 87498
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 10-30-2007 09:04 CDT
Last Modified: 05-20-2008 07:43 CDT
======================================================================
Summary: [patch] *BSD mutex lock issue
Description:
This is BSD specific issue.
If asterisk compiled on BSD, then used AST_MUTEX_INIT_W_CONSTRUCTORS
definition.
In this case asterisk used gcc constructor/destructor for creation
statically defined mutexes and linklists.
linklist struct may depend at external mutexes, by calling some function
what use it (lock/unlock).
And. But constructor order of calls is unknown (chaotic), some statically
mutex can be uninitialized at
the moment when these function was called.
In result we got sigfault in BSD, when ast_mutex_lock/ast_mutex_unlock are
called with uninitialized
mutexes (reference to NULL pointer), except Linux (where used reference to
structure) ast_mutex_lock
can use uninitialized mutex object.
The same may be applied to orders of destructors functions call.
As result I periodically see "Segmentation fault (core dumped)", mainly at
load/unload/reload CLI commands.
To resolve this problem, as one of the possible ways: init uninitialized
mutex on first request,
as in linux system for statically defined mutexes.
I upload the diff where realize these (BSD platform).
If someone tries to use not initialized mutex, initialize them.
If called init for already initialized mutex, function simply exit.
If try to destroy uninitialized mutex, function simply exit.
Also, I add some debug stuff into rwlock processing, if compiled with
DEBUG_THREADS option.
Path affected this file:
include/asterisk/lock.h
======================================================================
----------------------------------------------------------------------
mvanbaak - 05-20-08 07:43
----------------------------------------------------------------------
done
Issue History
Date Modified Username Field Change
======================================================================
05-20-08 07:43 mvanbaak Note Added: 0087060
======================================================================
More information about the asterisk-bugs
mailing list