From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C3B93858D33; Fri, 7 Apr 2023 07:46:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C3B93858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680853589; bh=yzmiPiLGLH/F3rCIfRzqHuehgur7m65zPMBnk7skGJU=; h=From:To:Subject:Date:From; b=m1Q5K3JeAkavihTa0kDfAPAWHGdv7r9wJcGT4crV/TKkuNgJAHpota8fez6GwRCws avJs/oYxrVHKuPT50k4qtphXVDCzXC9M22aslk8ITACWYPKdWY2MgPNVXriGolg9fG 2yBLwi6q05ROMd/uEKefgPmFipUJsPe6Jt3ULpNI= From: "mengda2020 at iscas dot ac.cn" To: gdb-prs@sourceware.org Subject: [Bug gdb/30322] New: gdb memory leak Date: Fri, 07 Apr 2023 07:46:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 13.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mengda2020 at iscas dot ac.cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30322 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=20 $ touch utils.o $ touch aaa $ mkdir dir $ touch core.357036 $ ./gdb --cd=3Ddir/ --se=3Dutils.o --core=3Dcore.357036 --exec=3D./aaa --pi= d=3D1680 --symbols=3Dutils.o ### Details ASAN report $./gdb --cd=3Ddir/ --se=3Dutils.o --core=3Dcore.357036 --exec=3D./aaa --pid= =3D1680 --symbols=3Dutils.o=20 ``` 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) preinstall= ed. 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 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: . Find the GDB manual and other documentation resources online at: . 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. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D2012456=3D=3DERROR: 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). ``` --=20 You are receiving this mail because: You are on the CC list for the bug.=