Skip to content

audio: dax: check param header fits before reading it - #11342

Open
Shrusti-pk wants to merge 1 commit into
thesofproject:mainfrom
Shrusti-pk:dax-param-header-bound
Open

Shrusti-pk wants to merge 1 commit into
thesofproject:mainfrom
Shrusti-pk:dax-param-header-bound

Conversation

@Shrusti-pk

Copy link
Copy Markdown
Contributor

update_params_from_buffer() in the DAX module reads each module_param header before checking that 8 bytes are left in the tuning blob:

  • the blob is host-supplied (IPC4_DAX_MODULE_CFG_PARAM_BLOB, or the IPC3 binary control) and comp_data_blob_set() keeps it in a heap buffer of exactly the received size
  • a blob shorter than one header, or with 1 to 7 bytes after its last whole record, makes the loop read param->id/param->size past the allocation; ASan reports a heap-buffer-overflow READ of size 4, 0 bytes after a 16-byte region, for a 12-byte record plus 4 trailing bytes
  • the nested DAX_PARAM_ID_ENDPOINT walk uses the same loop, so it is covered too
    The waves.c, dts.c and cadence.c module_param walkers already reject a truncated header this way. Blobs made of whole records parse as before.

update_params_from_buffer() walks the DAX tuning blob as a sequence
of struct module_param records but reads param->id and param->size
before checking that a whole 8-byte header is left in the buffer.

The blob comes from the host via IPC4_DAX_MODULE_CFG_PARAM_BLOB (or
the IPC3 binary control) and comp_data_blob_set() stores it in a heap
buffer of exactly the received size. A blob that leaves 1 to 7 bytes
after its last complete record, or is shorter than one header, makes
the loop read up to 7 bytes past the end of that allocation. The
nested DAX_PARAM_ID_ENDPOINT walk goes through the same loop.

Reject a truncated header at the top of the loop, as the module_param
walkers in waves.c, dts.c and cadence.c already do.
@sofci

sofci commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

@intel-sofci

Copy link
Copy Markdown

PR 11342: test results

Run date: 2026-10-23 09:13 UTC

Tested commit: 4115737f1c20828c669b6813f6cbf6a3604866e1

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@checkupup pls check.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow bounds check safely rejects truncated headers before access without changing valid-record processing.

No open issues 🎉

What changed in this PR

This PR hardens the DAX tuning-blob parser against out-of-bounds reads from truncated parameter headers.

Changes:

  • Checks that a complete header remains before accessing parameter fields.
  • Returns -EINVAL for truncated headers while preserving valid-record parsing.
File Description
src/​audio/​module_adapter/​module/​dolby/​dax.c Adds a remaining-length guard before reading each parameter header.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants