Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2224004/?format=api
{ "id": 2224004, "url": "http://patchwork.ozlabs.org/api/patches/2224004/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260416134842.1726474-1-hector.cao@canonical.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": "<20260416134842.1726474-1-hector.cao@canonical.com>", "list_archive_url": null, "date": "2026-04-16T13:48:42", "name": "module: fix early stop for module loading function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c97047206ec49b39364e61824acb5ae2d14c2570", "submitter": { "id": 89665, "url": "http://patchwork.ozlabs.org/api/people/89665/?format=api", "name": "Hector Cao", "email": "hector.cao@canonical.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260416134842.1726474-1-hector.cao@canonical.com/mbox/", "series": [ { "id": 500168, "url": "http://patchwork.ozlabs.org/api/series/500168/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500168", "date": "2026-04-16T13:48:42", "name": "module: fix early stop for module loading function", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500168/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2224004/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2224004/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 (4096-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20251003 header.b=dVLfQ7gI;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.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 4fxKBb4TP3z1yG9\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 23:49:42 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wDN5Z-0004bS-5f; Thu, 16 Apr 2026 09:49:01 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <hector.cao@canonical.com>)\n id 1wDN5X-0004aP-72\n for qemu-devel@nongnu.org; Thu, 16 Apr 2026 09:48:59 -0400", "from smtp-relay-canonical-1.canonical.com ([185.125.188.121])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <hector.cao@canonical.com>)\n id 1wDN5T-0006oW-KS\n for qemu-devel@nongnu.org; Thu, 16 Apr 2026 09:48:58 -0400", "from localhost.localdomain (1.general.hector.uk.vpn\n [10.172.192.134])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id B775941BCF;\n Thu, 16 Apr 2026 13:48:50 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20251003; t=1776347330;\n bh=3b/OHn1spnQeTh+fTVR6lNFAecDdacLs/uOeL7El+1c=;\n h=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=dVLfQ7gIG7Cpc0YEjRwhYd9KwIS68vxCITIyzOGwF8kh/Gi1P1G9j01dEuKdjjjsG\n lzz1ZiBFwNINnyLq80jmZrJ7ittolEnzpLFnp4/NFm0OC4aKMvnzZ2/6GBS1o7wgV9\n 5B5pdPCD9IzvKi5/CixLjV75ppgu2OXDWkdcdXgU4P5Y9oQErM8Wq0Vh6YAPr8mfg7\n 2HsVA6fLDEFJrHvFHLnje+UVMrxk8sKlSc060Wj1K9qJd6APGGDh8F+9Azcm7emoqd\n 9u938l6YogsOMyJyRqKYIq1VZO3xK1Mr71T99ZCXVROFNUy0UZHybuFNWeQxAmUTm+\n 8t3Gw9D2OeKhJU7c8JTBeTqWQ33HOwt5e49aV3Sr4A7OFEViiQRouLcynsS50PSkiT\n xx+d3tQI/S/lnnlz4XInqFvC+fmI1m8cr2HZqgnlz+zunKgpFQB6YReDeeY0q0nPOu\n 6KbyhOxyxJwPeCSM5POSpvoBfVDGsJmNMaZUQJrk09CvXjc8Uq2wE0Ws6AU4bxBGhQ\n P0TF45JLUdG42Su4r5wzFXFec1uBhF7Y+JXFjuGsJmlfT0bIR0BkeixbGK1UycH+Fd\n mtompqrHZ3NNQ2la2vO4z+T2QnwGHM29rcv53T2LocrStiR/YdiAZrwJ5gwBydKAlR\n VrhsIFyUDO32hzuHHsMWUUEg=", "From": "Hector Cao <hector.cao@canonical.com>", "To": "qemu-devel@nongnu.org", "Cc": "Hector Cao <hector.cao@canonical.com>", "Subject": "[PATCH] module: fix early stop for module loading function", "Date": "Thu, 16 Apr 2026 15:48:42 +0200", "Message-ID": "<20260416134842.1726474-1-hector.cao@canonical.com>", "X-Mailer": "git-send-email 2.43.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=185.125.188.121;\n envelope-from=hector.cao@canonical.com;\n helo=smtp-relay-canonical-1.canonical.com", "X-Spam_score_int": "-48", "X-Spam_score": "-4.9", "X-Spam_bar": "----", "X-Spam_report": "(-4.9 / 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_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n 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": "The commit c551fb0b53d introduces a regression on the behavior\nof the module load logic. Historically, if QEMU cannot load a\nparticular module in a folder, it keeps going and look for the\nmodule in the remaining folders. The mentioned commit make QEMU\nstop if the module exists but cannot be loaded (build mismatch\nreason for example).\n\nThis causes QEMU fail to load the right module and this failure\nhappens usually when QEMU is upgraded and therefore QEMU has\nseveral folders to look for the modules.\n\nIn addition to the regression on the behavior, this commit\nintroduces also a leak in the function module_load_dso()\nthat does not remove the entries from the list dso_init_list\nwhen the the module load fails for build mismatch.\n\nThis commit has 2 folds:\n - restores the correct legacy behavior\n - fix the memory leak in module_load_dso()\n\nFixes: c551fb0b53d (\"module: add Error arguments to module_load and module_load_qom\")\nSigned-off-by: Hector Cao <hector.cao@canonical.com>\n---\n util/module.c | 34 +++++++++++++++++++---------------\n 1 file changed, 19 insertions(+), 15 deletions(-)", "diff": "diff --git a/util/module.c b/util/module.c\nindex 32e263163c7..4d5b74fa6e4 100644\n--- a/util/module.c\n+++ b/util/module.c\n@@ -184,6 +184,11 @@ static bool module_load_dso(const char *fname, bool export_symbols,\n \"Only modules from the same build can be loaded.\\n\");\n }\n g_module_close(g_module);\n+ /* Clean up any dso init entries added during DSO initialization */\n+ QTAILQ_FOREACH_SAFE(e, &dso_init_list, node, next) {\n+ QTAILQ_REMOVE(&dso_init_list, e, node);\n+ g_free(e);\n+ }\n return false;\n }\n \n@@ -279,29 +284,28 @@ int module_load(const char *prefix, const char *name, Error **errp)\n }\n }\n \n- for (i = 0; i < n_dirs; i++) {\n+ /*\n+ * Try to load module in given folders until we load it successfully or no\n+ * more to look.\n+ * If no module can be loaded successfully, errp is set to the last encountered error\n+ */\n+ rv = 0; /* module not found */\n+ for (i = 0; (i < n_dirs) && (rv != 1); i++) {\n char *fname = g_strdup_printf(\"%s/%s%s\",\n dirs[i], module_name, CONFIG_HOST_DSOSUF);\n int ret = access(fname, F_OK);\n- if (ret != 0 && (errno == ENOENT || errno == ENOTDIR)) {\n- /*\n- * if we don't find the module in this dir, try the next one.\n- * If we don't find it in any dir, that can be fine too: user\n- * did not install the module. We will return 0 in this case\n- * with no error set.\n- */\n- g_free(fname);\n- continue;\n- } else if (ret != 0) {\n+ if ((ret == 0) && module_load_dso(fname, export_symbols, errp)) {\n+ rv = 1; /* module successfully loaded */\n+ }\n+\n+ /* The file exists but cannot be accessed -> report an error and continue */\n+ if ((ret != 0) && (errno != ENOENT) && (errno != ENOTDIR)) {\n /* most common is EACCES here */\n error_setg_errno(errp, errno, \"error trying to access %s\", fname);\n- } else if (module_load_dso(fname, export_symbols, errp)) {\n- rv = 1; /* module successfully loaded */\n }\n+\n g_free(fname);\n- goto out;\n }\n- rv = 0; /* module not found */\n \n out:\n if (rv <= 0) {\n", "prefixes": [] }