From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RM2xs-0003gn-W5 for qemu-devel@nongnu.org; Thu, 03 Nov 2011 15:28:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RM2xr-0001Qb-NP for qemu-devel@nongnu.org; Thu, 03 Nov 2011 15:28:40 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51286 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RM2xr-0001PU-I2 for qemu-devel@nongnu.org; Thu, 03 Nov 2011 15:28:39 -0400 Message-ID: <4EB2EB64.70603@suse.de> Date: Thu, 03 Nov 2011 20:28:36 +0100 From: Alexander Graf MIME-Version: 1.0 References: <1320261806-13194-1-git-send-email-agraf@suse.de> <1320261806-13194-2-git-send-email-agraf@suse.de> <1320261806-13194-3-git-send-email-agraf@suse.de> <1320261806-13194-4-git-send-email-agraf@suse.de> In-Reply-To: <1320261806-13194-4-git-send-email-agraf@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] linux-user: fake /proc/self/maps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: adrian@suse.de, riku.voipio@iki.fi 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 > --- > 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