[openssl/openssl] cf22c0: prov: remove static globals from provider_init

"'nikolapajkovsky' via openssl-commits" <[email protected]>
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/openssl-3.0/[email protected]>
  Branch: refs/heads/openssl-3.0
  Home:   https://github.com/openssl/openssl
  Commit: cf22c0f77e807649242de689e8da6de0541d5a00
      https://github.com/openssl/openssl/commit/cf22c0f77e807649242de689e8da6de0541d5a00
  Author: Matt Van Horn <[email protected]>
  Date:   2026-07-03 (Fri, 03 Jul 2026)

  Changed paths:
    M providers/defltprov.c

  Log Message:
  -----------
  prov: remove static globals from provider_init

The default provider stored two function pointers from the core
dispatch table (c_gettable_params, c_get_params) in file-scope statics,
written by ossl_default_provider_init() without any synchronization.
When OSSL_PROVIDER_load() is invoked from multiple threads concurrently,
TSAN reports a data race on both writes (issue #28935).

c_gettable_params is never read anywhere in the file; it was dead
storage. c_get_params is only consumed once, inside the same call to
ossl_default_provider_init(), to seed the provider context via
ossl_prov_ctx_set0_core_get_params(). It can therefore be a local
variable rather than file-scope state.

Drop the unused c_gettable_params static together with its dispatch
case, and scope c_get_params inside the init function. The behavior of
the default provider is unchanged for single-threaded callers; the
concurrent-load race goes away because the shared mutable state is
gone.

CLA: trivial
Fixes #28935

Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Fri Jul  3 19:37:32 2026
(Merged from https://github.com/openssl/openssl/pull/31634)

(cherry picked from commit 1ce249061e119eba0034ea79f8fc158facbc7e31)


  Commit: 658f1d68300b34c404bb0b2fa4c6a8bf11a158e1
      https://github.com/openssl/openssl/commit/658f1d68300b34c404bb0b2fa4c6a8bf11a158e1
  Author: Nikola Pajkovsky <[email protected]>
  Date:   2026-07-03 (Fri, 03 Jul 2026)

  Changed paths:
    M providers/baseprov.c

  Log Message:
  -----------
  baseprov: remove static globals

c_gettable_params is never read anywhere in the file; it was dead
storage. c_get_params is only consumed once, inside the same call to
ossl_default_provider_init(), to seed the provider context via
ossl_prov_ctx_set0_core_get_params(). It can therefore be a local
variable rather than file-scope state.

drop the unused c_gettable_params static together with its dispatch
case, and scope c_get_params inside the init function. The behavior of
the base provider is unchanged for single-threaded callers; the
concurrent-load race goes away because the shared mutable state is
gone.

Signed-off-by: Nikola Pajkovsky <[email protected]>

Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Fri Jul  3 19:37:34 2026
(Merged from https://github.com/openssl/openssl/pull/31634)

(cherry picked from commit fdfba64f4fa4f27baec5664201eeaee419298235)


  Commit: 7d91368502016de5edcc19234adda54d1c65d606
      https://github.com/openssl/openssl/commit/7d91368502016de5edcc19234adda54d1c65d606
  Author: Nikola Pajkovsky <[email protected]>
  Date:   2026-07-03 (Fri, 03 Jul 2026)

  Changed paths:
    M providers/fips/fipsprov.c
    M test/p_test.c

  Log Message:
  -----------
  fipsprov: remove c_gettable_params static global

c_gettable_params is never read anywhere in the file; it was dead
storage.

Signed-off-by: Nikola Pajkovsky <[email protected]>

Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Fri Jul  3 19:37:35 2026
(Merged from https://github.com/openssl/openssl/pull/31634)

(cherry picked from commit b582229e185bb4c6fb5ece74badafa783906afc4)


Compare: https://github.com/openssl/openssl/compare/f901148128c4...7d9136850201

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

-- 
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/openssl-3.0/f90114-7d9136%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.