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

Use system allocator for thread-local values #1397

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

justsmth
Copy link
Contributor

@justsmth justsmth commented Jan 11, 2024

Issues:

P111627750

Description of changes:

  • Depending on order destructors are called during process exit, custom allocators might no longer be available.
  • This commit uses the system allocator for all of our thread local values.

Call-outs:

Testing:

  • Tested locally.

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

@justsmth justsmth requested a review from a team as a code owner January 11, 2024 13:44
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on order destructors are called during process exit, custom allocators might no longer be available.

do we know which dtor invalidates the OpenSSL allocator? i'm wondering if, knowing which dtor needs to be called last, there's some way to enforce that that dtor is always called last.

crypto/fipsmodule/rand/rand.c Show resolved Hide resolved
@justsmth
Copy link
Contributor Author

Depending on order destructors are called during process exit, custom allocators might no longer be available.

do we know which dtor invalidates the OpenSSL allocator? i'm wondering if, knowing which dtor needs to be called last, there's some way to enforce that that dtor is always called last.

The concern is for consumers that are using CRYPTO_set_mem_functions to inject a custom allocator. At process exit, it's possible that our destructors are being invoked after the consumer's custom allocator (whatever that may be) has been destructed.

@justsmth justsmth enabled auto-merge (squash) January 11, 2024 21:38
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (82ff6a0) 76.81% compared to head (e78d97d) 76.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1397      +/-   ##
==========================================
+ Coverage   76.81%   76.86%   +0.05%     
==========================================
  Files         424      424              
  Lines       71338    71339       +1     
==========================================
+ Hits        54795    54835      +40     
+ Misses      16543    16504      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justsmth justsmth merged commit 7f9b4d9 into aws:main Jan 12, 2024
36 checks passed
justsmth added a commit to justsmth/aws-lc that referenced this pull request Jan 12, 2024
@justsmth justsmth deleted the thread-local-alloc branch January 12, 2024 15:06
dougch pushed a commit to dougch/aws-lc that referenced this pull request Jan 30, 2024
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.

5 participants