From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Subject: Re: [9fans] 9vx fork problem From: "Russ Cox" Date: Sun, 29 Jun 2008 22:02:22 -0400 In-Reply-To: <20080630003250.GA8819@dinah> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20080630020000.4C5791E8C22@holo.morphisms.net> Topicbox-Message-UUID: cc1a1992-ead3-11e9-9d60-3106f5b1d025 > 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=;