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 <ag...@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