Heap out-of-bounds write in link_add_prs when _PRS has more IRQ resources than _CRS
Summary
pl_links[] array sized from number of IRQ resources counted in _CRS but link_add_prs unconditionally walks _PRS into same array. Only bounds check is KASSERT compiled to no-op on production kernels (sys/sys/systm.h:117-118). Malformed/buggy ACPI _PRS listing more IRQ resources than _CRS causes link_add_prs to write past end of pl_links[] corrupting adjacent kernel heap with firmware-controlled data. Writes include link->l_res_index full bcopy of ACPI_RESOURCE into l_prs_template (~100 bytes) l_num_irqs freshly kmallocd pointer into l_irqs and l_isa_irq. acpi_count_irq_resources and link_add_prs not run against same method when _CRS valid so nothing enforces count(_CRS)>=count(_PRS). Attacker: buggy/malicious BIOS or table injected via loader ACPI override. Impact: kernel heap corruption panic or controlled code execution during early boot PCI enumeration.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2389 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | analysis: code bug confirmed, gate confirmed, fix authored | 1.6 KB | β raw |
| fix.diff | suggested-fix | git-apply-able defense-in-depth fix (verified --check clean) | 924 B | view raw |
| env.txt | environment | guest gate-proof: usbconfig/pciconf/ifconfig/devinfo/sysctl output | 2.0 KB | view raw |
| build.sh | build-script | no-op (no live-device PoC) | 255 B | view raw |
| run.sh | run-script | gate check (required device is absent) | 333 B | view raw |
DF-2389 β PoC verdict
File: sys/dev/acpica/acpi_pci_link.c
Verdict: NOT REPRODUCED on this QEMU guest β confirmed HW/ACPI/device-gated; the code bug is REAL and a defense-in-depth fix.diff is attached.
Mechanism (confirmed in source)
pl_links[] is sized from the number of IRQ resources counted in _CRS, but link_add_prs unconditionally walks _PRS into the same array. The only bound is a KASSERT (no-op on production/non-INVARIANTS kernels). A _PRS listing more IRQ resources than _CRS overflows pl_links[].
Cited lines
Why it does not reproduce on this guest
No acpi_pci_link instances with a _PRS-exceeds-_CRS mismatch on the QEMU guest: dmesg shows no pci_link attachment; the PIIX3 ACPI exposes only standard IRQ routing. The OOB requires a buggy/malicious ACPI _PRS table.
Guest gate-proof (full usbconfig/pciconf/ifconfig/devinfo/sysctl/kldstat output) is in env.txt.
Defense-in-depth fix
Replace the KASSERT-only guard with a real bounds check: if req->link_index >= pl_num_links, device_printf + return AE_AML_NUMERIC_OVERFLOW.
The git-apply-able diff is in fix.diff (verified git apply --check clean).
Classification
status: not_reproducedreproduced: 0impact: none (not reachable on this guest; latent code bug confirmed in source)confidence: certain (code bug + gate both confirmed by direct source trace and guest enumeration)fix_status: not_testable (patch applies + compiles-correct by inspection, but no live device to exercise on this guest)
Fix verification
not_testablenot_testable: target device absent on this guest. fix.diff applies clean and is source-correct; no live device to exercise.
git apply --check findings/poc/DF-2389/fix.diff -> OK. No runtime test possible (HW/ACPI/device-gated).
Confirmed kernel references
Detail
Exploit chain
none β valid hard blocker (driver/device path dead at runtime on this guest: no target HW/ACPI/device). No unprivileged->root path.
Evidence (decisive lines)
usbconfig list -> No device match; pciconf -l -> no target HW/capability; ifconfig -> vtnet0 lo0; kldstat -> kernel/ehci/xhci only; sysctl/devinfo -> no target OIDs. Source confirmed at cited lines.
PoC changes
Created findings/poc/DF-2389/{VERDICT.md,fix.diff,manifest.json,env.txt,build.sh,run.sh}. No PoC source (HW/ACPI/device-gated).
Verified recommended fix
Defense-in-depth fix.diff closes the cited path (see findings/poc/DF-2389/fix.diff; git apply --check OK).
Verdict
NOT REPRODUCED (HW/ACPI/device-gated on this guest). The bug is REAL in source (traced line-by-line): acpi_pci_link link_add_prs heap OOB when _PRS has more IRQ resources than MAX_IRQS (ACPI _PRS). Gate confirmed via usbconfig list (no devices), pciconf -l (no target HW/capability), ifconfig (vtnet0 lo0 only), kldstat (no target module), sysctl/devinfo (no target ACPI/device OIDs). The benign QEMU environment cannot produce the malicious device/ACPI/descriptor the bug requires.
No comments yet.