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

Inadequate Atomic Guarantees In QTHREAD_FASTLOCK_LOCK #190

Closed
insertinterestingnamehere opened this issue Dec 5, 2023 · 1 comment · Fixed by #206
Closed

Inadequate Atomic Guarantees In QTHREAD_FASTLOCK_LOCK #190

insertinterestingnamehere opened this issue Dec 5, 2023 · 1 comment · Fixed by #206
Labels
bug medium priority tsan Thread Sanitizer Errors

Comments

@insertinterestingnamehere
Copy link
Collaborator

insertinterestingnamehere commented Dec 5, 2023

QTHREAD_FASTLOCK_LOCK and the related functions need to be rewritten to use atomic reads and writes instead of relying on the atomicity guarantees from x86. For example, there's currently a race condition between

QTHREAD_FASTLOCK_LOCK(&(m->lock));
and
QTHREAD_FASTLOCK_UNLOCK(&(m->lock));
.

Note: this shows up readily in the hello_world_multi test.

@insertinterestingnamehere
Copy link
Collaborator Author

This also shows up inside the hash map when running the syncvar_prodcons test with thread sanitizer on. Specifically:

QTHREAD_FASTLOCK_LOCK(h->lock);
and
QTHREAD_FASTLOCK_UNLOCK(h->lock);

insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Dec 5, 2023
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Dec 7, 2023
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Jan 18, 2024
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Jan 18, 2024
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Jan 18, 2024
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Jan 18, 2024
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Feb 2, 2024
insertinterestingnamehere added a commit to insertinterestingnamehere/qthreads that referenced this issue Feb 6, 2024
@insertinterestingnamehere insertinterestingnamehere added the tsan Thread Sanitizer Errors label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug medium priority tsan Thread Sanitizer Errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant