All of lore.kernel.org
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: Alexander Graf <agraf@suse.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: Add binfmt wrapper
Date: Wed, 16 Jul 2014 09:54:45 +0300	[thread overview]
Message-ID: <20140716065445.GA6046@afflict.kos.to> (raw)
In-Reply-To: <OF75F912AF.665DF542-ONC1257D16.0052C3E2-C1257D16.00537A66@transmode.se>

On Tue, Jul 15, 2014 at 05:11:48PM +0200, Joakim Tjernlund wrote:
> Riku Voipio <riku.voipio@iki.fi> wrote on 2014/07/15 16:12:26:
> > On Mon, Jul 14, 2014 at 05:38:49PM +0200, Joakim Tjernlund wrote:
> > > Alexander Graf <agraf@suse.de> wrote on 2014/07/14 17:21:33:
> > > > On 14.07.14 16:38, Joakim Tjernlund wrote:
> > > > > The popular binfmt-wrapper patch adds an additional
> > > > > executable which mangle argv suitable for binfmt flag P.
> > > > > In a chroot you need the both (statically linked) qemu-$arch
> > > > > and qemu-$arch-binfmt-wrapper. This is sub optimal and a
> > > > > better approach is to recognize the -binfmt-wrapper extension
> > > > > within linux-user(qemu-$arch) and mangle argv there.
> > > > > This just produces on executable which can be either copied to
> > > > > the chroot or bind mounted with the appropriate -binfmt-wrapper
> > > > > suffix.
> > > > >
> > > > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > > 
> > > > Please make sure to CC Riku on patches like this - he is the 
> linux-user 
> > > > maintainer.
> > > 
> > > Doesn't he read the devel list? Anyhow CC:ed
> > 
> > I do - but CC gets directly to my inbox while qemu-devel goes to an
> > folder.
> > 
> > I take from this discussion, that this patch has been superceded by the
> > Patch at: http://patchwork.ozlabs.org/patch/369770/ ?
> 
> BTW, any chance qemu binfmt could fixup the ps output from within a 
> container:
>  jocke-ppc2 ~ # ps uaxww
> USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
> root         1  0.1  0.0 4138016 7600 ?        Ss   17:02   0:00 
> /usr/bin/qemu-ppc /sbin/init /sbin/init
> root        79  0.0  0.0 4138016 5792 ?        Ss   17:02   0:00 
> /usr/bin/qemu-ppc /usr/sbin/sshd /usr/sbin/sshd
> root       293  0.0  0.0 4137952 4072 ?        Ss   17:02   0:00 
> /usr/bin/qemu-ppc /bin/busybox /bin/busybox udhcpc -x hostname:jocke-ppc2 
> --interface=eth0 --now --script=/lib/netifrc/sh/udhcpc-hook.sh 
> --pidfile=/var/run/udhcpc-eth0.pid
> root       334  0.3  0.0 4138016 5964 tty1     Ss+  17:02   0:00 
> /usr/bin/qemu-ppc /sbin/agetty /sbin/agetty 38400 tty1 linux
> root       335  3.1  0.0 4138048 7064 console  Ss   17:02   0:00 
> /usr/bin/qemu-ppc /bin/login /bin/login -- root
> root       336  3.3  0.0 4138016 9764 console  S    17:02   0:00 
> /usr/bin/qemu-ppc /bin/bash -bash
> root       340  0.0  0.0 4138016 6336 ?        R+   Jul10   0:00 /bin/ps 
> ps uaxww
> 
> As you can see, qemu-ppc is visible. 

This isn't something binfmt could do. ps uses /proc/$pid/exe to map the
right binary. However, qemu already fixes /proc/self/exe to point to
right file - as you can see from the last line where "ps uaxww" doesn't
have qemu shown. So it would be possible to make do_open() in syscall.c do
similar mapping for /proc/$pid/exe. 

Exactly how and when the qemu processes should be hidden within qemu
needs careful thought thou. A naive approach would check if
/proc/$pid/exe points to same binary as /proc/self/exe, hiding at least
same architecture qemu processes.

Riku

  reply	other threads:[~2014-07-16  6:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 14:38 [Qemu-devel] [PATCH] linux-user: Add binfmt wrapper Joakim Tjernlund
2014-07-14 15:21 ` Alexander Graf
2014-07-14 15:38   ` Joakim Tjernlund
2014-07-14 15:46     ` Alexander Graf
2014-07-14 15:59       ` Joakim Tjernlund
2014-07-14 16:00         ` Alexander Graf
2014-07-14 16:32           ` Joakim Tjernlund
2014-07-14 16:34             ` Alexander Graf
2014-07-14 16:45               ` Joakim Tjernlund
2014-07-14 16:51               ` Joakim Tjernlund
2014-07-14 16:54                 ` Alexander Graf
2014-07-14 17:01                   ` Joakim Tjernlund
2014-07-14 17:08                   ` Joakim Tjernlund
2014-07-14 17:14                     ` Alexander Graf
2014-07-14 16:00         ` Peter Maydell
2014-07-14 16:08           ` Joakim Tjernlund
2014-07-15 14:12     ` Riku Voipio
2014-07-15 14:39       ` Joakim Tjernlund
2014-07-15 15:11       ` Joakim Tjernlund
2014-07-16  6:54         ` Riku Voipio [this message]
2014-07-16  7:22           ` Joakim Tjernlund
2014-07-16 11:38           ` Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140716065445.GA6046@afflict.kos.to \
    --to=riku.voipio@iki.fi \
    --cc=agraf@suse.de \
    --cc=joakim.tjernlund@transmode.se \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.