Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Issue 5574049: code review 5574049: proc: fix unlock(&procalloc) race (from 9front) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 12 months ago by akumar
Modified:
13 years, 9 months ago
Reviewers:
nix-dev, nemo
CC:
nix-dev_googlegroups.com
Visibility:
Public.

Description

proc: fix unlock(&procalloc) race (from 9front) This one comes from Cinap, for 9front¹ and seems to affect us as well. His comment: "problem is, unlock(&procalloc); decrements up->nlock *after* unlock! proc is on freelist at this point so another cpu can come in and use the proc before, zeroing up->nlock.ref!" ¹ http://code.google.com/p/plan9front/source/detail?r=7afbe2c3d65f4aa3dea6aad9f60e479491c4c200

Patch Set 1 #

Patch Set 2 : diff -r 147dee9a7fe7 https://code.google.com/p/nix-os/ #

Patch Set 3 : diff -r d3ec9fa5fda7 https://code.google.com/p/nix-os/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -1 line) Patch
M sys/src/nix/port/proc.c View 1 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 3
akumar
Hello nix-dev@googlegroups.com (cc: nix-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/nix-os/
13 years, 12 months ago (2012-01-23 19:43:26 UTC) #1
nemo_lsub.org
I'm only looking at the diff in the mail, so perhaps I'm mistaken, but changing ...
13 years, 12 months ago (2012-01-23 19:47:13 UTC) #2
akumar
13 years, 9 months ago (2012-04-24 19:52:09 UTC) #3
Aborted.

On 2012/01/23 19:47:13, nemo_lsub.org wrote:
> I'm only looking at the diff in the mail, so perhaps I'm mistaken, but
> changing break with sched does not look good to me.
> 
> 
> On Mon, Jan 23, 2012 at 8:43 PM,  <mailto:seed@mail.nanosouffle.net> wrote:
> > Reviewers: http://nix-dev_googlegroups.com,
> >
> > Message:
> > Hello mailto:nix-dev@googlegroups.com (cc: mailto:nix-dev@googlegroups.com),
> >
> > I'd like you to review this change to
> > https://code.google.com/p/nix-os/
> >
> >
> > Description:
> > proc: fix unlock(&procalloc) race (from 9front)
> >
> > This one comes from Cinap, for 9front¹ and
> > seems to affect us as well. His comment:
> > "problem is, unlock(&procalloc); decrements
> > up->nlock *after* unlock! proc is on freelist
> > at this point so another cpu can come in and
> > use the proc before, zeroing up->nlock.ref!"
> >
> > ¹
> >
>
http://code.google.com/p/plan9front/source/detail?r=7afbe2c3d65f4aa3dea6aad9f...
> >
> > Please review this at http://codereview.appspot.com/5574049/
> >
> > Affected files:
> > &nbsp;M sys/src/nix/port/proc.c
> >
> >
> > Index: sys/src/nix/port/proc.c
> > ===================================================================
> > --- a/sys/src/nix/port/proc.c
> > +++ b/sys/src/nix/port/proc.c
> > @@ -144,8 +144,11 @@
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;unlock(&pga);
> >
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;psrelease(up);
> > +
> > + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; /* proc is free now, make sure unlock() won't touch
> > it */
> > + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; up = procalloc.p = nil;
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;unlock(&procalloc);
> > - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; break;
> > + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; sched();
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up->mach = nil;
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;updatecpu(up);
> >
> >
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b