Skip to content

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 6, 2024

  • Explanation: We used C atomics but these were allocated as Swift variables. Even thought they were atomic, concurrent accesses to them could violate Swift’s exclusivity laws, raising thread sanitizer errors. Allocate the C atomic using malloc to fix this problem.
  • Scope: Only affects assert builds
  • Risk: Low, only affects assert builds
  • Testing: Verified that we no longer hit a thread sanitizer issue in SourceKit-LSP with this change
  • Issue: rdar://129170128
  • Reviewer: @hamishknight on Heap allocate our atomics #2671

We used C atomics but these were allocated as Swift variables. Even thought they were atomic, concurrent accesses to them could violate Swift’s exclusivity laws, raising thread sanitizer errors.

Allocate the C atomic using malloc to fix this problem.
@ahoppen ahoppen requested a review from bnbarham as a code owner June 6, 2024 13:39
@ahoppen
Copy link
Member Author

ahoppen commented Jun 6, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit 4c6cc0a into swiftlang:release/6.0 Jun 6, 2024
@ahoppen ahoppen deleted the 6.0/atomic-on-heap branch June 6, 2024 20:06
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.

2 participants