From: Serge Hallyn <serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
To: "chenhanxiao-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org"
<chenhanxiao-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Richard Weinberger <richard-/L3Ra7n9ekc@public.gmane.org>,
"containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
"linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2] ns: introduce getnspid syscall
Date: Wed, 25 Jun 2014 14:38:31 +0000 [thread overview]
Message-ID: <20140625143831.GB17169@ubuntumail> (raw)
In-Reply-To: <5871495633F38949900D2BF2DC04883E551F09-ZEd+hNNJ6a5ZYpXjqAkB5jz3u5zwRJJDAzI0kPv9QBlmR6Xm/wNWPw@public.gmane.org>
Quoting chenhanxiao@cn.fujitsu.com (chenhanxiao@cn.fujitsu.com):
> Hi,
>
> > -----Original Message-----
> > From: Serge E. Hallyn [mailto:serge@hallyn.com]
> > Sent: Monday, June 23, 2014 9:33 PM
> > To: Chen, Hanxiao/陈 晗霄
> > Cc: Richard Weinberger; containers@lists.linux-foundation.org;
> > linux-kernel@vger.kernel.org; Pavel Emelyanov; linux-api@vger.kernel.org;
> > Serge Hallyn; Oleg Nesterov; David Howells; Eric W. Biederman; Al Viro
> > Subject: Re: [PATCH v2] ns: introduce getnspid syscall
> >
> > > > >
> > > >
> > > > I don't think that adding a new system call for this is a good solution.
> > > > We need a more generic way. I bet people are interested in more than just
> > PID
> > > > numbers.
> > >
> > > Could you please give some hints on how to expand this interface?
> > >
> > > >
> > > > I agree with Eric that a procfs solution is more appropriate.
> > > >
> > >
> > > Procfs is a good solution, but syscall is not bad though.
> >
> > I might be inclined to agree, except that in this case you are still
> > needing mounted procfs anyway to get the proc/$pid/ns/pid fds.
> >
> > I'm sorry, I've not been watching this thread, so this probably has been
> > considered and decided against, but I'm going to ask anyway. Keeping
> > in mind both checkpoint-restart and and introspection for use in a
> > setns'd commend, why not make it
> >
> > pid_t getnspid(pid_t query_pid, pid_t observer_pid)
> >
> > which returns the process id of query_pid as seen from observer_pid's
> > pidns?
> >
>
> But this could be confused in nested ns.
>
> Ex:
> (thanks for Pavel's figure)
> init_pid_ns ns1 ns2
> t1 2
> t2 `- 3 1
> t3 `- 4 `- 5 1
> t4 5
>
> a) getnspid(1, 1):
> We expected it could return t2's pid(2nd 1 as pid
Clearly the passed-in pids should be interpreted as relative
to current's pidns. There can be no ambiguity at that point,
unless I'm overlooking something.
> such as systemd in init_pid_ns),
> but t3'pid is also an appropriate result.
> We may get more than one returns.
>
> b) getnspid(5, 1):
> (1st 5 was expected as pid in ns1)
> t3'pid and t4's pid could both be the answer.
> We could not determine which one is what we want.
>
> So something unique like fds of ns should be
> a better reference.
>
> Thanks,
> - Chen
>
> >
> > > Procfs works for me, but that seems could not fit
> > > Pavel's requirement.
> > > His opinion is that a syscall is a more generic interface
> > > than proc files, and also very helpful.
> > > And syscall could tell whether a pid lives in a specific pid namespace,
> > > much convenient than procfs.
> > >
> > > Thanks,
> > > - Chen
> >
> > > _______________________________________________
> > > Containers mailing list
> > > Containers@lists.linux-foundation.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/containers
>
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2014-06-25 14:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 10:18 [PATCH v2] ns: introduce getnspid syscall Chen Hanxiao
[not found] ` <1403259512-10510-1-git-send-email-chenhanxiao-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-06-20 11:02 ` Richard Weinberger
[not found] ` <53A414B2.20108-/L3Ra7n9ekc@public.gmane.org>
2014-06-23 10:15 ` chenhanxiao-BthXqXjhjHXQFUHtdCDX3A
[not found] ` <5871495633F38949900D2BF2DC04883E54ECC5-ZEd+hNNJ6a5ZYpXjqAkB5jz3u5zwRJJDAzI0kPv9QBlmR6Xm/wNWPw@public.gmane.org>
2014-06-23 13:32 ` Serge E. Hallyn
[not found] ` <20140623133230.GA31817-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2014-06-25 10:00 ` chenhanxiao-BthXqXjhjHXQFUHtdCDX3A
[not found] ` <5871495633F38949900D2BF2DC04883E551F09-ZEd+hNNJ6a5ZYpXjqAkB5jz3u5zwRJJDAzI0kPv9QBlmR6Xm/wNWPw@public.gmane.org>
2014-06-25 14:38 ` Serge Hallyn [this message]
2014-06-26 10:19 ` chenhanxiao-BthXqXjhjHXQFUHtdCDX3A
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=20140625143831.GB17169@ubuntumail \
--to=serge.hallyn-gewih/nmzzlqt0dzr+alfa@public.gmane.org \
--cc=chenhanxiao-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=richard-/L3Ra7n9ekc@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).