<p>Sebastian Kemper <strong>uploaded patch set #3</strong> to this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11217">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">loader: support for permanent dlopen()<br><br>Asterisk assumes that dlopen() will always run the constructor of a<br>shared library and every dlclose() will run its destructor. But dlopen()<br>may be permanent, meaning the constructor will only be run once, as is<br>the case with musl libc.<br><br>With a permanent dlopen() the Asterisk module loader does not work<br>correctly, because it's expectations regarding when the constructors and<br>destructors are run are not met. In fact a segmentation fault will occur<br>when the first module is "re-opened" that has AST_MODFLAG_GLOBAL_SYMBOLS<br>set (the dlopen() does not call the constructor, resource_being_loaded<br>is not set to NULL, then strlen is called with NULL instead of a string,<br>see issue ASTERISK-28319).<br><br>This commit adds code to the loader that will manually run the<br>constructors/destructors of the (non-builtin) modules where needed. To<br>achieve this a new ao2 container (linked list) is started and filled<br>with objects that contain the names of the modules and the pointers to<br>their respective info structs.<br><br>This behavior can be activated when configuring Asterisk<br>(--enable-permanent-dlopen). By default this is disabled, of course.<br><br>ASTERISK-28319 #close<br><br>Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net><br>Change-Id: I86693a0ecf25d5ba81c73773a03df4abc3426875<br>---<br>M configure.ac<br>M main/loader.c<br>2 files changed, 161 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/11217/3</pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11217">change 11217</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11217"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I86693a0ecf25d5ba81c73773a03df4abc3426875 </div>
<div style="display:none"> Gerrit-Change-Number: 11217 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Sebastian Kemper <sebastian_ml@gmx.net> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Sebastian Kemper <sebastian_ml@gmx.net> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>