Skip to content

intel/wov-d0i3-002: fix fuzzer abort and Linux/Windows build mismatch - #11530

Open
lgirdwood wants to merge 2 commits into
thesofproject:intel/wov-d0i3-002from
lgirdwood:wov-d0i3-002-ci-fixes2
Open

lgirdwood wants to merge 2 commits into
thesofproject:intel/wov-d0i3-002from
lgirdwood:wov-d0i3-002-ci-fixes2

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Follow-up to #11527. Fixes the remaining CI failures on intel/wov-d0i3-002 that are visible on GitHub.

  • simple-IPC-fuzz_sh (3, 4): cherry-picks ffda587eb5 "platform: posix: run fuzz teardown in thread context" from main. The branch forked from main just before that fix landed. Without it, the fuzzer aborts with nsif_cpu0_irq_raised_from_sw called from a HW model thread when pipeline_free() releases a spinlock on the libFuzzer thread while a timer IRQ is pending.
  • compare-linux-win: mww_tflm_lib and mww_nn_hifi_lib are plain add_library() targets. Zephyr's -fmacro-prefix-map options don't reach them, so TFLM's __FILE__ strings embed the absolute workspace path (/__w/sof/sof/tflite-micro/... on Linux vs D:/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, -d lnl). The fix maps the west top directory to WEST_TOPDIR for those targets, in both the built-in and the LLEXT CMake.

Testing

  • Reproducibility: I built ptl, tgl, mtl and -d lnl from the same tree at two workspace paths of different lengths. With the fix, stripped-zephyr.elf, stripped-main.elf, zephyr.lst and boot.mod are byte-identical. These are the files the CI check compares after clean-expected-release-differences.sh. Without the fix, ptl differs in the same way it does in CI.
  • Fuzzing: the fuzzer crashed locally within a few minutes before the cherry-pick. After it, IPC3 and IPC4 each ran 5 minutes × 6 workers with no crashes.
  • Builds: the full CI build matrix still passes with Zephyr SDK 1.0.1 and -Werror: the repro-build.conf platforms plus -d lnl, the shell and llext builds, and LP64 imx93.

I can't see the two intel-innersource jobs, so they aren't addressed here.

🤖 Generated with Claude Code

tmleman and others added 2 commits November 24, 2026 13:43
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>
@lgirdwood

Copy link
Copy Markdown
Member Author

@naveen-manohar @singalsu one from @tmleman and the other from claude to reduce the CI error.

@lgirdwood
lgirdwood marked this pull request as ready for review November 25, 2026 13:57
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.

3 participants