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 14:21:59 -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:46 AM, Chet Ramey wrote:
> 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.

And before anyone asks, here's what I got on Debian 8 with bash-4.4.12,
built from source.

chet@debian8-caleb:~/build/bash-4.4.12$ ./bash --version
GNU bash, version 4.4.12(1)-release (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@debian8-caleb:~/build/bash-4.4.12$ gdb ./bash
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 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-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 0x4799b0: file /home/chet/src/bash-4.4.12/xmalloc.c, line 147.
(gdb) r -c ''
Starting program: /home/chet/build/bash-4.4.12/bash -c ''

Breakpoint 1, xfree (string=0x71d1c8)
    at /home/chet/src/bash-4.4.12/xmalloc.c:147
147       if (string)
(gdb) where
#0  xfree (string=0x71d1c8) at /home/chet/src/bash-4.4.12/xmalloc.c:147
#1  0x000000000046194c in unwind_frame_run_internal (
    tag=0x4d67e9 "parse_and_execute top", ignore=0x0)
    at /home/chet/src/bash-4.4.12/unwind_prot.c:333
#2  0x0000000000461d60 in without_interrupts (arg2=<optimized out>,
    arg1=<optimized out>, function=<optimized out>)
    at /home/chet/src/bash-4.4.12/unwind_prot.c:123
#3  run_unwind_frame (tag=0x71d1c8 "",
    tag@entry=0x4d67e9 "parse_and_execute top")
    at /home/chet/src/bash-4.4.12/unwind_prot.c:151
#4  0x000000000047ff99 in parse_and_execute (string=<optimized out>,
    from_file=from_file@entry=0x4c0905 "-c", flags=flags@entry=4)
    at /home/chet/src/bash-4.4.12/builtins/evalstring.c:455
#5  0x000000000041f4ba in run_one_command (command=<optimized out>)
    at /home/chet/src/bash-4.4.12/shell.c:1399
#6  0x0000000000421122 in main (argc=3, argv=0x7fffffffe368,
    env=0x7fffffffe388) at /home/chet/src/bash-4.4.12/shell.c:724
(gdb) s
148         free (string);
(gdb) s
free (mem=0x71d1c8) at /home/chet/src/bash-4.4.12/lib/malloc/malloc.c:1273
1273      internal_free (mem,  (char *)NULL, 0, 0);
(gdb) s
internal_free (mem=0x71d1c8, file=0x0, line=0, flags=<optimized out>)
    at /home/chet/src/bash-4.4.12/lib/malloc/malloc.c:846
846     internal_free (mem, file, line, flags)
(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]