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

coreinit: fix race condition that causes crash #1138

Merged
merged 1 commit into from Mar 26, 2024

Conversation

goeiecool9999
Copy link
Contributor

@goeiecool9999 goeiecool9999 commented Mar 25, 2024

On linux cemu sometimes randomly crashes on startup. Looking at the coredump in a debugger showed that it crashed in emplace_back for a vector because of a double free. Write access to a vector is not thread-safe, but when cemu is in multi-core recompiler mode when the timing is just right two or more threads simultaneously emplace in the vector. Added a mutex to protect access.

@Exzap
Copy link
Contributor

Exzap commented Mar 26, 2024

The timing on this race condition is extremely narrow, so it's interesting that you got it to trigger. Thanks for the fix

@Exzap Exzap merged commit 111e383 into cemu-project:main Mar 26, 2024
5 checks passed
@goeiecool9999 goeiecool9999 deleted the fixracecondition branch March 27, 2024 15:35
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.

None yet

2 participants