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]
Date:	Tue, 09 Dec 2008 09:07:25 -0600
From:	Brian King <brking@...ux.vnet.ibm.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	mingo@...e.hu, efault@....de, vatsa@...ibm.com,
	balbir@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] sched: CPU remove deadlock fix

Peter Zijlstra wrote:
> On Tue, 2008-12-09 at 08:47 -0600, Brian King wrote:
>> This patch fixes a possible deadlock scenario in the CPU remove path.
>> migration_call grabs rq->lock, then wakes up everything on rq->migration_queue
>> with the lock held. Then one of the tasks on the migration queue ends up
>> calling tg_shares_up which then also tries to acquire the same rq->lock.
> 
> Looks ok, does lockdep agree?

I didn't have lockdep enabled when I verified it, but the section of code now
looks like:

spin_lock_irq(&rq->lock);
while (!list_empty(&rq->migration_queue)) {
	struct migration_req *req;

	req = list_entry(rq->migration_queue.next,
		 struct migration_req, list);
	list_del_init(&req->list);
	spin_unlock_irq(&rq->lock);
	complete(&req->done);
	spin_lock_irq(&rq->lock);
}
spin_unlock_irq(&rq->lock);

So I'm pretty sure lockdep will agree.

-Brian

> 
>> Signed-off-by: Brian King <brking@...ux.vnet.ibm.com>
>> ---
>>
>>  kernel/sched.c |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff -puN kernel/sched.c~sched_cpu_down_deadlock_fix kernel/sched.c
>> --- linux-2.6/kernel/sched.c~sched_cpu_down_deadlock_fix	2008-12-09 08:42:09.000000000 -0600
>> +++ linux-2.6-bjking1/kernel/sched.c	2008-12-09 08:42:09.000000000 -0600
>> @@ -6587,7 +6587,9 @@ migration_call(struct notifier_block *nf
>>  			req = list_entry(rq->migration_queue.next,
>>  					 struct migration_req, list);
>>  			list_del_init(&req->list);
>> +			spin_unlock_irq(&rq->lock);
>>  			complete(&req->done);
>> +			spin_lock_irq(&rq->lock);
>>  		}
>>  		spin_unlock_irq(&rq->lock);
>>  		break;
>> _
> 


-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center


--
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