Re: [PATCH 2/2] unshare: allow persisting mount namespaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 01, 2016 at 05:31:15PM +0300, Yuriy M. Kaminskiy wrote:
> Karel Zak <kzak@xxxxxxxxxx> writes:
> 
> > On Sat, Jan 30, 2016 at 04:31:06PM +0300, Yuriy M. Kaminskiy wrote:
> >> >> +	case 0:	/* child */
> >> >> +		do {
> >> >> +			/* wait until parent unshare() */
> >> >> +			ino_t new_ino = get_mnt_ino(ppid);
> >> >> +			if (ino != new_ino)
> >> >> +				break;
> >> >> +		} while (1);
> >> >
> >> > Racing? Suppose, parent died (e.g. unshare(2) failed), (parent) process
> >> > was reaped, new (unrelated) process was created with same pid, as a
> >> > result this function will bind namespaces from wrong process.
> >> 
> >> ... besides, this is a busyloop, if "imposer process" is in same mnt
> >> namespace as original process, it will occupy CPU forever (and this *is*
> >
> > Would be possible to use any lightweight solution rather than
> > pipe()+read/write(), for example use sigtimedwait() in child and
> > kill() in parent?
> 
> With my patch, if parent dies, child is automatically awoken (got EOF and
> cleanly exit). With signals, it is not.
> (Besides, it is not easy to set up without introducing more racing.)

OK, fair enough.

  Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux