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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110511195824.GA4047@redhat.com>
Date:	Wed, 11 May 2011 21:58:24 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Tejun Heo <tj@...nel.org>
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

On 05/08, Tejun Heo wrote:
>
> +static void ptrace_trap_notify(struct task_struct *t)
> +{
> +	WARN_ON_ONCE(!(t->ptrace & PT_SEIZED));
> +	assert_spin_locked(&t->sighand->siglock);
> +
> +	/*
> +	 * @t is being ptraced and new SEIZE behavior is in effect.
> +	 * Schedule sticky trap which will clear on the next GETSIGINFO.
> +	 */
> +	t->jobctl |= JOBCTL_TRAP_NOTIFY;
> +
> +	/*
> +	 * 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.

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.

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