[openssl/openssl] 6d1963: crypto/threads_pthread.c: Cleanup misaligned prepr...

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


  Branch: refs/heads/openssl-3.3
  Home:   https://github.com/openssl/openssl
  Commit: 6d1963b2dfb878652546bfa107dde6962f2e55c8
      https://github.com/openssl/openssl/commit/6d1963b2dfb878652546bfa107dde6962f2e55c8
  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)

(cherry picked from commit 81f393498b333534111e320a33e3b244db06bbe9)


  Commit: 8cecc55b85219c9e1f08012c4d2d0687d985625f
      https://github.com/openssl/openssl/commit/8cecc55b85219c9e1f08012c4d2d0687d985625f
  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)

(cherry picked from commit a02077d4d7aeb0c99cc88cdfc7c131e48f98c4de)


Compare: https://github.com/openssl/openssl/compare/af187d8ed3b8...8cecc55b8521

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