Repository navigation
Conversation
ipc4_get_vendor_config_module_instance() rejects a TL when
produced_data + sizeof(struct sof_tlv) + max_length exceeds
MAILBOX_DSPBOX_SIZE. max_length comes straight from the host and the
sum is a 32-bit size_t on the DSP, so max_length = 0xffffffff wraps the
sum to produced_data + 7 and the check always passes. Each getter is
then told it has 0xffffffff bytes and the loop keeps appending replies
past the end of ipc->comp_data (SOF_IPC_MSG_MAX_SIZE bytes).
Found by the IPC4 fuzzer (ASan): 38 BaseFW TLs of
{IPC4_FW_CONFIG, 0xffffffff} write at comp_data + 4096 on the 15th
basefw_config() call.
Check that the header fits first, then compare max_length against the
space left instead of adding it.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
basefw_config() writes the whole IPC4_FW_CONFIG tuple list (about
280 bytes) without looking at *data_offset. Through a
VENDOR_CONFIG_PARAM get, data points after earlier TLV replies inside
ipc->comp_data and *data_offset is the host max_length, narrowed to the
room that is left. A host sending many {IPC4_FW_CONFIG, 0} TLs passes
the vendor loop bound on every TL while each reply is ~288 bytes, so
the 15th reply runs past the end of the 4096 byte comp_data.
Add BASEFW_CONFIG_SIZE_MAX, the worst-case reply size including the
nested IPC4_FW_SOF_INFO tuple and the vendor tuples (new
BASEFW_VENDOR_FW_CONFIG_SIZE_MAX), and refuse with IPC4_OUT_OF_MEMORY
when MIN(*data_offset, SOF_IPC_MSG_MAX_SIZE) is smaller, as done for the
extended perf data reply. The bound is 536 bytes on posix and 572
bytes with the Intel vendor tuples; Linux asks with the full max
payload size, so normal FW_CONFIG queries are unchanged.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
tmleman
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1,
pblaszko and
plbossart
as code owners
December 3, 2026 15:45
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The size check requires worst-case capacity rather than the actual serialized reply size. With the default 64 Intel codec slots and both clock tuples enabled, it requires 572 bytes even though an empty-codec reply needs only 304, so a valid vendor request with a 512-byte buffer fails with IPC4_OUT_OF_MEMORY.
1 open issue
What changed in this PR
Hardens IPC4 vendor configuration replies against integer overflow in host-controlled length checks.
Changes:
- Replaces length addition with remaining-capacity checks.
- Adds worst-case FW_CONFIG size validation and vendor-specific size bounds.
| File | Description |
|---|---|
src/kernel/audio/base_fw.c |
Adds a worst-case reply capacity guard. |
src/ipc/ipc4/handler-user.c |
Makes vendor reply length checks overflow-safe. |
src/include/ipc4/base_fw_vendor.h |
Defines vendor configuration size bounds. |
Review effort: Balanced
Comment on lines
+318
to
+319
| if (MIN(*data_offset, SOF_IPC_MSG_MAX_SIZE) < BASEFW_CONFIG_SIZE_MAX) | ||
| return IPC4_OUT_OF_MEMORY; |
PR 11609: test resultsRun date: 2026-12-03 19:04 UTC Tested commit: b0bcf3939df75326ffd5655327e731268548e43a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ipc4_get_vendor_config_module_instance() rejects a TL when produced_data + sizeof(struct sof_tlv) + max_length exceeds MAILBOX_DSPBOX_SIZE. max_length comes straight from the host and the sum is a 32-bit size_t on the DSP, so max_length = 0xffffffff wraps the sum to produced_data + 7 and the check always passes. Each getter is then told it has 0xffffffff bytes and the loop keeps appending replies past the end of ipc->comp_data (SOF_IPC_MSG_MAX_SIZE bytes).
Found by the IPC4 fuzzer (ASan): 38 BaseFW TLs of {IPC4_FW_CONFIG, 0xffffffff} write at comp_data + 4096 on the 15th basefw_config() call.
Check that the header fits first, then compare max_length against the space left instead of adding it.