{linux,bsd}-user: Update ts_tid after fork()
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 5 Mar 2024 12:09:40 +0000 (12:09 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Wed, 6 Mar 2024 12:35:19 +0000 (12:35 +0000)
Currently ts_tid contains the parent tid after fork(), which is not
correct. So far it has not affected anything, but the upcoming
follow-fork-mode child support relies on the correct value, so fix it.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20240219141628.246823-4-iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240305121005.3528075-5-alex.bennee@linaro.org>

bsd-user/main.c
linux-user/main.c

index 512d4ab69fc95e26448e1ea32fa340a2ae0ce8e3..e39eef3040fecfde4b5947bf8f314c1b9c887439 100644 (file)
@@ -134,6 +134,7 @@ void fork_end(int child)
          * state, so we don't need to end_exclusive() here.
          */
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
     } else {
         mmap_fork_end(child);
index 551acf1661938a92d2064a56d04b3fa362e3d375..699da77371427f6fe4e5ae63081605285f6b530a 100644 (file)
@@ -161,6 +161,7 @@ void fork_end(int child)
             }
         }
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
     } else {
         cpu_list_unlock();