[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: |
Thu, 13 Apr 2017 11:27:48 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 4/13/17 11:18 AM, Reuben Thomas wrote:
> On 13 April 2017 at 16:11, Chet Ramey <chet.ramey@case.edu
> <mailto:chet.ramey@case.edu>> wrote:
>
>
> I see no reason why, since all of these things are defined in the same
> file and are statically linked, `free' would resolve to the glibc free
> when malloc resolves to the bash malloc.
>
>
> So this is the real problem?
If it is, it's a valgrind artifact. Contrary to Julian's (?) assumption,
free() resolves to the bash free implementation when compiled normally. I
tested this on a Fedora 25 VM I was using for something else. Putting a
breakpoint in xfree, running bash -c '', and stepping through it ends up
in the free() defined in lib/malloc/malloc.c.
>
> Do you have any suggestions for how I might investigate this?
Personally, I think the problem is that valgrind makes invalid assumptions:
that interposing malloc/realloc/free is sufficient. I showed it isn't.
You can try building without the bash malloc, but that's kind of a drastic
solution to just get rid of a valgrind false positive.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Re: Running bash under valgrind gives "invalid free()", (continued)
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()",
Chet Ramey <=
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/14
- Re: Running bash under valgrind gives "invalid free()", Hanno Böck, 2017/04/12
- Re: Running bash under valgrind gives "invalid free()", Chet Ramey, 2017/04/12
- Re: Running bash under valgrind gives "invalid free()", Reuben Thomas, 2017/04/13