qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] a5dba9: vfio: Fix CID 1458134 in vfio_registe


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] a5dba9: vfio: Fix CID 1458134 in vfio_register_ram_discard...
Date: Thu, 15 Jul 2021 13:44:33 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: a5dba9bc0552785b91315d457b9397ebd833224b
      
https://github.com/qemu/qemu/commit/a5dba9bc0552785b91315d457b9397ebd833224b
  Author: David Hildenbrand <david@redhat.com>
  Date:   2021-07-14 (Wed, 14 Jul 2021)

  Changed paths:
    M hw/vfio/common.c

  Log Message:
  -----------
  vfio: Fix CID 1458134 in vfio_register_ram_discard_listener()

  CID 1458134:  Integer handling issues  (BAD_SHIFT)
    In expression "1 << ctz64(container->pgsizes)", left shifting by more
    than 31 bits has undefined behavior.  The shift amount,
    "ctz64(container->pgsizes)", is 64.

Commit 5e3b981c330c ("vfio: Support for RamDiscardManager in the !vIOMMU
case") added an assertion that our granularity is at least as big as the
page size.

Although unlikely, we could have a page size that does not fit into
32 bit. In that case, we'd try shifting by more than 31 bit.

Let's use 1ULL instead and make sure we're not shifting by more than 63
bit by asserting that any bit in container->pgsizes is set.

Fixes: CID 1458134
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Auger Eric <eric.auger@redhat.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: teawater <teawaterz@linux.alibaba.com>
Cc: Marek Kedzierski <mkedzier@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Link: https://lore.kernel.org/r/20210712083135.15755-1-david@redhat.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>


  Commit: 936555bc4f9efce1a9d35466845169c2c7566794
      
https://github.com/qemu/qemu/commit/936555bc4f9efce1a9d35466845169c2c7566794
  Author: Cai Huoqing <caihuoqing@baidu.com>
  Date:   2021-07-14 (Wed, 14 Jul 2021)

  Changed paths:
    M hw/vfio/pci.c

  Log Message:
  -----------
  vfio/pci: Change to use vfio_pci_is()

Make use of vfio_pci_is() helper function.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210713014831.742-1-caihuoqing@baidu.com
[aw: commit log wording]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>


  Commit: 1bd9f1b14d1e9c1498bb03faf4e2bb945cf6542d
      
https://github.com/qemu/qemu/commit/1bd9f1b14d1e9c1498bb03faf4e2bb945cf6542d
  Author: Cai Huoqing <caihuoqing@baidu.com>
  Date:   2021-07-14 (Wed, 14 Jul 2021)

  Changed paths:
    M hw/vfio/pci.c
    M include/hw/pci/pci_ids.h

  Log Message:
  -----------
  vfio/pci: Add pba_offset PCI quirk for BAIDU KUNLUN AI processor

Fix pba_offset initialization value for BAIDU KUNLUN Virtual
Function device. The KUNLUN hardware returns an incorrect
value for the VF PBA offset, and add a quirk to instead
return a hardcoded value of 0xb400.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210713093743.942-1-caihuoqing@baidu.com
[aw: comment & whitespace tuning]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>


  Commit: bd306cfeeececee73ff2cdb3de1229ece72f3b28
      
https://github.com/qemu/qemu/commit/bd306cfeeececee73ff2cdb3de1229ece72f3b28
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-07-15 (Thu, 15 Jul 2021)

  Changed paths:
    M hw/vfio/common.c
    M hw/vfio/pci.c
    M include/hw/pci/pci_ids.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20210714.0' 
into staging

VFIO update 2021-07-14

 * Coverity fix to discard listener (David Hildenbrand)

 * MSI-X PBA quirk for BAIDU VFs, additional helper use cases (Cai Huoqing)

# gpg: Signature made Wed 14 Jul 2021 22:31:35 BST
# gpg:                using RSA key 42F6C04E540BD1A99E7B8A90239B9B6E3BB08B22
# gpg:                issuer "alex.williamson@redhat.com"
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex@shazbot.org>" [full]
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>" 
[full]
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-update-20210714.0:
  vfio/pci: Add pba_offset PCI quirk for BAIDU KUNLUN AI processor
  vfio/pci: Change to use vfio_pci_is()
  vfio: Fix CID 1458134 in vfio_register_ram_discard_listener()

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


Compare: https://github.com/qemu/qemu/compare/d4127349e316...bd306cfeeece



reply via email to

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