[PATCH v2 0/3] ACPI: RIMT: validate nested firmware extents

Pengpeng Hou <[email protected]>
Newsgroups gmane.linux.ports.riscv,gmane.linux.acpi.devel,gmane.linux.kernel
Message-ID <[email protected]>
RIMT consumers trust three separate layers of firmware data: the root
node area, the payload and arrays contained in each node, and cross-node
ID mappings.  Validating only the outer table does not establish the
bounds of either nested layer.

Split the validation by contract.  Patch 1 validates the root and node
envelopes while preserving unknown-node traversal.  Patch 2 validates
supported node payloads, arrays and the platform-device string.  Patch 3
validates exact destination-node references, mapping depth and ID
arithmetic.

Changes since v1:
https://lore.kernel.org/all/[email protected]/
- split root, node-data and mapping-reference validation
- preserve unknown-node traversal compatibility
- require destination offsets to match exact node boundaries
- treat num_ids as a count, as specified by the RIMT definition
- keep the existing unchanged-ID result on mapping failure

Testing used Linux 3d6d817622b0 plus this series, GCC 13.3 and QEMU
8.2.2 for riscv64.  A temporary KUnit harness in rimt.c called the
actual static validation helpers; the harness is not part of this
series.  The acpi_rimt_bounds suite passed all three tests, covering
truncated table and node extents, invalid payload and array extents,
unterminated device names, interior node references, ID range and
addition errors, and a cyclic mapping chain.

This did not exercise a platform-provided RIMT table through the complete
boot-time discovery path.

Pengpeng Hou (3):
  ACPI: RIMT: validate table and node extents before traversal
  ACPI: RIMT: validate node payload and array extents
  ACPI: RIMT: validate mapping references and ID arithmetic

 drivers/acpi/riscv/rimt.c | 239 ++++++++++++++++++++++++++++++++++----
 1 file changed, 219 insertions(+), 20 deletions(-)


base-commit: 3d6d817622b0a9721e3cc404df3469171582be13
-- 
2.50.1 (Apple Git-155)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.