Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] treewide: Add a flag to detect the Apple T2 chip
Date: Sun, 19 Jul 2026 18:14:47 +0000	[thread overview]
Message-ID: <20260719181448.55A5D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260719180308.1398-2-atharvatiwarilinuxdev@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Spoofable PCI device check allows local attackers to bypass UEFI Secure Boot revocations.
- [Medium] T2 Macs will suffer an EFI firmware crash if PCI enumeration is bypassed or disabled.
- [Low] Linking fails with an undefined reference to `has_t2_chip` on x86 architectures when `CONFIG_PCI` is disabled.
- [Low] The globally exported variable `has_t2_chip` uses a dangerously generic name.
--

--- Patch [1]: [PATCH 1/2] treewide: Add a flag to detect the Apple T2 chip ---
commit 371f6a2037c381d85697cd4a6b5cede313505414
Author: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>

treewide: Add a flag to detect the Apple T2 chip

This patch adds a flag to detect Apple T2 chips using a PCI early fixup.
It caches the result and replaces the existing DMI-based quirk in the EFI
certificate loading code to avoid repeated checks.

> diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
> --- a/arch/x86/pci/fixup.c
> +++ b/arch/x86/pci/fixup.c

[ ... ]

> @@ -995,6 +996,15 @@ static void asus_disable_nvme_d3cold(struct pci_dev *pdev)
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x9a09, asus_disable_nvme_d3cold);
>  
> +bool has_t2_chip;
> +EXPORT_SYMBOL(has_t2_chip);

[Severity: Low]
Since arch/x86/pci/fixup.c is only compiled when CONFIG_PCI is enabled, will
this cause a link-time build failure on x86 if a kernel is configured with
CONFIG_PCI=n and CONFIG_LOAD_UEFI_KEYS=y?

The declaration in include/linux/platform_data/x86/apple.h is active for all
x86 builds, so the missing definition would only be caught at link time.

[Severity: Low]
Is has_t2_chip too generic of a name for a globally exported symbol?

Exporting such a generic name to the global namespace might increase the risk
of symbol collisions with other components or out-of-tree modules.

> +
> +static void apple_has_t2_chip(struct pci_dev *pdev)
> +{
> +	has_t2_chip = true;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_APPLE, 0x1801, apple_has_t2_chip);

[Severity: High]
Can this unconditional PCI fixup be spoofed by an external hotplug device?

If an attacker connects a malicious PCIe device (such as via Thunderbolt)
that spoofs this Vendor and Device ID before boot, has_t2_chip will be set
globally.

This would cause load_uefi_certs() to skip loading the dbx revocation list,
potentially allowing revoked, malicious kexec payloads or modules to bypass
Secure Boot.

[Severity: Medium]
What happens to actual T2 Macs if the kernel is booted with pci=off or if
PCI enumeration fails?

If the PCI subsystem does not initialize, this fixup will never run and
has_t2_chip will remain false.

This would cause load_uefi_certs() to attempt reading the db and dbx UEFI
variables, triggering a page fault in Apple's firmware and crashing EFI
runtime services on these machines.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260719180308.1398-1-atharvatiwarilinuxdev@gmail.com?part=1

  reply	other threads:[~2026-07-19 18:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19 18:03 [PATCH 0/2] Add Apple T2 NHI device links Atharva Tiwari
2026-07-19 18:03 ` [PATCH 1/2] treewide: Add a flag to detect the Apple T2 chip Atharva Tiwari
2026-07-19 18:14   ` sashiko-bot [this message]
2026-07-19 18:03 ` [PATCH 2/2] thunderbolt: Add device links for Apple T2 NHI Atharva Tiwari
2026-07-19 18:12   ` 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=20260719181448.55A5D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=atharvatiwarilinuxdev@gmail.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