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

Audit connection bitfield for thread safety #4036

Closed
wants to merge 4 commits into from

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Jun 6, 2023

Resolved issues:

resolves #4026

Description of changes:

I went through the bitfield in s2n_connection and pulled out the two variables set post-handshake. I also added more documentation to make the situation clearer.

Testing:

Existing tests pass.

I also added a new test that runs with separate threads for send and receive. When run with ThreadSanitizer, it detected the issues fixed in this PR.

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 Jun 6, 2023
@lrstewart lrstewart marked this pull request as ready for review June 6, 2023 03:45
@lrstewart lrstewart force-pushed the threads branch 2 times, most recently from 67bb4d0 to cf221b9 Compare June 6, 2023 07:51
@lrstewart
Copy link
Contributor Author

lrstewart commented Jun 6, 2023

This PR has gotten a bit unfocused / disjointed. I'm going to split out some of the less relevant changes.

@maddeleine
Copy link
Contributor

However, adding -fsanitize=thread to the CI will take some buildspec changes

Is there an issue for this?

tests/unit/s2n_key_update_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_self_talk_threads_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_self_talk_threads_test.c Outdated Show resolved Hide resolved
@lrstewart lrstewart force-pushed the threads branch 2 times, most recently from 03ee173 to 08da3d0 Compare June 13, 2023 18:42
@@ -223,7 +223,7 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));
EXPECT_SUCCESS(s2n_connection_set_io_stuffers(&stuffer, &stuffer, client_conn));

client_conn->key_update_pending = true;
client_conn->key_update_pending = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is this change needed? I tend to prefer bools for flags as it indicates the intent better, rather than it being just some arbitrary number.

@lrstewart
Copy link
Contributor Author

I've been moving the changes from this PR into other PRs. Closing this one.

@lrstewart lrstewart closed this Jun 14, 2023
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.

s2n_connection bitfield potentially shared by s2n_send and s2n_recv
3 participants