search for: perform_reexec

Displaying 10 results from an estimated 10 matches for "perform_reexec".

2020 Jun 02
0
[PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
..._((cleanup (cleanup_free_buffer))) + +static void +cleanup_free_buffer (buffer *v) +{ + free (v->ptr); +} + +/* List of strings. */ DEFINE_VECTOR_TYPE(string_vector, char *); #define CLEANUP_FREE_STRING_VECTOR \ @@ -68,11 +81,13 @@ cleanup_free_string_vector (string_vector *v) static void perform_reexec (const char *env, const char *prepend) { + static const char cmdline_file[] = "/proc/self/cmdline"; + static const char exe_file[] = "/proc/self/exe"; CLEANUP_FREE char *library = NULL; + CLEANUP_FREE_BUFFER buffer buf = empty_vector; CLEANUP_FREE_STRING_VECTOR string_...
2020 Feb 18
0
[nbdkit PATCH v7 2/2] vddk: Drive library loading from libdir parameter.
...ugins/vddk/vddk.c @@ -41,6 +41,7 @@ #include <unistd.h> #include <dlfcn.h> #include <fcntl.h> +#include <libgen.h> #define NBDKIT_API_VERSION 2 @@ -254,10 +255,9 @@ vddk_config (const char *key, const char *value) * Thus, no return value is needed. */ static void -perform_reexec (const char *prepend) +perform_reexec (const char *env, const char *prepend) { CLEANUP_FREE char *library = NULL; - const char *env = getenv ("LD_LIBRARY_PATH"); int argc = 0; CLEANUP_FREE char **argv = NULL; int fd; @@ -334,13 +334,39 @@ perform_reexec (const char *prepend)...
2020 Feb 18
4
[nbdkit PATCH v7 0/2] vddk: Drive library loading from libdir parameter.
In v7: everything should work now! The re-exec code is slightly simplified, with Rich's suggestion to pass the original LD_LIBRARY_PATH rather than just the prefix being added, and I've now finished wiring up the initial dlopen() check into code that correctly computes the right prefix dir to add to LD_LIBRARY_PATH. Eric Blake (1): vddk: Add re-exec with altered environment Richard
2020 Jun 02
9
[PATCH nbdkit 0/5] vddk: Fix password parameter.
Probably needs a bit of cleanup, but seems like it is generally the right direction. One thing I've noticed is that the expect test randomly (but rarely) hangs :-( I guess something is racey but I don't know what at the moment. Rich.
2020 Jun 02
0
[PATCH nbdkit 2/5] vddk: Move reexec code to a new file.
...free); + free (v->ptr); +} + +/* Perform a re-exec that temporarily modifies LD_LIBRARY_PATH. Does + * not return on success; on failure, problems have been logged, but + * the caller prefers to proceed as if this had not been attempted. + * Thus, no return value is needed. + */ +static void +perform_reexec (const char *env, const char *prepend) +{ + CLEANUP_FREE char *library = NULL; + CLEANUP_FREE_STRING_VECTOR string_vector argv = empty_vector; + int fd; + size_t len = 0, buflen = 512; + CLEANUP_FREE char *buf = NULL; + + /* In order to re-exec, we need our original command line. The + * L...
2020 Jun 02
2
Re: [PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
...e an extensible buffer (a vector<char>) when reading > /proc/self/cmdline. > > Tidy up some error messages. > --- > plugins/vddk/reexec.c | 57 ++++++++++++++++++++++++++----------------- > 1 file changed, 35 insertions(+), 22 deletions(-) > > @@ -80,42 +95,40 @@ perform_reexec (const char *env, const char *prepend) > * until we get a short read. This assumes nbdkit did not alter its > * original argv[]. > */ > - fd = open ("/proc/self/cmdline", O_RDONLY); > + fd = open (cmdline_file, O_RDONLY|O_CLOEXEC); > if (fd == -1) {...
2020 Apr 19
2
[PATCH nbdkit 1/2] vddk: Use new vector library to allocate the argv list.
...eeded. */ +DEFINE_VECTOR_TYPE(string_vector, char *); + +#define CLEANUP_FREE_STRING_VECTOR \ + __attribute__((cleanup (cleanup_free_string_vector))) + +static void +cleanup_free_string_vector (string_vector *v) +{ + string_vector_iter (v, (void *) free); + free (v->ptr); +} + static void perform_reexec (const char *env, const char *prepend) { CLEANUP_FREE char *library = NULL; - int argc = 0; - CLEANUP_FREE char **argv = NULL; + CLEANUP_FREE_STRING_VECTOR string_vector argv = empty_vector; int fd; size_t len = 0, buflen = 512; CLEANUP_FREE char *buf = NULL; @@ -301,25 +313,22 @@ p...
2020 Jun 02
0
Re: [PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
...har>) when reading > >/proc/self/cmdline. > > > >Tidy up some error messages. > >--- > > plugins/vddk/reexec.c | 57 ++++++++++++++++++++++++++----------------- > > 1 file changed, 35 insertions(+), 22 deletions(-) > > > > >@@ -80,42 +95,40 @@ perform_reexec (const char *env, const char *prepend) > > * until we get a short read. This assumes nbdkit did not alter its > > * original argv[]. > > */ > >- fd = open ("/proc/self/cmdline", O_RDONLY); > >+ fd = open (cmdline_file, O_RDONLY|O_CLOEXEC); >...
2020 Feb 18
2
[nbdkit PATCH v6] vddk: Add re-exec with altered environment
...const char *value) return 0; } +/* Perform a re-exec that temporarily modifies LD_LIBRARY_PATH. Does + * not return on success; on failure, problems have been logged, but + * the caller prefers to fail as if this had not been attempted. + * Thus, no return value is needed. + */ +static void +perform_reexec (const char *prepend) +{ + CLEANUP_FREE char *library = NULL; + char *env = getenv ("LD_LIBRARY_PATH"); + int argc = 0; + CLEANUP_FREE char **argv = NULL; + int fd; + size_t len = 0, buflen = 512; + CLEANUP_FREE char *buf = NULL; + + /* In order to re-exec, we need our original co...
2020 Jun 02
0
[PATCH nbdkit 5/5] vddk: Munge password parameters when we reexec (RHBZ#1842440).
...ex 9641ee8c..43d4e1b7 100644 --- a/plugins/vddk/reexec.c +++ b/plugins/vddk/reexec.c @@ -37,6 +37,7 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> +#include <sys/types.h> #define NBDKIT_API_VERSION 2 #include <nbdkit-plugin.h> @@ -122,7 +123,47 @@ perform_reexec (const char *env, const char *prepend) /* Split cmdline into argv, then append one more arg. */ for (len = 0; len < buf.size; len += strlen (buf.ptr + len) + 1) { - if (string_vector_append (&argv, buf.ptr + len) == -1) { + char *arg = buf.ptr + len; /* Next \0-terminated argu...