qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gilbert <david.gilbert@linaro.org>
To: Alexander Graf <agraf@suse.de>
Cc: adrian@suse.de, riku.voipio@iki.fi, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] linux-user: add open() hijack infrastructure
Date: Thu, 3 Nov 2011 09:34:26 +0000	[thread overview]
Message-ID: <CA+1XiSeztdzafoQ7hLjruc2CckUrStymLWCnAz5f5sfgg6QEPg@mail.gmail.com> (raw)
In-Reply-To: <1320261806-13194-3-git-send-email-agraf@suse.de>

On 2 November 2011 19:23, Alexander Graf <agraf@suse.de> wrote:
> There are a number of files in /proc that expose host information
> to the guest program. This patch adds infrastructure to override
> the open() syscall for guest programs to enable us to on the fly
> generate guest sensible files.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  linux-user/syscall.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 49 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 9f5da36..38953ba 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -4600,6 +4600,52 @@ int get_osversion(void)
>     return osversion;
>  }
>
> +static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)

Once you open the pandoras-box that is emulating /proc, I think you'll probably
need to hook it in more places and be more general; although you may
well get away
with it for this particular case.

Isn't it better to put the filename interception code somewhere more general
so that it can also be misused by other calls - e.g. stat().

I guess you're also going to need to be able to do /proc/pid/* instead
of /proc/self;
something is bound to use that.

Dave

  parent reply	other threads:[~2011-11-03  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 19:23 [Qemu-devel] [PATCH 0/5] linux-user: fake some /proc/self entries Alexander Graf
2011-11-02 19:23 ` [Qemu-devel] [PATCH 1/5] linux-user: save auxv length Alexander Graf
2011-11-02 19:23   ` [Qemu-devel] [PATCH 2/5] linux-user: add open() hijack infrastructure Alexander Graf
2011-11-02 19:23     ` [Qemu-devel] [PATCH 3/5] linux-user: fake /proc/self/maps Alexander Graf
2011-11-02 19:23       ` [Qemu-devel] [PATCH 4/5] linux-user: fake /proc/self/stat Alexander Graf
2011-11-02 19:23         ` [Qemu-devel] [PATCH 5/5] linux-user: fake /proc/self/auxv Alexander Graf
2011-11-03 19:28       ` [Qemu-devel] [PATCH 3/5] linux-user: fake /proc/self/maps Alexander Graf
2011-11-03  9:34     ` David Gilbert [this message]
2011-11-03 18:33       ` [Qemu-devel] [PATCH 2/5] linux-user: add open() hijack infrastructure Alexander Graf
2011-11-03 10:47 ` [Qemu-devel] [PATCH 0/5] linux-user: fake some /proc/self entries Riku Voipio
2011-11-03 18:34   ` Alexander Graf

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=CA+1XiSeztdzafoQ7hLjruc2CckUrStymLWCnAz5f5sfgg6QEPg@mail.gmail.com \
    --to=david.gilbert@linaro.org \
    --cc=adrian@suse.de \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 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).