All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1346769] [NEW] /proc/self/maps content returned to 32-bits guest under 64-bits qemu
@ 2014-07-22  6:47 Mikhail Ilyin
  2014-07-22  8:51 ` [Qemu-devel] [Bug 1346769] " Peter Maydell
  2016-06-17 16:05 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Mikhail Ilyin @ 2014-07-22  6:47 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Reading /proc/self/maps a user doesn't get a stack record. Not all
programs relies on the maps file but some do.

The bug found by running 32-bits binaries with address sanitizer (Asan)
instrumentations under 64-bit qemu.

$ echo "int main() { return 0; }" > /tmp/test.c
$ gcc -m32 -fsanitize=address -fno-common -Wall -g -fPIC -o /tmp/test /tmp/test.c
$ qemu-i386-static /tmp/test
==4092==AddressSanitizer CHECK failed: /home/michail/Downloads/gcc-4.9.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:63 "(((uptr)&rl >= start && (uptr)&rl < end)) != (0)" (0x0, 0x0)
    #0 0xf632ff01 (/home/michail/build/lib32/libasan.so.1+0x53f01)
    #1 0xf6333f49 (/home/michail/build/lib32/libasan.so.1+0x57f49)
    #2 0xf6338785 (/home/michail/build/lib32/libasan.so.1+0x5c785)
    #3 0xf6338bd1 (/home/michail/build/lib32/libasan.so.1+0x5cbd1)
    #4 0xf6331baf (/home/michail/build/lib32/libasan.so.1+0x55baf)
    #5 0xf6331dca (/home/michail/build/lib32/libasan.so.1+0x55dca)
    #6 0xf6331f5a (/home/michail/build/lib32/libasan.so.1+0x55f5a)
    #7 0xf6330bd4 (/home/michail/build/lib32/libasan.so.1+0x54bd4)
    #8 0xf67ebeec (/lib/ld-linux.so.2+0xeeec)
    #9 0xf67de10e (/lib/ld-linux.so.2+0x110e)

This happened because during initialization Asan can't find stack
boundaries.

For some reasons Qemu wants to report stack boundaries just for several
arch targets skipping other ones. This is from linux-user/syscall.c
open_self_maps()

#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->info->start_stack +
                                     (TARGET_PAGE_SIZE - 1)) & TARGET_PAGE_MASK,
                (unsigned long long)0);
#endif

Not very clear why the case covers just specific targets.

This bug continues the previously reported issue with not hiden system
map http://lists.nongnu.org/archive/html/qemu-
devel/2014-07/msg02793.html.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1346769

Title:
  /proc/self/maps content returned to 32-bits guest under 64-bits qemu

Status in QEMU:
  New

Bug description:
  Reading /proc/self/maps a user doesn't get a stack record. Not all
  programs relies on the maps file but some do.

  The bug found by running 32-bits binaries with address sanitizer
  (Asan) instrumentations under 64-bit qemu.

  $ echo "int main() { return 0; }" > /tmp/test.c
  $ gcc -m32 -fsanitize=address -fno-common -Wall -g -fPIC -o /tmp/test /tmp/test.c
  $ qemu-i386-static /tmp/test
  ==4092==AddressSanitizer CHECK failed: /home/michail/Downloads/gcc-4.9.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:63 "(((uptr)&rl >= start && (uptr)&rl < end)) != (0)" (0x0, 0x0)
      #0 0xf632ff01 (/home/michail/build/lib32/libasan.so.1+0x53f01)
      #1 0xf6333f49 (/home/michail/build/lib32/libasan.so.1+0x57f49)
      #2 0xf6338785 (/home/michail/build/lib32/libasan.so.1+0x5c785)
      #3 0xf6338bd1 (/home/michail/build/lib32/libasan.so.1+0x5cbd1)
      #4 0xf6331baf (/home/michail/build/lib32/libasan.so.1+0x55baf)
      #5 0xf6331dca (/home/michail/build/lib32/libasan.so.1+0x55dca)
      #6 0xf6331f5a (/home/michail/build/lib32/libasan.so.1+0x55f5a)
      #7 0xf6330bd4 (/home/michail/build/lib32/libasan.so.1+0x54bd4)
      #8 0xf67ebeec (/lib/ld-linux.so.2+0xeeec)
      #9 0xf67de10e (/lib/ld-linux.so.2+0x110e)

  This happened because during initialization Asan can't find stack
  boundaries.

  For some reasons Qemu wants to report stack boundaries just for
  several arch targets skipping other ones. This is from linux-
  user/syscall.c open_self_maps()

  #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->info->start_stack +
                                       (TARGET_PAGE_SIZE - 1)) & TARGET_PAGE_MASK,
                  (unsigned long long)0);
  #endif

  Not very clear why the case covers just specific targets.

  This bug continues the previously reported issue with not hiden system
  map http://lists.nongnu.org/archive/html/qemu-
  devel/2014-07/msg02793.html.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1346769/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1346769] Re: /proc/self/maps content returned to 32-bits guest under 64-bits qemu
  2014-07-22  6:47 [Qemu-devel] [Bug 1346769] [NEW] /proc/self/maps content returned to 32-bits guest under 64-bits qemu Mikhail Ilyin
@ 2014-07-22  8:51 ` Peter Maydell
  2014-07-23  5:04   ` Mikhail Ilin
  2016-06-17 16:05 ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2014-07-22  8:51 UTC (permalink / raw)
  To: qemu-devel

I think the ifdefs are just accident of history and we can safely remove
them.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1346769

Title:
  /proc/self/maps content returned to 32-bits guest under 64-bits qemu

Status in QEMU:
  New

Bug description:
  Reading /proc/self/maps a user doesn't get a stack record. Not all
  programs relies on the maps file but some do.

  The bug found by running 32-bits binaries with address sanitizer
  (Asan) instrumentations under 64-bit qemu.

  $ echo "int main() { return 0; }" > /tmp/test.c
  $ gcc -m32 -fsanitize=address -fno-common -Wall -g -fPIC -o /tmp/test /tmp/test.c
  $ qemu-i386-static /tmp/test
  ==4092==AddressSanitizer CHECK failed: /home/michail/Downloads/gcc-4.9.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:63 "(((uptr)&rl >= start && (uptr)&rl < end)) != (0)" (0x0, 0x0)
      #0 0xf632ff01 (/home/michail/build/lib32/libasan.so.1+0x53f01)
      #1 0xf6333f49 (/home/michail/build/lib32/libasan.so.1+0x57f49)
      #2 0xf6338785 (/home/michail/build/lib32/libasan.so.1+0x5c785)
      #3 0xf6338bd1 (/home/michail/build/lib32/libasan.so.1+0x5cbd1)
      #4 0xf6331baf (/home/michail/build/lib32/libasan.so.1+0x55baf)
      #5 0xf6331dca (/home/michail/build/lib32/libasan.so.1+0x55dca)
      #6 0xf6331f5a (/home/michail/build/lib32/libasan.so.1+0x55f5a)
      #7 0xf6330bd4 (/home/michail/build/lib32/libasan.so.1+0x54bd4)
      #8 0xf67ebeec (/lib/ld-linux.so.2+0xeeec)
      #9 0xf67de10e (/lib/ld-linux.so.2+0x110e)

  This happened because during initialization Asan can't find stack
  boundaries.

  For some reasons Qemu wants to report stack boundaries just for
  several arch targets skipping other ones. This is from linux-
  user/syscall.c open_self_maps()

  #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->info->start_stack +
                                       (TARGET_PAGE_SIZE - 1)) & TARGET_PAGE_MASK,
                  (unsigned long long)0);
  #endif

  Not very clear why the case covers just specific targets.

  This bug continues the previously reported issue with not hiden system
  map http://lists.nongnu.org/archive/html/qemu-
  devel/2014-07/msg02793.html.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1346769/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Bug 1346769] Re: /proc/self/maps content returned to 32-bits guest under 64-bits qemu
  2014-07-22  8:51 ` [Qemu-devel] [Bug 1346769] " Peter Maydell
