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

bug: s2n_dynamic_load_test breaks when calling s2n_atexit_disable #4827

Open
maddeleine opened this issue Oct 7, 2024 · 0 comments
Open

Comments

@maddeleine
Copy link
Contributor

maddeleine commented Oct 7, 2024

Problem:

The dynamic_load_test is broken if you additionally call s2n_atexit_disable(). This is an important usecase since apparently this is how CRT is used.

The cause of this bug is that when our atexit handler is disabled, the call to s2n_cleanup fully cleans up the library. This means that the destructor to delete the pthread key is a no-op, as it is gated by s2n_is_initialized. So when atexit is disabled, we never delete the pthread key and each subsequent thread that calls s2n_init() creates a new pthread key. If we go over PTHREAD_KEYS_MAX threads, the call to s2n_init() will error since we've run out of keys.

This issue adds other notch to issues linked to our randomness module #4348

Solution:

Not sure what the solution is. We can't remove the is_initialized() call in the pthread destructor because we added it for a bugfix: #4085

Requirements / Acceptance Criteria:

s2n_dynamic_load_test can call s2n_disabled_atexit and succeed.

Out of scope:

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant