ipc4: helper: unlock module instance verbs on native_sim - #11062
Open
tmleman wants to merge 1 commit into
Open
Conversation
tmleman
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
August 5, 2026 12:27
Contributor
There was a problem hiding this comment.
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_LIBFUZZERbranch to resolvemodule_idby walking the runtimecomp_driverregistry. - Restrict the mapping to instantiable drivers (
ops.createpresent) and IPC4-relevant module-adapter drivers (type == SOF_COMP_MODULE_ADAPTER). - Return the resolved
comp_driverdirectly instead of doing a redundant UUID re-lookup.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)