Repository navigation
Conversation
The IPC fuzzer aborts partway through a run with: programming error: nsif_cpu0_irq_raised_from_sw called from a HW model thread The between-testcase topology teardown (posix_ipc_teardown(), added in commit d53a762 "platform: posix: tear down IPC topology between fuzz testcases") was invoked from posix_fuzz_case_begin(), which executes on the libFuzzer driver thread. On native_sim that thread is a "HW model" context: the simulated CPU is halted (posix_is_cpu_running() == false) whenever execution is outside nsi_exec_for(). The teardown frees pipelines and cancels scheduler tasks, taking Zephyr spinlocks (and the LL scheduler's k_mutex). Releasing a spinlock reaches arch_irq_unlock() -> hw_irq_ctrl_change_lock(); if a HW interrupt is pending there it is vectored synchronously via nsif_cpu0_irq_raised_from_sw(), which aborts because the CPU is not running. gdb confirms the pending interrupt is the system tick (irq_status == 0x1, IRQ 0 = TIMER_TICK_IRQ), delivered from pipeline_posn_unlock() -> k_spin_unlock() inside pipeline_free(). Running the teardown on the driver thread was always unsafe, but only became reproducible after a Zephyr update that converted the native_sim system timer from a periodic tick to a one-shot, fully tickless model (drivers/timer/native_sim_timer.c "use the generic timer core", plus the native_simulator hwtimer_set_tick_one_shot() addition). hwtimer_enable() previously armed a periodic tick on a fixed grid and no tick happened to be pending at the between-testcase boundary; the one-shot core now arms the tick at the exact next timeout deadline, which lands at/after an nsi_exec_for() quantum boundary. nsi_exec_for() stops on its time budget, so it returns after the tick fires but before the CPU services it, leaving TIMER_TICK_IRQ pending exactly when the teardown runs. Fix this by running the teardown where SOF frees pipelines during normal operation: the EDF workqueue thread. posix_fuzz_case_begin() now only sets a flag; ipc_platform_do_cmd() consumes it and runs posix_ipc_teardown() before this testcase's first command. There the CPU is running (a pending tick is delivered legitimately) and blocking primitives such as k_mutex are valid. Clearing the pending interrupt on the driver thread was rejected as an alternative: dropping the tick leaves the one-shot timer with no armed deadline (next_timer_time == NSI_NEVER), so the simulator exits via nsi_exit() and libFuzzer reports "fuzz target exited". Validated with the IPC4 seed corpus (342142 runs) and the IPC3 seed corpus (111135 runs); both complete cleanly with no crash artifacts. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com> (cherry picked from commit ffda587)
mww_tflm_lib and mww_nn_hifi_lib are plain add_library() targets, so Zephyr's -fmacro-prefix-map options do not reach them and TFLM's __FILE__ strings embed the absolute path of the build workspace, e.g. /__w/sof/sof/tflite-micro/tensorflow/lite/kernels/kernel_util.cc D:/a/sof/sof/workspace/tflite-micro/tensorflow/lite/kernels/kernel_util.cc The firmware therefore depends on where it was built, and CI's compare-linux-win check fails for every platform that builds MWW. The rodata size change also moves code, so unrelated objects differ after linker relaxation. Map the west top directory to WEST_TOPDIR, as Zephyr does for its own targets, in both the built-in and the LLEXT builds. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
@naveen-manohar @singalsu one from @tmleman and the other from claude to reduce the CI error. |
lgirdwood
marked this pull request as ready for review
November 25, 2026 13:57
lgirdwood
requested review from
dbaluta,
kv2019i,
lbetlej,
mmaka1 and
plbossart
as code owners
November 25, 2026 13:57
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.
Follow-up to #11527. Fixes the remaining CI failures on
intel/wov-d0i3-002that are visible on GitHub.ffda587eb5"platform: posix: run fuzz teardown in thread context" frommain. The branch forked frommainjust before that fix landed. Without it, the fuzzer aborts withnsif_cpu0_irq_raised_from_sw called from a HW model threadwhenpipeline_free()releases a spinlock on the libFuzzer thread while a timer IRQ is pending.mww_tflm_libandmww_nn_hifi_libare plainadd_library()targets. Zephyr's-fmacro-prefix-mapoptions don't reach them, so TFLM's__FILE__strings embed the absolute workspace path (/__w/sof/sof/tflite-micro/...on Linux vsD:/a/sof/sof/workspace/tflite-micro/...on Windows). That changes rodata size and code layout on every platform that builds MWW (lnl, mtl, ptl, tgl,-dlnl). The fix maps the west top directory toWEST_TOPDIRfor those targets, in both the built-in and the LLEXT CMake.Testing
-dlnl from the same tree at two workspace paths of different lengths. With the fix,stripped-zephyr.elf,stripped-main.elf,zephyr.lstandboot.modare byte-identical. These are the files the CI check compares afterclean-expected-release-differences.sh. Without the fix, ptl differs in the same way it does in CI.-Werror: therepro-build.confplatforms plus-dlnl, the shell and llext builds, and LP64 imx93.I can't see the two
intel-innersourcejobs, so they aren't addressed here.🤖 Generated with Claude Code