Skip to content

bug: s2n_dynamic_load_test breaks when calling s2n_atexit_disable #4827

Open
@maddeleine

Description

@maddeleine

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions