From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: adrian@suse.de, riku.voipio@iki.fi
Subject: Re: [Qemu-devel] [PATCH 3/5] linux-user: fake /proc/self/maps
Date: Thu, 03 Nov 2011 20:28:36 +0100 [thread overview]
Message-ID: <4EB2EB64.70603@suse.de> (raw)
In-Reply-To: <1320261806-13194-4-git-send-email-agraf@suse.de>
Alexander Graf wrote:
> glibc's pthread_attr_getstack tries to find the stack range from
> /proc/self/maps. Unfortunately, /proc is usually the host's /proc
> which means linux-user guests see qemu's stack there.
>
> Fake the file with a constructed maps entry that exposes the guest's
> stack range.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> linux-user/syscall.c | 15 +++++++++++++++
> 1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 38953ba..a51b457 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -4600,6 +4600,20 @@ int get_osversion(void)
> return osversion;
> }
>
> +
> +static int open_self_maps(void *cpu_env, int fd)
> +{
> + TaskState *ts = ((CPUState *)cpu_env)->opaque;
> +
> + dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n",
> + (unsigned long long)ts->info->stack_limit,
> + (unsigned long long)(ts->stack_base + (TARGET_PAGE_SIZE - 1))
> + & TARGET_PAGE_MASK,
>
This needs to be guarded by:
#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
Any idea how to fetch the stack range from somewhere else for other archs?
Alex
next prev parent reply other threads:[~2011-11-03 19:28 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 ` Alexander Graf [this message]
2011-11-03 9:34 ` [Qemu-devel] [PATCH 2/5] linux-user: add open() hijack infrastructure David Gilbert
2011-11-03 18:33 ` 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=4EB2EB64.70603@suse.de \
--to=agraf@suse.de \
--cc=adrian@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).