Skip to content

Race condition in SDL_DBus_Init leading to SIGSEGV #3643

Closed
@SDLBugzilla

Description

@SDLBugzilla

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.9
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2020-04-14 21:48:28 +0000, Daniel Glöckner wrote:

I observed the crashes with SDL 2.0.9 in an application that opens multiple audio devices, but it might still happen with the current version (although less likely).

If two threads manage to enter SDL_DBus_Init at the same time and both get past the LoadDBusLibrary line, the first thread that fails to connect to the session bus will clear the function pointers in the dbus structure by calling SDL_DBus_Quit. This might cause the other thread to crash when it still needs to call some of these functions.

I was hit by this bug since by default there is no system bus in Flatpak environments and 2.0.9 still failed when the system bus is not available. D-Bus was accessed in my case because each opened audio device gets its own thread and each of these threads tries to raise its priority by asking rtkit over D-Bus.

How about wrapping SDL_DBus_Init in a mutex?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions