Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jan 2025 00:26:42 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e2268518dff0 - stable/14 - libpthread_init(): ensure curthread == NULL until set explicitly
Message-ID:  <202501210026.50L0QgEY013286@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501210026.50L0QgEY013286>