[Home]

Summary:ASTERISK-24155: [patch]Non-portable and non-reliable recursion detection in ast_malloc
Reporter:Timo Teräs (fabled)Labels:
Date Opened:2014-08-04 08:32:07Date Closed:2015-03-27 02:08:17
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/General Core/Portability
Versions:12.4.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ast_log_safe-11.patch
( 1) ast_log_safe-13.patch
( 2) ast_log_safe-trunk.patch
( 3) musl-outofmem-handling.patch
Description:Great care was earlier taken to not depend on execinfo.h's backtrace() which is non-portable. It was used if available, but it was not required. But now an unconditional core code dependency to it was added.

This is also non-reliable on certain hardware architectures if the binary is fully stripped as there is no unwind information present.

Basically the function is used for purposes it should never be used for. Please replace the recursive call logic with something better. See attached patch for one suggestions.
Comments:By: Timo Teräs (fabled) 2014-08-04 08:33:03.799-0500

One alternate way to detect recursive malloc failures.

By: Rusty Newton (rnewton) 2014-08-07 09:57:50.548-0500

Thanks!  For this patch and the other you just filed, you'll want to go ahead and throw them on Reviewboard if possible, following the [Code Review|https://wiki.asterisk.org/wiki/display/AST/Code+Review] process.

By: Corey Farrell (coreyfarrell) 2015-03-15 20:35:55.640-0500

[~fabled]: Your patch gave me an idea, I've attached patches for ast_log_safe.  Will post to reviewboard shortly.

By: Corey Farrell (coreyfarrell) 2015-03-15 21:22:20.033-0500

In the first upload ast_log_safe did not pass callid to ast_log_full.  Patches updated.