about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/fork.c')
-rw-r--r--sysdeps/mach/hurd/fork.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index 60c34c7620..51bc2c0753 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -129,9 +129,13 @@ __fork (void)
       ports_locked = 1;
 
 
+      /* Keep our SS locked while stopping other threads, so they don't get a
+         chance to have it locked in the copied space.  */
+      __spin_lock (&ss->lock);
       /* Stop all other threads while copying the address space,
 	 so nothing changes.  */
       err = __proc_dostop (_hurd_ports[INIT_PORT_PROC].port, ss->thread);
+      __spin_unlock (&ss->lock);
       if (!err)
 	{
 	  stopped = 1;