From 4b452c19f24e271c10662a36d08f4d327d96b42aa05e4a90d5a9f5f09372f398 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 31 May 2012 17:37:49 +0000 Subject: [PATCH] - fix /proc/self/maps faking with secondary threads OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=75 --- ...-linux-user-fix-multi-threaded-proc-.patch | 32 +++++++++++++++++++ qemu.changes | 5 +++ qemu.spec | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 0021-linux-user-fix-multi-threaded-proc-.patch diff --git a/0021-linux-user-fix-multi-threaded-proc-.patch b/0021-linux-user-fix-multi-threaded-proc-.patch new file mode 100644 index 00000000..29e051e5 --- /dev/null +++ b/0021-linux-user-fix-multi-threaded-proc-.patch @@ -0,0 +1,32 @@ +From 3f4da458294fda52c7595bbb1fb9ca3d50e5b887 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Wed, 30 May 2012 14:40:47 +0200 +Subject: [PATCH] linux-user: fix multi-threaded /proc/self/maps + +When reading our faked /proc/self/maps from a secondary thread, +we get an invalid stack entry. This is because ts->stack_base is not +initialized in non-primary threads. + +However, ts->info is, and the stack layout information we're looking +for is there too. So let's use that one instead! + +Signed-off-by: Alexander Graf +--- + linux-user/syscall.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 39d02f8..06408bd 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -4920,8 +4920,8 @@ static int open_self_maps(void *cpu_env, int fd) + #if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32) + 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->info->start_stack + ++ (TARGET_PAGE_SIZE - 1)) & TARGET_PAGE_MASK, + (unsigned long long)0); + #endif + diff --git a/qemu.changes b/qemu.changes index f14ed8f4..7c953623 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu May 31 17:37:26 UTC 2012 - agraf@suse.com + +- fix /proc/self/maps faking with secondary threads + ------------------------------------------------------------------- Wed May 30 20:19:05 CEST 2012 - agraf@suse.de diff --git a/qemu.spec b/qemu.spec index 71ad6b7b..40fa6c8d 100644 --- a/qemu.spec +++ b/qemu.spec @@ -44,6 +44,7 @@ Patch0017: 0017-linux-user-fix-segfault-deadlock.pa.patch Patch0018: 0018-linux-user-binfmt-support-host-bina.patch Patch0019: 0019-linux-user-ARM-Ignore-immediate-val.patch Patch0020: 0020-linux-user-arm-no-tb_flush-on-reset.patch +Patch0021: 0021-linux-user-fix-multi-threaded-proc-.patch # this is to make lint happy Source300: rpmlintrc Source400: update_git.sh @@ -134,6 +135,7 @@ run cross architectures builds %patch0018 -p1 %patch0019 -p1 %patch0020 -p1 +%patch0021 -p1 %build # build QEMU