qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] Error reporting patches for 2025-12-02
@ 2025-12-02  8:32 Markus Armbruster
  2025-12-02  8:32 ` [PULL 1/2] migration: Fix double-free on error path Markus Armbruster
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Markus Armbruster @ 2025-12-02  8:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

The following changes since commit 9ef49528b5286f078061b52ac41e0ca19fa10e36:

  Merge tag 'hw-misc-20251125' of https://github.com/philmd/qemu into staging (2025-11-25 14:22:39 -0800)

are available in the Git repository at:

  https://repo.or.cz/qemu/armbru.git tags/pull-error-2025-12-02

for you to fetch changes up to 88be119fb19b8ee04d681ad9048cde9f6a37c631:

  kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value (2025-12-02 07:46:21 +0100)

----------------------------------------------------------------
Error reporting patches for 2025-12-02

----------------------------------------------------------------
Markus Armbruster (2):
      migration: Fix double-free on error path
      kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value

 accel/kvm/kvm-all.c | 4 ++--
 migration/multifd.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.49.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PULL 1/2] migration: Fix double-free on error path
  2025-12-02  8:32 [PULL 0/2] Error reporting patches for 2025-12-02 Markus Armbruster
@ 2025-12-02  8:32 ` Markus Armbruster
  2025-12-02  8:32 ` [PULL 2/2] kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value Markus Armbruster
  2025-12-03 12:20 ` [PULL 0/2] Error reporting patches for 2025-12-02 Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2025-12-02  8:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

Fixes: ffaa1b50a879 (migration: Use warn_reportf_err() where appropriate)
Resolves: Coverity CID 1643463
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20251125070554.2256181-1-armbru@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
---
 migration/multifd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/multifd.c b/migration/multifd.c
index 6210454838..3203dc98e1 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -450,7 +450,7 @@ static void multifd_send_set_error(Error *err)
  */
 static void migration_ioc_shutdown_gracefully(QIOChannel *ioc)
 {
-    g_autoptr(Error) local_err = NULL;
+    Error *local_err = NULL;
 
     if (!migration_has_failed(migrate_get_current()) &&
         object_dynamic_cast((Object *)ioc, TYPE_QIO_CHANNEL_TLS)) {
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PULL 2/2] kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value
  2025-12-02  8:32 [PULL 0/2] Error reporting patches for 2025-12-02 Markus Armbruster
  2025-12-02  8:32 ` [PULL 1/2] migration: Fix double-free on error path Markus Armbruster
@ 2025-12-02  8:32 ` Markus Armbruster
  2025-12-03 12:20 ` [PULL 0/2] Error reporting patches for 2025-12-02 Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2025-12-02  8:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

These functions wrap ioctl().  When ioctl() fails, it sets @errno.
The wrappers then return that @errno negated.

Except they call accel_ioctl_end() between calling ioctl() and reading
@errno.  accel_ioctl_end() can clobber @errno, e.g. when a futex()
system call fails.  Seems unlikely, but it's a bug all the same.

Fix by retrieving @errno before calling accel_ioctl_end().

Fixes: a27dd2de68f3 (KVM: keep track of running ioctls)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251128152050.3417834-1-armbru@redhat.com>
---
 accel/kvm/kvm-all.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f9254ae654..28006d73c5 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3373,10 +3373,10 @@ int kvm_vm_ioctl(KVMState *s, unsigned long type, ...)
     trace_kvm_vm_ioctl(type, arg);
     accel_ioctl_begin();
     ret = ioctl(s->vmfd, type, arg);
-    accel_ioctl_end();
     if (ret == -1) {
         ret = -errno;
     }
+    accel_ioctl_end();
     return ret;
 }
 
@@ -3413,10 +3413,10 @@ int kvm_device_ioctl(int fd, unsigned long type, ...)
     trace_kvm_device_ioctl(fd, type, arg);
     accel_ioctl_begin();
     ret = ioctl(fd, type, arg);
-    accel_ioctl_end();
     if (ret == -1) {
         ret = -errno;
     }
+    accel_ioctl_end();
     return ret;
 }
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PULL 0/2] Error reporting patches for 2025-12-02
  2025-12-02  8:32 [PULL 0/2] Error reporting patches for 2025-12-02 Markus Armbruster
  2025-12-02  8:32 ` [PULL 1/2] migration: Fix double-free on error path Markus Armbruster
  2025-12-02  8:32 ` [PULL 2/2] kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value Markus Armbruster
@ 2025-12-03 12:20 ` Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2025-12-03 12:20 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel

On 12/2/25 00:32, Markus Armbruster wrote:
> The following changes since commit 9ef49528b5286f078061b52ac41e0ca19fa10e36:
> 
>    Merge tag 'hw-misc-20251125' ofhttps://github.com/philmd/qemu into staging (2025-11-25 14:22:39 -0800)
> 
> are available in the Git repository at:
> 
>    https://repo.or.cz/qemu/armbru.git tags/pull-error-2025-12-02
> 
> for you to fetch changes up to 88be119fb19b8ee04d681ad9048cde9f6a37c631:
> 
>    kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value (2025-12-02 07:46:21 +0100)
> 
> ----------------------------------------------------------------
> Error reporting patches for 2025-12-02

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

r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-03 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02  8:32 [PULL 0/2] Error reporting patches for 2025-12-02 Markus Armbruster
2025-12-02  8:32 ` [PULL 1/2] migration: Fix double-free on error path Markus Armbruster
2025-12-02  8:32 ` [PULL 2/2] kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value Markus Armbruster
2025-12-03 12:20 ` [PULL 0/2] Error reporting patches for 2025-12-02 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).