Skip to content

ipc4: helper: reject cross-core modules early when unsupported - #11375

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
ujfalusi:peter/pr/ll-no-crosscore-fix
Oct 30, 2026
Merged

kv2019i merged 1 commit into
thesofproject:mainfrom
ujfalusi:peter/pr/ll-no-crosscore-fix

Conversation

@ujfalusi

Copy link
Copy Markdown
Contributor

With CONFIG_SOF_USERSPACE_LL the IPC4 module commands run in a user thread which cannot issue IDC messages. CONFIG_CROSS_CORE_STREAM is therefore disabled in that configuration, but a module created on a different core than its pipeline (e.g. the compress decoder pinned to core 1) was still accepted, and the first cross-core operation then panicked the DSP from user space instead of failing:

  • ipc4_comp_connect() called comp_get_attribute() on the remote sink before checking cross_core_bind, hitting the privileged IDC path (rzalloc/idc_send_msg) -> privileged instruction exception.
  • the host's error unwind deleted the pipeline, and ipc_pipeline_module_free() used ipc_comp_free_remote() for the remote module -> load error on the kernel-only IDC data.

Reject such a module already at MOD_INIT_INSTANCE when user-space LL is enabled and cross-core streams are disabled, and move the cross-core check in ipc4_comp_connect() before any remote access so the bind fails with IPC4_INVALID_REQUEST instead of crashing.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 13:38

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.

🟡 Changes recommended

With CONFIG_SOF_USERSPACE_LL, the userspace constructor bypasses pipeline/core validation, allowing a cross-core module that exposes the privileged ipc_comp_free_remote() path during pipeline deletion.

1 open issue
What changed in this PR

This PR aims to prevent IPC4 cross-core module operations from crashing the DSP when user-space LL execution cannot issue privileged inter-core messages.

Changes:

  • Adds a module/pipeline core check in comp_new_ipc4() for user-space LL configurations without cross-core stream support.
  • Moves unsupported cross-core bind rejection ahead of remote attribute access, returning IPC4_INVALID_REQUEST.
File Description
src/​ipc/​ipc4/​helper.c Adds constructor validation and rejects unsupported cross-core binds earlier.

Review effort: Balanced

Comment thread src/ipc/ipc4/helper.c Outdated
Comment on lines +193 to +194
if (IS_ENABLED(CONFIG_SOF_USERSPACE_LL) && !IS_ENABLED(CONFIG_CROSS_CORE_STREAM) &&
ppl->core != ipc_config.core) {

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.

Valid, I'll move the check

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

Thanks @ujfalusi , looks good. Please fix the copilot finding on unreachable code.

@intel-sofci

intel-sofci commented Oct 29, 2026 •

Copy link
Copy Markdown

PR 11375: test results

Run date: 2026-10-30 13:49 UTC

Tested commit: b38835fcd9213bd2315c9a4a7157e48d9b15e2e1

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

Comment thread src/ipc/ipc4/helper.c Outdated
/* The user-space IPC thread cannot issue the IDC calls needed to
* bind or free a module living on another core than its pipeline.
*/
if (IS_ENABLED(CONFIG_SOF_USERSPACE_LL) && !IS_ENABLED(CONFIG_CROSS_CORE_STREAM) &&

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.

Why is this even limited to CONFIG_SOF_USERSPACE_LL?
If CONFIG_CROSS_CORE_STREAM is disabled, it's over anyway.

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.

true, I will drop the LL check

@ujfalusi
ujfalusi force-pushed the peter/pr/ll-no-crosscore-fix branch from 5286bc7 to b38835f Compare October 30, 2026 08:58
@ujfalusi
ujfalusi requested a review from pblaszko as a code owner October 30, 2026 08:58
Without CONFIG_CROSS_CORE_STREAM a stream must be processed entirely
on a single core, but a module created on a different core than its
pipeline (e.g. the compress decoder pinned to core 1) was still
accepted.

With CONFIG_SOF_USERSPACE_LL the IPC4 module commands run in a user
thread which cannot issue IDC messages, so CONFIG_CROSS_CORE_STREAM is
disabled in that configuration and the first cross-core operation then
panicked the DSP from user space instead of failing:

 - ipc4_comp_connect() called comp_get_attribute() on the remote sink
   before checking cross_core_bind, hitting the privileged IDC path
   (rzalloc/idc_send_msg) -> privileged instruction exception.
 - the host's error unwind deleted the pipeline, and
   ipc_pipeline_module_free() used ipc_comp_free_remote() for the
   remote module -> load error on the kernel-only IDC data.

Reject such a module already at MOD_INIT_INSTANCE whenever cross-core
streams are disabled. Do the check, together with the existing parent
pipeline existence check, in ipc4_comp_new_config() so that it covers
every module creation path: comp_new_ipc4() as well as the
CONFIG_SOF_USERSPACE_LL specific ipc4_user_module_load() and
comp_new_ipc4_user(), which skipped both checks so far.

Also move the cross-core check in ipc4_comp_connect() before any remote
access so the bind fails with IPC4_INVALID_REQUEST instead of crashing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ujfalusi

Copy link
Copy Markdown
Contributor Author

Changes since v1:

  • move the cross-core check to ipc4_comp_new_config(), which is called from all paths
  • only keep the !CONFIG_CROSS_CORE_STREAM check, drop the LL condition.

@kv2019i
kv2019i merged commit da95b63 into thesofproject:main Oct 30, 2026
44 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.

6 participants