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] [day] [month] [year] [list]
Message-ID: <20140619163209.GN26904@htj.dyndns.org>
Date:	Thu, 19 Jun 2014 12:32:09 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] workqueue: sanity check pool->cpu in wq_worker_sleeping()

On Tue, Jun 03, 2014 at 03:33:08PM +0800, Lai Jiangshan wrote:
> In theory, pool->cpu is equals to @cpu in wq_worker_sleeping() after
> worker->flags is checked.
> 
> And "pool->cpu != cpu" sanity check will help us if something wrong.
> 
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
>  kernel/workqueue.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 9f53abd..61381a2 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -843,7 +843,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
>  	pool = worker->pool;
>  
>  	/* this can only happen on the local cpu */
> -	if (WARN_ON_ONCE(cpu != raw_smp_processor_id()))
> +	if (WARN_ON_ONCE(cpu != raw_smp_processor_id() || pool->cpu != cpu))

Hmmm... yeah, this can catch work functions hijacking and binding
per-cpu worker to another cpu.

Applied to wq/for-3.17.

Thanks.

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