[openssl/openssl] 83efcf: Make rcu_thread_key context-aware

Neil Horman noreply at github.com
Thu Jun 20 14:56:55 UTC 2024


  Branch: refs/heads/openssl-3.3
  Home:   https://github.com/openssl/openssl
  Commit: 83efcfdfa1de760bd30df7f4cf94e7a0d2b0db9f
      https://github.com/openssl/openssl/commit/83efcfdfa1de760bd30df7f4cf94e7a0d2b0db9f
  Author: Neil Horman <nhorman at openssl.org>
  Date:   2024-06-20 (Thu, 20 Jun 2024)

  Changed paths:
    M crypto/conf/conf_mod.c
    M crypto/context.c
    M crypto/threads_none.c
    M crypto/threads_pthread.c
    M crypto/threads_win.c
    M doc/internal/man3/ossl_rcu_lock_new.pod
    M include/internal/cryptlib.h
    M include/internal/rcu.h
    M test/threadstest.c
    M test/threadstest.h

  Log Message:
  -----------
  Make rcu_thread_key context-aware

Currently, rcu has a global bit of data, the CRYPTO_THREAD_LOCAL object
to store per thread data.  This works in some cases, but fails in FIPS,
becuase it contains its own copy of the global key.

So
1) Make the rcu_thr_key a per-context variable, and force
   ossl_rcu_lock_new to be context aware

2) Store a pointer to the context in the lock object

3) Use the context to get the global thread key on read/write lock

4) Use ossl_thread_start_init to properly register a cleanup on thread
   exit

5) Fix up missed calls to OSSL_thread_stop() in our tests

(cherry picked from commit 24d16d3a1915a06a2130385a87de9a37fc09c4b9)

Fixes #24581

Reviewed-by: Paul Dale <ppzgs1 at gmail.com>
Reviewed-by: Matt Caswell <matt at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24630)


  Commit: d38d2642287ef9a22f20e662a19c217c227043a6
      https://github.com/openssl/openssl/commit/d38d2642287ef9a22f20e662a19c217c227043a6
  Author: Neil Horman <nhorman at openssl.org>
  Date:   2024-06-20 (Thu, 20 Jun 2024)

  Changed paths:
    M crypto/threads_none.c
    M crypto/threads_pthread.c
    M crypto/threads_win.c
    M test/threadstest.c

  Log Message:
  -----------
  Some minor nit corrections in the thread code for rcu

Reviewed-by: Paul Dale <ppzgs1 at gmail.com>
Reviewed-by: Matt Caswell <matt at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24630)


Compare: https://github.com/openssl/openssl/compare/a13df6879682...d38d2642287e

To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications


More information about the openssl-commits mailing list