Re: [hatari-devel] ASAN issues with tests

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


Le 31/07/2022 à 07:38, Thomas Huth a écrit :
Am Sun, 31 Jul 2022 02:02:38 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:

Hi,

On 30.7.2022 23.29, Nicolas Pomarède wrote:
[...]
In my case I get in both cases:
Tracer caught signal 11: addr=0x0 pc=0x7f5c9873c0f0 sp=0x7f5c883d9d10
==7495==LeakSanitizer has encountered a fatal error.

So AddressSanitizer tries to find leaks at program end, but crashes
instead, maybe due to memory corruption that it did not detect.

Could you try whether it works somehow better if you set this first:

export ASAN_OPTIONS="fast_unwind_on_malloc=0"

?
maybe some memory is allocated by SDL for audio in all cases, but not
correctly free'd when "sound = off" ?

Sounds plausible.

Yes, that sounds likely. If it does not show the correct location, it often
means that it is somewhere in one of the system libraries.

  Thomas



fast_unwind_on_malloc=0 helped a lot to be more verbose.

now I get this : all leaks seem related to Joy_Init which calls SDL_InitSubSystem_REAL.

I tried adding SDL_QuitSubSystem(SDL_INIT_JOYSTICK) before SDL_Quit() in main.c, but it doesn't change anything.

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7f8a62cb8d6f in __interceptor_malloc (/lib64/libasan.so.8+0xb8d6f)
#1 0x7f8a616e4593 (/home/npomarede/src/hatari.git/src/hatari+0x78b0593) #2 0x7f8a616d7cec (/home/npomarede/src/hatari.git/src/hatari+0x78a3cec) #3 0x7f8a62b715b0 in SDL_DBus_Init_Spinlocked (/lib64/libSDL2-2.0.so.0+0x10e5b0)
    #4 0x7f8a62b71bf4 in SDL_DBus_Init (/lib64/libSDL2-2.0.so.0+0x10ebf4)
#5 0x7f8a62a8a06f in SDL_InitSubSystem_REAL (/lib64/libSDL2-2.0.so.0+0x2706f)
    #6 0x682719 in Joy_Init /home/npomarede/src/hatari.git/src/joy.c:135
#7 0x5c6288 in Main_Init_HW /home/npomarede/src/hatari.git/src/main.c:686
    #8 0x5c6288 in main /home/npomarede/src/hatari.git/src/main.c:920
    #9 0x7f8a62230176 in __libc_start_call_main (/lib64/libc.so.6+0x29176)
#10 0x7f8a62230234 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29234) #11 0x5c9430 in _start (/home/npomarede/src/hatari.git/src/hatari+0x5c9430)

Direct leak of 368 byte(s) in 2 object(s) allocated from:
    #0 0x7f8a62cb8757 in calloc (/lib64/libasan.so.8+0xb8757)
#1 0x7f8a616cb4df (/home/npomarede/src/hatari.git/src/hatari+0x78974df) #2 0x7f8a616d042a (/home/npomarede/src/hatari.git/src/hatari+0x789c42a) #3 0x7f8a616d898f (/home/npomarede/src/hatari.git/src/hatari+0x78a498f) #4 0x7f8a616d8ac5 (/home/npomarede/src/hatari.git/src/hatari+0x78a4ac5) #5 0x7f8a616d966e (/home/npomarede/src/hatari.git/src/hatari+0x78a566e) #6 0x7f8a616d9e1c (/home/npomarede/src/hatari.git/src/hatari+0x78a5e1c) #7 0x7f8a616d887c (/home/npomarede/src/hatari.git/src/hatari+0x78a487c) #8 0x7f8a616c133c (/home/npomarede/src/hatari.git/src/hatari+0x788d33c) #9 0x7f8a616c1c67 (/home/npomarede/src/hatari.git/src/hatari+0x788dc67) #10 0x7f8a616c22d4 (/home/npomarede/src/hatari.git/src/hatari+0x788e2d4) #11 0x7f8a616be2c7 (/home/npomarede/src/hatari.git/src/hatari+0x788a2c7) #12 0x7f8a616be537 (/home/npomarede/src/hatari.git/src/hatari+0x788a537) #13 0x7f8a62b71600 in SDL_DBus_Init_Spinlocked (/lib64/libSDL2-2.0.so.0+0x10e600)
    #14 0x7f8a62b71bf4 in SDL_DBus_Init (/lib64/libSDL2-2.0.so.0+0x10ebf4)
#15 0x7f8a62a8a06f in SDL_InitSubSystem_REAL (/lib64/libSDL2-2.0.so.0+0x2706f)
    #16 0x682719 in Joy_Init /home/npomarede/src/hatari.git/src/joy.c:135
#17 0x5c6288 in Main_Init_HW /home/npomarede/src/hatari.git/src/main.c:686
    #18 0x5c6288 in main /home/npomarede/src/hatari.git/src/main.c:920
    #19 0x7f8a62230176 in __libc_start_call_main (/lib64/libc.so.6+0x29176)
