Skip to contentSkip to conversation

Trivial patches for 2025-11-21

GIT PULL Applied Michael Tokarev 2 participants 5 messages Nov 22, 2025 – Nov 23, 2025

lore
Share & tools
lore
#0 lore raw

The following changes since commit 5a5b06d2f6f71d7789719b97143fc5b543bec07a:

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)

are available in the Git repository at:

https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

for you to fetch changes up to 5f9ac963735598c1efbdce9c4a09f0a64e13d613:

Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)

----------------------------------------------------------------
trivial patches for 2025-11-21
Just 3 patches so far, but since we're reaching a
release, there's no point at waiting longer :)

----------------------------------------------------------------
Jack Wang (1):
qmp: Fix a typo for a USO feature

Michael Tokarev (1):
qga: use access(2) to check for command existance instead of questionable stat(2)

Yanghang Liu (1):
Fix the typo of vfio-pci device's enable-migration option

 hw/vfio/pci.c          |  2 +-
 hw/virtio/virtio-qmp.c |  2 +-
 qga/commands-posix.c   | 12 +++---------
 3 files changed, 5 insertions(+), 11 deletions(-)
#1 lore raw

[PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2)

The code checks existance of a command (halt/poweroff/reboot) by using stat(2) and immediately checking for S_ISLNK() on the returned stat struct. This check will never be true, because stat(2) always follows symbolic links and hence will either return ENOENT (in case of dangling symlink) or the properties for the final target file. It is lstat(2) which might return information about the symlink itself. However, even there, we want to check the final file properties, not the first symlink.

This check - S_ISLNK - is harmful but useless in this case. However, it is confusing and it helps the wrong usage of stat(2) to spread, so it is better to remove it.

Additionally, the code would better to check for the executable bits of the final file, not check if it's a regular file - it's sort of dubious to have anything but regular files in /sbin/.

But a POSIX system provides another command which suits the purpose
perfectly: it is access(2). And it is so simple that it's not necessary to create a separate function when usin it.

Replace stat(2) with access(X_OK) to check for file existance in qga/commands-posix.c

Fixes c5b4afd4d56e "qga: Support guest shutdown of BusyBox-based systems"
---
 qga/commands-posix.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
qga/commands-posix.c +3 -9
index 66f3e6f673..837be51c40 100644
@@ -216,12 +216,6 @@ out:
     return retcode;
 }
 
-static bool file_exists(const char *path)
-{
-    struct stat st;
-    return stat(path, &st) == 0 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode));
-}
-
 #define POWEROFF_CMD_PATH "/sbin/poweroff"
 #define HALT_CMD_PATH "/sbin/halt"
 #define REBOOT_CMD_PATH "/sbin/reboot"
@@ -248,17 +242,17 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
 
     slog("guest-shutdown called, mode: %s", mode);
     if (!mode || strcmp(mode, "powerdown") == 0) {
-        if (file_exists(POWEROFF_CMD_PATH)) {
+        if (access(POWEROFF_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = POWEROFF_CMD_PATH;
         }
         shutdown_flag = powerdown_flag;
     } else if (strcmp(mode, "halt") == 0) {
-        if (file_exists(HALT_CMD_PATH)) {
+        if (access(HALT_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = HALT_CMD_PATH;
         }
         shutdown_flag = halt_flag;
     } else if (strcmp(mode, "reboot") == 0) {
-        if (file_exists(REBOOT_CMD_PATH)) {
+        if (access(REBOOT_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = REBOOT_CMD_PATH;
         }
         shutdown_flag = reboot_flag;
Signature · 1 line
2.47.3
#2 lore raw

[PULL 2/3] qmp: Fix a typo for a USO feature

In reply to Michael Tokarev

From: Jack Wang <[email protected]>

There is a copy & paste error, USO6 should be there.

Fixes 58f81689789f ("qmp: update virtio feature maps, vhost-user-gpio introspection")
---
 hw/virtio/virtio-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-qmp.c +1 -1
index b338344c6c..968299fda0 100644
@@ -299,7 +299,7 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {
     FEATURE_ENTRY(VIRTIO_NET_F_GUEST_USO4, \
             "VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv4"),
     FEATURE_ENTRY(VIRTIO_NET_F_GUEST_USO6, \
-            "VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv6"),
+            "VIRTIO_NET_F_GUEST_USO6: Driver can receive USOv6"),
     FEATURE_ENTRY(VIRTIO_NET_F_HOST_USO, \
             "VIRTIO_NET_F_HOST_USO: Device can receive USO"),
     FEATURE_ENTRY(VIRTIO_NET_F_HASH_REPORT, \
Signature · 1 line
2.47.3
#3 lore raw

[PULL 3/3] Fix the typo of vfio-pci device's enable-migration option

In reply to Michael Tokarev

From: Yanghang Liu <[email protected]>

---
 hw/vfio/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/pci.c +1 -1
index 8b8bc5a421..b46b1305a7 100644
@@ -3871,7 +3871,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
                                           "(DEBUG)");
     object_class_property_set_description(klass, /* 5.2, 8.0 non-experimetal */
                                           "enable-migration",
-                                          "Enale device migration. Also requires a host VFIO PCI "
+                                          "Enable device migration. Also requires a host VFIO PCI "
                                           "variant or mdev driver with migration support enabled");
     object_class_property_set_description(klass, /* 8.1 */
                                           "vf-token",
Signature · 1 line
2.47.3
#4 lore raw
In reply to Michael Tokarev
Quoted 8 lines · Michael Tokarev

The following changes since commit 5a5b06d2f6f71d7789719b97143fc5b543bec07a:

   Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)

are available in the Git repository at:

https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

Quoted 8 lines

for you to fetch changes up to 5f9ac963735598c1efbdce9c4a09f0a64e13d613:

   Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)

----------------------------------------------------------------
trivial patches for 2025-11-21
Just 3 patches so far, but since we're reaching a
release, there's no point at waiting longer :)

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~