Page MenuHomeFreeBSD

amd_iommu: Bound IVHD device-entry parsing
ClosedPublic

Authored by kbowling on Aug 8 2026, 7:27 AM.
Tags
None
Referenced Files
F170997431: D58724.id183677.diff
Tue, Sep 8, 2:25 AM
F170997227: D58724.id183686.diff
Tue, Sep 8, 2:23 AM
F170989905: D58724.id183668.diff
Tue, Sep 8, 1:18 AM
Unknown Object (File)
Sun, Sep 6, 5:08 AM
Unknown Object (File)
Sun, Sep 6, 4:01 AM
Unknown Object (File)
Sun, Sep 6, 2:01 AM
Unknown Object (File)
Sun, Sep 6, 12:25 AM
Unknown Object (File)
Sat, Sep 5, 10:22 PM
Subscribers

Details

Summary
Validate the IVRS table and every subtable length before using either
to form iterator bounds. Reject truncated typed IVHD blocks instead of
passing them to a type-specific callback.

Within each IVHD payload, correct the lower-bound comparison for
extended range entries and validate fixed-size entries, paired range
terminators, the fixed HID body, and the variable HID UID before
dereferencing or advancing. Malformed firmware can no longer drive
either iterator beyond its enclosing object.

MFC after:      2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/x86/iommu/amd_drv.c
699

I do not like repeating the list of supported types of entries twice. Why cannot the check for the length embedded into the corresponding handler directly?

sys/x86/iommu/amd_drv.c
135

Why do you check this only for the requested type?

kib added inline comments.
sys/x86/iommu/amd_drv.c
100

Either return (done); or move the initialization of done after this if()

This revision is now accepted and ready to land.Sun, Aug 23, 11:49 AM