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:	Thu, 17 Jul 2008 00:30:50 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Roland McGrath <roland@...hat.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...sign.ru>, Ingo Molnar <mingo@...e.hu>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] ptrace children revamp

On Thu, 17 Jul 2008 00:13:22 -0700 (PDT) Roland McGrath <roland@...hat.com> wrote:

> ptrace no longer fiddles with the children/sibling links, and the
> old ptrace_children list is gone.  Now ptrace, whether of one's own
> children or another's via PTRACE_ATTACH, just uses the new ptraced
> list instead.
> 
> There should be no user-visible difference that matters.  The only
> change is the order in which do_wait() sees multiple stopped
> children and stopped ptrace attachees.  Since wait_task_stopped()
> was changed earlier so it no longer reorders the children list, we
> already know this won't cause any new problems.
> 
> ...
>
> +repeat:
>  	task_lock(current);
>  	if (!(current->ptrace & PT_PTRACED)) {
> +		/*
> +		 * See ptrace_attach() comments about the locking here.
> +		 */

	/*
	 * Nasty, nasty.
	 *
	 * We want to hold both the task-lock and the
	 * tasklist_lock for writing at the same time.
	 * But that's against the rules (tasklist_lock
	 * is taken for reading by interrupts on other
	 * cpu's that may have task_lock).
	 */

> +		unsigned long flags;
> +		if (!write_trylock_irqsave(&tasklist_lock, flags)) {
> +			task_unlock(current);
> +			do {
> +				cpu_relax();
> +			} while (!write_can_lock(&tasklist_lock));
> +			goto repeat;
> +		}
> +

hm, copying this code didn't do much to improve the world.

Is there any prospect of "fixing" this somehow?

Perhaps this code should be pulled up into a separate function, not
that this will help things a lot.


>  		ret = security_ptrace(current->parent, current,
>  				      PTRACE_MODE_ATTACH);
> +
>  		/*
>  		 * Set the ptrace bit in the process ptrace flags.
> +		 * Then link us on our parent's ptraced list.
>  		 */
> -		if (!ret)
> +		if (!ret) {
>  			current->ptrace |= PT_PTRACED;
> +			__ptrace_link(current, current->real_parent);
> +		}
> +
> +		write_unlock_irqrestore(&tasklist_lock, flags);
>  	}
>  	task_unlock(current);
>  	return ret;
--
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