RE: [PATCH] ns: introduce getnspid syscall

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

 




> -----Original Message-----
> From: Oleg Nesterov [mailto:oleg@xxxxxxxxxx]
> Sent: Thursday, June 19, 2014 1:58 AM
> To: Chen, Hanxiao/陈 晗霄
> Cc: containers@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> Andrew Morton; Eric W. Biederman; Serge Hallyn; Daniel P. Berrange; Al Viro; David
> Howells; Richard Weinberger; Pavel Emelyanov; Vasiliy Kulikov; Gotou, Yasunori/
> 五? 康文
> Subject: Re: [PATCH] ns: introduce getnspid syscall
> 
> 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 ?
> 
You're right. We should check this part.

Thanks,
- Chen

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

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/containers

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

  Powered by Linux