git: 86f6ff9ff00e - main - libthr: move dlerror_msg into zeroed part of struct thread

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 28 Dec 2024 17:20:23 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=86f6ff9ff00e2ba4d4cd5b7a94d57b1c3f85ff98

commit 86f6ff9ff00e2ba4d4cd5b7a94d57b1c3f85ff98
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-23 23:48:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-28 17:01:34 +0000

    libthr: move dlerror_msg into zeroed part of struct thread
    
    struct thread reuse might cause stalled rtld error message to propagate
    to the new thread.
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D48200
---
 lib/libthr/thread/thr_private.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index d6c12348e3ab..926e868293cd 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -562,8 +562,12 @@ struct pthread {
 
 	/* Deferred threads from pthread_cond_signal. */
 	unsigned int 		*defer_waiters[MAX_DEFER_WAITERS];
-#define _pthread_endzero	wake_addr
 
+	/* rtld thread-local dlerror message and seen control */
+	char			dlerror_msg[512];
+	int			dlerror_seen;
+
+#define _pthread_endzero	wake_addr
 	struct wake_addr	*wake_addr;
 #define WAKE_ADDR(td)           ((td)->wake_addr)
 
@@ -572,10 +576,6 @@ struct pthread {
 
 	/* pthread_set/get_name_np */
 	char			*name;
-
-	/* rtld thread-local dlerror message and seen control */
-	char			dlerror_msg[512];
-	int			dlerror_seen;
 };
 
 #define THR_SHOULD_GC(thrd) 						\