@ 2014-07-23  5:04   ` Mikhail Ilin
  2014-07-23  5:23     ` Mikhail Ilin
  0 siblings, 1 reply; 5+ messages in thread
From: Mikhail Ilin @ 2014-07-23  5:04 UTC (permalink / raw)
  To: qemu-devel, peter.maydell, 'Yury Gribov', Slava Garbuzov

On 22.07.2014 12:51, Peter Maydell wrote:
 > I think the ifdefs are just accident of history and we can safely remove
 > them.
 >

Good, let make a fix.

 From 719f4e66b134a043dabdf5f6cb6d40445a53e071 Mon Sep 17 00:00:00 2001
From: Mikhail Ilyin <m.ilin@samsung.com>
Date: Wed, 23 Jul 2014 08:49:09 +0400
Subject: [PATCH] Remove target specific ifdefs which are not relevant 
any more.

Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com>
---
  linux-user/syscall.c | 4 ----
  1 file changed, 4 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a50229d..09bbc44 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5092,10 +5092,8 @@ static int open_self_cmdline(void *cpu_env, int fd)

  static int open_self_maps(void *cpu_env, int fd)
  {
-#if defined(TARGET_ARM) || defined(TARGET_M68K) || 
defined(TARGET_UNICORE32)
      CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
      TaskState *ts = cpu->opaque;
-#endif
      FILE *fp;
      char *line = NULL;
      size_t len = 0;
@@ -5133,13 +5131,11 @@ static int open_self_maps(void *cpu_env, int fd)
      free(line);
      fclose(fp);

-#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->info->start_stack +
                                       (TARGET_PAGE_SIZE - 1)) & 
TARGET_PAGE_MASK,
                  (unsigned long long)0);
-#endif

      return 0;
  }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Bug 1346769] Re: /proc/self/maps content returned to 32-bits guest under 64-bits qemu
  2014-07-23  5:04   ` Mikhail Ilin
@ 2014-07-23  5:23     ` Mikhail Ilin
  0 siblings, 0 replies; 5+ messages in thread
From: Mikhail Ilin @ 2014-07-23  5:23 UTC (permalink / raw)
  To: qemu-devel, peter.maydell, 'Yury Gribov', Slava Garbuzov
  Cc: riku.voipio

Adding Riku Voipio

On 23.07.2014 09:04, Mikhail Ilin wrote:
> On 22.07.2014 12:51, Peter Maydell wrote:
>  > I think the ifdefs are just accident of history and we can safely remove
>  > them.
>  >
>
> Good, let make a fix.
>
>  From 719f4e66b134a043dabdf5f6cb6d40445a53e071 Mon Sep 17 00:00:00 2001
> From: Mikhail Ilyin <m.ilin@samsung.com>
> Date: Wed, 23 Jul 2014 08:49:09 +0400
> Subject: [PATCH] Remove target specific ifdefs which are not relevant
> any more.
>
> Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com>
> ---
>   linux-user/syscall.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a50229d..09bbc44 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -5092,10 +5092,8 @@ static int open_self_cmdline(void *cpu_env, int fd)
>
>   static int open_self_maps(void *cpu_env, int fd)
>   {
> -#if defined(TARGET_ARM) || defined(TARGET_M68K) ||
> defined(TARGET_UNICORE32)
>       CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
>       TaskState *ts = cpu->opaque;
> -#endif
>       FILE *fp;
>       char *line = NULL;
>       size_t len = 0;
> @@ -5133,13 +5131,11 @@ static int open_self_maps(void *cpu_env, int fd)
>       free(line);
>       fclose(fp);
>
> -#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->info->start_stack +
>                                        (TARGET_PAGE_SIZE - 1)) &
> TARGET_PAGE_MASK,
>                   (unsigned long long)0);
> -#endif
>
>       return 0;
>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1346769] Re: /proc/self/maps content returned to 32-bits guest under 64-bits qemu
  2014-07-22  6:47 [Qemu-devel] [Bug 1346769] [NEW] /proc/self/maps content returned to 32-bits guest under 64-bits qemu Mikhail Ilyin
  2014-07-22  8:51 ` [Qemu-devel] [Bug 1346769] " Peter Maydell
@ 2016-06-17 16:05 ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-06-17 16:05 UTC (permalink / raw)
  To: qemu-devel

We removed the ifdefs at some point; the test case in this bug report
now runs successfully.


** Changed in: qemu
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1346769

Title:
  /proc/self/maps content returned to 32-bits guest under 64-bits qemu

Status in QEMU:
  Fix Released

Bug description:
  Reading /proc/self/maps a user doesn't get a stack record. Not all
  programs relies on the maps file but some do.

  The bug found by running 32-bits binaries with address sanitizer
  (Asan) instrumentations under 64-bit qemu.

  $ echo "int main() { return 0; }" > /tmp/test.c
  $ gcc -m32 -fsanitize=address -fno-common -Wall -g -fPIC -o /tmp/test /tmp/test.c
  $ qemu-i386-static /tmp/test
  ==4092==AddressSanitizer CHECK failed: /home/michail/Downloads/gcc-4.9.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:63 "(((uptr)&rl >= start && (uptr)&rl < end)) != (0)" (0x0, 0x0)
      #0 0xf632ff01 (/home/michail/build/lib32/libasan.so.1+0x53f01)
      #1 0xf6333f49 (/home/michail/build/lib32/libasan.so.1+0x57f49)
      #2 0xf6338785 (/home/michail/build/lib32/libasan.so.1+0x5c785)
      #3 0xf6338bd1 (/home/michail/build/lib32/libasan.so.1+0x5cbd1)
      #4 0xf6331baf (/home/michail/build/lib32/libasan.so.1+0x55baf)
      #5 0xf6331dca (/home/michail/build/lib32/libasan.so.1+0x55dca)
      #6 0xf6331f5a (/home/michail/build/lib32/libasan.so.1+0x55f5a)
      #7 0xf6330bd4 (/home/michail/build/lib32/libasan.so.1+0x54bd4)
      #8 0xf67ebeec (/lib/ld-linux.so.2+0xeeec)
      #9 0xf67de10e (/lib/ld-linux.so.2+0x110e)

  This happened because during initialization Asan can't find stack
  boundaries.

  For some reasons Qemu wants to report stack boundaries just for
  several arch targets skipping other ones. This is from linux-
  user/syscall.c open_self_maps()

  #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->info->start_stack +
                                       (TARGET_PAGE_SIZE - 1)) & TARGET_PAGE_MASK,
                  (unsigned long long)0);
  #endif

  Not very clear why the case covers just specific targets.

  This bug continues the previously reported issue with not hiden system
  map http://lists.nongnu.org/archive/html/qemu-
  devel/2014-07/msg02793.html.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1346769/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-17 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22  6:47 [Qemu-devel] [Bug 1346769] [NEW] /proc/self/maps content returned to 32-bits guest under 64-bits qemu Mikhail Ilyin
2014-07-22  8:51 ` [Qemu-devel] [Bug 1346769] " Peter Maydell
2014-07-23  5:04   ` Mikhail Ilin
2014-07-23  5:23     ` Mikhail Ilin
2016-06-17 16:05 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.