lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1307455140.2322.262.camel@twins>
Date:	Tue, 07 Jun 2011 15:59:00 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Hillf Danton <dhillf@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] sched: correct testing need_resched in
 mutex_spin_on_owner()

On Tue, 2011-06-07 at 15:47 +0200, Peter Zijlstra wrote:
> On Tue, 2011-06-07 at 21:41 +0800, Hillf Danton wrote:
> > It is suppose to check the owner task that is not absolutly running on the
> > local CPU, 
> 
> Oh, why do you think so?
> 
> > and if NEED_RESCHED is happenly set on the current task of local
> > CPU, we get incorrect result.
> 
> Only if your above assumption holds, which it doesn't. It explicitly
> checks to see if _this_ cpu needs a resched while spinning, if so it
> bails the spinning and calls schedule in the lock slow path.
> 
> If the owner cpu reschedules, owner will leave the rq and
> owner_running() will return false, also breaking the loop.
> 
> > 
> > Signed-off-by: Hillf Danton <dhillf@...il.com>
> > ---
> >  kernel/sched.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index fd18f39..3ea64fe 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -4326,7 +4326,7 @@ int mutex_spin_on_owner(struct mutex *lock,
> > struct task_struct *owner)
> >  		return 0;
> > 
> >  	while (owner_running(lock, owner)) {
> > -		if (need_resched())
> > +		if (test_tsk_need_resched(owner))
> >  			return 0;
> > 

Furthermore, that can crash the machine, as there's no guarantee owner
is a sane pointer at this point.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