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: <20240607190955.15376-1-fgriffo@amazon.co.uk>
Date: Fri, 7 Jun 2024 19:09:47 +0000
From: Fred Griffoul <fgriffo@...zon.co.uk>
To: <griffoul@...il.com>
CC: Fred Griffoul <fgriffo@...zon.co.uk>, Catalin Marinas
	<catalin.marinas@....com>, Will Deacon <will@...nel.org>, Alex Williamson
	<alex.williamson@...hat.com>, Waiman Long <longman@...hat.com>, Zefan Li
	<lizefan.x@...edance.com>, Tejun Heo <tj@...nel.org>, Johannes Weiner
	<hannes@...xchg.org>, Mark Rutland <mark.rutland@....com>, Marc Zyngier
	<maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>, Mark Brown
	<broonie@...nel.org>, Ard Biesheuvel <ardb@...nel.org>, Joey Gouly
	<joey.gouly@....com>, Ryan Roberts <ryan.roberts@....com>, Jeremy Linton
	<jeremy.linton@....com>, Jason Gunthorpe <jgg@...pe.ca>, Yi Liu
	<yi.l.liu@...el.com>, Kevin Tian <kevin.tian@...el.com>, Eric Auger
	<eric.auger@...hat.com>, Stefan Hajnoczi <stefanha@...hat.com>, "Christian
 Brauner" <brauner@...nel.org>, Ankit Agrawal <ankita@...dia.com>, "Reinette
 Chatre" <reinette.chatre@...el.com>, Ye Bin <yebin10@...wei.com>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<kvm@...r.kernel.org>, <cgroups@...r.kernel.org>
Subject: [PATCH v3 0/2] vfio/pci: add msi interrupt affinity support

v4:
 - export arm64_mismatched_32bit_el0 to compile the vfio driver as
   a kernel module on arm64 if CONFIG_CPUSETS is not defined.
 - vfio_pci_ioctl_set_irqs(): free the cpumask_var_t only if data_size
   is not zero, otherwise it was not allocated.
 - vfio_pci_set_msi_trigger(): call the new function
   vfio_pci_set_msi_affinity() later, after the DATA_EVENTFD
   processing and the vdev index check.

v3:
 - add a first patch to export cpuset_cpus_allowed() to be able to
   compile the vfio driver as a kernel module.

v2:
 - change the ioctl() interface to use a cpu_set_t in vfio_irq_set
   'data' to keep the 'start' and 'count' semantic, as suggested by
    David Woodhouse <dwmw2@...radead.org>

v1:

The usual way to configure a device interrupt from userland is to write
the /proc/irq/<irq>/smp_affinity or smp_affinity_list files. When using
vfio to implement a device driver or a virtual machine monitor, this may
not be ideal: the process managing the vfio device interrupts may not be
granted root privilege, for security reasons. Thus it cannot directly
control the interrupt affinity and has to rely on an external command.

This patch extends the VFIO_DEVICE_SET_IRQS ioctl() with a new data flag
to specify the affinity of a vfio pci device interrupt.

The affinity argument must be a subset of the process cpuset, otherwise
an error -EPERM is returned.

The vfio_irq_set argument shall be set-up in the following way:

- the 'flags' field have the new flag VFIO_IRQ_SET_DATA_AFFINITY set
as well as VFIO_IRQ_SET_ACTION_TRIGGER.

- the 'start' field is the device interrupt index. Only one interrupt
can be configured per ioctl().

- the variable-length array consists of one or more CPU index
encoded as __u32, the number of entries in the array is specified in the
'count' field.

Fred Griffoul (2):
  cgroup/cpuset: export cpuset_cpus_allowed()
  vfio/pci: add msi interrupt affinity support

 arch/arm64/kernel/cpufeature.c    |  1 +
 drivers/vfio/pci/vfio_pci_core.c  | 26 +++++++++++++++++----
 drivers/vfio/pci/vfio_pci_intrs.c | 39 +++++++++++++++++++++++++++++++
 drivers/vfio/vfio_main.c          | 13 +++++++----
 include/uapi/linux/vfio.h         | 10 +++++++-
 kernel/cgroup/cpuset.c            |  1 +
 6 files changed, 81 insertions(+), 9 deletions(-)


base-commit: cbb325e77fbe62a06184175aa98c9eb98736c3e8
--
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