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, 24 Apr 2007 11:18:27 -0600
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Oleg Nesterov <oleg@...sign.ru>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Davide Libenzi <davidel@...ilserver.org>,
	Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Roland McGrath <roland@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps

Oleg Nesterov <oleg@...sign.ru> writes:

> On 04/24, Oleg Nesterov wrote:
>>
>> Hm, mm_release() clears ->vfork_done before complete().

Duh.  Yes somehow I had a blind spot there.  I clearly
need to handle that case.

>> 	mm_release:
>> 
>> 		struct completion *vfork_done = tsk->vfork_done;
>> 
>> 		if (vfork_done) {
>> 			tsk->vfork_done = NULL;
>> 			complete(vfork_done);
>> 		}
>> 
>> 
>> 	kthread_stop:
>> 
>> 		set_tsk_thread_flag(tsk, TIF_KTHREAD_STOP);
>> 		signal_wake_up(tsk, 1);
>> 
>> 		// tsk exits, sets ->vfork_done == NULL
>> 
>> 		wait_for_completion(tsk->vfork_done);
>
> Since the task_struct should be pinned anyway, I think kthread_stop()
> should do:
>
> 	vfork_done = tsk->vfork_done;
> 	barrier();
> 	if (vfork_done)
> 		wait_for_completion(vfork_done);

That should work, and this may explain what is going on. I was trying
to figure out how this could happen but if the thread is running on
another cpu there is a race and it may exit quickly enough to cause us
problems before we get to kthread_stop.

I don't know if this is the problem but it certainly needs to be fixed.

Eric

-
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