From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brice Waegeneire Subject: bug#34276: =?UTF-8?Q?=E2=80=98guix?= system disk-im =?UTF-8?Q?age=E2=80=99?= successfully builds a bad image Date: Thu, 19 Mar 2020 20:05:08 +0000 Message-ID: <7a36cb1fc7c68f5d63a324df49170cdc@waegenei.re> References: <877eejfqmb.fsf@nckx> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34966) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF1Qa-0007ZH-Av for bug-guix@gnu.org; Thu, 19 Mar 2020 16:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF1QZ-0007Hq-4I for bug-guix@gnu.org; Thu, 19 Mar 2020 16:06:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF1QY-0007H6-Hz for bug-guix@gnu.org; Thu, 19 Mar 2020 16:06:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jF1QY-0002JP-Ai for bug-guix@gnu.org; Thu, 19 Mar 2020 16:06:02 -0400 In-Reply-To: <877eejfqmb.fsf@nckx> Sender: "Debbugs-submit" Resent-Message-ID: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org Sender: "bug-Guix" To: 34276@debbugs.gnu.org Hello Ludovic, > I investigated a bit. I managed to get our code to cause a kernel > panic > upon failure (patch below). However I fail to turn that guest kernel > panic into a different QEMU exit code. > > I tried to use the “pvpanic” paravirtualized device (the ‘pvpanic.ko’ > module in the guest, and “-device pvpanic” on the QEMU command line), > but unfortunately that thing is almost undocumented and I can’t get it > to turn the panic into a non-zero exit code, nor do I know if it’s > possible. > > Thoughts anyone? I looked a little into it and I have found how to use pvpanic. Unfortunately it's not as straight forward as getting a non-zero exit code form qemu. When pvpanic is loaded in a VṂ, as you did with “-device pvpanic”, generate events[0] on the QMP interface when a crash happen and qemu either shutdown or pause when using --no-shutdown[1]. (gnu build marionette) which use the “-monitor” interface could be recycled to use “-qmp” a machine interface using JSON. Following is log of a QMP session where the guest panicked[2]: --8<---------------cut here---------------start------------->8--- { "QMP": { "version": { "qemu": { "micro": 0, "minor": 2, "major": 4 }, "package": "" }, "capabilities": [ "oob" ] } } { "execute": "qmp_capabilities" } { "return": { } } { "timestamp": { "seconds": 1584645026, "microseconds": 936550 }, "event": "GUEST_PANICKED", "data": { "action": "pause" } } { "timestamp": { "seconds": 1584645026, "microseconds": 936675 }, "event": "GUEST_PANICKED", "data": { "action": "poweroff" } } { "timestamp": { "seconds": 1584645026, "microseconds": 936776 }, "event": "SHUTDOWN", "data": { "guest": true, "reason": "guest-panic" } } --8<---------------cut here---------------end--------------->8--- [0]: https://github.com/qemu/qemu/blob/9ced5c7c20cb16dff0c2fa3242c3ee96b68cec2a/qapi/run-state.json#L339-L355 [1]: https://github.com/qemu/qemu/blob/4dd6517e369828171290b65e11f6a45aeeed15af/softmmu/vl.c#L1423-L1427 [2]: https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/interop/qmp-intro.txt;hb=HEAD Brice.