[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash in malloc.c : internal_malloc under Asan

From: Chet Ramey
Subject: Re: Crash in malloc.c : internal_malloc under Asan
Date: Sun, 17 Jan 2021 16:27:53 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/15/21 7:11 PM, Ángel wrote:

lib/malloc/malloc.c, if you want to view it online:

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:


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

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]