9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@9fans.net
Subject: Re: [9fans] 9vx fork problem
Date: Sun, 29 Jun 2008 22:02:22 -0400	[thread overview]
Message-ID: <20080630020000.4C5791E8C22@holo.morphisms.net> (raw)
In-Reply-To: <20080630003250.GA8819@dinah>

> On 9vx, iostats suicides:
>
>   term% iostats echo
>   iostats 128: suicide: sys: trap: page fault pc=0x0000b21c
>
> Apparently, after a fork, a child retains it's parent's
> pid in _tos->pid. It isn't updated until the next syscall
> finishes with kexit.
>
> This is a problem if the child's first function call is
> malloc. When malloc locks it's pool, it stores the pid
> from _tos in a private area. After the kernel returns from
> the brk, _tos->pid has been corrected by the call to kexit.
> Punlock then fails because the pids don't match.
>
> I'm not sure of the best way to go about fixing this.

Thank you for the detailed reports.
It makes it very easy to fix the bugs!

a1=; hg diff -r37 9vx/vx32.c
diff -r d945b0921bdc src/9vx/vx32.c
--- a/src/9vx/vx32.c	Sun Jun 29 22:01:07 2008 -0400
+++ b/src/9vx/vx32.c	Sun Jun 29 22:01:55 2008 -0400
@@ -186,6 +186,9 @@ void
 void
 forkret(void)
 {
+	extern void kexit(Ureg*);
+
+	kexit(nil);
 	touser(0);
 }

a1=;



  reply	other threads:[~2008-06-30  2:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30  0:32 Anthony Martin
2008-06-30  2:02 ` Russ Cox [this message]
2008-06-30  3:25   ` Anthony Martin
2008-06-30 12:34 ` Steve Simon
2008-06-30 12:42   ` Pietro Gagliardi
2008-06-30 15:14     ` Robert William Fuller
2008-06-30 12:51   ` Russ Cox
2008-06-30 13:03     ` Steve Simon

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=20080630020000.4C5791E8C22@holo.morphisms.net \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).