git: e2268518dff0 - stable/14 - libpthread_init(): ensure curthread == NULL until set explicitly
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Jan 2025 00:26:42 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e2268518dff082d32b8399ccdac37ce3c597f178
commit e2268518dff082d32b8399ccdac37ce3c597f178
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-14 22:11:48 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-21 00:24:55 +0000
libpthread_init(): ensure curthread == NULL until set explicitly
(cherry picked from commit 676be27133fa3296f3d9083732d8837a3eaa5ea4)
---
lib/libthr/thread/thr_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index ff59288d919e..80f7c05ee5ce 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -332,6 +332,8 @@ _libpthread_init(struct pthread *curthread)
/* Set the initial thread. */
if (curthread == NULL) {
first = 1;
+ /* Force _get_curthread() return NULL until set. */
+ _tcb_get()->tcb_thread = NULL;
/* Create and initialize the initial thread. */
curthread = _thr_alloc(NULL);
if (curthread == NULL)