patch-2.2.13 linux/kernel/fork.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/exit.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.12/linux/kernel/fork.c linux/kernel/fork.c
@@ -575,6 +575,13 @@
 	struct task_struct *p;
 	struct semaphore sem = MUTEX_LOCKED;
 
+	if(clone_flags & CLONE_PID)
+	{
+		/* This is only allowed from the boot up thread */
+		if(current->pid)
+			return -EPERM;
+	}
+	
 	current->vfork_sem = &sem;
 
 	p = alloc_task_struct();
@@ -672,6 +679,11 @@
 	if (retval)
 		goto bad_fork_cleanup_mm;
 	p->semundo = NULL;
+	
+	/* Our parent execution domain becomes current domain
+	   These must match for thread signalling to apply */
+	   
+	p->parent_exec_id = p->self_exec_id;
 
 	/* ok, now we should be set up.. */
 	p->swappable = 1;
@@ -698,9 +710,9 @@
 		write_lock_irq(&tasklist_lock);
 		SET_LINKS(p);
 		hash_pid(p);
-		write_unlock_irq(&tasklist_lock);
-
 		nr_tasks++;
+
+		write_unlock_irq(&tasklist_lock);
 
 		p->next_run = NULL;
 		p->prev_run = NULL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)