Skip to content

ipc4: large_config: log rejected data_off_size validation failures#10934

Open
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:ipc_user_handler_security_fixes_followup
Open

ipc4: large_config: log rejected data_off_size validation failures#10934
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:ipc_user_handler_security_fixes_followup

Conversation

@jsarha

@jsarha jsarha commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The data_off_size bounds checks in ipc4_set_vendor_config_module_instance() silently returned IPC4_INVALID_CONFIG_DATA_STRUCT, giving no clue why a MOD_LARGE_CONFIG_SET request was rejected. This makes diagnosing malformed or malicious topologies/host requests harder.

Add tr_dbg() traces to both rejection paths reporting the offending data_off_size together with the limit it violated (the mailbox size for the upper bound, and sizeof(struct sof_tlv) for the init_block lower bound). No functional change to the validation itself.

Copilot AI review requested due to automatic review settings June 17, 2026 10:25

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 improves diagnosability of IPC4 MOD_LARGE_CONFIG_SET rejections by adding debug traces when data_off_size fails existing bounds checks in ipc4_set_vendor_config_module_instance() (no change to validation logic).

Changes:

  • Add tr_dbg() logging when data_off_size exceeds MAILBOX_HOSTBOX_SIZE.
  • Add tr_dbg() logging when init_block requests provide a data_off_size smaller than sizeof(struct sof_tlv).

Comment thread src/ipc/ipc4/handler-user.c Outdated
Comment on lines +1111 to +1112
tr_dbg(&ipc_tr, "data_off_size greater than mailbox %u > %u",
data_off_size, MAILBOX_HOSTBOX_SIZE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why on earth copilot wants to cast literal macro to size_t and then use %zu ? Double space fixed.

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.

@jsarha was this giving a warning for native sim/fuzzing builds. I dont see it giving an issue today on 64bit since its sizes.

Comment thread src/ipc/ipc4/handler-user.c Outdated
Comment on lines +1116 to +1117
tr_dbg(&ipc_tr, "init_block data_off_size too small %u < %u",
data_off_size, sizeof(struct sof_tlv));
@jsarha jsarha force-pushed the ipc_user_handler_security_fixes_followup branch 2 times, most recently from b91d399 to d4c5415 Compare June 17, 2026 13:24

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

Comment on the changes inline. -1 due to wrong sign-off...


/* Validate host-controlled payload size before any use or arithmetic. */
if (data_off_size > MAILBOX_HOSTBOX_SIZE)
if (data_off_size > MAILBOX_HOSTBOX_SIZE) {

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.

tr_dbg() logs are disabled by default, so not sure of the benefit., If we want to leave these in production binaries, we need to use err or warn. And not 100% sure this is worth the binary space to have the logs for errors like these that will only occur if completely out-of-spec IPC messages are sent by host.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Damn. Copilot stole my commit. I wrote the changes and only asked copilot to write the commit message and it stole all the credit.

The data_off_size bounds checks in ipc4_set_vendor_config_module_instance()
silently returned IPC4_INVALID_CONFIG_DATA_STRUCT, giving no clue why a
MOD_LARGE_CONFIG_SET request was rejected. This makes diagnosing malformed
or malicious topologies/host requests harder.

Add tr_dbg() traces to both rejection paths reporting the offending
data_off_size together with the limit it violated (the mailbox size for
the upper bound, and sizeof(struct sof_tlv) for the init_block lower
bound). No functional change to the validation itself.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the ipc_user_handler_security_fixes_followup branch from d4c5415 to a548c0c Compare June 18, 2026 08:42
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.

4 participants