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: <4d3f68f8-e599-6b27-a2e8-9e96b401d57a@codeaurora.org>
Date:   Thu, 26 Apr 2018 21:23:25 +0530
From:   "Kohli, Gaurav" <gkohli@...eaurora.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     tglx@...utronix.de, mpe@...erman.id.au, mingo@...nel.org,
        bigeasy@...utronix.de, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org,
        Neeraj Upadhyay <neeraju@...eaurora.org>,
        Will Deacon <will.deacon@....com>,
        Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against
 wakeup

On 4/26/2018 2:27 PM, Peter Zijlstra wrote:

> On Thu, Apr 26, 2018 at 10:41:31AM +0200, Peter Zijlstra wrote:
>> diff --git a/kernel/kthread.c b/kernel/kthread.c
>> index cd50e99202b0..4b6503c6a029 100644
>> --- a/kernel/kthread.c
>> +++ b/kernel/kthread.c
>> @@ -177,12 +177,13 @@ void *kthread_probe_data(struct task_struct *task)
>>   
>>   static void __kthread_parkme(struct kthread *self)
>>   {
>> -	__set_current_state(TASK_PARKED);
>> -	while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) {
>> +	for (;;) {
>> +		__set_task_state(TASK_PARKED);
> 		set_current_state(TASK_PARKED);
>
> of course..

Hi Peter,

Maybe i am missing something , but still that race can come as we don't put task_parked on special state.

Controller                                                                       Hotplug

                                                                                  Loop

                                                                                  Task_Interruptible

Set SHOULD_PARK

wakeup -> Proceeds

                                                                                   Set Running

                                                                                   kthread_parkme

                                                                                   SET TASK_PARKED

                                                                                   schedule

Set TASK_RUNNING

Can you please correct ME, if I misunderstood this.

>
>> +		if (!test_bit(KTHREAD_SHOULD_PARK, &self->flags))
>> +			break;
>>   		if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags))
>>   			complete(&self->parked);
>>   		schedule();
>> -		__set_current_state(TASK_PARKED);
>>   	}
>>   	clear_bit(KTHREAD_IS_PARKED, &self->flags);
>>   	__set_current_state(TASK_RUNNING);
>>
>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