Skip to content

drm/tyr: KUnit tests and fixes for the firmware parser

Daniel Almeida dri-devel lkml rust-for-linux 1 version In review

Get series with b4
b4 am [email protected] change-id 20261125-tyr-fw-parser-073e351dc7b6

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3drm/tyr: add KUnit tests for the firmware parserdrivers/gpu/drm/tyr/fw/parser.rs+298 -00 replies
2/3drm/tyr: reject firmware sections that overlapdrivers/gpu/drm/tyr/fw/parser.rs+37 -00 replies
3/3drm/tyr: reject firmware sections with oversized datadrivers/gpu/drm/tyr/fw/parser.rs+44 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RESEND 0/3] drm/tyr: KUnit tests and fixes for the firmware parser

Tyr's firmware parser has no tests at all. Assuming well-formed files in linux-firmware, it means that the error paths in the parser are not tested. This is a bad combination for code that directly consumes userspace data.

Patch 1 adds a KUnit suite for it. The suite builds a well-formed image from named fields and checks that malformed images are rejected. This suite obviously can't cover every corner case, but at least it can be progressively expanded.

The parser also accepted two kinds of malformed images, so the gap is closed by patches 2 and 3. Patch 2 rejects sections whose VA ranges overlap, and patch 3 rejects section data that is larger than its VA range. Each adds the test that fails without it. Sami Tolvanen had already fixed both of these issues downstream.

This is based on drm-rust-next. Tested with KUnit on arm64 under QEMU, and with IGT on an RK3588 board.

---
Daniel Almeida (3):
drm/tyr: add KUnit tests for the firmware parser drm/tyr: reject firmware sections that overlap drm/tyr: reject firmware sections with oversized data

 drivers/gpu/drm/tyr/fw/parser.rs | 379 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 379 insertions(+)

---
base-commit: abfb640b2374e26de8ff81d488c39d8254db538e
change-id: 20261125-tyr-fw-parser-073e351dc7b6

Best regards,
--
Daniel Almeida <[email protected]>

Signature · 1 line
Daniel Almeida <[email protected]>