PS-11143-[8.4] sql/auth: quiesce caching_sha2_password before teardown#6028
PS-11143-[8.4] sql/auth: quiesce caching_sha2_password before teardown#6028lukin-oleksiy wants to merge 1 commit into
Conversation
https://perconadev.atlassian.net/browse/PS-11143 Guard caching_sha2_password entry points during plugin shutdown so auth/cache accesses drain before the singleton is destroyed. This avoids use-after-free on the rwlock-backed password cache in in-flight authentication paths, including threadpool worker threads. Also simplify the lifecycle bookkeeping by keeping it in one small file-scope state object and using the existing scope guard helper for cleanup.
a9ba74f to
13101d4
Compare
jankowsk
left a comment
There was a problem hiding this comment.
That solves the problem of unloading the plugin while an authentication is ongoing. It
would work providing the authentication is never called after deinit. Are we sure this condition is met?
|
Generally, how it works (8.4): do_auth_once() locks the auth plugin (my_plugin_lock_by_name(...)), calls auth->authenticate_user(...), then unlocks it (plugin_unlock(...)) in sql/auth/sql_authentication.cc (around lines 3535-3557). So, conclusion is: we are safe when unloading is complete. |
https://perconadev.atlassian.net/browse/PS-11143
Guard caching_sha2_password entry points during plugin shutdown so auth/cache accesses drain before the singleton is destroyed.
This avoids use-after-free on the rwlock-backed password cache in in-flight authentication paths, including threadpool worker threads.
Also simplify the lifecycle bookkeeping by keeping it in one small file-scope state object and using the existing scope guard helper for cleanup.