Skip to content

ipc4: helper: unlock module instance verbs on native_sim - #11062

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part8
Aug 7, 2026
Merged

ipc4: helper: unlock module instance verbs on native_sim#11062
kv2019i merged 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part8

Conversation

@tmleman

@tmleman tmleman commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

ipc4_get_comp_drv() returned NULL unconditionally on native_sim because the RIMAGE_MANIFEST guard (Intel ADSP ACE/CAVS only) was the sole path to a driver UUID lookup. Every INIT_INSTANCE call therefore failed with IPC4_MOD_NOT_INITIALIZED before creating any comp_dev, making the entire module instance verb surface (CONFIG_GET/SET, LARGE_CONFIG on real modules, BIND, UNBIND, DELETE_INSTANCE) unreachable from the fuzzer.

Add a CONFIG_ARCH_POSIX_LIBFUZZER branch that mirrors the existing IPC3 whitebox hack in posix/ipc.c: treat module_id as a 1-based index into the runtime comp_driver list. module_id 0 (BaseFW, handled separately and having no create callback) is excluded. Drivers without an ops.create callback are skipped during the index walk so the fuzzer's module_id space only maps to instantiable components, otherwise a module_id that lands on such a driver would cause a NULL function pointer call. Return the resolved driver directly instead of a redundant UUID re-lookup. The change is inactive in all non-fuzz builds.

Measured impact (UBSan IPC4, seed=1, 20 s, small corpus):
cov ~558 -> ~3974 (~7x lift from previously dead module instance paths)

Copilot AI lite review requested due to automatic review settings August 5, 2026 12:27

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 fixes IPC4 module driver resolution on native_sim fuzz builds by adding a CONFIG_ARCH_POSIX_LIBFUZZER fallback path in ipc4_get_comp_drv(), enabling fuzzer reachability of IPC4 module instance verbs that previously always failed due to missing rimage manifest support.

Changes:

  • Add a CONFIG_ARCH_POSIX_LIBFUZZER branch to resolve module_id by walking the runtime comp_driver registry.
  • Restrict the mapping to instantiable drivers (ops.create present) and IPC4-relevant module-adapter drivers (type == SOF_COMP_MODULE_ADAPTER).
  • Return the resolved comp_driver directly instead of doing a redundant UUID re-lookup.

Comment thread src/ipc/ipc4/helper.c Outdated

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

Only 1 minor comment.

Comment thread src/ipc/ipc4/helper.c Outdated
@tmleman

tmleman commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Need to wait for: #11066

Comment thread src/ipc/ipc4/helper.c

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

I think separating the fuzzer-only code is a good idea. Otherwise looks good.

Comment thread src/ipc/ipc4/helper.c
@tmleman
tmleman force-pushed the topic/upstream/pr/fuzzing/enhancement/part8 branch 2 times, most recently from be29621 to d63db5b Compare August 7, 2026 10:55
ipc4_get_comp_drv() returned NULL unconditionally on native_sim because
the RIMAGE_MANIFEST guard (Intel ADSP ACE/CAVS only) was the sole path
to a driver UUID lookup. Every INIT_INSTANCE call therefore failed with
IPC4_MOD_NOT_INITIALIZED before creating any comp_dev, making the entire
module instance verb surface (CONFIG_GET/SET, LARGE_CONFIG on real
modules, BIND, UNBIND, DELETE_INSTANCE) unreachable from the fuzzer.

Resolve module drivers on native_sim from a small fuzzer-only helper,
ipc4_get_fuzzer_drv(), called from the CONFIG_ARCH_POSIX_LIBFUZZER branch
of ipc4_get_comp_drv() so the heavily-used manifest lookup path is left
untouched. It mirrors the IPC3 whitebox hack in posix/ipc.c: module_id is
a 1-based index into the runtime component driver list, counting only
instantiable module-adapter drivers so the fuzzer's module_id space
matches what a real signed manifest exposes. Drivers with no ops.create,
and internal gateway drivers (SOF_COMP_HOST/DAI) that are never IPC4
modules, are skipped (otherwise a module_id could land on an
unconfigurable component or a NULL create op).

module_id 0 (BaseFW) intentionally resolves to NULL: BaseFW is never
created as a pipeline component, its messages are dispatched directly by
base_fw.c. A tr_err() logs any module_id that maps to no driver to help
developers and agents triage. The change is inactive in all non-fuzz
builds.

Measured impact (UBSan IPC4, seed=1, 20 s, small corpus):
  cov ~558 -> ~3974  (~7x lift from previously dead module instance paths)

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@kv2019i
kv2019i merged commit 58a8d62 into thesofproject:main Aug 7, 2026
45 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