Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/810063/?format=api
{ "id": 810063, "url": "http://patchwork.ozlabs.org/api/1.2/patches/810063/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504605227-5124-1-git-send-email-thuth@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504605227-5124-1-git-send-email-thuth@redhat.com>", "list_archive_url": null, "date": "2017-09-05T09:53:47", "name": "[RFC] tests: Add a device_add/del HMP test", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0493ea7656589cbbf991c18d8fc284655d21d4c5", "submitter": { "id": 66152, "url": "http://patchwork.ozlabs.org/api/1.2/people/66152/?format=api", "name": "Thomas Huth", "email": "thuth@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504605227-5124-1-git-send-email-thuth@redhat.com/mbox/", "series": [ { "id": 1539, "url": "http://patchwork.ozlabs.org/api/1.2/series/1539/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1539", "date": "2017-09-05T09:53:47", "name": "[RFC] tests: Add a device_add/del HMP test", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1539/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810063/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810063/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmhv337wBz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 19:56:31 +1000 (AEST)", "from localhost ([::1]:57831 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpAar-000432-HE\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 05:56:29 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:32905)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpAYT-0002Gf-4G\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:54:06 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpAYO-0001DV-F1\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:54:01 -0400", "from mx1.redhat.com ([209.132.183.28]:59732)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>)\n\tid 1dpAYO-0001DD-7D; Tue, 05 Sep 2017 05:53:56 -0400", "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2D8304E334;\n\tTue, 5 Sep 2017 09:53:55 +0000 (UTC)", "from thh440s.redhat.com (ovpn-116-114.ams2.redhat.com\n\t[10.36.116.114])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 191DA90D63;\n\tTue, 5 Sep 2017 09:53:48 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 2D8304E334", "From": "Thomas Huth <thuth@redhat.com>", "To": "\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>,\n\tqemu-devel@nongnu.org", "Date": "Tue, 5 Sep 2017 11:53:47 +0200", "Message-Id": "<1504605227-5124-1-git-send-email-thuth@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.16", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tTue, 05 Sep 2017 09:53:55 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [RFC PATCH] tests: Add a device_add/del HMP test", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tAlexander Graf <agraf@suse.de>, qemu-ppc@nongnu.org, Igor Mammedov\n\t<imammedo@redhat.com>, John Snow <jsnow@redhat.com>, =?utf-8?q?Andrea?=\n\t=?utf-8?b?cyBGw6RyYmVy?= <afaerber@suse.de>, armbru@redhat.com", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "People tend to forget to mark internal devices with \"user_creatable = false\nor hotpluggable = false, and these devices can crash QEMU if added via the\nHMP monitor. So let's add a test to run through all devices and that tries\nto add them blindly (without arguments) to see whether this could crash the\nQEMU instance.\n\nSigned-off-by: Thomas Huth <thuth@redhat.com>\n---\n I've marked the patch as RFC since not all of the required device bug\n fixes have been merged yet (so this patch can not be included yet without\n breaking \"make check\"). It's also sad that \"macio-oldworld\" currently\n has to be blacklisted - I tried to find a fix for that device, but I was\n not able to spot the exact problem so far. So help for fixing that device\n is very very welcome! The crash can be reproduced like this:\n\n $ qemu-system-ppc64 -nographic -S -monitor stdio -serial none\n QEMU 2.10.50 monitor - type 'help' for more information\n (qemu) device_add macio-oldworld,id=x\n (qemu) device_del x\n (qemu) **\n ERROR:qom/object.c:1611:object_get_canonical_path_component:\n assertion failed: (obj->parent != NULL)\n Aborted (core dumped)\n\n tests/test-hmp.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 59 insertions(+), 1 deletion(-)", "diff": "diff --git a/tests/test-hmp.c b/tests/test-hmp.c\nindex 7a38cdc..e8a25c4 100644\n--- a/tests/test-hmp.c\n+++ b/tests/test-hmp.c\n@@ -28,7 +28,6 @@ static const char *hmp_cmds[] = {\n \"commit all\",\n \"cpu-add 1\",\n \"cpu 0\",\n- \"device_add ?\",\n \"device_add usb-mouse,id=mouse1\",\n \"mouse_button 7\",\n \"mouse_move 10 10\",\n@@ -116,6 +115,64 @@ static void test_info_commands(void)\n g_free(info_buf);\n }\n \n+/*\n+ * People tend to forget to mark internal devices with \"user_creatable = false\n+ * and these devices can crash QEMU if added via the HMP monitor. So let's run\n+ * through all devices and try to add them blindly (without arguments) to see\n+ * whether this could crash the QEMU instance.\n+ */\n+static void test_device_add_commands(void)\n+{\n+ char *resp, *devices, *devices_buf, *endp;\n+\n+ devices = devices_buf = hmp(\"device_add help\");\n+\n+ while (*devices) {\n+ /* Ignore header lines etc. */\n+ if (strncmp(devices, \"name \\\"\", 6)) {\n+ devices = strchr(devices, '\\n');\n+ if (!devices) {\n+ break;\n+ }\n+ devices += 1;\n+ continue;\n+ }\n+ /* Extract the device name, ignore parameters and description */\n+ devices += 6;\n+ endp = strchr(devices, '\"');\n+ g_assert(endp != NULL);\n+ *endp = '\\0';\n+ /* Check whether it is blacklisted... */\n+ if (g_str_equal(\"macio-oldworld\", devices)) {\n+ devices = strchr(endp + 1, '\\n');\n+ if (!devices) {\n+ break;\n+ }\n+ devices += 1;\n+ continue;\n+ }\n+ /* Now run the device_add + device_del commands */\n+ if (verbose) {\n+ fprintf(stderr, \"\\tdevice_add %s,id=%s\\n\", devices, devices);\n+ }\n+ resp = hmp(\"device_add %s,id=%s\", devices, devices);\n+ g_free(resp);\n+ if (verbose) {\n+ fprintf(stderr, \"\\tdevice_del %s\\n\", devices);\n+ }\n+ resp = hmp(\"device_del %s\", devices);\n+ g_free(resp);\n+ /* And move forward to the next line */\n+ devices = strchr(endp + 1, '\\n');\n+ if (!devices) {\n+ break;\n+ }\n+ devices += 1;\n+ }\n+\n+ g_free(devices_buf);\n+}\n+\n static void test_machine(gconstpointer data)\n {\n const char *machine = data;\n@@ -125,6 +182,7 @@ static void test_machine(gconstpointer data)\n qtest_start(args);\n \n test_info_commands();\n+ test_device_add_commands();\n test_commands();\n \n qtest_end();\n", "prefixes": [ "RFC" ] }