From: sashiko-bot@kernel.org
To: "Wei Wang" <wei.w.wang@hotmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v10 5/6] PCI: Enable the enhanced ACS controls introduced by PCI_ACS_ECAP
Date: Tue, 22 Sep 2026 15:14:28 +0000 [thread overview]
Message-ID: <20260922151428.56F281F000FF@smtp.kernel.org> (raw)
In-Reply-To: <SI2PR01MB43937D197A3C0286A51A8D69DC832@SI2PR01MB4393.apcprd01.prod.exchangelabs.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] pci: missing port-type validation allows setting reserved UMAC/URRC bits on Root Ports
- [Medium] pci: unconditional check for reserved DMAC/UMAC encodings breaks config_acs on non-ECAP devices
--
commit d128af062fd915f74bfeafe2fdd8a9e6bffb5ab9
Author: Wei Wang <wei.w.wang@hotmail.com>
PCI: Enable the enhanced ACS controls introduced by PCI_ACS_ECAP
The ACS Enhanced Capability introduces several new access controls to
improve device isolation. These new controls are particularly important
for device passthrough in virtualization scenarios.
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ffb489e4cbef6..4942bb6f1e111 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
[ ... ]
> @@ -982,6 +985,10 @@ static void pci_param_config_acs(struct pci_dev *dev, struct pci_acs *caps)
> u16 shift = 0, enabled_bits = 0, disabled_bits = 0, invalid_bits;
> u16 valid_ctrl = dev->acs_capabilities & PCI_ACS_BASIC_CTRL_MASK;
> const char *p, *seg;
> + u16 new_ctrl;
> +
> + if (dev->acs_capabilities & PCI_ACS_ECAP)
> + valid_ctrl |= PCI_ACS_ECAP_CTRL_MASK;
[Severity: Medium]
Does this missing port-type validation allow setting reserved UMAC/URRC
bits on Root Ports?
Because PCI_ACS_ECAP_CTRL_MASK unconditionally includes the UMAC and URRC
bits, an administrator could use the config_acs= boot parameter to
overwrite these reserved bits on a Root Port device that supports
PCI_ACS_ECAP.
The PCIe Base Specification states these bits must be hardwired to 0 for Root
Ports, so permitting them to be configured here could lead to undefined
behavior on poorly-behaved hardware.
>
> if (!config_acs_param || !valid_ctrl)
> return;
[ ... ]
> @@ -1023,10 +1030,23 @@ static void pci_param_config_acs(struct pci_dev *dev, struct pci_acs *caps)
> disabled_bits &= valid_ctrl;
> }
>
> + /*
> + * DMAC/UMAC are 2-bit fields where encoding 0b11 is reserved. The
> + * final value can land on 0b11 not only when the user enables both
> + * bits, but also when they enable one bit, e.g. "1x", while fw_ctrl
> + * already has the other set (e.g. "01").
> + */
> + new_ctrl = (caps->fw_ctrl | enabled_bits) & ~disabled_bits;
> + if (FIELD_GET(PCI_ACS_DMAC_MASK, new_ctrl) == PCI_ACS_MAC_RSVD ||
> + FIELD_GET(PCI_ACS_UMAC_MASK, new_ctrl) == PCI_ACS_MAC_RSVD) {
[Severity: Medium]
Does this unconditional check for reserved DMAC/UMAC encodings break
config_acs on non-ECAP devices?
If a non-ECAP device has firmware or hardware quirks that leave bits 8-11
initialized to 1s, this check will falsely trigger. Because it runs
unconditionally, it applies ECAP-specific validation constraints to non-ECAP
devices where the bits are just reserved.
This will cause the function to abort, preventing the user from configuring
even basic, supported ACS controls on the device.
> + pci_err(dev, "ACS DMAC/UMAC would be set to reserved value\n");
> + return;
> + }
> +
> pci_dbg(dev, "ACS enabled: %#06x, disabled: %#06x\n",
> enabled_bits, disabled_bits);
>
> - caps->ctrl = (caps->fw_ctrl | enabled_bits) & ~disabled_bits;
> + caps->ctrl = new_ctrl;
> }
>
> /**
--
Sashiko AI review · https://sashiko.dev/#/patchset/SI2PR01MB43935D2C01946E6D8FD9EFAADC832@SI2PR01MB4393.apcprd01.prod.exchangelabs.com?part=5
next prev parent reply other threads:[~2026-09-22 15:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 15:02 [PATCH v10 0/6] PCI: Add support for ACS Enhanced Capability Wei Wang
2026-09-22 15:02 ` [PATCH v10 1/6] PCI: Validate ACS control bits against device-specific ACS capabilities Wei Wang
2026-09-22 15:12 ` sashiko-bot
2026-09-22 15:02 ` [PATCH v10 2/6] Documentation/kernel-parameters: Add multi-device config_acs example Wei Wang
2026-09-22 15:13 ` sashiko-bot
2026-09-22 15:02 ` [PATCH v10 3/6] PCI: Consolidate delimiter handling into pci_dev_str_match() Wei Wang
2026-09-22 15:09 ` sashiko-bot
2026-09-22 15:02 ` [PATCH v10 4/6] PCI: Refactor disable_acs_redir and config_acs param handling Wei Wang
2026-09-22 15:13 ` sashiko-bot
2026-09-22 15:02 ` [PATCH v10 5/6] PCI: Enable the enhanced ACS controls introduced by PCI_ACS_ECAP Wei Wang
2026-09-22 15:14 ` sashiko-bot [this message]
2026-09-22 15:02 ` [PATCH v10 6/6] PCI: Add the enhanced ACS controls check to pci_acs_flags_enabled() Wei Wang
2026-09-22 15:14 ` sashiko-bot
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=20260922151428.56F281F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.w.wang@hotmail.com \
/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