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

Use an RCU lock for the method store #24344

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Commits on May 7, 2024

  1. Convert ossl_method_store_add() to use an RCU lock instead

    We also convert the various instance of gaining the "property read lock"
    to use RCU too.
    mattcaswell committed May 7, 2024
    Configuration menu
    Copy the full SHA
    7f3bbf8 View commit details
    Browse the repository at this point in the history
  2. Remove ossl_method_store_remove()

    The ossl_method_store_remove() function was never called by anything
    outside of the test suite. So we remove it.
    mattcaswell committed May 7, 2024
    Configuration menu
    Copy the full SHA
    7065045 View commit details
    Browse the repository at this point in the history
  3. Convert ossl_method_store_remove_all_provided for RCU

    We convert the function ossl_method_store_remove_all_provided() from
    using the old lock style to the new RCU lock.
    mattcaswell committed May 7, 2024
    Configuration menu
    Copy the full SHA
    452b400 View commit details
    Browse the repository at this point in the history
  4. Convert ossl_method_store_cache_flush_all() for RCU

    We change the ossl_method_store_cache_flush_all() function to use the
    new RCU lock
    mattcaswell committed May 7, 2024
    Configuration menu
    Copy the full SHA
    e2a7eed View commit details
    Browse the repository at this point in the history

Commits on May 9, 2024

  1. Configuration menu
    Copy the full SHA
    7c3a745 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0e20fca View commit details
    Browse the repository at this point in the history
  3. Convert ossl_method_store_do_all to use an RCU lock

    We need to ensure that we hold a read RCU lock while iterating over the
    store.
    mattcaswell committed May 9, 2024
    Configuration menu
    Copy the full SHA
    5d492e0 View commit details
    Browse the repository at this point in the history
  4. Fix some memory leaks

    mattcaswell committed May 9, 2024
    Configuration menu
    Copy the full SHA
    947a5d9 View commit details
    Browse the repository at this point in the history
  5. Suppress false positives from ThreadSanitizer

    TSan does not understand RCU locks. We suppress false positives from code
    using these locks.
    mattcaswell committed May 9, 2024
    Configuration menu
    Copy the full SHA
    7601083 View commit details
    Browse the repository at this point in the history
  6. Workaround for thread local storage destruction order

    The current OPENSSL_thread_stop() mechanism uses thread local storage
    to store cleanup handlers for the various threads. When a thread exits the
    destructor for the thread local storage gets called and we can call the
    various handlers. The handlers assume that they can still access the
    thread local storage for that particular part of the code - but this relies
    on the OPENSSL_thread_stop() thread local storage being destroyed first.
    If happens in a different order then glibc seems to NULL out thread local
    storage that hasn't been explicitly destroyed causing a memory leak.
    
    glibc seems to call the destructors in the same order that the keys were
    created, so we workaround this by always ensuring that the
    OPENSSL_thread_stop() key is always created first. This is only a
    workaround because it assumes a particular implementation in glibc. We need
    a better solution.
    
    We also revert an earlier change in test/threadstest.h. This was only
    necessary because of this problem and masked the real issue.
    mattcaswell committed May 9, 2024
    Configuration menu
    Copy the full SHA
    f6b6973 View commit details
    Browse the repository at this point in the history

Commits on May 17, 2024

  1. Ensure that we properly synchronize on RCU write unlock

    If we have successfully made updates that on RCU write unlock we need
    to call ossl_syncrhonize_rcu()
    mattcaswell committed May 17, 2024
    Configuration menu
    Copy the full SHA
    490bcc3 View commit details
    Browse the repository at this point in the history