Skip to contentSkip to conversation

modules: load modules from /var/run/qemu/<version> directory firstly

PATCH In review Siddhi Katage 2 participants 3 messages Jan 23, 2023 – Jan 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modules: load modules from /var/run/qemu/<version> directory firstly

From: Siddhi Katage <[email protected]>

An old running QEMU will try to load modules with new build-id first,this will fail as expected ,then QEMU will fallback to load the old modules that matches its build-id from /var/run/qemu/<version> directory . Make /var/run/qemu/<version> directory as first search path to load modules.

Fixes bd83c861c0 ("modules: load modules from versioned /var/run dir")
---
 util/module.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
util/module.c +6 -6
index 620412e..c4f6c57 100644
@@ -194,6 +194,12 @@ bool module_load_one(const char *prefix, const char *lib_name)
 
     exec_dir = qemu_get_exec_dir();
     search_dir = getenv("QEMU_MODULE_DIR");
+#ifdef CONFIG_MODULE_UPGRADES
+    version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
+                             G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
+                             '_');
+    dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
+#endif
     if (search_dir != NULL) {
         dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
     }
@@ -201,12 +207,6 @@ bool module_load_one(const char *prefix, const char *lib_name)
     dirs[n_dirs++] = g_strdup_printf("%s/..", exec_dir ? : "");
     dirs[n_dirs++] = g_strdup_printf("%s", exec_dir ? : "");
 
-#ifdef CONFIG_MODULE_UPGRADES
-    version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
-                             G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
-                             '_');
-    dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
-#endif
 
     assert(n_dirs <= ARRAY_SIZE(dirs));
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Siddhi Katage

From: Siddhi Katage <[email protected]>

An old running QEMU will try to load modules with new build-id first,this will fail as expected ,then QEMU will fallback to load the old modules that matches its build-id from /var/run/qemu/<version> directory . Make /var/run/qemu/<version> directory as first search path to load modules.

Quoted 5 lines
Fixes bd83c861c0 ("modules: load modules from versioned /var/run dir")
---
  util/module.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
author Reviewed-by Philippe Mathieu-Daudé
#2 lore raw

RE: [External] : Re: [PATCH 1/1] modules: load modules from /var/run/qemu/<version> directory firstly

Hi ,
Please ignore this patch as it is not based on top of current master branch. I apologize for mistake and the inconvenience caused.

I will resend the correct patch .

Thank you,
Siddhi Katage

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]>
Sent: Tuesday, January 24, 2023 1:26 PM
To: Siddhi Katage <[email protected]>; [email protected]
Cc: Joe Jin <[email protected]>; Dongli Zhang <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [External] : Re: [PATCH 1/1] modules: load modules from /var/run/qemu/<version> directory firstly

Quoted 7 lines · Siddhi Katage

From: Siddhi Katage <[email protected]>

An old running QEMU will try to load modules with new build-id first,this will fail as expected ,then QEMU will fallback to load the old modules that matches its build-id from /var/run/qemu/<version> directory . Make /var/run/qemu/<version> directory as first search path to load modules.

Quoted 6 lines
Fixes bd83c861c0 ("modules: load modules from versioned /var/run

dir")

---
  util/module.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)