[Top][All Lists]

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

Re: Running bash under valgrind gives "invalid free()"

From: Chet Ramey
Subject: Re: Running bash under valgrind gives "invalid free()"
Date: Wed, 12 Apr 2017 09:50:45 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 4/12/17 8:57 AM, Reuben Thomas wrote:
> See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=849517
> ​I can reproduce this also in bash 4.3 as supplied with Ubuntu 16.04, and
> in a build of 4.4 from source on my Ubuntu system.
> ​As stated in the bug report, the bug causes problems beyond bash, as it
> causes build systems to think that valgrind is not working, and hence run
> tests without it.

Look at it this way: if the "bug" can't be reproduced on another OS, or
can't be reproduced using a debugging malloc library other than valgrind,
that points the finger at valgrind or Debian.

For instance, here's what happens when you run valgrind on bash-4.4.12
under RHEL6:

$ valgrind --leak-check=full ./bash -c ''
==12098== Memcheck, a memory error detector
==12098== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==12098== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==12098== Command: ./bash -c
==12098== HEAP SUMMARY:
==12098==     in use at exit: 0 bytes in 0 blocks
==12098==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==12098== All heap blocks were freed -- no leaks are possible
==12098== For counts of detected and suppressed errors, rerun with: -v
==12098== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)

Running the same command using bash's builtin malloc library, which catches
things like invalid frees, or the MacOS X debugging malloc, doesn't produce
that error.

I'll take another look, but it would help if there were some more detail
in the report besides `???'.

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

reply via email to

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