qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] linux-user: add option to intercept execve() syscalls
@ 2016-06-14 19:26 Joel Holdsworth
  2016-06-14 19:26 ` [Qemu-devel] [PATCH v2 1/4] " Joel Holdsworth
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Joel Holdsworth @ 2016-06-14 19:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vasileios.Kalintiris, riku.voipio

This patch-set includes Peter Angelatos's previous patch-set [1] and
adds code to pass arguments for setting the environment variables,
passing the interpeter prefix, and passing the strace option.

Changes since v1:
 - Fixed argument array overflows.

[1] https://patchwork.ozlabs.org/patch/582756/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/4] linux-user: pass environment arguments in execve
@ 2016-06-20 20:08 Riku Voipio
  0 siblings, 0 replies; 19+ messages in thread
From: Riku Voipio @ 2016-06-20 20:08 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: Vasileios.Kalintiris, Riku Voipio, qemu-devel, Laurent Vivier

   20.6.2016 22.51 Joel Holdsworth <joel.holdsworth@vcatechnology.com>
   kirjoitti:
   >
   > On 15/06/16 20:59, Laurent Vivier wrote:
   > >
   > > Le 14/06/2016 `a 21:26, Joel Holdsworth a ecrit :
   > >> Previously, when emulating execve(2), qemu would execute a child
   > >> instance of the emulator with the environment variables provided
   by
   > >> the parent process. This caused problems with qemu if any of the
   > >> variables affected the child emulator's behaviour e.g.
   > >> LD_LIBRARY_PATH.
   > > The best way to avoid that is to use a statically linked qemu.
   >
   > Stepping back a bit; the problem I'm trying to solve is this...
   >
   > There are some processes that invoke a helper process to do some work
   > for them e.g. gstreamer's gst-plugin-scanner. Previously qemu would
   > attempt to execute the helper executable as if it were
   machine-native,
   > which won't work. These patches modify qemu so that it will
   (optionally)
   > run the child process inside a child instance of qemu.
   >
   > My experience as a user was that it took a couple of hours of
   searching
   > through strace logs to figure out what the issue was. gstreamer would
   > just fail with a generic error about the helper. These patches are
   meant
   > to make qemu do the right thing.
   >
   > Saying to the user that they should make a static linked build of
   qemu
   > isn't very practical. Having a command line argument is a much easier
   > solution for the user, that doesn't force them not to used
   > shared-library builds. The distros aren't going to go for that.

   Actually at least Debian and Ubuntu already ship static qemu-user
   binaries. Using static qemu-user and binfmt_misc is the standard way
   people use qemu-user.

   >
   > Moreover, LD_LIBRARY_PATH is just one example. LD_PRELOAD is another.
   > Timezone and locale environment variables are also an issue.
   >
   > In an ideal world, it wouldn't even be necessary to add an argument -
   > qemu would just do the right thing automatically. Though I'm not sure
   > how that could be done correctly, so a command line option is a good
   > compromise for a starting point.
   >
   >
   > >
   > >> This patch solves this issue by passing the environment variables
   > >> with '-E' arguments to the child qemu instance. The call to
   > >> execve(2) is replaced by a call to execv(2) so that the parent
   > >> emulator's environment variable state is propagated into the
   child.
   > >>
   > >> Any variables from the host environment that are not in the in the
   > >> execve() call are removed with a '-U' argument.
   > > Run ./scripts/checkpatch.pl on your patch...
   > >
   > > and add your Signed-off-by here.
   > Sure ok.
   >
   >
   > > The environment is already managed in linux-user/main.c:main(), I
   don't
   > > understand why the qemu_execve() special case should differ from
   the
   > > general case.
   > Maybe I've missed something, but the problem I'm trying to solve here
   is
   > the issue of correctly propagating the guest environment variables
   into
   > the child process.
   >
   > The parent guest process (running inside qemu-user) constructs a set
   of
   > environment variables and passes them to execve. However, if the
   parent
   > qemu-user decides to run a child instance of qemu-user it should run
   > with the same environment variables as the parent, but with
   environment
   > variables the parent-guest passed through the arguments for the
   child-guest.
   >
   > If gstreamer decides to run gst-plugin-scanner with a certain
   environ,
   > that is for the child qemu guest, not the child qemu instance itself.
   >
   >

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-06-20 22:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-14 19:26 [Qemu-devel] linux-user: add option to intercept execve() syscalls Joel Holdsworth
2016-06-14 19:26 ` [Qemu-devel] [PATCH v2 1/4] " Joel Holdsworth
2016-06-15 19:31   ` Laurent Vivier
2016-06-20 20:04     ` Joel Holdsworth
2016-06-14 19:26 ` [Qemu-devel] [PATCH v2 2/4] linux-user: pass environment arguments in execve Joel Holdsworth
2016-06-15 19:59   ` Laurent Vivier
2016-06-20 19:51     ` Joel Holdsworth
2016-06-20 20:29       ` Laurent Vivier
2016-06-20 21:27         ` Joel Holdsworth
2016-06-20 21:40           ` Peter Maydell
2016-06-20 22:15             ` Joel Holdsworth
2016-06-20 22:54               ` Peter Maydell
2016-06-14 19:26 ` [Qemu-devel] [PATCH v2 3/4] linux-user: pass elf interpreter prefix " Joel Holdsworth
2016-06-15 20:06   ` Laurent Vivier
2016-06-20 19:57     ` Joel Holdsworth
2016-06-14 19:26 ` [Qemu-devel] [PATCH v2 4/4] linux-user: pass strace argument " Joel Holdsworth
2016-06-15 20:37   ` Laurent Vivier
2016-06-20 20:02     ` Joel Holdsworth
  -- strict thread matches above, loose matches on Subject: below --
2016-06-20 20:08 [Qemu-devel] [PATCH v2 2/4] linux-user: pass environment arguments " Riku Voipio

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).