[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/19] linux-user: fake /proc/self/maps
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 04/19] linux-user: fake /proc/self/maps |
Date: |
Fri, 3 Feb 2012 16:49:17 +0200 |
From: Alexander Graf <address@hidden>
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 <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
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 e100025..1864d7f 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,
+ (unsigned long long)ts->stack_base);
+
+ return 0;
+}
+
static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -4608,6 +4622,7 @@ static int do_open(void *cpu_env, const char *pathname,
int flags, mode_t mode)
};
const struct fake_open *fake_open;
static const struct fake_open fakes[] = {
+ { "/proc/self/maps", open_self_maps },
{ NULL, NULL }
};
--
1.7.5.4
- [Qemu-devel] [PATCH 01/19] linux-user: stack_base is now mandatory on all targets, (continued)
- [Qemu-devel] [PATCH 01/19] linux-user: stack_base is now mandatory on all targets, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 06/19] linux-user: fake /proc/self/auxv, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 16/19] linux-user: Add default configs for mips64[el], riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 03/19] linux-user: add open() hijack infrastructure, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 07/19] linux-user/main.c: Add option to user-mode emulation so that user can specify log file name, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 05/19] linux-user: fake /proc/self/stat, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 08/19] linux-user: add SO_PEERCRED support for getsockopt, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 11/19] linux-user: fix wait* syscall status returns, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 13/19] linux-user/syscall.c: Implement f and l versions of set/get/removexattr, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 04/19] linux-user: fake /proc/self/maps,
riku . voipio <=
- [Qemu-devel] [PATCH 10/19] linux-user/strace.c: Correct errno printing for mmap etc, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 12/19] linux-user: Allow NULL value pointer in setxattr and getxattr, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 14/19] linux-user: Implement *listxattr syscalls, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 09/19] linux-user: fix QEMU_STRACE=1 segfault, riku . voipio, 2012/02/03
- [Qemu-devel] [PATCH 18/19] linux-user: Define TARGET_QEMU_ESIGRETURN for mips64, riku . voipio, 2012/02/03
- Re: [Qemu-devel] [PULL] [PATCH 00/19] linux-user update, Blue Swirl, 2012/02/04