From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LBRYj-0000NP-Bm for qemu-devel@nongnu.org; Sat, 13 Dec 2008 05:17:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LBRYi-0000MP-GE for qemu-devel@nongnu.org; Sat, 13 Dec 2008 05:17:16 -0500 Received: from [199.232.76.173] (port=60824 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LBRYi-0000MI-BC for qemu-devel@nongnu.org; Sat, 13 Dec 2008 05:17:16 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:34649) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LBRYh-0005SG-Rj for qemu-devel@nongnu.org; Sat, 13 Dec 2008 05:17:16 -0500 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate01.web.de (Postfix) with ESMTP id 3C14EFA86C82 for ; Sat, 13 Dec 2008 11:17:15 +0100 (CET) Received: from [88.64.11.10] (helo=[192.168.1.198]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1LBRYh-0000KH-00 for qemu-devel@nongnu.org; Sat, 13 Dec 2008 11:17:15 +0100 Message-ID: <49438B8B.8050709@web.de> Date: Sat, 13 Dec 2008 11:16:43 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1229125944.3898.39.camel@cocoduo.atr> <1229126410.3898.42.camel@cocoduo.atr> In-Reply-To: <1229126410.3898.42.camel@cocoduo.atr> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3F654301206D9D4E7B1E97BA" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [linux-user] Fixed Qemu crash using Gdbstub Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3F654301206D9D4E7B1E97BA Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Lionel Landwerlin wrote: > I just forgot to remove 2 printf ... > Here the good patch : >=20 >=20 >=20 >=20 >>>From 2b3fe65ea3f2ee8dd3efbb52b66a2f4e53b788ea Mon Sep 17 00:00:00 2001 > From: Lionel Landwerlin > Date: Sat, 13 Dec 2008 00:32:04 +0100 > Subject: [PATCH] [linux-user] Fixed Qemu crash using Gdbstub >=20 > When using gdb with qemu (via gdbstub), if your emulated > application is multithreaded and does a segfault then qemu > crashes. >=20 > Qemu crashes because the break/watch points are shared between > cpus. The TAILQ structure which handles the list of break/watch > points is copied inside each CPUState structure. When the last > breakpoint is removed (this happens on a segfault), it is > removed across all cpus but because of the copied TAILQ > structure a same breakpoint can be freed N times with N the > current number of cpus. OK, now I got the problem: user space emulation spawns additional VCPUs to emulate fork. Those VCPUs are cloned via cpu_copy which simply duplicates the CPUState of the parent, including the breakpoint and watchpoint TAILQ headers. This is doomed to fail. But your approach to let the cloned VCPU point to the same TAILQ header as its parent is not correct as well. It will cause troubles to gdbstub which manages breakpoints on all VCPUs by adding duplicate instances on a per-VCPU base. If you inject a breakpoint before a fork and then remove it afterwards, gdbstub will report an error because it will only find the breakpoint once, not n times (n =3D number of VCPUs). What you have to do is to cleanly duplicate the breakpoint and watchpoint lists on cpu_copy (filter out BP_CPU types for cleanness reasons, although they do not occur in user emulation ATM). Jan --------------enig3F654301206D9D4E7B1E97BA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAklDi5AACgkQniDOoMHTA+lZlQCfWbHSyft7vIroqmGXxqpSnByQ 0OYAn1uePJ+uNEfedApeCsAE1ykW19YV =cGWs -----END PGP SIGNATURE----- --------------enig3F654301206D9D4E7B1E97BA--