mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Lista Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: pid allocator bug ?
Date: Fri, 15 Feb 2002 01:58:10 +0100	[thread overview]
Message-ID: <20020215015810.C14226@werewolf.able.es> (raw)
In-Reply-To: <20020214172941.A14007@hendriks.cx>
In-Reply-To: <20020214172941.A14007@hendriks.cx>; from erik@hendriks.cx on vie, feb 15, 2002 at 01:29:41 +0100

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:
>
...
>
>        * 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.

--- linux-2.4.17/kernel/fork.c.orig	Mon Feb  4 14:53:31 2002
+++ linux-2.4.17/kernel/fork.c	Mon Feb  4 14:53:53 2002
@@ -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)

????

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
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

           reply	other threads:[~2002-02-15  0:58 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20020214172941.A14007@hendriks.cx>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020215015810.C14226@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®