Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Farhan Ali <alifm@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, alex@shazbot.org,
	schnelle@linux.ibm.com, mjrosato@linux.ibm.com,
	stable@vger.kernel.org
Subject: Re: [PATCH v21 1/4] PCI: Allow per function PCI slots to fix slot reset on s390
Date: Wed, 22 Jul 2026 17:32:31 -0500	[thread overview]
Message-ID: <20260722223231.GA801609@bhelgaas> (raw)
In-Reply-To: <95f6e8f0-19b7-434f-a39c-7c07df67650f@linux.ibm.com>

On Thu, Jul 16, 2026 at 11:15:33AM -0700, Farhan Ali wrote:
> 
> On 7/15/2026 4:34 PM, Bjorn Helgaas wrote:
> > > On s390 systems, which use a machine level hypervisor, PCI devices are
> > > always accessed through a form of PCI pass-through which fundamentally
> > > operates on a per PCI function granularity. This is also reflected in the
> > > s390 PCI hotplug driver which creates hotplug slots for individual PCI
> > > functions. Its reset_slot() function, which is a wrapper for
> > > zpci_hot_reset_device(), thus also resets individual functions.
> > > 
> > > Currently, the kernel's PCI_SLOT() macro assigns the same pci_slot object
> > > to multifunction devices.
> > PCI_SLOT() doesn't assign pci_slot objects; I guess they're assigned
> > by some code that*uses* PCI_SLOT().  Since this says "currently," I
> > assume you're changing that code, so we should mention where it is to
> > help readers out.
> 
> Thanks for your response! I can re-word the commit message, how about
> something like this:
> 
> Currently, the pci_create_slot() assigns the same pci_slot object to
> multifunction devices.
> 
> > I see some Sashiko comments; those also need to be addressed or
> > explained away.
> 
> Regarding Sashiko's comments for this patch, it mentions 2 issues:
> 
> New issues: - [High] Unconditional enablement of `per_func_slot` on S390
> breaks standard PCI hotplug (e.g., pciehp, shpchp) slot matching and resets.
> 
> I believe this is not applicable as on s390 we don't support any other PCI
> hotplug drivers given the unique nature of zPCI architecture.

Makes sense.

> Pre-existing issues:
> - [High] Lockless access to `dev->slot` in `pci_dev_reset_slot_function` can
> lead to Use-After-Free if a hotplug driver is concurrently unbound.
> 
> Sashiko identified this as a pre-existing issue, so I don't think should be
> addressed with this patch.

Right, we don't need to fix pre-existing issues in this series, but I
meant there were Sashiko comments on other patches in this series that
look like they *should* be addressed, e.g.,

  [PATCH v21 2/4] PCI: Avoid saving config space state if inaccessible

    - [High] pci_dev_save_and_disable() skips disabling the device if
      config space is momentarily inaccessible, potentially leaving
      DMA and interrupts enabled.
    - [Low] String literal passed to a non-const `char *` pointer in
      `pci_dev_config_accessible()`.

    https://lore.kernel.org/all/20260630170754.093021F00A3A@smtp.kernel.org

  [PATCH v21 3/4] PCI: Fail FLR when config space is inaccessible

    - [High] Un-ratelimited pci_warn() in pci_dev_config_accessible()
      allows an attacker to flood the host kernel log.
    - [High] Early bailout in pcie_flr() when config space is
      inaccessible skips the Function Level Reset and the subsequent
      wait, allowing device assignment to continue without reset,
      leaking state.

    https://lore.kernel.org/all/20260630171310.F25D41F000E9@smtp.kernel.org

  [PATCH v21 4/4] PCI/MSI: Enable memory decoding before restoring MSI-X messages

    - [Medium] Blindly restoring a stale PCI_COMMAND value introduces
      a TOCTOU race window that can erase concurrent modifications to
      the register.

    https://lore.kernel.org/all/20260630171255.20BD91F000E9@smtp.kernel.org

Annoyingly, on v22, Sashiko complained about *different* things and
didn't complain about some of these even though the v22 patches are
identical to v21.  Sigh.

  reply	other threads:[~2026-07-22 22:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 16:48 [PATCH v21 0/4] [PCI] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-06-30 16:48 ` [PATCH v21 1/4] PCI: Allow per function PCI slots to fix slot reset on s390 Farhan Ali
2026-06-30 17:10   ` sashiko-bot
2026-07-15 23:34   ` Bjorn Helgaas
2026-07-16 18:15     ` Farhan Ali
2026-07-22 22:32       ` Bjorn Helgaas [this message]
2026-07-23  1:21         ` Farhan Ali
2026-07-16 18:19     ` Farhan Ali
2026-06-30 16:48 ` [PATCH v21 2/4] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-06-30 17:07   ` sashiko-bot
2026-06-30 16:48 ` [PATCH v21 3/4] PCI: Fail FLR when config space is inaccessible Farhan Ali
2026-06-30 17:13   ` sashiko-bot
2026-06-30 16:48 ` [PATCH v21 4/4] PCI/MSI: Enable memory decoding before restoring MSI-X messages Farhan Ali
2026-06-30 17:12   ` sashiko-bot
2026-07-13 18:21 ` [PATCH v21 0/4] [PCI] Error recovery for vfio-pci devices on s390x Farhan Ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722223231.GA801609@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alex@shazbot.org \
    --cc=alifm@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=schnelle@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox