ASAN memcopy overlap on Ubuntu Budgie from libSDL 2.0.6+dfsg1

Bug #1743086 reported by Klaus Halfmann
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

I revived some Ubuntu Budgie I have on an USB-Stick for an older iMAC.
For the sake of completeness I compiled Widelands bzr8554[trunk].

On startup I immediately got the following assertions form ASAN:

[] [../src/profile/profile.cc:138] disable_music: '' is not a boolean value
=================================================================
==20453==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x62900046f200,0x6290004715c0) and [0x6290004703e0, 0x6290004727a0) overlap
    #0 0xd05f06 (/home/klaus/develop/wideland-repo/trunk/widelands+0xd05f06)
    #1 0x7f01eea9be9a (/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0+0x21e9a)
    #2 0x7f01eea9c3b6 (/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0+0x223b6)
    #3 0x7f01ee61492f (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb92f)
    #4 0x165bd01 (/home/klaus/develop/wideland-repo/trunk/widelands+0x165bd01)
    #5 0x165b43b (/home/klaus/develop/wideland-repo/trunk/widelands+0x165b43b)
    #6 0x1659096 (/home/klaus/develop/wideland-repo/trunk/widelands+0x1659096)
    #7 0x1657a10 (/home/klaus/develop/wideland-repo/trunk/widelands+0x1657a10)
    #8 0xda4e9d (/home/klaus/develop/wideland-repo/trunk/widelands+0xda4e9d)
    #9 0xda3ac6 (/home/klaus/develop/wideland-repo/trunk/widelands+0xda3ac6)
    #10 0xda2e17 (/home/klaus/develop/wideland-repo/trunk/widelands+0xda2e17)
    #11 0x7f01ebc541c0 (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
    #12 0xcaf4e9 (/home/klaus/develop/wideland-repo/trunk/widelands+0xcaf4e9)

0x62900046f200 is located 0 bytes inside of 18304-byte region [0x62900046f200,0x629000473980)
allocated by thread T0 here:
    #0 0xd64d38 (/home/klaus/develop/wideland-repo/trunk/widelands+0xd64d38)
    #1 0x7f01ee614901 (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb901)
    #2 0x3fffffffffffffff (<unknown module>)

0x6290004703e0 is located 4576 bytes inside of 18304-byte region [0x62900046f200,0x629000473980)
allocated by thread T0 here:
    #0 0xd64d38 (/home/klaus/develop/wideland-repo/trunk/widelands+0xd64d38)
    #1 0x7f01ee614901 (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb901)
    #2 0x3fffffffffffffff (<unknown module>)

SUMMARY: AddressSanitizer: memcpy-param-overlap (/home/klaus/develop/wideland-repo/trunk/widelands+0xd05f06)
==20453==ABORTING

libsdl2-mixer-dev is 2.0.1+dfsg1-3
libsdl2-dev is 2.0.6+dfsg1-3ubuntu1

* Maybe this is an old / new Bug inherited from libSDL2
* Note thet message about disable_music
* starting widelands with --no sound works (tested upto the multiplayer lobby)

at the end I get:

=================================================================
==20514==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0xd64d38 (/home/klaus/develop/wideland-repo/trunk/widelands+0xd64d38)
    #1 0x7f0aaf1959d0 (/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0+0xab9d0)
    #2 0xda4e8c (/home/klaus/develop/wideland-repo/trunk/widelands+0xda4e8c)
    #3 0xda3ac6 (/home/klaus/develop/wideland-repo/trunk/widelands+0xda3ac6)
    #4 0xda2e17 (/home/klaus/develop/wideland-repo/trunk/widelands+0xda2e17)
    #5 0x7f0aac2c41c0 (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)

I will not use this computer again unril we _must_ reproduce this bug, so please
contact me if you need more details

Tags: asan sdl

Related branches

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Does not happen on OSX with bzr8554[trunk] and
libsdl2_mixer @2.0.2 and libsdl2 @2.0.7.

Can someone using Ubuntu on a regular basis compare, pelase?

Revision history for this message
Vej (vej) wrote :

Hello!
I can verify this with the current trunk (8610) and a fresh Ubuntu 17.10.

My Stacktrace:

==25986==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x6290004e7200,0x6290004e95c0) and [0x6290004e83e0, 0x6290004ea7a0) overlap
    #0 0x7fc91dcf1425 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79425)
    #1 0x7fc91c108e9a (/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0+0x21e9a)
    #2 0x7fc91c1093b6 (/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0+0x223b6)
    #3 0x7fc91da3192f in Mix_LoadWAV_RW (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb92f)
    #4 0x55b4b9baa75e in SoundHandler::load_one_fx(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/etc/widelands/src/sound/sound_handler.cc:282
    #5 0x55b4b9baa2db in SoundHandler::load_fx_if_needed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/etc/widelands/src/sound/sound_handler.cc:259
    #6 0x55b4b9ba8539 in SoundHandler::load_system_sounds() /home/etc/widelands/src/sound/sound_handler.cc:219
    #7 0x55b4b9ba7014 in SoundHandler::init() /home/jonas/etc/widelands/src/sound/sound_handler.cc:133
    #8 0x55b4b94f25a2 in WLApplication::WLApplication(int, char const* const*) /home/etc/widelands/src/wlapplication.cc:346
    #9 0x55b4b94f13d5 in WLApplication::get(int, char const**) /home/etc/widelands/src/wlapplication.cc:261
    #10 0x55b4b94ef756 in main /home/jonas/etc/widelands/src/main.cc:47
    #11 0x7fc91b2161c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
    #12 0x55b4b94ef619 in _start (/home/etc/widelands/widelands+0xcc3619)

