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: <20110511201848.GF24245@mtj.dyndns.org>
Date:	Wed, 11 May 2011 22:18:48 +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
Subject: Re: [PATCH 11/11] ptrace: implement group stop notification for
 ptracer

Hey, Oleg.

On Wed, May 11, 2011 at 09:58:24PM +0200, Oleg Nesterov wrote:
> > +	/*
> > +	 * If @t is currently trapped for group stop or INTERRUPT
> > +	 * (JOBCTL_TRAPPED set), it should re-trap with new exit_code
> > +	 * indicating continuation so that the ptracer can notice the
> > +	 * event; otherwise, use normal signal delivery wake up.
> > +	 *
> > +	 * The re-trapping sets JOBCTL_TRAPPING such that the transition is
> > +	 * hidden from the ptracer.
> > +	 *
> > +	 * This means that if @t is trapped for other reasons than group
> > +	 * stop or INTERRUPT, the notification trap won't be delievered
> > +	 * until the current one is complete.  This is the intended
> > +	 * behavior.
> > +	 */
> > +	if (task_is_traced(t) && (t->jobctl & JOBCTL_TRAPPED)) {
> > +		t->jobctl |= JOBCTL_TRAPPING;
> > +		signal_wake_up(t, true);
> 
> and its tracer can be inside sys_ptrace().
> 
> No, I don't think this can be right. Otherwise, why ptrace_check_attach()
> calls wait_task_inactive() ? The tracee can be scheduled but only if killed,
> in this case we don't care.
>
> I know very little about this low-level (and worse, arch dependant) magic,
> but even on x86 this doesn't look safe. Suppose that the tracer changes the
> fpu state of the tracer and __switch_to(next_p == tracee) does
> __math_state_restore() before the tracer finishes.

Yeah, yeah, it's dangerous to let ptrace operations while the target
task is still on CPU.  It shouldn't happen.

> Or PTRACE_GETSIGINFO can fail while it shouldn't, but this is minor.
> 
> Hmm. I think we need a bit more discussion, even ignoring the implementation
> details.

Hmmm... this whole re-trapping thing is turning out to be more
problematic than expected.  Maybe it would be better to somehow notify
ptracer directly from prepare_signal().

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