All of lore.kernel.org
 help / color / mirror / Atom feed
From: yumkam@gmail.com (Yuriy M. Kaminskiy)
To: util-linux@vger.kernel.org
Subject: Re: [PATCH 2/2] unshare: allow persisting mount namespaces
Date: Mon, 01 Feb 2016 17:31:15 +0300	[thread overview]
Message-ID: <m3mvrkfqoc.fsf@gmail.com> (raw)
In-Reply-To: 20160201104114.5iv5hznaslpi2xkz@ws.net.home

Karel Zak <kzak@redhat.com> 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.)

> The ideal solution would be to have /proc/self/ns/<name> files poll()-able.

I'm not sure how it can fit with the way ns/<name> exposed by kernel
currently (symlink to ns inode). (And more racing opportunities too).


  reply	other threads:[~2016-02-01 14:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 11:22 [PATCH 1/2] unshare: allow persisting namespaces Karel Zak
2015-04-09 11:22 ` [PATCH 2/2] unshare: allow persisting mount namespaces Karel Zak
2015-04-09 17:07   ` Eric W. Biederman
2015-04-10  8:17     ` Karel Zak
2016-01-30  3:52       ` Yuriy M. Kaminskiy
2016-01-30 13:31         ` Yuriy M. Kaminskiy
2016-02-01 10:41           ` Karel Zak
2016-02-01 14:31             ` Yuriy M. Kaminskiy [this message]
2016-02-02 10:14               ` Karel Zak
2016-02-17 13:07           ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3mvrkfqoc.fsf@gmail.com \
    --to=yumkam@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.