Page MenuHomeFreeBSD

amd_iommu: Bound IVHD device-entry parsing
ClosedPublic

Authored by kbowling on Sat, Aug 8, 7:27 AM.
Tags
None
Referenced Files
F170719448: D58724.diff
Sun, Sep 6, 5:08 AM
F170711906: D58724.diff
Sun, Sep 6, 4:01 AM
F170696290: D58724.id184764.diff
Sun, Sep 6, 2:01 AM
F170682702: D58724.id.diff
Sun, Sep 6, 12:25 AM
F170667745: D58724.id.diff
Sat, Sep 5, 10:22 PM
Unknown Object (File)
Sat, Sep 5, 2:09 PM
Unknown Object (File)
Sat, Sep 5, 12:22 PM
Unknown Object (File)
Sat, Sep 5, 7:58 AM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/x86/iommu/amd_drv.c
708

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
123

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