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:	Mon, 16 May 2011 17:59:35 +0200
From:	Tejun Heo <tj@...nel.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	jan.kratochvil@...hat.com, vda.linux@...glemail.com,
	linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
	akpm@...ux-foundation.org, indan@....nu, bdonlan@...il.com
Subject: Re: [PATCH 4/9] ptrace: relocate set_current_state(TASK_TRACED) in
 ptrace_stop()

Hello,

On Mon, May 16, 2011 at 05:51:58PM +0200, Oleg Nesterov wrote:
> > The racy part was task_is_stopped_or_traced() in task_stopped_code()
> > and the value of exit_code doesn't matter at that point.
> 
> Why exit_code doesn't matter? task_stopped_code() needs
> task_is_stopped_or_traced() && exit_code != 0. Both changes should be
> visible.

Because the actual exit_code is checked only after grabbing siglock.
As long as task_is_stopped_or_traced() is true, ptracer will grab
siglock and then check exit_code, so TASK_* is the only thing which
matters.  Fragile, if you ask me - we don't have proper mechanism
around lockless do_wait() checks and synchronizations are just
scattered around the code.

> > All we need to update on the tracee is tracee->state and
> > ~JOBCTL_TRAPPING and __wake_up_sync_key() can be considered single
> > operation.
> 
> Yes! IOW, it safe to reorder the memory operations which change ->state,
> ->exit_code, and ->jobctl. This only important thing is that we should not
> wake up the tracer before we change them.
> 
> And if I remember correctly this was the problem, the early patches did
> something like
> 
> 	task_clear_jobctl_trapping();
> 	set_current_state(TASK_TRACED);

Right, try_to_wake_up() already contains smp_wmb().  We'll be fine
with __set_current_state().  Can we do it in a later patch?

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