Author: sthibault Date: 2014-08-27 21:24:09 +0000 (Wed, 27 Aug 2014) New Revision: 6257
Added: glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask2.diff Modified: glibc-package/trunk/debian/changelog glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask.diff glibc-package/trunk/debian/patches/series Log: patches/hurd-i386/submitted-bind_umask.diff: Split into patches/hurd-i386/submitted-bind_umask2 as requested by upstream. Modified: glibc-package/trunk/debian/changelog =================================================================== --- glibc-package/trunk/debian/changelog 2014-08-27 19:49:47 UTC (rev 6256) +++ glibc-package/trunk/debian/changelog 2014-08-27 21:24:09 UTC (rev 6257) @@ -3,6 +3,8 @@ [ Samuel Thibault ] * patches/hurd-i386/tg-thread-cancel.diff: Update patch against two other overzealous assertions. + * patches/hurd-i386/submitted-bind_umask.diff: Split into + patches/hurd-i386/submitted-bind_umask2 as requested by upstream. -- Aurelien Jarno <aure...@debian.org> Wed, 27 Aug 2014 08:22:41 +0200 Modified: glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask.diff =================================================================== --- glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask.diff 2014-08-27 19:49:47 UTC (rev 6256) +++ glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask.diff 2014-08-27 21:24:09 UTC (rev 6257) @@ -1,19 +1,17 @@ -2014-08-25 Samuel Thibault <samuel.thiba...@ens-lyon.org> +2014-08-27 Samuel Thibault <samuel.thiba...@ens-lyon.org> - Fix bind when umask is e.g. 0777. + Simplify atomicity of socket creation in bind. - * sysdeps/mach/hurd/bind.c (__bind): Pass mode 0666 to __dir_mkfile - instead of final mode, so that call __ifsock_getsockaddr can always - succeed, before calling __file_chmod to fix the mode according to umask, - before calling __dir_link to show the file. + * sysdeps/mach/hurd/bind.c (__bind): Use dir_lookup(node, "") instead of + looking up the name after linking the file. --- - bind.c | 57 ++++++++++++++++++++++++++++++++------------------------- - 1 file changed, 32 insertions(+), 25 deletions(-) + bind.c | 48 +++++++++++++++++++++++++----------------------- + 1 file changed, 25 insertions(+), 23 deletions(-) ---- a/sysdeps/mach/hurd/bind.c.orig 2014-08-25 14:11:11.245229537 +0200 -+++ b/sysdeps/mach/hurd/bind.c 2014-08-25 14:11:35.892517639 +0200 -@@ -40,7 +40,7 @@ +--- a/sysdeps/mach/hurd/bind.c ++++ b/sysdeps/mach/hurd/bind.c +@@ -40,7 +40,7 @@ __bind (int fd, __CONST_SOCKADDR_ARG ad char *name = _hurd_sun_path_dupa (addr, len); /* For the local domain, we must create a node in the filesystem using the ifsock translator and then fetch the address from it. */ @@ -22,16 +20,7 @@ char *n; dir = __file_name_split (name, &n); -@@ -48,7 +48,7 @@ - return -1; - - /* Create a new, unlinked node in the target directory. */ -- err = __dir_mkfile (dir, O_CREAT, 0666 & ~_hurd_umask, &node); -+ err = __dir_mkfile (dir, O_CREAT, 0666, &node); - - if (! err) - { -@@ -61,36 +61,43 @@ +@@ -61,36 +61,38 @@ __bind (int fd, __CONST_SOCKADDR_ARG ad MACH_MSG_TYPE_COPY_SEND); if (! err) { @@ -42,7 +31,7 @@ + enum retry_type doretry; + char retryname[1024]; + /* Get a port to the ifsock translator. */ -+ err = __dir_lookup(node, "", 0, 0, &doretry, retryname, &ifsock); ++ err = __dir_lookup (node, "", 0, 0, &doretry, retryname, &ifsock); + if (! err) + if (doretry != FS_RETRY_NORMAL || retryname[0] != '\0') + err = EADDRINUSE; @@ -78,17 +67,11 @@ - it, and replaced it with a different node, before we - did our lookup. Treat it as if our link had failed - with EEXIST. */ -- err = EADDRINUSE; -+ /* Fix the access mode before showing the file. */ -+ err = __file_chmod (node, 0666 & ~_hurd_umask); -+ if (! err) -+ { -+ /* Link the node, now a socket with proper mode, into the -+ * target directory. */ -+ err = __dir_link (dir, node, n, 1); -+ if (err == EEXIST) -+ err = EADDRINUSE; -+ } ++ /* Link the node, now a socket with proper mode, into the ++ * target directory. */ ++ err = __dir_link (dir, node, n, 1); ++ if (err == EEXIST) + err = EADDRINUSE; + if (err) + __mach_port_deallocate (__mach_task_self (), aport); } Added: glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask2.diff =================================================================== --- glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask2.diff (rev 0) +++ glibc-package/trunk/debian/patches/hurd-i386/submitted-bind_umask2.diff 2014-08-27 21:24:09 UTC (rev 6257) @@ -0,0 +1,46 @@ +2014-08-27 Samuel Thibault <samuel.thiba...@ens-lyon.org> + + Fix bind when umask is e.g. 0777. + + * sysdeps/mach/hurd/bind.c (__bind): Pass mode 0666 to __dir_mkfile + instead of final mode, so that call __ifsock_getsockaddr can always + succeed, before calling __file_chmod to fix the mode according to umask, + before calling __dir_link to show the file. + +--- + bind.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +--- a/sysdeps/mach/hurd/bind.c ++++ b/sysdeps/mach/hurd/bind.c +@@ -48,7 +48,7 @@ __bind (int fd, __CONST_SOCKADDR_ARG ad + return -1; + + /* Create a new, unlinked node in the target directory. */ +- err = __dir_mkfile (dir, O_CREAT, 0666 & ~_hurd_umask, &node); ++ err = __dir_mkfile (dir, O_CREAT, 0666, &node); + + if (! err) + { +@@ -82,11 +82,16 @@ __bind (int fd, __CONST_SOCKADDR_ARG ad + err = EADDRINUSE; + if (! err) + { +- /* Link the node, now a socket with proper mode, into the +- * target directory. */ +- err = __dir_link (dir, node, n, 1); +- if (err == EEXIST) +- err = EADDRINUSE; ++ /* Fix the access mode before showing the file. */ ++ err = __file_chmod (node, 0666 & ~_hurd_umask); ++ if (! err) ++ { ++ /* Link the node, now a socket with proper mode, into the ++ * target directory. */ ++ err = __dir_link (dir, node, n, 1); ++ if (err == EEXIST) ++ err = EADDRINUSE; ++ } + if (err) + __mach_port_deallocate (__mach_task_self (), aport); + } Modified: glibc-package/trunk/debian/patches/series =================================================================== --- glibc-package/trunk/debian/patches/series 2014-08-27 19:49:47 UTC (rev 6256) +++ glibc-package/trunk/debian/patches/series 2014-08-27 21:24:09 UTC (rev 6257) @@ -150,6 +150,7 @@ hurd-i386/cvs-libpthread_guardsize.diff hurd-i386/cvs-libpthread_std_thread.diff hurd-i386/submitted-bind_umask.diff +hurd-i386/submitted-bind_umask2.diff i386/local-biarch.diff i386/local-cmov.diff -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1xmkhn-0004nr...@moszumanska.debian.org