qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 4daff8: migration: Check current_migration in


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 4daff8: migration: Check current_migration in migration_is...
Date: Fri, 15 Nov 2024 02:01:18 -0800

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 4daff81efb381d1138832648511218a646f8092e
      
https://github.com/qemu/qemu/commit/4daff81efb381d1138832648511218a646f8092e
  Author: Peter Xu <peterx@redhat.com>
  Date:   2024-11-13 (Wed, 13 Nov 2024)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Check current_migration in migration_is_running()

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c733@linaro.org

Denis Rastyogin reported more such issue:

https://lore.kernel.org/r/20241107114256.106831-1-gerben@altlinux.org

  In this merge, the migration_is_idle() function was replaced with
  migrate_is_running().  However, the null pointer check for `s` was
  removed, leading to a dereference of `s` when using qemu-system-x86_64
  -hda *.vdi.

When replacing migration_is_idle() with "!migration_is_running()", it was
overlooked that the idle helper also checks for current_migration being
available first.  Sample stack dump:

 migration_is_running
 is_busy
 migrate_add_blocker_modes
 migrate_add_blocker_normal
 vmdk_open
 bdrv_open_driver
 bdrv_open_common
 bdrv_open_inherit
 bdrv_open
 blk_new_open
 blockdev_init
 drive_new
 drive_init_func
 qemu_opts_foreach
 configure_blockdev
 qemu_create_early_backends
 qemu_init
 main

The check would be there if the whole series was applied, but since the
last patches in the previous series rely on some other patches to land
first, we need to recover the behavior of migration_is_idle() first before
that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think
it's possible for them to hit uninitialized current_migration. Also they're
prone to removal soon from VFIO side.

Cc: Peter Maydell <peter.maydell@linaro.org>
Fixes: 34a8892dec ("migration: Drop migration_is_idle()")
Reported-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reported-by: Denis Rastyogin <gerben@altlinux.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20241105182725.2393425-1-peterx@redhat.com
[peterx: enhance commit msg]
Signed-off-by: Peter Xu <peterx@redhat.com>


  Commit: 0926c002c7c71749a781de13f28b0481e029d323
      
https://github.com/qemu/qemu/commit/0926c002c7c71749a781de13f28b0481e029d323
  Author: Dmitry Frolov <frolov@swemel.ru>
  Date:   2024-11-13 (Wed, 13 Nov 2024)

  Changed paths:
    M migration/multifd.c

  Log Message:
  -----------
  migration: fix-possible-int-overflow

stat64_add() takes uint64_t as 2nd argument, but both
"p->next_packet_size" and "p->packet_len" are uint32_t.
Thus, theyr sum may overflow uint32_t.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Link: https://lore.kernel.org/r/20241113140509.325732-2-frolov@swemel.ru
Signed-off-by: Peter Xu <peterx@redhat.com>


  Commit: f0a5a31c33a8109061c2493e475c8a2f4d022432
      
https://github.com/qemu/qemu/commit/f0a5a31c33a8109061c2493e475c8a2f4d022432
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-13 (Wed, 13 Nov 2024)

  Changed paths:
    M VERSION

  Log Message:
  -----------
  Update version for v9.2.0-rc0 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 9b52521984da88e0a248f10c4a4803d16bb9d440
      
https://github.com/qemu/qemu/commit/9b52521984da88e0a248f10c4a4803d16bb9d440
  Author: Peter Xu <peterx@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Check current_migration in migration_is_running()

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c733@linaro.org

When replacing migration_is_idle() with "!migration_is_running()", it was
overlooked that the idle helper also checks for current_migration being
available first.

The check would be there if the whole series was applied, but since the
last patches in the previous series rely on some other patches to land
first, we need to recover the behavior of migration_is_idle() first before
that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think
it's possible for them to hit his case (current_migration not initialized).
Also they're prone to removal soon from VFIO side.

Cc: Fabiano Rosas <farosas@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Fixes: 34a8892dec ("migration: Drop migration_is_idle()")
Reported-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-ID: <20241105182725.2393425-1-peterx@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 5caf2afbdf9c9551f577f337de264d30301416f4
      
https://github.com/qemu/qemu/commit/5caf2afbdf9c9551f577f337de264d30301416f4
  Author: Dmitry Frolov <frolov@swemel.ru>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M block/parallels.c

  Log Message:
  -----------
  parallels: fix possible int overflow

The sum "cluster_index + count" may overflow uint32_t.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Message-ID: <20241106080521.219255-2-frolov@swemel.ru>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 056c263704fcd403e9fa1244bfc9822e8e1abb75
      
