[Top][All Lists]

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

Re: Valgrind detects invalid read in bash. malloc assertion fails.

From: Chet Ramey
Subject: Re: Valgrind detects invalid read in bash. malloc assertion fails.
Date: Wed, 15 May 2019 09:15:41 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 5/15/19 5:46 AM, Andrew Church wrote:
>>> I assume this is a valgrind false positive.
>> That possible. However, the assertion that causes the abort, is part of
>> the malloc.c version (line 934) that ships with bash. I guess that the
>> issue is caused by the fact that bash uses it's own malloc.c, which
>> seems to be incompatible with valgrind.
> The immediate cause of this error (which is indeed a false positive) is
> that Valgrind replaces calls to functions named "malloc" and "free" with
> its own memory management functions, but Bash's "free" (from
> lib/malloc/malloc.c) is renamed to "sh_xfree" by xmalloc.h.  So memory
> allocations from Bash call Valgrind's malloc(), then eventually pass
> that pointer to Bash's custom free(), which naturally gets confused
> because the pointer wasn't returned from the custom malloc() in the same
> file.

There is a longish discussion about this from two years ago:


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

reply via email to

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