bug-bash
[Top][All Lists]
Advanced

[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:46:37 -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:41 AM, Reuben Thomas wrote:

> ​This is not the result I obtained. I simply ran gdb on the bash binary,
> valgrind was not involved.​

If you didn't build the binary yourself, you don't know what changes were
made to it.  Here's what I got on Fedora 25.

[chet@caleb-fedora25 bash-20170407]$ ./bash --version
GNU bash, version 4.4.12(1)-maint (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[chet@caleb-fedora25 bash-20170407]$ gdb ./bash
GNU gdb (GDB) Fedora 7.12-24.fc25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bash...done.
(gdb) b xfree
Breakpoint 1 at 0x47e180: file /home/chet/src/bash-20170407/xmalloc.c, line
147.
(gdb) r -c ''
Starting program: /home/chet/build/bash-20170407/bash -c ''
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.24-3.fc25.x86_64

Breakpoint 1, xfree (string=0x7bd218)
    at /home/chet/src/bash-20170407/xmalloc.c:147
147       if (string)
Missing separate debuginfos, use: dnf debuginfo-install
ncurses-libs-6.0-6.20160709.fc25.x86_64
(gdb) s
148         free (string);
(gdb) s
free (mem=0x7bd218) at /home/chet/src/bash-20170407/lib/malloc/malloc.c:1338
1338      internal_free (mem,  (char *)NULL, 0, 0);
(gdb) s
internal_free (mem=0x7bd218, file=0x0, line=0, flags=0)
    at /home/chet/src/bash-20170407/lib/malloc/malloc.c:868
868       if ((ap = (char *)mem) == 0)
(gdb)


-- 
``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/



reply via email to

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