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:	Sun, 29 Apr 2012 11:49:05 +0200
From:	Mike Galbraith <efault@....de>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Pavel Emelyanov <xemul@...allels.com>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Louis Rilling <louis.rilling@...labs.com>
Subject: Re: [RFC PATCH] namespaces: fix leak on fork() failure

On Sun, 2012-04-29 at 00:57 -0700, Eric W. Biederman wrote:

> Mike's proposed change to switch_task_namespace is most definitely not
> correct.  This will potentially get called on unshare and so we don't
> limit ourselves to just an exit pid_namespace.  The result is that we
> could free the proc mount long before it is safe.

!new && !(p->flags & PF_EXITING) should prevent that..

> At the same time the leak that Mike detected is most definitely real.
> 
> > Perhaps it would be more clean to add the explicit
> >
> > 	 bad_fork_cleanup_namespaces:
> > 	+	if (unlikely(clone_flags & CLONE_NEWPID))
> > 	+		pid_ns_release_proc(...);
> > 		exit_task_namespaces(p);
> > 		
> > 		
> > code into this error path in copy_process?
> 
> For now Oleg your minimal patch looks good.

..but yeah, that looks much nicer.

> Part of me would like to call proc_flush_task instead of
> pid_ns_release_proc but we have no assurance task_pid and task_tgid are
> valid when we get here so proc_flush_task is out.

I only discovered pid_ns_release_proc() exists after didn't work :)

-Mike

--
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