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

fix(bindings): remove mutation behind Arc #5124

Merged
merged 2 commits into from
Feb 19, 2025
Merged

Conversation

jmayclin
Copy link
Contributor

Description of changes:

  • don't mutate item behind immutable ref
  • tie lifetime to CertificateChainHandle

In connection.rs, we essentially mutate a CertificateChainHandle which is behind Arc<CertificateChainHandle>. This does not seem correct.

If you have a reference &T, then normally in Rust the compiler performs optimizations based on the knowledge that &T points to immutable data. Mutating that data, for example through an alias or by transmuting a &T into a &mut T, is considered undefined behavior.
UnsafeCell docs

Additionally, the most accurate place to tag the lifetime is on the underlying CertificateChainHandle, which already has the is_owned field.

Call-outs:

This refactor is being done to simplify the addition of an application-level CertificateChainContext.

Testing:

This is a refactor. All existing tests should continue to pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Feb 18, 2025
* correct out-of-date comment
* rename builder member to cert_handle
@jmayclin jmayclin requested a review from goatgoose February 19, 2025 19:03
@jmayclin jmayclin enabled auto-merge February 19, 2025 19:23
@jmayclin jmayclin added this pull request to the merge queue Feb 19, 2025
Merged via the queue into aws:main with commit 4ae43ec Feb 19, 2025
46 checks passed
@jmayclin jmayclin deleted the fix-arc-freeze branch February 19, 2025 22:24
dougch pushed a commit to dougch/s2n-tls that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants