qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Helge Deller <deller@gmx.de>, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PULL 05/13] linux-user: Use walk_memory_regions for open_self_maps
Date: Fri, 26 Jan 2024 13:03:58 +0000	[thread overview]
Message-ID: <9860cd401db66e6bf10e9e41df148b25ee6c73fd.camel@linuxfoundation.org> (raw)
In-Reply-To: <20230901204251.137307-6-richard.henderson@linaro.org>

Hi,

I've run into a problem with this change.

We (Yocto Project) upgraded to qemu 8.2.0 recently and after that we
started seeing errors cross compiling webkitgtk on x86_64 for x86_64
during the introspection code which runs under user mode qemu.

The error we see is:

qemu-x86_64: QEMU internal SIGSEGV {code=MAPERR, addr=0x20}
Segmentation fault

e.g. here:

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8488/steps/11/logs/stdio

This usually seems to happen on our debian 11 based autobuilder
machines.

I took one of the broken builds and bisected it to this change (commit
7b7a3366e142d3baeb3fd1d3660a50e7956c19eb).

There was a change in output from commit
7dfd3ca8d95f9962cdd2ebdfcdd699279b98fa18, before that it was:

ERROR:../git/accel/tcg/cpu-exec.c:532:cpu_exec_longjmp_cleanup: assertion failed: (cpu == current_cpu)
Bail out! ERROR:../git/accel/tcg/cpu-exec.c:532:cpu_exec_longjmp_cleanup: assertion failed: (cpu == current_cpu)

After digging into the code and trying to work out what is going on, I
realised that n is NULL when it fails so this makes the problem "go
away":

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e384e14248..2577fb770d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8085,6 +8085,9 @@ static int open_self_maps_2(void *opaque, target_ulong guest_start,
     while (1) {
         IntervalTreeNode *n =
             interval_tree_iter_first(d->host_maps, host_start, host_start);
+        if (!n) {
+            return 0;
+        }
         MapInfo *mi = container_of(n, MapInfo, itree);
         uintptr_t this_hlast = MIN(host_last, n->last);
         target_ulong this_gend = h2g(this_hlast) + 1;


I'm hoping that might be enough to give you an idea of what is going on
and what the correct fix may be?

I haven't managed to make an isolated test to reproduce the issue yet.

Cheers,

Richard


  reply	other threads:[~2024-01-26 13:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 20:42 [PULL 00/13] linux-user patch queue Richard Henderson
2023-09-01 20:42 ` [PULL 01/13] linux-user: Split out cpu/target_proc.h Richard Henderson
2023-09-01 20:42 ` [PULL 02/13] linux-user: Emulate /proc/cpuinfo on aarch64 and arm Richard Henderson
2023-09-01 20:42 ` [PULL 03/13] linux-user: Emulate /proc/cpuinfo for Alpha Richard Henderson
2023-09-01 20:42 ` [PULL 04/13] util/selfmap: Use dev_t and ino_t in MapInfo Richard Henderson
2023-09-01 20:42 ` [PULL 05/13] linux-user: Use walk_memory_regions for open_self_maps Richard Henderson
2024-01-26 13:03   ` Richard Purdie [this message]
2024-01-26 13:33     ` Michael Tokarev
2024-01-26 13:52       ` Richard Purdie
2024-02-05  3:05         ` Richard Henderson
2024-02-05 11:11           ` Richard Purdie
2024-02-12 20:43             ` Ilya Leoshkevich
2024-02-22  0:14               ` Richard Henderson
2023-09-01 20:42 ` [PULL 06/13] linux-user: Adjust brk for load_bias Richard Henderson
2023-09-01 20:42 ` [PULL 07/13] linux-user: Show heap address in /proc/pid/maps Richard Henderson
2023-09-01 20:42 ` [PULL 08/13] linux-user: Emulate the Anonymous: keyword in /proc/self/smaps Richard Henderson
2023-09-01 20:42 ` [PULL 09/13] linux-user: Remove ELF_START_MMAP and image_info.start_mmap Richard Henderson
2023-09-01 20:42 ` [PULL 10/13] linux-user: Move shmat and shmdt implementations to mmap.c Richard Henderson
2023-09-01 20:42 ` [PULL 11/13] linux-user: Use WITH_MMAP_LOCK_GUARD in target_{shmat, shmdt} Richard Henderson
2023-09-01 20:42 ` [PULL 12/13] linux-user: Fix shmdt Richard Henderson
2023-09-01 20:42 ` [PULL 13/13] linux-user: Track shm regions with an interval tree Richard Henderson
2023-09-06 18:24 ` [PULL 00/13] linux-user patch queue Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9860cd401db66e6bf10e9e41df148b25ee6c73fd.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=deller@gmx.de \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).