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: <20150313162113.GA25966@redhat.com>
Date:	Fri, 13 Mar 2015 17:21:13 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Josh Triplett <josh@...htriplett.org>
Cc:	Al Viro <viro@...iv.linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Lutomirski <luto@...capital.net>,
	Ingo Molnar <mingo@...hat.com>,
	Kees Cook <keescook@...omium.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	"H. Peter Anvin" <hpa@...or.com>, Rik van Riel <riel@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Thiago Macieira <thiago.macieira@...el.com>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task
	exit notification via fd

Josh,

I'll certainly try to read this series, but not before next week.

but a couple of nits right now.

On 03/12, Josh Triplett wrote:
>
> When passed CLONE_FD, clone4 will return a file descriptor rather than a
> PID.  When the child process exits, it gets automatically reaped,

And even I have no idea what you are actually doing, this doesn't look
right, see below.

> +static unsigned int clonefd_poll(struct file *file, poll_table *wait)
> +{
> +	struct task_struct *p = file->private_data;
> +	poll_wait(file, &p->clonefd_wqh, wait);
> +	return p->exit_state == EXIT_DEAD ? (POLLIN | POLLRDNORM) : 0;
> +}
> +
> +static ssize_t clonefd_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> +{
> +	struct task_struct *p = file->private_data;
> +	int ret = 0;
> +
> +	/* EOF after first read */
> +	if (*ppos)
> +		return 0;
> +
> +	if (file->f_flags & O_NONBLOCK)
> +		ret = -EAGAIN;
> +	else
> +		ret = wait_event_interruptible(p->clonefd_wqh, p->exit_state == EXIT_DEAD);
> +
> +	if (p->exit_state == EXIT_DEAD) {

Again, I simply do not know what this code does at all. But I bet the usage
of EXIT_DEAD is wrong ;)

OK, OK, I can be wrong. But I simply do not see what protects this task_struct
if it is EXIT_DEAD (in fact even if it is EXIT_ZOMBIE).

> @@ -598,7 +600,9 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
>  	if (group_dead)
>  		kill_orphaned_pgrp(tsk->group_leader, NULL);
>  
> -	if (unlikely(tsk->ptrace)) {
> +	if (tsk->autoreap) {
> +		autoreap = true;

Debuggers won't be happy. A ptraced task should not autoreap itself.

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