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:	Fri, 12 Jun 2009 16:00:44 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Stanislaw Gruszka <sgruszka@...hat.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/2] posix-cpu-timers: remove tasklist_lock where we can

On 06/12, Stanislaw Gruszka wrote:
>
> tasklist_lock is not needed to protect find_task_by_vpid() nor
> thread_group_leader()

It does protect thread_group_leader(), unless we use current.
Please see below.

> @@ -398,7 +398,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
>  	new_timer->it.cpu.incr.sched = 0;
>  	new_timer->it.cpu.expires.sched = 0;
>
> -	read_lock(&tasklist_lock);
> +	rcu_read_lock();
>  	if (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {
>  		if (pid == 0) {
>  			p = current;
> @@ -422,7 +422,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
>  	} else {
>  		ret = -EINVAL;
>  	}
> -	read_unlock(&tasklist_lock);
> +	rcu_read_unlock();

Suppose that the non-main thread execs. de_thread() does

	attach_pid(tsk, PIDTYPE_PID, task_pid(leader));
	leader->group_leader = tsk;

under write_lock(tasklist). This means posix_cpu_timer_create() can return
-EINVAL if it is called in between, or if we found the group leader but
thread_group_leader() is called after "tsk->group_leader = tsk".

I think the patch is fine, but you should also replace thread_group_leader()
with has_group_leader_pid().



This reminds me. !CPUCLOCK_PERTHREAD timers survive after exec, but only
if ->group_leader execs. Not good.

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