File exit.patch of Package qemu

From d73358b598c31f8953232a38e932ff65742f522d Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 5 Jun 2024 13:14:09 +0200
Subject: [PATCH] TARGET_NR_exit

---
 linux-user/syscall.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b9b5a387b3..797771a657 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9109,12 +9109,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
 
         if (CPU_NEXT(first_cpu)) {
             TaskState *ts = get_task_state(cpu);
-
-            if (ts->child_tidptr) {
-                put_user_u32(0, ts->child_tidptr);
-                do_sys_futex(g2h(cpu, ts->child_tidptr),
-                             FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
-            }
+            void *h_child_tidptr = g2h(cpu, ts->child_tidptr);
 
             object_unparent(OBJECT(cpu));
             object_unref(OBJECT(cpu));
@@ -9126,6 +9121,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
 
             pthread_mutex_unlock(&clone_lock);
 
+            if (ts->child_tidptr) {
+                put_user_u32(0, ts->child_tidptr);
+                do_sys_futex(h_child_tidptr,
+                             FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
+            }
             thread_cpu = NULL;
             g_free(ts);
             rcu_unregister_thread();
-- 
2.45.2

openSUSE Build Service is sponsored by