Files
reverse-engineering-anything/docs/guides
Vinícius AndradeandVincent Koc eb5cd34258 fix(devicetree): read later FDT versions backwards compatible with v17 (#14136)
* fix(devicetree): read later FDT versions backwards compatible with v17

The header reader admitted only versions 16 and 17 and consulted
last_comp_version only to reject a value above the version. DTSpec 5.1
requires a client to accept any version backwards compatible with
version 17, and libfdt reads such a blob with the version 17 header.

Admit a later version whose last_comp_version is 17 or lower and read it
with the version 17 layout, reporting the declared version. A later
version that needs a newer reader and any version below 16 stay
unsupported, and v16 and v17 outcomes are unchanged. FIT recognition
shares the reader, so it now claims a FIT in such a version as well.

* test(devicetree): cover a later FDT version backwards compatible with v17

Parse the shared fixture with version 18 and last_comp_version 16: the
header is read with the version 17 layout and the tree decodes as it
does for v17. Raising last_comp_version to 18 keeps the blob
unsupported. FIT recognition, which shares the header reader, covers
the same version.

On the previous reader the version 18 parse and the version 18 FIT
recognition fail, because version 18 was refused before
last_comp_version was read.

* docs(devicetree): describe later FDT versions backwards compatible with v17

* test(devicetree): keep the unsupported-version cases on an incompatible header

The CLI and MCP error cases used version 18 as an arbitrary unsupported
version, but their fixture declares last_comp_version 16, which is now
read as a version 17 blob. Declare last_comp_version 18 there so both
cases still reach unsupported_target through the public paths.

The shared fixture takes the declared compatibility version for this,
and the parser case uses it instead of patching the header word.

* test(devicetree): cover compatible versions through CLI and MCP

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-30 16:02:58 +08:00
..
…