The virtio PCI drivers forgo a number of consistency checks,
particularly around pointer validation and bounds checking. This series
focuses on the modern driver to add those checks.

The start of the series adds and fixes some basic bounds checks. Later
patches ensure PCI addresses fall within the expected regions rather
than any arbitrary address. This is acheived by introducing range
parameters to a few of the dm_pci_* functions that allow the ranges to
be checked.

The series also adds a few new configs to allow parts of virtio and PCI
to be disabled where the features may be unused and the current
implementations don't have the needed consistencty checks.

Changelog:
v2:
 - Refactor dm_pci_* functions, not adding new ones
 - Reorder patches per request in v1
v3:
 - Use CI to test more targets
 - Move EA config patch to end for dropping if needed

Andrew Scull (18):
  virtio: pci: Allow exclusion of legacy driver
  virtio: pci: Fix discovery of device config length
  virtio: pci: Bounds check device config access
  virtio: pci: Bounds check notification writes
  virtio: pci: Check virtio common config size
  virtio: pci: Check virtio capability is in bounds
  virtio: pci: Read entire capability into memory
  pci: Fix use of flags in dm_pci_map_bar()
  pci: Check region ranges are addressable
  pci: Range check address conversions
  test: pci: Test PCI address conversion functions
  pci: Map bars with offset and length
  pci: Match region flags using a mask
  pci: Update dm_pci_bus_to_virt() parameters
  pci: Add mask parameter to dm_pci_map_bar()
  virtio: pci: Check virtio configs are mapped
  virtio: pci: Make use of dm_pci_map_bar()
  pci: Add config for Enhanced Allocation

 arch/sandbox/dts/test.dts               |   2 +-
 arch/x86/cpu/baytrail/cpu.c             |   2 +-
 drivers/ata/ahci.c                      |   9 +-
 drivers/ata/sata_sil.c                  |   6 +-
 drivers/bios_emulator/atibios.c         |   4 +-
 drivers/gpio/octeon_gpio.c              |   2 +-
 drivers/i2c/designware_i2c_pci.c        |   3 +-
 drivers/i2c/intel_i2c.c                 |   2 +-
 drivers/i2c/octeon_i2c.c                |   2 +-
 drivers/mmc/octeontx_hsmmc.c            |   2 +-
 drivers/mmc/pci_mmc.c                   |   2 +-
 drivers/mtd/nand/raw/octeontx_bch.c     |   6 +-
 drivers/mtd/nand/raw/octeontx_nand.c    |   2 +-
 drivers/net/bnxt/bnxt.c                 |   9 +-
 drivers/net/e1000.c                     |   4 +-
 drivers/net/fsl_enetc.c                 |   2 +-
 drivers/net/fsl_enetc_mdio.c            |   2 +-
 drivers/net/mscc_eswitch/felix_switch.c |   4 +-
 drivers/net/octeontx/bgx.c              |   2 +-
 drivers/net/octeontx/nic_main.c         |   2 +-
 drivers/net/octeontx/nicvf_main.c       |   2 +-
 drivers/net/octeontx/smi.c              |   2 +-
 drivers/net/octeontx2/cgx.c             |   2 +-
 drivers/net/octeontx2/rvu_af.c          |   2 +-
 drivers/net/octeontx2/rvu_pf.c          |   3 +-
 drivers/net/pch_gbe.c                   |   2 +-
 drivers/nvme/nvme_pci.c                 |   4 +-
 drivers/pci/Kconfig                     |   7 +
 drivers/pci/pci-uclass.c                | 185 +++++++++++-------------
 drivers/spi/octeon_spi.c                |   2 +-
 drivers/usb/host/ehci-pci.c             |   3 +-
 drivers/usb/host/ohci-pci.c             |   2 +-
 drivers/usb/host/xhci-pci.c             |   3 +-
 drivers/virtio/Kconfig                  |   9 ++
 drivers/virtio/Makefile                 |   3 +-
 drivers/virtio/virtio_pci_legacy.c      |   3 +-
 drivers/virtio/virtio_pci_modern.c      | 143 ++++++++++++------
 include/pci.h                           |  46 ++++--
 test/dm/pci.c                           | 118 ++++++++++++++-
 39 files changed, 401 insertions(+), 209 deletions(-)

-- 
2.36.0.rc2.479.g8af0fa9b8e-goog

Reply via email to