Skip to contentSkip to conversation

pid allocator bug ?

PATCH J.A. Magallon 1 participant 1 message Feb 15, 2002 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · On 20020215 Erik Arjan Hendriks wrote:

BProc 3.1.7 is out and in the usual spot:

http://sourceforge.net/project/showfiles.php?group_id=24453&release_id=75172

Release notes and change log follow:

...

Quoted 3 lines

* Added patch for Linux PID allocator bug.

Patch is like this:

$Id: linux-2.4.17-fork-pid-alloc.patch,v 1.1 2002/02/14 17:21:35 hendriks Exp $

This patch fixes a bug in the Linux process ID allocator. It isn't quite SMP safe since it references "last_pid" after releasing the lock protecting it. This can result in two processes getting assigned the same process ID.

kernel/fork.c renamed from kernel/fork.c.orig +3 -1
@@ -85,6 +85,7 @@
 {
 	static int next_safe = PID_MAX;
 	struct task_struct *p;
+	int pid;
 
 	if (flags & CLONE_PID)
 		return current->pid;
@@ -120,9 +121,10 @@
 		}
 		read_unlock(&tasklist_lock);
 	}
+	pid = last_pid;
 	spin_unlock(&lastpid_lock);
 
-	return last_pid;
+	return pid;
 }
 
 static inline int dup_mmap(struct mm_struct * mm)

????

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.18-rc1-slb1 #1 SMP Thu Feb 14 01:04:12 CET 2002 i686