mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] fix do_fork() return value
@ 2003-05-20  2:46 Rusty Russell
  2003-05-25 17:31 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Rusty Russell @ 2003-05-20  2:46 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, torvalds

# 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".

Thanks!
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix do_fork() return value
  2003-05-20  2:46 [PATCH] fix do_fork() return value Rusty Russell
@ 2003-05-25 17:31 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2003-05-25 17:31 UTC (permalink / raw)
  To: Rusty Russell; +Cc: mingo, linux-kernel, torvalds

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?]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-25 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-20  2:46 [PATCH] fix do_fork() return value Rusty Russell
2003-05-25 17:31 ` Pavel Machek

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®