Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Aug 2022 00:44:14 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: fedb2ee64c0d - stable/13 - thread_create(): call cpu_copy_thread() after td_pflags is zeroed
Message-ID:  <202208100044.27A0iEXe017431@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit fedb2ee64c0d2d853131df994729d2e4f522c1b3
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-07 17:00:02 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-10 00:44:03 +0000

    thread_create(): call cpu_copy_thread() after td_pflags is zeroed
    
    (cherry picked from commit 1b0a4974c5004216daf4a2ac4375074ce56bc55b)
---
 sys/compat/linux/linux_fork.c | 4 ++--
 sys/kern/kern_thr.c           | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index bcd5ffe3c589..2839e865e95f 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -280,8 +280,6 @@ linux_clone_thread(struct thread *td, struct l_clone_args *args)
 	if (error)
 		goto fail;
 
-	cpu_copy_thread(newtd, td);
-
 	bzero(&newtd->td_startzero,
 	    __rangeof(struct thread, td_startzero, td_endzero));
 	bcopy(&td->td_startcopy, &newtd->td_startcopy,
@@ -290,6 +288,8 @@ linux_clone_thread(struct thread *td, struct l_clone_args *args)
 	newtd->td_proc = p;
 	thread_cow_get(newtd, td);
 
+	cpu_copy_thread(newtd, td);
+
 	/* create the emuldata */
 	linux_proc_init(td, newtd, true);
 
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 18722cc6a73d..5da2735facb4 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -231,8 +231,6 @@ thread_create(struct thread *td, struct rtprio *rtp,
 	if (error)
 		goto fail;
 
-	cpu_copy_thread(newtd, td);
-
 	bzero(&newtd->td_startzero,
 	    __rangeof(struct thread, td_startzero, td_endzero));
 	bcopy(&td->td_startcopy, &newtd->td_startcopy,
@@ -241,6 +239,8 @@ thread_create(struct thread *td, struct rtprio *rtp,
 	newtd->td_rb_list = newtd->td_rbp_list = newtd->td_rb_inact = 0;
 	thread_cow_get(newtd, td);
 
+	cpu_copy_thread(newtd, td);
+
 	error = initialize_thread(newtd, thunk);
 	if (error != 0) {
 		thread_cow_free(newtd);



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