Skip to content

Avoid using String while holding an internal libobjc lock. #938

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

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Feb 3, 2025

String can inadvertently touch libobjc when we implicitly cast it to a C string (when calling getsectiondata()), which can result in a deadlock if that operation needs to acquire one of libobjc's internal locks.

Switch to StaticString which we can guarantee never touches libobjc.

Resolves rdar://144093524.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

`String` can inadvertently touch libobjc when we implicitly cast it to a C
string (when calling `getsectiondata()`), which can result in a deadlock if that
operation needs to acquire one of libobjc's internal locks.

Switch to `StaticString` which we can guarantee never touches libobjc.

Resolves rdar://144093524.
@grynspan grynspan added bug 🪲 Something isn't working darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support labels Feb 3, 2025
@grynspan grynspan added this to the Swift 6.x milestone Feb 3, 2025
@grynspan grynspan self-assigned this Feb 3, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Feb 3, 2025

@swift-ci test

@grynspan grynspan merged commit 10ab127 into main Feb 3, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/144093524-avoid-string branch February 3, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants