search for: getumask

Displaying 17 results from an estimated 17 matches for "getumask".

2016 Apr 13
0
Re: [PATCH libguestfs] launch: Implement a safer getumask.
On 04/13/2016 03:43 PM, Richard W.M. Jones wrote: > The current implementation of getumask involves writing a file with > mode 0777 and then testing what mode was created by the kernel. This > doesn't work properly if the user set a per-mount umask (or fmask/ > dmask). > > This alternative method was suggested by Josh Stone. By forking, we > can use the thread-un...
2016 Apr 14
0
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
On 04/14/2016 03:59 AM, Richard W.M. Jones wrote: > The current implementation of getumask involves writing a file with > mode 0777 and then testing what mode was created by the kernel. This > doesn't work properly if the user set a per-mount umask (or fmask/ > dmask). > > This alternative method was suggested by Josh Stone. By forking, we > can use the thread-un...
2016 Apr 13
1
[PATCH v2 libguestfs] launch: Implement a safer getumask.
The current implementation of getumask involves writing a file with mode 0777 and then testing what mode was created by the kernel. This doesn't work properly if the user set a per-mount umask (or fmask/ dmask). This alternative method was suggested by Josh Stone. By forking, we can use the thread-unsafe method (calling umask) an...
2016 Apr 13
3
[PATCH libguestfs] launch: Implement a safer getumask.
The current implementation of getumask involves writing a file with mode 0777 and then testing what mode was created by the kernel. This doesn't work properly if the user set a per-mount umask (or fmask/ dmask). This alternative method was suggested by Josh Stone. By forking, we can use the thread-unsafe method (calling umask) an...
2016 Apr 14
2
[PATCH v3 libguestfs] launch: Implement a safer getumask.
The current implementation of getumask involves writing a file with mode 0777 and then testing what mode was created by the kernel. This doesn't work properly if the user set a per-mount umask (or fmask/ dmask). This alternative method was suggested by Josh Stone. By forking, we can use the thread-unsafe method (calling umask) an...
2016 Apr 14
0
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
On 04/14/2016 07:57 AM, Richard W.M. Jones wrote: > On Thu, Apr 14, 2016 at 07:38:23AM -0600, Eric Blake wrote: >>> + /* Read the umask. */ >>> + if (read (fd[0], &mask, sizeof mask) != sizeof mask) { >>> + perrorf (g, "read"); >>> + close (fd[0]); >>> + return -1; >> >> Oops - this strands a child process. You
2016 Apr 15
0
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
BTW this causes valgrind to fail in a particularly strange way. I filed a bug upstream with a minimal reproducer. Do you have any ideas? https://bugs.kde.org/show_bug.cgi?id=361810 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual
2016 Apr 14
2
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
On Thu, Apr 14, 2016 at 07:38:23AM -0600, Eric Blake wrote: > > + /* Read the umask. */ > > + if (read (fd[0], &mask, sizeof mask) != sizeof mask) { > > + perrorf (g, "read"); > > + close (fd[0]); > > + return -1; > > Oops - this strands a child process. You have to reap the child, even > if the read() failed. Bleah that was
2016 Apr 14
3
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
On Thu, Apr 14, 2016 at 08:04:39AM -0600, Eric Blake wrote: > On 04/14/2016 07:57 AM, Richard W.M. Jones wrote: > > On Thu, Apr 14, 2016 at 07:38:23AM -0600, Eric Blake wrote: > >>> + /* Read the umask. */ > >>> + if (read (fd[0], &mask, sizeof mask) != sizeof mask) { > >>> + perrorf (g, "read"); > >>> + close (fd[0]);
2016 May 21
1
[PATCH] umask: Use /proc/<PID>/status to read umask in Linux >= 4.7.
...--- 1 file changed, 78 insertions(+), 8 deletions(-) diff --git a/src/umask.c b/src/umask.c index b8748e8..3f32337 100644 --- a/src/umask.c +++ b/src/umask.c @@ -18,12 +18,22 @@ /** * Return current umask in a thread-safe way. + * + * glibc documents, but does not actually implement, a "getumask(3)" + * call. + * + * We use C<Umask> from F</proc/I<PID>/status> for Linux E<ge> 4.7. + * For older Linux and other Unix, this file implements an expensive + * but thread-safe way to get the current process's umask. + * + * Thanks to: Josh Stone, Jiri Jaburek, Eric...
2016 Feb 02
0
Re: [PATCH 1/3] launch: add internal helper for socket paths creation
...PATH_MAX-1, "%s/%s", path, filename); > + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; What's wrong with: snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", path, filename); > + return 0; > +} > + > /* glibc documents, but does not actually implement, a 'getumask(3)' > * call. This implements a thread-safe way to get the umask. Note > * this is only called when g->verbose is true and after g->tmpdir Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: htt...
2016 Jan 29
0
[PATCH 6/6] launch: avoid too long paths for sockets
...for the socket '%s'"), + filename); + return -1; + } + } + + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; + + return 0; +} + /* glibc documents, but does not actually implement, a 'getumask(3)' * call. This implements a thread-safe way to get the umask. Note * this is only called when g->verbose is true and after g->tmpdir diff --git a/src/tmpdirs.c b/src/tmpdirs.c index 9154d8b..e406e53 100644 --- a/src/tmpdirs.c +++ b/src/tmpdirs.c @@ -139,6 +139,21 @@ guestfs_int_la...
2016 Jan 29
7
[PATCH 1/6] launch: unix: check for length of sockets
Error out early if the path to the socket will not fit into sockaddr_un::sun_path, as we will not be able to connect to it. --- src/launch-unix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/launch-unix.c b/src/launch-unix.c index 740c554..973e14b 100644 --- a/src/launch-unix.c +++ b/src/launch-unix.c @@ -47,6 +47,12 @@ launch_unix (guestfs_h *g, void *datav, const char
2016 Feb 03
4
[PATCH v2 1/2] launch: add internal helper for socket paths creation
...ame) > UNIX_PATH_MAX-1) { + error (g, _("socket path too long: %s/%s"), g->tmpdir, filename); + return -1; + } + + snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", g->tmpdir, filename); + + return 0; +} + /* glibc documents, but does not actually implement, a 'getumask(3)' * call. This implements a thread-safe way to get the umask. Note * this is only called when g->verbose is true and after g->tmpdir -- 2.5.0
2016 Feb 02
6
[PATCH 1/3] launch: add internal helper for socket paths creation
...char (*sockpath)[UNIX_PATH_MAX]) +{ + char *path = g->tmpdir; + + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; + + return 0; +} + /* glibc documents, but does not actually implement, a 'getumask(3)' * call. This implements a thread-safe way to get the umask. Note * this is only called when g->verbose is true and after g->tmpdir -- 2.5.0
2016 Jan 29
1
Re: [PATCH 6/6] launch: avoid too long paths for sockets
...name); > + return -1; > + } > + } > + > + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); > + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; > + > + return 0; > +} > + > /* glibc documents, but does not actually implement, a 'getumask(3)' > * call. This implements a thread-safe way to get the umask. Note > * this is only called when g->verbose is true and after g->tmpdir > diff --git a/src/tmpdirs.c b/src/tmpdirs.c > index 9154d8b..e406e53 100644 > --- a/src/tmpdirs.c > +++ b/src/tmpdirs.c >...
2016 Aug 08
0
ANNOUNCE: libguestfs 1.34 released
...The error(3) function is now used everywhere, replacing most previous uses of perror(3) + exit(3), and fprintf(3) + exit. In C code, "/**" comments are turned into documentation which is automatically added to the guestfs-hacking(1) manual page. A safe "getumask" function has been added. For recent Linux kernels this uses the newly added "Umask" field in /proc/self/status. For older Linux and other Unix, this uses a thread-safe technique involving fork(2) (thanks: Josh Stone, Jiri Jaburek, Eric Blake). Safe pos...