[Home]

Summary:ASTERISK-25021: Fix invalid pointer dereference on module load
Reporter:Emmanuel Dreyfus (manu0208)Labels:
Date Opened:2015-04-28 03:43:35Date Closed:2015-05-21 09:20:44
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/General
Versions:1.8.32.3 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:After upgrading asterisk,, the daemon crashes on startup if the autoload=yes option iis not enabled in modules.conf's modules section.

This happens because of invalid pointer dereference during module loading. Here is the technical analysis:

If a module once failed to load with globally exposed symbols, the DSO is unloaded while the struct ast_module remains valid and referenced,  with just mod->lib being NULL.

If the module is later attempted to be loaded again, typically on a second attempt without globally exposed symbols, we get an unpleasant crash because mod->lib is used.

A fix is proposed here:
[edit by Rusty - inline patch removed as per the guidelines, see comment on patch contribution process]

In this patch, we check mod->lib and if it is NULL, we call load_dynamic_module() again to reload the DSO.

Wa also add an additional test that mod->lib is not NULL to make sure code path using it will not be used if something still goes wrong.
Comments:By: Rusty Newton (rnewton) 2015-04-30 18:52:00.264-0500

Per the Asterisk versions page [1], the maintenance (bug fix) support for the Asterisk branch you are using has ended. For continued maintenance support please move to a supported branch of Asterisk. After testing with a supported branch, if you find this problem has not been resolved, please open a new issue against the latest version of that Asterisk branch.

Thanks!

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions



By: Rusty Newton (rnewton) 2015-04-30 18:53:15.048-0500

If this issue applies to a supported branch (11,13) then please follow the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process] as we cannot accept inline patches not submitted under CLA.

By: Matt Jordan (mjordan) 2015-05-21 09:20:44.647-0500

Asterisk 1.8 no longer receives bug fixes, and I'm not able to reproduce this issue in 11+. On top of that, the module loader was tweaked in both 11 and 13. If this is still a problem, please provide explicit instructions and configuration files that reproduce the issue in the supported versions.