https://github.com/qemu/qemu/commit/056c263704fcd403e9fa1244bfc9822e8e1abb75
  Author: John Snow <jsnow@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: reflow ReproducibleTestRunner arguments

Trivial reflow to let the type names breathe.

(I need to add a longer type name.)

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20241101173700.965776-2-jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 86b6a9566f02499dba37eab7fbc7bd60aea9348a
      
https://github.com/qemu/qemu/commit/86b6a9566f02499dba37eab7fbc7bd60aea9348a
  Author: John Snow <jsnow@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: correct resultclass type in ReproducibleTestRunner

I have a vague memory that I suggested this base class to Vladimir and
said "Maybe someday it will break, and I'll just fix it then." Guess
that's today.

Fixes various mypy errors in the "make check-tox" python test for at
least Python3.8; seemingly requires a fairly modern mypy and/or Python
base version to trigger.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20241101173700.965776-3-jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 0c637add5a55b937d3a3e78e4c1782ea9f54997b
      
https://github.com/qemu/qemu/commit/0c637add5a55b937d3a3e78e4c1782ea9f54997b
  Author: John Snow <jsnow@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M python/setup.cfg
    M tests/qemu-iotests/pylintrc

  Log Message:
  -----------
  python: disable too-many-positional-arguments warning

Newest versions of pylint complain about specifically positional
arguments in addition to too many in general. We already disable the
general case, so silence this new warning too.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20241101173700.965776-4-jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: ac5c4b9cf8d04b93ebabd3fc7c5bcb6bca5f1304
      
https://github.com/qemu/qemu/commit/ac5c4b9cf8d04b93ebabd3fc7c5bcb6bca5f1304
  Author: John Snow <jsnow@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M python/scripts/mkvenv.py

  Log Message:
  -----------
  python: silence pylint raising-non-exception error

As of (at least) pylint 3.3.1, this code trips pylint up into believing
we are raising something other than an Exception. We are not: the first
two values may indeed be "None", but the last and final value must by
definition be a SystemExit exception.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20241101173700.965776-5-jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 9cfeb320e0758fc3b6ff1d8a6ba6661c605a3bc7
      
https://github.com/qemu/qemu/commit/9cfeb320e0758fc3b6ff1d8a6ba6661c605a3bc7
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M system/qdev-monitor.c

  Log Message:
  -----------
  qdev-monitor: avoid QemuOpts in QMP device_add

The QMP device_add monitor command converts the QDict arguments to
QemuOpts and then back again to QDict. This process only supports scalar
types. Device properties like virtio-blk-pci's iothread-vq-mapping (an
array of objects) are silently dropped by qemu_opts_from_qdict() during
the QemuOpts conversion even though QAPI is capable of validating them.
As a result, hotplugging virtio-blk-pci devices with the
iothread-vq-mapping property does not work as expected (the property is
ignored).

Get rid of the QemuOpts conversion in qmp_device_add() and call
qdev_device_add_from_qdict() with from_json=true. Using the QMP
command's QDict arguments directly allows non-scalar properties.

The HMP is also adjusted since qmp_device_add()'s now expects properly
typed JSON arguments and cannot be used from HMP anymore. Move the code
that was previously in qmp_device_add() (with QemuOpts conversion and
from_json=false) into hmp_device_add() so that its behavior is
unchanged.

This patch changes the behavior of QMP device_add but not HMP
device_add. QMP clients that sent incorrectly typed device_add QMP
commands no longer work. This is a breaking change but clients should be
using the correct types already. See the netdev_add QAPIfication in
commit db2a380c8457 for similar reasoning and object-add in commit
9151e59a8b6e. Unlike those commits, we continue to rely on 'gen': false
for the time being.

Markus helped me figure this out and even provided a draft patch. The
code ended up very close to what he suggested.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240827192751.948633-2-stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 378a645b2f6125b1bdbd1fae3e8f30452d5b5934
      
https://github.com/qemu/qemu/commit/378a645b2f6125b1bdbd1fae3e8f30452d5b5934
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M system/vl.c

  Log Message:
  -----------
  vl: use qmp_device_add() in qemu_create_cli_devices()

qemu_create_cli_devices() should use qmp_device_add() to match the
behavior of the QMP monitor. A comment explained that libvirt changes
implementing strict CLI syntax were needed.

Peter Krempa <pkrempa@redhat.com> has confirmed that modern libvirt uses
the same JSON for -device (CLI) and device_add (QMP). Go ahead and use
qmp_device_add().

