Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2012 17:37:54 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Xin LI <delphij@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI <delphij@freebsd.org>
Subject:   Re: svn commit: r235301 - head/sys/kern
Message-ID:  <20120512172928.U926@besplex.bde.org>
In-Reply-To: <CAGMYy3twRfACSF9rMCwjJOwUBuT_j9N1VLtTeJ5xNO6xhnd2PA@mail.gmail.com>
References:  <201205112343.q4BNhWh7005829@svn.freebsd.org> <CAGMYy3twRfACSF9rMCwjJOwUBuT_j9N1VLtTeJ5xNO6xhnd2PA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-609456488-1336808274=:926
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Fri, 11 May 2012, Xin LI wrote:

>> Log:
>> =C2=A0Revert previous revision, misunderstood the code :(
>>
>> Modified:
>> =C2=A0head/sys/kern/kern_kthread.c
>>
>> Modified: head/sys/kern/kern_kthread.c
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- head/sys/kern/kern_kthread.c =C2=A0 =C2=A0 =C2=A0 =C2=A0Fri May 11 2=
3:41:52 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r235300)
>> +++ head/sys/kern/kern_kthread.c =C2=A0 =C2=A0 =C2=A0 =C2=A0Fri May 11 2=
3:43:32 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r235301)
>> @@ -182,7 +182,6 @@ kproc_suspend(struct proc *p, int timo)
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (EINVAL);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0SIGADDSET(p->p_siglist, SIGSTOP);
>> - =C2=A0 =C2=A0 =C2=A0 PROC_UNLOCK(p);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0wakeup(p);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0return msleep(&p->p_siglist, &p->p_mtx, PPAUS=
E | PDROP, "suspkp", timo);

Please don't use mailer clients that corrupt whitespace to binary character=
s.
The above is unreadable in vi (but i remember it from the original).

> For the record, p->p_mtx is the mutex used by PROC_[UN]LOCK(), which
> has to be held while calling msleep().

Even if it weren't, dropping the lock before sleeping would give a classic
race.

Otherwise, PROC_UNLOCK() is a good obfuscation.  p_mtx in the sleep call
isn't similarly obfuscated.  Some subsystems have a macro that obfuscates
the name of their lock(s) too, but proc.h doesn't.  kern/*.c has 23
hard-coded references of the form &somep->p_mtx.

Bruce
--0-609456488-1336808274=:926--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120512172928.U926>