[PATCH 10/10] [2.35] nptl: PTHREAD_COND_INITIALIZER compatibility with pre-2.41 versions (bug 32786)

sunilkumar.dora@windriver.com sunilkumar.dora@windriver.com
Wed Jul 23 10:18:27 GMT 2025


From: Florian Weimer <fweimer@redhat.com>

[BZ #25847]

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.

(cherry picked from commit dbc5a50d12eff4cb3f782129029d04b8a76f58e7)

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 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 6f17afa473..2354ea219f 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 bbb365407e..8d6d24ff87 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 */
-- 
2.49.0



More information about the Libc-stable mailing list