#20 0x7f8a62230234 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29234) #21 0x5c9430 in _start (/home/npomarede/src/hatari.git/src/hatari+0x5c9430)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f8a62cb8757 in calloc (/lib64/libasan.so.8+0xb8757)
#1 0x7f8a616cb4df (/home/npomarede/src/hatari.git/src/hatari+0x78974df) #2 0x7f8a616cf786 (/home/npomarede/src/hatari.git/src/hatari+0x789b786) #3 0x7f8a616d291f (/home/npomarede/src/hatari.git/src/hatari+0x789e91f) #4 0x7f8a616c2019 (/home/npomarede/src/hatari.git/src/hatari+0x788e019) #5 0x7f8a616c22b9 (/home/npomarede/src/hatari.git/src/hatari+0x788e2b9) #6 0x7f8a616be2c7 (/home/npomarede/src/hatari.git/src/hatari+0x788a2c7) #7 0x7f8a616be537 (/home/npomarede/src/hatari.git/src/hatari+0x788a537) #8 0x7f8a62b715cf in SDL_DBus_Init_Spinlocked (/lib64/libSDL2-2.0.so.0+0x10e5cf)
    #9 0x7f8a62b71bf4 in SDL_DBus_Init (/lib64/libSDL2-2.0.so.0+0x10ebf4)
#10 0x7f8a62a8a06f in SDL_InitSubSystem_REAL (/lib64/libSDL2-2.0.so.0+0x2706f)
    #11 0x682719 in Joy_Init /home/npomarede/src/hatari.git/src/joy.c:135
#12 0x5c6288 in Main_Init_HW /home/npomarede/src/hatari.git/src/main.c:686
    #13 0x5c6288 in main /home/npomarede/src/hatari.git/src/main.c:920
    #14 0x7f8a62230176 in __libc_start_call_main (/lib64/libc.so.6+0x29176)
#15 0x7f8a62230234 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29234) #16 0x5c9430 in _start (/home/npomarede/src/hatari.git/src/hatari+0x5c9430)


As a test, if I remove the call to JoyInit(), then I don't get leaks on JOYSTICK anymore, but lots of leaks on Video susbsytem :

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7fee3b2b8d6f in __interceptor_malloc (/lib64/libasan.so.8+0xb8d6f)
    #1 0x7fee39e64593  (<unknown module>)
    #2 0x7fee39e57cec  (<unknown module>)
#3 0x7fee3b1715b0 in SDL_DBus_Init_Spinlocked (/lib64/libSDL2-2.0.so.0+0x10e5b0)
    #4 0x7fee3b171bf4 in SDL_DBus_Init (/lib64/libSDL2-2.0.so.0+0x10ebf4)
#5 0x7fee3b08a06f in SDL_InitSubSystem_REAL (/lib64/libSDL2-2.0.so.0+0x2706f)
    #6 0x5c6353 in Main_Init /home/npomarede/src/hatari.git/src/main.c:708
    #7 0x5c6353 in main /home/npomarede/src/hatari.git/src/main.c:952
    #8 0x7fee3aa30176 in __libc_start_call_main (/lib64/libc.so.6+0x29176)
#9 0x7fee3aa30234 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29234) #10 0x5c9430 in _start (/home/npomarede/src/hatari.git/src/hatari+0x5c9430)

Direct leak of 368 byte(s) in 2 object(s) allocated from:
    #0 0x7fee3b2b8757 in calloc (/lib64/libasan.so.8+0xb8757)
    #1 0x7fee39e4b4df  (<unknown module>)
    #2 0x7fee39e5042a  (<unknown module>)
    #3 0x7fee39e5898f  (<unknown module>)
    #4 0x7fee39e58ac5  (<unknown module>)
    #5 0x7fee39e5966e  (<unknown module>)
    #6 0x7fee39e59e1c  (<unknown module>)
    #7 0x7fee39e5887c  (<unknown module>)
    #8 0x7fee39e4133c  (<unknown module>)
    #9 0x7fee39e41c67  (<unknown module>)
    #10 0x7fee39e422d4  (<unknown module>)
    #11 0x7fee39e3e2c7  (<unknown module>)
    #12 0x7fee39e3e537  (<unknown module>)
#13 0x7fee3b171600 in SDL_DBus_Init_Spinlocked (/lib64/libSDL2-2.0.so.0+0x10e600)
    #14 0x7fee3b171bf4 in SDL_DBus_Init (/lib64/libSDL2-2.0.so.0+0x10ebf4)
#15 0x7fee3b08a06f in SDL_InitSubSystem_REAL (/lib64/libSDL2-2.0.so.0+0x2706f)
    #16 0x5c6353 in Main_Init /home/npomarede/src/hatari.git/src/main.c:708
    #17 0x5c6353 in main /home/npomarede/src/hatari.git/src/main.c:952
    #18 0x7fee3aa30176 in __libc_start_call_main (/lib64/libc.so.6+0x29176)
#19 0x7fee3aa30234 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29234) #20 0x5c9430 in _start (/home/npomarede/src/hatari.git/src/hatari+0x5c9430)

main.c line 708 is a call to "SDL_Init(SDL_INIT_VIDEO)"

As thomas confirmed with a small test program, it seems SDL is really leaking some memory that the calling program can't free correctly.

Apart from the SDL leaks, I don't see any leaks related to Hatari itself, but in my case this still make most of the tests fail.

Maybe there's an ASAN option to ignore leaks from SDL lib ? (in my case I'm using sdl 2.0.20)

Nicolas



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