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: <alpine.DEB.2.02.1309121534130.4089@ionos.tec.linutronix.de>
Date:	Thu, 12 Sep 2013 15:36:04 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Libin <huawei.libin@...wei.com>
cc:	akpm@...ux-foundation.org, tj@...nel.org, viro@...iv.linux.org.uk,
	eparis@...hat.com, rusty@...tcorp.com.au, ebiederm@...ssion.com,
	paulmck@...ux.vnet.ibm.com, john.stultz@...aro.org,
	mingo@...hat.com, peterz@...radead.org, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org, lizefan@...wei.com,
	jovi.zhangwei@...wei.com, guohanjun@...wei.com,
	zhangdianfang@...wei.com, wangyijing@...wei.com
Subject: Re: [PATCH 06/14] irq: Fix invalid wakeup in
 irq_wait_for_interrupt

On Thu, 29 Aug 2013, Libin wrote:
> If this thread is preempted at(or before) location a, and the other thread
> set the condition(kthread_stop). After that when this thread is re-scheduled,
> calling set_current_state to set itself as state TASK_INTERRUPTIBLE, if it is
> preempted again after that and before __set_current_state(TASK_RUNNING), it
> triggers the invalid wakeup problem.
> -----------------------
> irq_wait_for_interrupt()
> -----------------------
> ...
> //location a
> set_current_state(TASK_INTERRUPTIBLE);
> //location b
> while (!kthread_should_stop()) {
> 
> 	if (test_and_clear_bit(IRQTF_RUNTHREAD,
> 					   &action->thread_flags)) {
> 			__set_current_state(TASK_RUNNING);
> 			return 0;
> 	}
> 	schedule();//location c
> 	set_current_state(TASK_INTERRUPTIBLE);
> 	//location d
> }
> __set_current_state(TASK_RUNNING);
> ...
> 
> The following circumstance will also trigger this issue:
> At location c, consumer is scheduled out, and be preempted after calling
> set_current_state(TASK_INTERRUPTIBLE) when it be re-schdeuled.
> 
> To solve this problem, using preempt_disable() to bound the operaion that
> setting the task state and the conditions(set by the wake thread) validation.

This is a completely pointless exercise. The irq threads are only
woken from the core code itself and not by some random other threads.

The core code already handles the legit wakeups correctly without
having the need for preemption disable.

Thanks,

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