netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"thierry.reding@avionic-design.de"
	<thierry.reding@avionic-design.de>,
	"bfields@redhat.com" <bfields@redhat.com>,
	"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
	Pavel Emelianov <xemul@parallels.com>,
	"neilb@suse.de" <neilb@suse.de>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"paul.gortmaker@windriver.com" <paul.gortmaker@windriver.com>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"gorcunov@openvz.org" <gorcunov@openvz.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"tim.c.chen@linux.intel.com" <tim.c.chen@linux.intel.com>,
	"devel@openvz.org" <devel@openvz.org>
Subject: Re: [RFC PATCH 0/5] net: socket bind to file descriptor introduced
Date: Mon, 20 Aug 2012 14:18:13 +0400	[thread overview]
Message-ID: <50320EE5.10307@parallels.com> (raw)
In-Reply-To: <87y5lf7d37.fsf@xmission.com>

16.08.2012 07:03, Eric W. Biederman пишет:
> Stanislav Kinsbursky <skinsbursky@parallels.com> writes:
>
>> This patch set introduces new socket operation and new system call:
>> sys_fbind(), which allows to bind socket to opened file.
>> File to bind to can be created by sys_mknod(S_IFSOCK) and opened by
>> open(O_PATH).
>>
>> This system call is especially required for UNIX sockets, which has name
>> lenght limitation.
>>
>> The following series implements...
>
> Hmm.  I just realized this patchset is even sillier than I thought.
>
> Stanislav is the problem you are ultimately trying to solve nfs clients
> in a container connecting to the wrong user space rpciod?
>

Hi, Eric.
The problem you mentioned was the reason why I started to think about this.
But currently I believe, that limitations in unix sockets connect or bind should 
be removed, because it will be useful it least for CRIU project.

> Aka net/sunrpc/xprtsock.c:xs_setup_local only taking an absolute path
> and then creating a delayed work item to actually open the unix domain
> socket?
>
> The straight correct and straight forward thing to do appears to be:
> - Capture the root from current->fs in xs_setup_local.
> - In xs_local_finish_connect change current->fs.root to the captured
>    version of root before kernel_connect, and restore current->fs.root
>    after kernel_connect.
>
> It might not be a bad idea to implement open on unix domain sockets in
> a filesystem as create(AF_LOCAL)+connect() which would allow you to
> replace __sock_create + kernel_connect with a simple file_open_root.
>

I like the idea of introducing new family (AF_LOCAL_AT for example) and new 
sockaddr for connecting or binding from specified root. The only thing I'm 
worrying is passing file descriptor to unix bind or connect routine. Because 
this approach doesn't provide easy way to use such family and sockaddr in kernel 
(like in NFS example).

> But I think the simple scheme of:
> struct path old_root;
> old_root = current->fs.root;
> kernel_connect(...);
> current->fs.root = old_root;
>
> Is more than sufficient and will remove the need for anything
> except a purely local change to get nfs clients to connect from
> containers.
>

That was my first idea. And probably it would be worth to change all fs_struct 
to support sockets with relative path.
What do you think about it?

> Eric
>


-- 
Best regards,
Stanislav Kinsbursky

  parent reply	other threads:[~2012-08-20 10:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 16:21 [RFC PATCH 0/5] net: socket bind to file descriptor introduced Stanislav Kinsbursky
2012-08-15 16:22 ` [RFC PATCH 1/5] net: cleanup unix_bind() a little Stanislav Kinsbursky
2012-08-15 16:22 ` [RFC PATCH 2/5] net: split unix_bind() Stanislav Kinsbursky
2012-08-15 16:22 ` [RFC PATCH 3/5] net: new protocol operation fbind() introduced Stanislav Kinsbursky
2012-08-15 16:22 ` [RFC PATCH 4/5] net: fbind() for unix sockets protocol operations introduced Stanislav Kinsbursky
2012-08-15 16:22 ` [RFC PATCH 5/5] syscall: sys_fbind() introduced Stanislav Kinsbursky
2012-08-15 16:30   ` H. Peter Anvin
2012-08-15 16:43     ` Stanislav Kinsbursky
2012-08-15 16:52 ` [RFC PATCH 0/5] net: socket bind to file descriptor introduced Ben Pfaff
2012-08-15 17:54   ` H. Peter Anvin
2012-08-15 19:49 ` Eric W. Biederman
2012-08-15 20:58   ` H. Peter Anvin
2012-08-15 21:25     ` Eric W. Biederman
2012-08-16  3:03 ` Eric W. Biederman
2012-08-16 13:54   ` J. Bruce Fields
2012-08-20 10:18   ` Stanislav Kinsbursky [this message]
2012-09-04 19:00     ` J. Bruce Fields
2012-10-05 20:00       ` J. Bruce Fields
2012-10-08  8:37         ` Stanislav Kinsbursky

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=50320EE5.10307@parallels.com \
    --to=skinsbursky@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@redhat.com \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@avionic-design.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=xemul@parallels.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;
as well as URLs for NNTP newsgroup(s).