-
Notifications
You must be signed in to change notification settings - Fork 791
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
[21435] Solve SecurityManager memory issue #5115
Conversation
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change makes sense to me.
I like more the approach of making the method thread safe, since find_change
and remove_change
already take the mutex as commented in the description.
However, if the first solution proposal is finally chosen, I think it would make sense to rename the method to remove_change_and_reuse_nts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We would need to backport this to |
@Mergifyio backport 2.14.x 2.10.x |
✅ Backports have been created
|
Description
A memory issue is reported by ASAN when running tests using security such as BlackboxTests_DDS_PIM.Security.BuiltinAuthenticationPlugin_second_participant_creation_loop.
The issue is that the events thread might call
SecurityManager::resend_handshake_message_token
, which internally callsWriterHistory::remove_change_and_reuse
, the latter not being (atomically) thread safe. If at the same time a handshake is processed (SecurityManager::on_process_handshake
) from another thread, this may resolve in a change being added to the aforementioned writer history. As a result a change is added toHistory::m_changes
vector, which would invalidate the iterator dealt with inWriterHistory::remove_change_and_reuse
without protection.Two potential solutions are proposed:
WriterHistory::remove_change_and_reuse
from the security manager, as it's done when callingPDPServer::remove_change_from_history_nts
WriterHistory::remove_change_and_reuse
fully, converting it in an atomic thread-safe method. Note that since the functions internally called from within this method already take the mutex, no (new) deadlocks should be introduced.@Mergifyio backport 2.14.x 2.10.x
Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist