mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: [PATCH] fix do_fork() return value
Date: Sun, 25 May 2003 19:31:20 +0200	[thread overview]
Message-ID: <20030525173119.GA26077@elf.ucw.cz> (raw)
In-Reply-To: <20030520024801.535E02C002@lists.samba.org>

Hi!

> # Noticed by Julie DeWandel <jdewand@redhat.com>.
> # 
> # do_fork() needs to return the pid (or error), not the pointer to the
> # resulting process structure.  The process structure may not even be
> # valid any more, since do_fork() has already woken the process up (and as
> # a result it might already have done its thing and gone away).
> # 
> # Besides, doing it this way cleans up the users, which all really just
> # wanted the pid or error number _anyway_.
> 
> Just FYI: the change was done in the first place to allow spawning a
> new init thread as CPUs come up.  But now we have copy_process it can
> be done neatly (it should also be done out of keventd so we get a
> clean thread, but that's another story).
> 
> Note that this version also has a (theoretical) race, except hidden
> by the time to wrap PIDs ie. "never happens".

We have more such wrappers. IIRC, it is possible to go into
/proc/PID/something, and just stay there, kill the process, and wait
for PIDs to wrap around, fun stuff happens...
								Pavel
-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

      reply	other threads:[~2003-05-25 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-20  2:46 Rusty Russell
2003-05-25 17:31 ` Pavel Machek [this message]

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=20030525173119.GA26077@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    /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®