nptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786)
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
fail
|
Patch failed to apply
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
fail
|
Patch failed to apply
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
Commit Message
The new initializer and struct layout does not initialize the
__g_signals field in the old struct layout before the change in
commit c36fc50781995e6758cae2b6927839d0157f213c ("nptl: Remove
g_refs from condition variables"). Bring back fields at the end
of struct __pthread_cond_s, so that they are again zero-initialized.
Tested on x86_64-linux-gnu and i686-linux-gnu.
---
sysdeps/nptl/bits/thread-shared-types.h | 2 ++
sysdeps/nptl/pthread.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
base-commit: a8e9022e0f829d44a818c642fc85b3bfbd26a514
Comments
Florian Weimer <fweimer@redhat.com> writes:
> The new initializer and struct layout does not initialize the
> __g_signals field in the old struct layout before the change in
> commit c36fc50781995e6758cae2b6927839d0157f213c ("nptl: Remove
> g_refs from condition variables"). Bring back fields at the end
> of struct __pthread_cond_s, so that they are again zero-initialized.
>
> Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Sam James <sam@gentoo.org>
>
> ---
> sysdeps/nptl/bits/thread-shared-types.h | 2 ++
> sysdeps/nptl/pthread.h | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
> index 7c24c0a6be..e614c7f3c9 100644
> --- a/sysdeps/nptl/bits/thread-shared-types.h
> +++ b/sysdeps/nptl/bits/thread-shared-types.h
> @@ -99,6 +99,8 @@ struct __pthread_cond_s
> unsigned int __g1_orig_size;
> unsigned int __wrefs;
> unsigned int __g_signals[2];
> + unsigned int __unused_initialized_1;
> + unsigned int __unused_initialized_2;
> };
>
> typedef unsigned int __tss_t;
> diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
> index b4d10a37c6..92957a620d 100644
> --- a/sysdeps/nptl/pthread.h
> +++ b/sysdeps/nptl/pthread.h
> @@ -152,7 +152,7 @@ enum
>
>
> /* Conditional variable handling. */
> -#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0} } }
> +#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0}, 0, 0 } }
>
>
> /* Cleanup buffers */
>
> base-commit: a8e9022e0f829d44a818c642fc85b3bfbd26a514
@@ -99,6 +99,8 @@ struct __pthread_cond_s
unsigned int __g1_orig_size;
unsigned int __wrefs;
unsigned int __g_signals[2];
+ unsigned int __unused_initialized_1;
+ unsigned int __unused_initialized_2;
};
typedef unsigned int __tss_t;
@@ -152,7 +152,7 @@ enum
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0} } }
+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0}, 0, 0 } }
/* Cleanup buffers */