From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 7/7] PCI/quirks: Avoid certain address on Genoa systems
Date: Fri, 2 Oct 2026 16:47:54 +0300 (EEST) [thread overview]
Message-ID: <27be560c-4b69-bc39-f362-bd77b217d7c5@linux.intel.com> (raw)
In-Reply-To: <20261002114833.679371F000FF@smtp.kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3111 bytes --]
On Fri, 2 Oct 2026, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] pci/quirks: skipped workaround and UAF on rescan due to dangling resource pointer
> --
>
> commit 988b9fe1c0d1202ac7629ed0f5250a0381f61b90
> Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>
> PCI/quirks: Avoid certain address on Genoa systems
>
> This commit addresses a 64kB iomem black hole on Genoa systems that causes
> reads to return ~0 and blocks overlapping BARs from working. It reserves the
> problematic space via a bridge quirk.
>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222074
>
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index de9bbccda21fd..5483b47d8d544 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
>
> [ ... ]
>
> > +static struct resource black_hole_res = DEFINE_RES_MEM_NAMED(0x9c000000, SZ_64K,
> > + "reserved");
> > +
> > +static void genoa_iomem_black_hole(struct pci_dev *dev)
> > +{
> > + struct resource *r;
> > +
> > + pci_bus_for_each_resource(dev->bus, r) {
> > + if (!r || !r->flags || !resource_assigned(r))
> > + continue;
> > +
> > + if (!__resource_contains_unbound(r, &black_hole_res))
> > + continue;
> > +
> > + if (resource_assigned(&black_hole_res))
> > + pci_dbg(dev, "iomem black hole workaround already applied\n");
>
> [Severity: High]
> Can this lead to a use-after-free and cause the workaround to be skipped on
> rescan?
>
> During the first probe, insert_resource() sets black_hole_res.parent to the
> dynamically allocated host bridge window. If the PCI bridge is subsequently
> removed, the bridge's resources are released and freed.
>
> However, release_resource() unlinks the parent but does not clear the parent
> pointers of child resources. Because black_hole_res is statically allocated,
> its parent pointer is left dangling.
>
> When the bus is rescanned, resource_assigned(&black_hole_res) evaluates to
> true due to the dangling parent pointer. The code erroneously logs "already
> applied" and skips inserting the reservation into the new bridge window.
>
> This leaves the new window unprotected, allowing subsequent BAR allocations
> to fall into the 0x9c000000 black hole.
Before sending this, I did test removing the PCI devices all the way to
the Root Complex (RC included) and the black hole marker weathered the
storm just fine.
I suppose if I'd proceed removing something from further up (something
ACPI side?), the scenario might actually occur but why would anyone want
to do that?
I think this goes to the territory where root has many ways to shoot
oneself's own foot...
--
i.
> > + else if (!insert_resource(r, &black_hole_res))
> > + pci_info(dev, "iomem black hole workaround enabled\n");
> > + else
> > + pci_dbg(dev, "iomem black hole workaround add failed\n");
> > + return;
> > + }
> > +}
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x14ab, genoa_iomem_black_hole);
>
>
next prev parent reply other threads:[~2026-10-02 13:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 11:33 [PATCH v2 0/7] PCI: Resource placement algorithm fixes Ilpo Järvinen
2026-10-02 11:33 ` [PATCH v2 1/7] resource: Mark free space assigned Ilpo Järvinen
2026-10-02 11:43 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 2/7] PCI/parisc: Clean up resource debug print & use dynamic debug Ilpo Järvinen
2026-10-02 11:43 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 3/7] PCI: Honor alignment overrides Ilpo Järvinen
2026-10-02 11:46 ` Jani Nikula
2026-10-02 11:49 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 4/7] PCI: Fix nesting windows with remainder at the left edge Ilpo Järvinen
2026-10-02 11:42 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 5/7] PCI: Place resources to either edge of the window Ilpo Järvinen
2026-10-02 11:46 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 6/7] PCI: Fix composite resource sizing Ilpo Järvinen
2026-10-02 11:51 ` sashiko-bot
2026-10-02 11:33 ` [PATCH v2 7/7] PCI/quirks: Avoid certain address on Genoa systems Ilpo Järvinen
2026-10-02 11:48 ` sashiko-bot
2026-10-02 13:47 ` Ilpo Järvinen [this message]
2026-10-02 13:12 ` Mario Limonciello
2026-10-04 15:44 ` Borislav Petkov
2026-10-05 18:47 ` Bjorn Helgaas
2026-10-06 12:02 ` Ilpo Järvinen
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=27be560c-4b69-bc39-f362-bd77b217d7c5@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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