[openssl/openssl] 81f393: crypto/threads_pthread.c: Cleanup misaligned prepr...

Richard Levitte noreply at github.com
Tue Apr 16 07:20:06 UTC 2024


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 81f393498b333534111e320a33e3b244db06bbe9
      https://github.com/openssl/openssl/commit/81f393498b333534111e320a33e3b244db06bbe9
  Author: Richard Levitte <levitte at openssl.org>
  Date:   2024-04-16 (Tue, 16 Apr 2024)

  Changed paths:
    M crypto/threads_pthread.c

  Log Message:
  -----------
  crypto/threads_pthread.c: Cleanup misaligned preprocessor directives

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24123)


  Commit: a02077d4d7aeb0c99cc88cdfc7c131e48f98c4de
      https://github.com/openssl/openssl/commit/a02077d4d7aeb0c99cc88cdfc7c131e48f98c4de
  Author: Richard Levitte <levitte at openssl.org>
  Date:   2024-04-16 (Tue, 16 Apr 2024)

  Changed paths:
    M crypto/threads_pthread.c

  Log Message:
  -----------
  crypto/threads_pthread.c: refactor all atomics fallbacks for type safety

The atomics fallbacks were using 'void *' as a generic transport for all
possible scalar and pointer types, with the hypothesis that a pointer is
as large as the largest possible scalar type that we would use.

Then enters the use of uint64_t, which is larger than a pointer on any
32-bit system (or any system that has 32-bit pointer configurations).

We could of course choose a larger type as a generic transport.  However,
that only pushes the problem forward in time...  and it's still a hack.
It's therefore safer to reimplement the fallbacks per type that atomics
are used for, and deal with missing per type fallbacks when the need
arrises in the future.

For test build purposes, the macro USE_ATOMIC_FALLBACKS is introduced.
If OpenSSL is configured with '-DUSE_ATOMIC_FALLBACKS', the fallbacks
will be used, unconditionally.

Fixes #24096

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24123)


Compare: https://github.com/openssl/openssl/compare/3c0bb68c75bc...a02077d4d7ae

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