Cc: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240827192751.948633-3-stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: ee8f878541f890af93b2193d4dea5f75f145a396
      
https://github.com/qemu/qemu/commit/ee8f878541f890af93b2193d4dea5f75f145a396
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M migration/migration.c
    M migration/multifd.c

  Log Message:
  -----------
  Merge tag 'migration-20241113-pull-request' of https://gitlab.com/peterx/qemu 
into staging

Migration pull request for 9.2-rc1

- Dmitry's small patch to quiesce a warning in possible uint32_t overflow
- Peter's fix on a recent regression to iotests (and potentially elsewhere)

# -----BEGIN PGP SIGNATURE-----
#
# iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCZzUJDxIccGV0ZXJ4QHJl
# ZGhhdC5jb20ACgkQO1/MzfOr1wbuEQEAoRiMlHo4cfRTuViRoGHwFkqboLdyqsC9
# ZtDcZ2efgMQBAMR65KSgEAakbm3h4fuj0lUTkg564Wi9XkBleo/w3tAD
# =uIeB
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 13 Nov 2024 20:16:15 GMT
# gpg:                using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706
# gpg:                issuer "peterx@redhat.com"
# gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [marginal]
# gpg:                 aka "Peter Xu <peterx@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D  D1A9 3B5F CCCD F3AB D706

* tag 'migration-20241113-pull-request' of https://gitlab.com/peterx/qemu:
  migration: fix-possible-int-overflow
  migration: Check current_migration in migration_is_running()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: a166650446d0a26183350d5b47dccbf75fd600cd
      
https://github.com/qemu/qemu/commit/a166650446d0a26183350d5b47dccbf75fd600cd
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M block/parallels.c
    M python/scripts/mkvenv.py
    M python/setup.cfg
    M system/qdev-monitor.c
    M system/vl.c
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/pylintrc

  Log Message:
  -----------
  Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging

Block layer patches

- Fix qmp_device_add() to not throw non-scalar options away (fixes
  iothread-vq-mapping being silently ignored in device_add)
- iotests: Fix mypy failure
- parallels: Avoid potential integer overflow
- Fix crash in migration_is_running()

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmc2K5wRHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9aM8xAAyi4beLDkkbYYEYZXiol1MNst81OLe1Ft
# GxwI+riXJVnJBXzMhoKfEgPBz+q8gY7D/5ODLksGkwYdbP71U/7hYCO4ObWep1vP
# dxW6/B8Hi+qH2HnP852s/bHiVg+YT7NWU++maAc9Pj/2cFfsnjz85wkJQEf700CP
# w6nNhGt8Fe2pYe2iu69IKQLpF04yEnhYmuVKcTpouRL3IwA5DBAnDCehcrXrZGsh
# 4W+CTEShz83SthY/xtLbX0MV6yRt01Jf9oTr6uQxTbzTIEHq0EfmwrioYikfwfaZ
# qov4pL0MYfv9sdAouZY2kayPIZ8TRpyBA8LOh2fZvk7bjQ/qaDhiThLjVGnUXL1N
# cJiItMqtwHEcjAYpORVT035lGR6+9k54eKhZk7/DhC13fYS4n2sWVQMFKabWDp0l
# D36oPGuySrFoOX6oP3Imqb4ApEgOn1Oqu7LXBpfokbG5xtKkTXzB7yiO0EEJKAhk
# eGezLBQXZy8OZ12pTBoKenT50cmE12sR27XWnEfWe0Z16Gy18VVQJaDkhHwau8T9
# U3bIVZcviL7R9dY5YZHaWWdexp0zQUepevyc2g6FlNq0OjyhTVRbN/EWh2FdwY0P
# rfEpezem56SfAqOJnUcyRkw7geANGQ7FzFY08qFyAhJswmzD/9EpUYtEjkibtR0P
# 0J0/SYJ+NFM=
# =XZG5
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 14 Nov 2024 16:55:56 GMT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://repo.or.cz/qemu/kevin:
  vl: use qmp_device_add() in qemu_create_cli_devices()
  qdev-monitor: avoid QemuOpts in QMP device_add
  python: silence pylint raising-non-exception error
  python: disable too-many-positional-arguments warning
  iotests: correct resultclass type in ReproducibleTestRunner
  iotests: reflow ReproducibleTestRunner arguments
  parallels: fix possible int overflow
  migration: Check current_migration in migration_is_running()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/b1e35c760acd...a166650446d0

To unsubscribe from these emails, change your notification settings at 
https://github.com/qemu/qemu/settings/notifications



reply via email to

[Prev in Thread] Current Thread [Next in Thread]