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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 May 2013 14:28:29 +0530
From:	anish singh <anish198519851985@...il.com>
To:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Borislav Petkov <bp@...en8.de>,
	Li Zhong <zhong@...ux.vnet.ibm.com>,
	Don Zickus <dzickus@...hat.com>
Subject: Re: [RFC PATCH 6/8] kthread: Enable parking requests from setup() and
 unpark() callbacks

On Tue, May 21, 2013 at 1:19 PM, Srivatsa S. Bhat
<srivatsa.bhat@...ux.vnet.ibm.com> wrote:
> On 05/21/2013 11:04 AM, anish singh wrote:
>> On Mon, May 20, 2013 at 9:31 PM, Frederic Weisbecker <fweisbec@...il.com> wrote:
>>> When the watchdog code is boot-disabled by the user, for example
>>> through the 'nmi_watchdog=0' boot option, the setup() callback of
>>> the watchdog kthread requests to park the task, and that until the
>>> user later re-enables the watchdog through sysctl or procfs.
>>>
>>> However the parking request is not well handled when done from
>>> the setup() callback. After ->setup() is called, the generic smpboot
>>> kthread loop directly tries to call the thread function or wait
>>> for some event if ->thread_should_run() is false.
>>>
>>> In the case of the watchdog kthread, ->thread_should_run() returns
>>> false and the kthread goes to sleep and wait for the watchdog timer
>>> to wake it up. But the timer is not enabled since the user requested
>>> to disable the watchdog. We want the kthread to park instead of waiting
>>> for events that can't happen.
>>>
>>> As a result, later unpark requests after sysctl write through
>>> 'sysctl -w kernel.watchdog=1' won't wake up/unpark the task as
>>> expected, since it's not parked anyway, leaving the value modified
>>> without triggering any action.
>> Out of curiosity, this can happen only for short period of time right?After
>> some time this will work right as the thread get back in action
>> after the schedule call.Then sysctl and procfs will work I think.
>
> kthread_unpark() can wake up a task only if the task is in TASK_PARKED
> state. But since the above task would be in TASK_INTERRUPTIBLE state
> (since it is not parked), kthread_unpark() will be powerless to do anything.
Yes but this will happen only for a short period of time right?
After the schdule() call the below code gets executed in while() loop.

if (kthread_should_park()) {
__set_current_state(TASK_RUNNING);
preempt_enable();
if (ht->park && td->status == HP_THREAD_ACTIVE) {
BUG_ON(td->cpu != smp_processor_id());
ht->park(td->cpu);
td->status = HP_THREAD_PARKED;
}
kthread_parkme();
/* We might have been woken for stop */
continue;
}

As we have already called kthread_park this above if() condition gets true and
it will park the thread wouldn't it?But this will happen after the schedule
call which is not right as mentioned by fredrick.
--
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