浏览代码

{linux,bsd}-user: Update ts_tid after fork()

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>
Ilya Leoshkevich 1 年之前
父节点
当前提交
d4e1369abe
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      bsd-user/main.c
  2. 1 0
      linux-user/main.c

+ 1 - 0
bsd-user/main.c

@@ -134,6 +134,7 @@ void fork_end(int child)
          * state, so we don't need to end_exclusive() here.
          * state, so we don't need to end_exclusive() here.
          */
          */
         qemu_init_cpu_list();
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
         gdbserver_fork(thread_cpu);
     } else {
     } else {
         mmap_fork_end(child);
         mmap_fork_end(child);

+ 1 - 0
linux-user/main.c

@@ -161,6 +161,7 @@ void fork_end(int child)
             }
             }
         }
         }
         qemu_init_cpu_list();
         qemu_init_cpu_list();
+        get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id();
         gdbserver_fork(thread_cpu);
         gdbserver_fork(thread_cpu);
     } else {
     } else {
         cpu_list_unlock();
         cpu_list_unlock();