0x6290004e7200 is located 0 bytes inside of 18304-byte region [0x6290004e7200,0x6290004eb980)
allocated by thread T0 here:
    #0 0x7fc91dd56d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x7fc91da31901 in Mix_LoadWAV_RW (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb901)
    #2 0x3fffffffffffffff (<unknown module>)

0x6290004e83e0 is located 4576 bytes inside of 18304-byte region [0x6290004e7200,0x6290004eb980)
allocated by thread T0 here:
    #0 0x7fc91dd56d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x7fc91da31901 in Mix_LoadWAV_RW (/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so.0+0xb901)
    #2 0x3fffffffffffffff (<unknown module>)

SUMMARY: AddressSanitizer: memcpy-param-overlap (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79425)
==25986==ABORTING

End of stacktrace.

Changed in widelands:
status: New → Confirmed
GunChleoc (gunchleoc)
Changed in widelands:
importance: Undecided → High
milestone: none → build20-rc1
tags: added: asan
Revision history for this message
GunChleoc (gunchleoc) wrote :

@Klaus: I can't reproduce this bug on my machine, so I have assigned you, just in case you find time to work on this.

I tried deleting the config file and entering nonsense values for the option that gets flagged up in the original stack trace, but it's working fine here.

Changed in widelands:
assignee: nobody → Klaus Halfmann (klaus-halfmann)
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I meanwhile build it with -a / No ASAN (took me > 2h) and then it worked.
Had no time to do some real testing. I assume this is related to
libsdl2_mixer nd libsdl2 Version as found un Ubuntu.
(and or the way they are compiled)
libsdl2-mixer-dev is 2.0.1+dfsg1-3
libsdl2-dev is 2.0.6+dfsg1-3ubuntu1

How can we make them bump the versions?

This happens a the very start and may not actually harm us,
OTOH it may result in a crash much later, no idea.

Vej can you test this? so we could at least lower the priority.

Revision history for this message
kaputtnik (franku) wrote :

I guess this is the same as (or inherited from) bug 1720819.

See also bug 1722060 for the Ubuntu SDL-Package.

Since this is an upstream bug, it should be marked as invalid for widelands and as a duplicate of bug 1720819, imho.

Revision history for this message
Vej (vej) wrote :

Hello!

My versions of libsdl are the same as mentioned in comment #4.

> Vej can you test this? so we could at least lower the priority.

Can you give me more details on how to test this. I tried to run `./compile.sh -a` which did not fix that.

> How can we make them bump the versions?
Someone needs to Triage first (I will do this if my test runs successful).

 After that someone (not me) needs to take both upstream packages (the fixed and the not fixed one) and compare them. There does not seem to be a dedicated release to fix this, so one needs to make a debiandiff containing nothing but the required change and attach it to the bugreport.

After that comes some tagging, targeting and team assigning, while one needs to make a proper SRU justification (these steps could be done by me again).

This will hopefully catch the attention of a packager (or a MOTU), who creates a new updatepackage and add it to an update (or applies an upstream sync of the update branch with debian testing if he can justify it).

Revision history for this message
GunChleoc (gunchleoc) wrote :

I guess it can't hurt to add the same workaround that Red Eclipse has, just in case?

https://github.com/red-eclipse/base/commit/70c19e9cf25b9e3aae9e97d391cecb8e8d24b52c

@Vej: you might need to delete your build directory and compile from scratch again for `./compile.sh -a` to work properly.

If you can help with getting https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1722060 resolved, that would be great :)

tags: added: sdl
Revision history for this message
Vej (vej) wrote :

Hello again!

@Vej: you might need to delete your build directory and compile from scratch again for `./compile.sh -a` to work properly.
memory acess violation.
With that I can build and run it unless I open a game. That crashes with a memory access violation.

So I would assume, that ASAN was right to complain here.

GunChleoc (gunchleoc)
Changed in widelands:
assignee: Klaus Halfmann (klaus-halfmann) → GunChleoc (gunchleoc)
Revision history for this message
GunChleoc (gunchleoc) wrote :

The attached branch detects SDL 2.1.6 and switches off the sound system. Can somebody with an affected system please test this?

Revision history for this message
GunChleoc (gunchleoc) wrote :

Typo, I mean SDL 2.0.6 of course.

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.