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: <20090901130436.GA22514@redhat.com>
Date:	Tue, 1 Sep 2009 15:04:36 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	arjan@...radead.org, jeremy@...p.org, mschmidt@...hat.com,
	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	tj@...nel.org, tglx@...utronix.de,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-tip-commits@...r.kernel.org
Subject: Re: [PATCH] kthreads: Fix startup synchronization boot crash

On 09/01, Ingo Molnar wrote:
>
> In fact i dont see any proper serialization here: there appears to
> be a race between the initial task and the init task (which are not
> one and the same). The race is possibly timing dependent as well,
> hence the (in hindsight, false) dependency on the stackprotector
> commit.

Yes, this looks racy, and I think this was always racy.

> I think the bug was introduced
> via:
>
>   cdd140b: kthreads: simplify the startup synchronization

Cough ;) No, I don't think this patch introduced this bug. With or without
this patch, kthread_create() assumes kthreadd_task != NULL, otherwise
wake_up_process(kthreadd_task) is obviously can crash.

>  static DEFINE_SPINLOCK(kthread_create_lock);
>  static LIST_HEAD(kthread_create_list);
> +
>  struct task_struct *kthreadd_task;
> +DECLARE_COMPLETION(kthreadd_task_init_done);
>
>  struct kthread_create_info
>  {
> @@ -129,6 +131,9 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
>  	list_add_tail(&create.list, &kthread_create_list);
>  	spin_unlock(&kthread_create_lock);
>
> +	if (unlikely(!kthreadd_task))
> +		wait_for_completion(&kthreadd_task_init_done);
> +

Yes, this should work. But I _think_ we can make the better fix...

I'll try to make the patch soon. Afaics we don't need kthreadd_task_init_done.

Oleg.

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