On 1/15/21 7:11 PM, Ángel wrote:
lib/malloc/malloc.c, if you want to view it online: https://git.savannah.gnu.org/cgit/bash.git/tree/lib/malloc/malloc.c Maybe libasan is providing its own malloc and there is a conflict of calls between theirs and bash mallocs. I would recommend to rebuild bash with the parameter --without-bash-malloc and see if that makes the error go away (which is likely).
It's not a conflict so much as the bash malloc using different function names to implement the conventional malloc functionality, and address sanitizer (and valgrind, for that matter) not interposing those functions. For instance, the bash debugging malloc uses sh_malloc and sh_free, and both those functions and the conventional malloc/free call internal_malloc and internal_free, respectively. Bash also uses xfree through a function pointer in a callback fashion to implement unwind-protect cleanups, which confuses valgrind, at least, because it doesn't think the allocations and frees match. Thestructure is described here: https://lists.gnu.org/archive/html/bug-bash/2017-04/msg00053.html Asan and valgrind are easy to confuse; their assumptions are consistent with `normal' usage of the libc malloc implementation(s). If you want to use asan all the time, configure bash --without-bash-malloc as Ángel suggested. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/