Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2220117/?format=api
{ "id": 2220117, "url": "http://patchwork.ozlabs.org/api/patches/2220117/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260406115247.4879-2-armenon@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/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": "<20260406115247.4879-2-armenon@redhat.com>", "list_archive_url": null, "date": "2026-04-06T11:52:46", "name": "[1/2] migration/vmstate: Add VMState support for GByteArray", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0c7b68ff478ad256d73eb33d9c72234449987b58", "submitter": { "id": 91136, "url": "http://patchwork.ozlabs.org/api/people/91136/?format=api", "name": "Arun Menon", "email": "armenon@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260406115247.4879-2-armenon@redhat.com/mbox/", "series": [ { "id": 498846, "url": "http://patchwork.ozlabs.org/api/series/498846/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498846", "date": "2026-04-06T11:52:45", "name": "migration/vmstate: Add VMState support to safely migrate GByteArray", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498846/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220117/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220117/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@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Di+VQKxh;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=RfUfiqm+;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fq75J3jzhz1yGn\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 21:53:38 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w9iVt-0002VH-Qp; Mon, 06 Apr 2026 07:53:05 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <armenon@redhat.com>)\n id 1w9iVr-0002UL-SH\n for qemu-devel@nongnu.org; Mon, 06 Apr 2026 07:53:03 -0400", "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <armenon@redhat.com>)\n id 1w9iVq-0002M3-Aj\n for qemu-devel@nongnu.org; Mon, 06 Apr 2026 07:53:03 -0400", "from mail-pg1-f200.google.com (mail-pg1-f200.google.com\n [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-146-VEgNwjhJNr-jQ3jJ0-NlTg-1; Mon, 06 Apr 2026 07:53:00 -0400", "by mail-pg1-f200.google.com with SMTP id\n 41be03b00d2f7-c741c4cebf3so2496154a12.2\n for <qemu-devel@nongnu.org>; Mon, 06 Apr 2026 04:53:00 -0700 (PDT)", "from fedora.armenon-thinkpadp16vgen1.bengluru.csb ([152.59.100.215])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82d12218738sm11547849b3a.21.2026.04.06.04.52.55\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 06 Apr 2026 04:52:58 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775476381;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=At4efh5zbXMwqFU0+ES27jl76V1LSdL1JadRGtGkEcc=;\n b=Di+VQKxhntbTLylZThkp3lUrETYkf7PZdsQvyR8uyMTnynI3Z84+h0hKeEixqkPEewstwR\n D6//pMHon/Wj0VNV091WwX6mEojrmDFQg2dRKsgpVuiapf45uKBlNqFLbDhDvxHeC4b5/A\n w04x0G6utXchKvJbTtCTQZkmxkEuQQo=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1775476379; x=1776081179; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=At4efh5zbXMwqFU0+ES27jl76V1LSdL1JadRGtGkEcc=;\n b=RfUfiqm+woIp5IfdqubTRNjBO8vQnDMrBL5yx85/8us1N/YZYKN4yY1qKFep4e1LL1\n O/dmfyjUPCjFaPzY4zoTcJUHwb/qCT6qPmo492kOlnPWuwUFQHJGLAbd3QJy32NUD9Zp\n 5gWHwbYvQ/wVBguFIWgpSJ2IdyM8DVkm0CPx2Ngx8Pu1+U4tdoK+uX0BGqr889sRm2Ix\n vbQ95vLPosFGZkTa3M5TFd28DTUGGHqYA/csKHMDT5ikI7X9v3PR7r3lbNWnsKjv/UfD\n apOinPaHYESJ8S5Xsj5f6jBFJ0e2qVaEt/I5ulsamipg3xI+sG6T5mvP1lmb9rHe/+Qx\n F1DQ==" ], "X-MC-Unique": "VEgNwjhJNr-jQ3jJ0-NlTg-1", "X-Mimecast-MFC-AGG-ID": "VEgNwjhJNr-jQ3jJ0-NlTg_1775476380", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775476379; x=1776081179;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=At4efh5zbXMwqFU0+ES27jl76V1LSdL1JadRGtGkEcc=;\n b=BuNDj+Edh3dO2LGoqz0kK9BgmMxg9HeuGJDzisWI8yUCSYYjRAxXNJlpawA9RRZoJo\n yAycjaOyii97gObLSqi+BFxi1HFmz5sKMJAUXT+7zTHwCtGPa7Ry5rTVMGjqy/Rp0rfi\n GkmFOQAEz3IS9pEcXWZHmfeFU8ICvzznaOTV7Zfc4j+/Jj3VVrUMMTMzlUGc5BxgDHv3\n 1cVqp1KDtmYcKRCOorjhb1GbS9SvLqhFtmf5RGtHzCQuIAx6gwA7vYsklX9bUXWypn61\n aj1Dik7agZzQH1UfjU2wzXRmxFueu70dafiiEKGlZzvrPgfKTNViBdtri+e/EKLNNhde\n 9EyA==", "X-Gm-Message-State": "AOJu0YwAKyMT+OybKwib7ieDwyePXRNJyEfQsDOPYG/EdoJR9Pd7fj7V\n BT14Z1FID+Fy0OpVl+cgS20arJZtzaMnKV4gTG7AYd9V0GRr4RbeNTmHOVSARFyn8ieoIPAx5wf\n QVEzN7u4Zi4sI5YTekreaw7CXIc0L2b1MFCp26H1ZABhIiddaBAvLwnFL7LDpFQJJcdM14oYTRw\n L9ds0bczLkmteWLpwvWlBx0arMdTUYxFLwgSFvpls=", "X-Gm-Gg": "AeBDieuephmLxW0nvA6hkV/vFJSAYbgzPl7bmWPbrpIDNQVH5orpjw/ZJLbZQjQCuaI\n I/TfKP1MEWr93DCGCzO57nYkThWFHWdO6lJ5MvcglbC3k9lqpoHpy1RWdoIC+wQDlhZ/iff90KK\n nUurJNaUDetr7i8pexgbaTr2qKkiC5+udLayMaD4rQg8/POre1wWMRqIUCfv4DtU1xxjZvUfOR3\n 1H4+NeeUEafDV9cA04uE93zCBM1V3yTvyRHe+v/XrpMZ4fe3OWqQXrdh5sEa3Y4YDgXsLdrAngj\n cc2YrVyltpwitEN15QevU3hO4+Himf59JKEQtRBbo2T/UxYIOBl1OAQAROd9W0flMpeBE520vP0\n HqKJFkBVPbXvE0NMAd2DvTt2ZVMQfhcIJu8PJGEIZuwjSe23BFkXiF6VOK2+Rgh5ZWBEf", "X-Received": [ "by 2002:a05:6a00:6ca8:b0:82a:ea3:c16f with SMTP id\n d2e1a72fcca58-82d0dbe3dabmr12061947b3a.53.1775476379036;\n Mon, 06 Apr 2026 04:52:59 -0700 (PDT)", "by 2002:a05:6a00:6ca8:b0:82a:ea3:c16f with SMTP id\n d2e1a72fcca58-82d0dbe3dabmr12061927b3a.53.1775476378454;\n Mon, 06 Apr 2026 04:52:58 -0700 (PDT)" ], "From": "Arun Menon <armenon@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n\t=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n Arun Menon <armenon@redhat.com>", "Subject": "[PATCH 1/2] migration/vmstate: Add VMState support for GByteArray", "Date": "Mon, 6 Apr 2026 17:22:46 +0530", "Message-ID": "<20260406115247.4879-2-armenon@redhat.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260406115247.4879-1-armenon@redhat.com>", "References": "<20260406115247.4879-1-armenon@redhat.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=armenon@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-25", "X-Spam_score": "-2.6", "X-Spam_bar": "--", "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Arun Menon <armenon@redhat.com>\n\nIn GLib, GByteArray is an object managed by the library. Currently,\nmigrating a GByteArray requires treating it as a raw C struct and using\nVMSTATE_VBUFFER_ALLOC_UINT32. For example, see vmstate_vdba in\nui/vdagent.c\n\nQEMU cannot pretend that GByteArray is a C struct and simply use\nVMS_ALLOC to g_malloc() the buffer. This is because, VMS_ALLOC blindly\noverwrites the data pointer with a newly allocated buffer, thereby\nleaking the previous memory. Besides, GLib tracks the array's capacity\nin a hidden alloc field. Bypassing GLib APIs leave this capacity out of\nsync with the newly allocated buffer, potentially leading to heap buffer\noverflows during subsequent g_byte_array_append() calls.\n\nThis commit introduces VMSTATE_GBYTEARRAY which uses specific library\nAPI calls (g_byte_array_set_size()) to safely resize and populate the\nbuffer.\n\nSigned-off-by: Arun Menon <armenon@redhat.com>\nFix-Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nSigned-off-by: Arun Menon <armenon@redhat.com>\n---\n include/migration/vmstate.h | 10 ++++++++++\n migration/vmstate-types.c | 37 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 47 insertions(+)", "diff": "diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h\nindex 62c2abd0c4..ab20445c4c 100644\n--- a/include/migration/vmstate.h\n+++ b/include/migration/vmstate.h\n@@ -265,6 +265,7 @@ extern const VMStateInfo vmstate_info_bitmap;\n extern const VMStateInfo vmstate_info_qtailq;\n extern const VMStateInfo vmstate_info_gtree;\n extern const VMStateInfo vmstate_info_qlist;\n+extern const VMStateInfo vmstate_info_g_byte_array;\n \n #define type_check_2darray(t1,t2,n,m) ((t1(*)[n][m])0 - (t2*)0)\n /*\n@@ -892,6 +893,15 @@ extern const VMStateInfo vmstate_info_qlist;\n .start = offsetof(_type, _next), \\\n }\n \n+#define VMSTATE_GBYTEARRAY(_field, _state, _version) { \\\n+ .name = (stringify(_field)), \\\n+ .version_id = (_version), \\\n+ .size = sizeof(GByteArray), \\\n+ .info = &vmstate_info_g_byte_array, \\\n+ .flags = VMS_SINGLE | VMS_POINTER, \\\n+ .offset = vmstate_offset_pointer(_state, _field, GByteArray), \\\n+}\n+\n /* _f : field name\n _f_n : num of elements field_name\n _n : num of elements\ndiff --git a/migration/vmstate-types.c b/migration/vmstate-types.c\nindex 89cb211472..ccac731388 100644\n--- a/migration/vmstate-types.c\n+++ b/migration/vmstate-types.c\n@@ -942,3 +942,40 @@ const VMStateInfo vmstate_info_qlist = {\n .get = get_qlist,\n .put = put_qlist,\n };\n+\n+static int get_g_byte_array(QEMUFile *f, void *pv, size_t size,\n+ const VMStateField *field)\n+{\n+ GByteArray *byte_array = pv;\n+ uint32_t len = qemu_get_be32(f);\n+\n+ if (!byte_array) {\n+ byte_array = g_byte_array_new();\n+ }\n+\n+ g_byte_array_set_size(byte_array, len);\n+ if (len > 0) {\n+ qemu_get_buffer(f, byte_array->data, len);\n+ }\n+ return 0;\n+}\n+\n+static int put_g_byte_array(QEMUFile *f, void *pv, size_t size,\n+ const VMStateField *field, JSONWriter *vmdesc)\n+{\n+ GByteArray *byte_array = pv;\n+ uint32_t len = byte_array ? byte_array->len : 0;\n+\n+ qemu_put_be32(f, len);\n+ if (len > 0) {\n+ qemu_put_buffer(f, byte_array->data, len);\n+ }\n+\n+ return 0;\n+}\n+\n+const VMStateInfo vmstate_info_g_byte_array = {\n+ .name = \"GByteArray\",\n+ .get = get_g_byte_array,\n+ .put = put_g_byte_array,\n+};\n", "prefixes": [ "1/2" ] }