File exit.patch of Package qemu

From 208396935fad0e86b15f7c8b909caf36b049a616 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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 125eaf9ecb..442eba1f9b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9409,11 +9409,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
 
         if (CPU_NEXT(first_cpu)) {
             TaskState *ts = get_task_state(cpu);
+            void *h_child_tidptr = g2h(cpu, ts->child_tidptr);
 
             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);
             }
 
             object_unparent(OBJECT(cpu));
@@ -9426,6 +9425,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
 
             pthread_mutex_unlock(&clone_lock);
 
+            if (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.51.0

openSUSE Build Service is sponsored by