Skip to content

audio: module_adapter_ipc4: add range check to module_set_large_config() - #11044

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/ipc4/module_adapter/set_large/add_size_check
Open

audio: module_adapter_ipc4: add range check to module_set_large_config()#11044
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/ipc4/module_adapter/set_large/add_size_check

Conversation

@tmleman

@tmleman tmleman commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

module_set_large_config() reads a SET_LARGE_CONFIG payload out of the fixed-size HOSTBOX mailbox. For a single-fragment config (init_block && final_block) the number of bytes copied, fragment_size, is set verbatim to the host-controlled data_off_size (a 20-bit field, up to ~1 MB), without bounding it to the mailbox. The .set_configuration handler (e.g. comp_data_blob_set() -> memcpy_s()) then copies that many bytes from the ~4 KB mailbox; memcpy_s() only validates the destination size, so the source over-read is not caught and reads past MAILBOX_HOSTBOX_BASE.

A fuzzer-crafted request (data_off_size = 64778 from a 4096-byte mailbox) triggers a global-buffer-overflow read reported by AddressSanitizer.

Reject a single fragment larger than MAILBOX_HOSTBOX_SIZE, mirroring the range check already present on the GET path (commit f72dbb2) and the mailbox bound used at module init.

Copilot AI review requested due to automatic review settings July 28, 2026 18:19
@tmleman
tmleman requested a review from ranj063 as a code owner July 28, 2026 18:19

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.

Pull request overview

This PR hardens IPC4 module adapter large-configuration handling by rejecting oversized single-fragment SET_LARGE_CONFIG payloads to prevent mailbox source over-reads during module configuration updates.

Changes:

  • Add a range check in module_set_large_config() to reject single-fragment payload sizes larger than MAILBOX_HOSTBOX_SIZE.
  • Emit an error and return -EINVAL on invalid single-fragment sizes.

Comment on lines 239 to +243
case MODULE_CFG_FRAGMENT_SINGLE:
if (data_offset_size > MAILBOX_HOSTBOX_SIZE) {
comp_err(dev, "invalid large_config fragment size %u", data_offset_size);
return -EINVAL;
}
module_set_large_config() reads a SET_LARGE_CONFIG payload out of the
fixed-size HOSTBOX mailbox. For a single-fragment config (init_block &&
final_block) the number of bytes copied, fragment_size, is set verbatim
to the host-controlled data_off_size (a 20-bit field, up to ~1 MB),
without bounding it to the mailbox. The .set_configuration handler
(e.g. comp_data_blob_set() -> memcpy_s()) then copies that many bytes
from the ~4 KB mailbox; memcpy_s() only validates the destination size,
so the source over-read is not caught and reads past
MAILBOX_HOSTBOX_BASE.

A fuzzer-crafted request (data_off_size = 64778 from a 4096-byte
mailbox) triggers a global-buffer-overflow read reported by
AddressSanitizer.

Reject a single fragment larger than MAILBOX_HOSTBOX_SIZE, mirroring the
range check already present on the GET path (commit f72dbb2) and the
mailbox bound used at module init.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
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.

2 participants