Skip to content

ipc4: handler: bound large config get reply size - #11327

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
checkupup:main_fix_ipc_fuzzer
Oct 22, 2026
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
checkupup:main_fix_ipc_fuzzer

Conversation

@checkupup

Copy link
Copy Markdown
Contributor

For a LARGE_CONFIG_GET the reply size starts as the host-controlled 20-bit data_off_size field and is only updated if the module's get_configuration() writes it back. Modules that do not (e.g. the selector, whose getter is a stub returning 0) leave it untouched, so up to ~1 MB ends up in msg_reply->tx_size.

Writing that reply to the 4 KB DSP mailbox then fails in memcpy_s(). On the POSIX/fuzz platform this trips an assert inside the IPC TX work queue, whose handler re-asserts while holding a spinlock and recurses until the 2 KB thread stack overflows. The IPC fuzzer reported this as an AddressSanitizer stack-overflow.

Reject reply sizes larger than MAILBOX_DSPBOX_SIZE with IPC4_INVALID_CONFIG_DATA_STRUCT in both large config get paths.

For a LARGE_CONFIG_GET the reply size starts as the host-controlled
20-bit data_off_size field and is only updated if the module's
get_configuration() writes it back. Modules that do not (e.g. the
selector, whose getter is a stub returning 0) leave it untouched, so
up to ~1 MB ends up in msg_reply->tx_size.

Writing that reply to the 4 KB DSP mailbox then fails in memcpy_s().
On the POSIX/fuzz platform this trips an assert inside the IPC TX work
queue, whose handler re-asserts while holding a spinlock and recurses
until the 2 KB thread stack overflows. The IPC fuzzer reported this as
an AddressSanitizer stack-overflow.

Reject reply sizes larger than MAILBOX_DSPBOX_SIZE with
IPC4_INVALID_CONFIG_DATA_STRUCT in both large config get paths.

Signed-off-by: Jun Lai <junlai@dolby.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sofci

sofci commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

@checkupup

Copy link
Copy Markdown
Contributor Author

This PR is a fix about [IPC fuzzing / simple-IPC-fuzz_sh (4) CI error that I found in another PR #11320. I have verified it locally and work fine

@checkupup
checkupup marked this pull request as ready for review October 21, 2026 14:27
@checkupup
checkupup force-pushed the main_fix_ipc_fuzzer branch from b7c08ef to e796d85 Compare October 21, 2026 14:34

@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.

Thanks @checkupup

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

Both guards reject oversized replies before publishing their sizes and preserve existing error handling.

No open issues 🎉

What changed in this PR

Bounds IPC4 large-configuration GET replies to prevent oversized mailbox writes and the resulting fuzz-platform crash.

Changes:

  • Checks reply sizes against MAILBOX_DSPBOX_SIZE in both GET paths.
  • Returns IPC4_INVALID_CONFIG_DATA_STRUCT before publishing oversized replies.
File Description
src/​ipc/​ipc4/​handler-user.c Adds mailbox-size guards to both large-configuration GET paths.

Review effort: Balanced

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same fix also at #11327 but I like the shorter comments in this one.

@lgirdwood

Copy link
Copy Markdown
Member

Same fix also at #11327 but I like the shorter comments in this one.

I'll merge whatever passes CI first as it seem we have some blockage or backlog today.

@intel-sofci

Copy link
Copy Markdown

PR 11327: test results

Run date: 2026-10-22 15:24 UTC

Tested commit: e796d8599132a4abe91899064241959217765293

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

@lgirdwood
lgirdwood merged commit 9b2a89d into thesofproject:main Oct 22, 2026
83 checks passed
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.

7 participants