Skip to content

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

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part8
Open

ipc4: helper: unlock module instance verbs on native_sim#11062
tmleman wants to merge 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
Comment on lines +1365 to +1376
/*
* native_sim fuzz builds have no rimage manifest so ipc4_get_comp_drv()
* would always return NULL, making every module instance verb
* (INIT_INSTANCE, CONFIG_GET/SET, LARGE_CONFIG, BIND, UNBIND,
* DELETE_INSTANCE) unreachable from the fuzzer.
*
* Mirror the 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)
* has no comp_driver entry and is handled separately above via
* ipc4_get_drv(); non-zero ids map to registered drivers so the fuzzer
* can create real module instances with valid driver UUIDs.
*/
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)

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