Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

al_run_detached_thread: fix segfault on detaching when the thread is already gone #1047

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dos1
Copy link
Contributor

@dos1 dos1 commented May 3, 2019

detached_thread_func_trampoline freed the outer thread at its end. If outer->proc
was really fast to finish, _al_thread_detach could get called with &outer->thread
as its argument after outer was already freed.

Usually it would be fast enough to not ever be overwritten after freeing, but tools
like asan explicitly overwrite freed memory, leading to reproducible crash.

…already gone

detached_thread_func_trampoline freed the outer thread at its end. If outer->proc
was really fast to finish, _al_thread_detach could get called with &outer->thread
as its argument after outer was already freed.

Usually it would be fast enough to not ever be overwritten after freeing, but tools
like asan explicitly overwrite freed memory, leading to reproducible crash.
@dos1
Copy link
Contributor Author

dos1 commented May 12, 2019

I'm getting some segfaults with this patch now, let's hold with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant