public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Cc: containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Serge Hallyn <serge.hallyn@ubuntu.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	Richard Weinberger <richard.weinberger@gmail.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Vasiliy Kulikov <segooon@gmail.com>,
	Gotou Yasunori <y-goto@jp.fujitsu.com>
Subject: Re: [PATCH] ns: introduce getnspid syscall
Date: Wed, 18 Jun 2014 19:58:07 +0200	[thread overview]
Message-ID: <20140618175807.GA21565@redhat.com> (raw)
In-Reply-To: <1403000496-10094-1-git-send-email-chenhanxiao@cn.fujitsu.com>

On 06/17, Chen Hanxiao wrote:
>
> +SYSCALL_DEFINE4(getnspid, pid_t, pid, int, fd1, int, fd2, int, pidtype)
> +{
> +	struct file *file1 = NULL, *file2 = NULL;
> +	struct task_struct *task;
> +	struct pid_namespace *ns1, *ns2;
> +	struct proc_ns *ei;
> +	int ret = -1;
> +
> +	if (pidtype >= PIDTYPE_MAX)
> +		return -EINVAL;
> +
> +	file1 = proc_ns_fget(fd1);
> +	if (IS_ERR(file1))
> +		return PTR_ERR(file1);
> +	ei = get_proc_ns(file_inode(file1));
> +	ns1 = (struct pid_namespace *)ei->ns;

and I am not sure this part is correct... shouldn't we also verify that
ns_ops == pidns_operations ?

Perhaps it makes sense to generalize get_net_ns_by_fd() into
"void *get_ns_by_fd(fd, type)"... this probably needs another "check-and-get"
method in proc_ns_operations(). I dunno.

Oleg.


  parent reply	other threads:[~2014-06-18 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 10:21 [PATCH] ns: introduce getnspid syscall Chen Hanxiao
2014-06-17 12:13 ` Pavel Emelyanov
2014-06-18  8:28   ` chenhanxiao
2014-06-18 18:02   ` Oleg Nesterov
2014-06-18 19:10     ` Pavel Emelyanov
2014-06-17 18:27 ` Michael Kerrisk
2014-06-18  8:29   ` chenhanxiao
2014-06-18  1:31 ` Eric W. Biederman
2014-06-18 10:03   ` chenhanxiao
2014-06-18 17:58 ` Oleg Nesterov [this message]
2014-06-20  9:14   ` chenhanxiao

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=20140618175807.GA21565@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=berrange@redhat.com \
    --cc=chenhanxiao@cn.fujitsu.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.weinberger@gmail.com \
    --cc=segooon@gmail.com \
    --cc=serge.hallyn@ubuntu.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xemul@parallels.com \
    --cc=y-goto@jp.fujitsu.com \
    /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