diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2014-01-23 08:32:41 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-28 00:48:27 +0000 |
commit | 24183f5ec9c71db936e75060387941463d30d962 (patch) | |
tree | 56d0f61785a94fdb66be124d67bf74b19b74e4a5 /meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch | |
parent | 56490921d267b784118df43cbd107925c8b94200 (diff) | |
download | openembedded-core-contrib-24183f5ec9c71db936e75060387941463d30d962.tar.gz |
unfs3: Add a NFSv3 user mode server for use with runqemu
The user mode nfs server allows the use of runqemu without any root
privileges and may even be accelerated with kvm.
Example:
runqemu-extract-sdk tmp-eglibc/deploy/images/qemux86-64/core-image-minimal-qemux86-64.tar.bz2 rootfs
runqemu qemux86-64 `pwd`/rootfs nographic slirp kvm
[YOCTO #5639]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch')
-rw-r--r-- | meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch b/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch new file mode 100644 index 0000000000..17ad7b6feb --- /dev/null +++ b/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch @@ -0,0 +1,74 @@ +nfs.c: Allow max sa.sun_path for a localdomain socket with the user nfs-server + +There is a hard limit for the kernel of 108 characters for a +localdomain socket name. To avoid problems with the user nfs +server it should maximize the number of characters by using +a relative path on the server side. + +Previously the nfs-server used the absolute path name passed to +the sa.sunpath arg for binding the socket and this has caused +problems for both the X server and UST binaries which make +heavy use of named sockets with long names. + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> + +Upstream-Status: Pending + +--- + nfs.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +--- a/nfs.c ++++ b/nfs.c +@@ -672,6 +672,7 @@ SYMLINK3res *nfsproc3_symlink_3_svc(SYML + } + + #ifndef WIN32 ++static char pathbuf_tmp[NFS_MAXPATHLEN + NFS_MAXNAMLEN + 1]; + + /* + * create Unix socket +@@ -680,17 +681,41 @@ static int mksocket(const char *path, mo + { + int res, sock; + struct sockaddr_un addr; ++ unsigned int len = strlen(path); + + sock = socket(PF_UNIX, SOCK_STREAM, 0); +- addr.sun_family = AF_UNIX; +- strcpy(addr.sun_path, path); + res = sock; + if (res != -1) { ++ addr.sun_family = AF_UNIX; ++ if (len < sizeof(addr.sun_path) -1) { ++ strcpy(addr.sun_path, path); ++ } else { ++ char *ptr; ++ res = -1; ++ if (len >= sizeof(path)) ++ goto out; ++ strcpy(pathbuf_tmp, path); ++ ptr = strrchr(pathbuf_tmp,'/'); ++ if (ptr) { ++ *ptr = '\0'; ++ ptr++; ++ if (chdir(pathbuf_tmp)) ++ goto out; ++ } else { ++ ptr = pathbuf_tmp; ++ } ++ if (strlen(ptr) >= sizeof(addr.sun_path)) ++ goto out; ++ strcpy(addr.sun_path, ptr); ++ } + umask(~mode); + res = + bind(sock, (struct sockaddr *) &addr, + sizeof(addr.sun_family) + strlen(addr.sun_path)); + umask(0); ++out: ++ if (chdir("/")) ++ fprintf(stderr, "Internal failure to chdir /\n"); + close(sock); + } + return res; |