Re: [hatari-devel] Double free when freeing profile data/symbols

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Thorsten,

Thanks for reporting! I was not able to reproduce the issue, but based on your backtraces, I'm pretty sure it's now fixed.


	- Eero

On 14.9.2022 15.02, Thorsten Otto wrote:
while experimenting with profile data gathered by Hatari, i get an "invalid
free" when the program terminates. Running Hatari under Valgrind reports this:

profile save bla
Disassembled 1872 (of active 1872) CPU addresses.
c
Returning to emulation...
Freed previous CPU profile buffers.
Allocated CPU profile buffer (117 MB).
Allocated CPU profile callsite buffer for 113 symbols.
WARNING: previous PC for tracked address 0x231814 is undefined!
==31832== Conditional jump or move depends on uninitialised value(s)
==31832==    at 0x15CBCF2: symbol_list_free (symbols-common.c:196)
==31832==    by 0x15CEB8B: Symbols_Free (symbols.c:355)
==31832==    by 0x15CF84A: Symbols_RemoveCurrentProgram (symbols.c:784)
==31832==    by 0x62D899: GemDOS_Pterm (gemdos.c:3356)
==31832==    by 0x62E403: GemDOS_Trap (gemdos.c:4072)
==31832==    by 0x6F15AC: OpCode_GemDos (hatari-glue.c:262)
==31832==    by 0x6BC4BA: m68k_run_2_000 (newcpu.c:7146)
==31832==    by 0x6BD006: m68k_go (newcpu.c:7594)
==31832==    by 0x64957B: M68000_Start (m68000.c:305)
==31832==    by 0x64B481: main (main.c:1010)
==31832==
==31832== Invalid free() / delete / delete[] / realloc()
==31832==    at 0x48389AB: free (in /usr/lib64/valgrind/vgpreload_memcheck-
amd64-linux.so)
==31832==    by 0x15CBD1C: symbol_list_free (symbols-common.c:197)
==31832==    by 0x15CEB8B: Symbols_Free (symbols.c:355)
==31832==    by 0x15CF84A: Symbols_RemoveCurrentProgram (symbols.c:784)
==31832==    by 0x62D899: GemDOS_Pterm (gemdos.c:3356)
==31832==    by 0x62E403: GemDOS_Trap (gemdos.c:4072)
==31832==    by 0x6F15AC: OpCode_GemDos (hatari-glue.c:262)
==31832==    by 0x6BC4BA: m68k_run_2_000 (newcpu.c:7146)
==31832==    by 0x6BD006: m68k_go (newcpu.c:7594)
==31832==    by 0x64957B: M68000_Start (m68000.c:305)
==31832==    by 0x64B481: main (main.c:1010)
==31832==  Address 0x5a1bdab is 2,059 bytes inside a block of size 3,324
alloc'd
==31832==    at 0x483777F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-
amd64-linux.so)
==31832==    by 0x15CCF43: symbols_load_gnu (symbols-common.c:728)
==31832==    by 0x15CDDCC: symbols_load_binary (symbols-common.c:1066)
==31832==    by 0x15CE887: Symbols_Load (symbols.c:293)
==31832==    by 0x15CF957: Symbols_LoadCurrentProgram (symbols.c:831)
==31832==    by 0x15C2E82: DebugUI (debugui.c:1189)
==31832==    by 0x15C7701: DebugCpu_Check (debugcpu.c:914)
==31832==    by 0x6B9356: do_specialties (newcpu.c:5061)
==31832==    by 0x6BC5B7: m68k_run_2_000 (newcpu.c:7172)
==31832==    by 0x6BD006: m68k_go (newcpu.c:7594)
==31832==    by 0x64957B: M68000_Start (m68000.c:305)
==31832==    by 0x64B481: main (main.c:1010)
==31832==
Program exit, removing its symbols.

The program i used i attached below, should that matter. Steps to reproduce
can be found in https://www.atari-forum.com/viewtopic.php?p=437796#p437796




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/