Merged revisions 376049 via svnmerge from

file:///srv/subversion/repos/asterisk/trunk

................
  r376049 | rmudgett | 2012-11-08 11:38:31 -0600 (Thu, 08 Nov 2012) | 41 lines
  
  Add 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.
  
  Review: https://reviewboard.asterisk.org/r/2182/
  ........
  
  Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Automerge script
2012-11-08 18:19:49 +00:00
parent f28061145f
commit f69513b85b
5 changed files with 456 additions and 133 deletions

View File

@@ -2219,3 +2219,35 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size)
return NULL;
}
void ast_do_crash(void)
{
#if defined(DO_CRASH)
abort();
/*
* Just in case abort() doesn't work or something else super
* silly, and for Qwell's amusement.
*/
*((int *) 0) = 0;
#endif /* defined(DO_CRASH) */
}
#if defined(AST_DEVMODE)
void __ast_assert_failed(int condition, const char *condition_str, const char *file, int line, const char *function)
{
/*
* Attempt to put it into the logger, but hope that at least
* someone saw the message on stderr ...
*/
ast_log(__LOG_ERROR, file, line, function, "FRACK!, Failed assertion %s (%d)\n",
condition_str, condition);
fprintf(stderr, "FRACK!, Failed assertion %s (%d) at line %d in %s of %s\n",
condition_str, condition, line, function, file);
/*
* Give the logger a chance to get the message out, just in case
* we abort(), or Asterisk crashes due to whatever problem just
* happened after we exit ast_assert().
*/
usleep(1);
ast_do_crash();
}
#endif /* defined(AST_DEVMODE) */