[asterisk-dev] [Code Review] MALLOC_DEBUG enhancements.

David Lee reviewboard at asterisk.org
Wed Nov 7 15:04:32 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2182/#review7373
-----------------------------------------------------------



/branches/1.8/main/astmm.c
<https://reviewboard.asterisk.org/r/2182/#comment14161>

    I'm probably being overly pedantic about this, but it's a bit confusing that reg->fence may or may not be the actual fence, depending on how the alignment works out.



/branches/1.8/main/astmm.c
<https://reviewboard.asterisk.org/r/2182/#comment14162>

    It's worth a comment as to why you don't just use reg->fence to access the fence.



/branches/1.8/main/astmm.c
<https://reviewboard.asterisk.org/r/2182/#comment14163>

    It's worth a comment as to why you don't just use reg->fence to access the fence.


- David


On Nov. 7, 2012, 2:55 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2182/
> -----------------------------------------------------------
> 
> (Updated Nov. 7, 2012, 2:55 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> MALLOC_DEBUG enhancements.
> 
> * Makes malloc() behave like calloc().  It will return a memory block
> filled with 0x55.  A nonzero value.
> 
> * Makes free() fill the released memory block and boundary fence's with
> 0xdeaddead.  Any pointer use after free is going to have a pointer
> pointing to 0xdeaddead.  The 0xdeaddead pointer is usually an invalid
> memory address so a crash is expected.
> 
> * Puts the freed memory block into a circular array so it is not reused
> immediately.
> 
> * When the circular array rotates out a memory block to the heap it checks
> that the memory has not been altered from 0xdeaddead.
> 
> * Made the astmm_log message wording better.
> 
> * Made crash if the DO_CRASH menuselect option is enabled and something is
> found.
> 
> * Fixed a potential alignment issue on 64 bit systems.
> struct ast_region.data[] should now be aligned correctly for all platforms.
> 
> * Extracted region_check_fences() from __ast_free_region() and
> handle_memory_show().
> 
> * Updated handle_memory_show() CLI usage help.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/include/asterisk/astmm.h 376023 
>   /branches/1.8/include/asterisk/utils.h 376023 
>   /branches/1.8/main/asterisk.c 376023 
>   /branches/1.8/main/astmm.c 376023 
>   /branches/1.8/main/utils.c 376023 
> 
> Diff: https://reviewboard.asterisk.org/r/2182/diff
> 
> 
> Testing
> -------
> 
> The MALLOC_DEBUG enhancements were instrumental in pointing out a memory corruption problem.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121107/4d4f57a7/attachment-0001.htm>


More information about the asterisk-dev mailing list