public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30322] New: gdb memory leak
@ 2023-04-07  7:46 mengda2020 at iscas dot ac.cn
  2023-04-07 19:10 ` [Bug gdb/30322] " tromey at sourceware dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mengda2020 at iscas dot ac.cn @ 2023-04-07  7:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30322

            Bug ID: 30322
           Summary: gdb memory leak
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: mengda2020 at iscas dot ac.cn
  Target Milestone: ---

I found a memory leak bug in gdb.
Please confirm.
Thanks!



### Test Environment
Ubuntu 20.04, 64 bit binutils (version: v13.1 ;master)

### How to trigger
Compile the program with AddressSanitizer
Run command 
$ touch utils.o
$ touch aaa
$ mkdir dir
$ touch core.357036
$ ./gdb --cd=dir/ --se=utils.o --core=core.357036 --exec=./aaa --pid=1680
--symbols=utils.o

### Details
ASAN report
$./gdb --cd=dir/ --se=utils.o --core=core.357036 --exec=./aaa --pid=1680
--symbols=utils.o 
```
warning: Found custom handler for signal 7 (Bus error) preinstalled.
warning: Found custom handler for signal 8 (Floating point exception)
preinstalled.
warning: Found custom handler for signal 11 (Segmentation fault) preinstalled.
warning: Found custom handler for signal 15 (Terminated) preinstalled.
Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)
won't be propagated to spawned programs.
GNU gdb (GDB) 13.0.50.20220805-git
Copyright (C) 2022 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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"...
./aaa: No such file or directory.
utils.o: No such file or directory.
Can't attach to process and specify a core file at the same time.

=================================================================
==2012456==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/lengthFuzz/binutils/gdb/gdb_cd_se_c_e_p_s/gdb+0x4e242d)
    #1 0x1de9fa6 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/top.c:313:19
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/gdb.c:32:10
    #6 0x7f7aecdff082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

Direct leak of 52 byte(s) in 1 object(s) allocated from:
    #0 0x4b0963 in __interceptor_realloc
(/home/cmd/lengthFuzz/binutils/gdb/gdb_cd_se_c_e_p_s/gdb+0x4b0963)
    #1 0x7f7aeceea077 in getcwd
/build/glibc-SzIz7B/glibc-2.31/io/../sysdeps/unix/sysv/linux/getcwd.c:84:8

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/lengthFuzz/binutils/gdb/gdb_cd_se_c_e_p_s/gdb+0x4e242d)
    #1 0x1dea176 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/top.c:315:19
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/gdb.c:32:10
    #6 0x7f7aecdff082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/lengthFuzz/binutils/gdb/gdb_cd_se_c_e_p_s/gdb+0x4e242d)
    #1 0x1de9fc1 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/top.c:313:35
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/FuzzDateset/binutils/binutils-gdb-binutils-2_39/gdb/gdb.c:32:10
    #6 0x7f7aecdff082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: 260 byte(s) leaked in 4 allocation(s).
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/30322] gdb memory leak
  2023-04-07  7:46 [Bug gdb/30322] New: gdb memory leak mengda2020 at iscas dot ac.cn
@ 2023-04-07 19:10 ` tromey at sourceware dot org
  2023-06-01 13:30 ` tromey at sourceware dot org
  2023-06-09 20:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-04-07 19:10 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30322

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |tromey at sourceware dot org
   Last reconfirmed|                            |2023-04-07
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I think that 'ui' leak is known and kind of a pain to get rid of.
Not sure but maybe my unfinished rewrite of the redirection code fixes it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/30322] gdb memory leak
  2023-04-07  7:46 [Bug gdb/30322] New: gdb memory leak mengda2020 at iscas dot ac.cn
  2023-04-07 19:10 ` [Bug gdb/30322] " tromey at sourceware dot org
@ 2023-06-01 13:30 ` tromey at sourceware dot org
  2023-06-09 20:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-06-01 13:30 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30322

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 30504 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/30322] gdb memory leak
  2023-04-07  7:46 [Bug gdb/30322] New: gdb memory leak mengda2020 at iscas dot ac.cn
  2023-04-07 19:10 ` [Bug gdb/30322] " tromey at sourceware dot org
  2023-06-01 13:30 ` tromey at sourceware dot org
@ 2023-06-09 20:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-06-09 20:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30322

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 30533 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-09 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07  7:46 [Bug gdb/30322] New: gdb memory leak mengda2020 at iscas dot ac.cn
2023-04-07 19:10 ` [Bug gdb/30322] " tromey at sourceware dot org
2023-06-01 13:30 ` tromey at sourceware dot org
2023-06-09 20:02 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).