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

net/tls: Wait for data_{source,sink}::close() #2547

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Nov 22, 2024

Fixes #799

data_{source,sink}::close() return a future. If it is not ready on close() return, then the current tls session close() may result in use after free.

Converting close_after_shutdown() to a coroutine and sequentially co_awaiting on close() addresses this issue. The waiting is done sequentially, as this is shutdown path anyway.

@p12tic p12tic force-pushed the wait-tls-data-sink-source-close branch 2 times, most recently from 4164e6e to 4e836f0 Compare November 24, 2024 17:17
@p12tic
Copy link
Contributor Author

p12tic commented Nov 24, 2024

Rebased and removed accidentally added whitespace changes

Fixes scylladb#799

data_{source,sink}::close() return a future. If it is not ready on
close() return, then the current tls session close() may result in use
after free.

Converting close_after_shutdown() to a coroutine and sequentially
co_awaiting on close() addresses this issue. The waiting is done
sequentially, as this is shutdown path anyway.
@p12tic p12tic force-pushed the wait-tls-data-sink-source-close branch from 4e836f0 to a0f50e7 Compare November 24, 2024 17:19
@avikivity
Copy link
Member

Can you add a test that fails before the patch and succeeds after it?

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.

tls::server does not wait for the future returned by data_sink::close() and data_source::close() to resolve
2 participants