lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251120123647.3522082-1-michal.winiarski@intel.com>
Date: Thu, 20 Nov 2025 13:36:41 +0100
From: Michał Winiarski <michal.winiarski@...el.com>
To: Jason Gunthorpe <jgg@...pe.ca>, Alex Williamson <alex@...zbot.org>, "Kevin
 Tian" <kevin.tian@...el.com>, Yishai Hadas <yishaih@...dia.com>, Longfang Liu
	<liulongfang@...wei.com>, Shameer Kolothum <skolothumtho@...dia.com>, "Brett
 Creeley" <brett.creeley@....com>, Giovanni Cabiddu
	<giovanni.cabiddu@...el.com>, <kvm@...r.kernel.org>, <qat-linux@...el.com>,
	<virtualization@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
CC: Michał Winiarski <michal.winiarski@...el.com>
Subject: [PATCH 0/6] vfio: Reset migration device state using dedicated callback

Hi,

In a recent discussion [1], an unsafe locking pattern was discovered.
Initially, it was believed that the locking issue is related to calling
copy_from_user()/copy_to_user() under state_mutex [2], but it turns out
that it's a generic issue that has impact on all drivers that are not
implementing a "deferred reset".

This is a first attempt to simplify the migration device state locking,
following a suggestion from Jason to try and solve the issue on core
side rather than duplicating deferred reset in all of the drivers.

Introduce a dedicated .migration_reset_state() callback called outside
vdev->memory_lock to break the locking dependency chain and convert all
of the drivers to use it.

[1] https://lore.kernel.org/intel-xe/7dtl5qum4mfgjosj2mkfqu5u5tu7p2roi2et3env4lhrccmiqi@asemffaeeflr/
[2] https://lore.kernel.org/kvm/20240220132459.GM13330@nvidia.com/

Michał Winiarski (6):
  vfio: Introduce .migration_reset_state() callback
  hisi_acc_vfio_pci: Use .migration_reset_state() callback
  vfio/pds: Use .migration_reset_state() callback
  vfio/qat: Use .migration_reset_state() callback
  vfio/mlx5: Use .migration_reset_state() callback
  vfio/virtio: Use .migration_reset_state() callback

 .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c    |  7 +-
 drivers/vfio/pci/mlx5/cmd.c                   | 15 ++--
 drivers/vfio/pci/mlx5/cmd.h                   |  3 -
 drivers/vfio/pci/mlx5/main.c                  | 59 ++++-----------
 drivers/vfio/pci/pds/pci_drv.c                | 10 ---
 drivers/vfio/pci/pds/vfio_dev.c               | 12 ++++
 drivers/vfio/pci/qat/main.c                   | 36 +++++-----
 drivers/vfio/pci/vfio_pci_core.c              | 25 ++++++-
 drivers/vfio/pci/virtio/common.h              |  3 -
 drivers/vfio/pci/virtio/main.c                |  1 -
 drivers/vfio/pci/virtio/migrate.c             | 71 ++++++-------------
 include/linux/vfio.h                          |  4 ++
 12 files changed, 101 insertions(+), 145 deletions(-)

-- 
2.51.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