The older native_posix board is being deprecated, use native_sim,
which is the future-proof API. Mostly just swap the board target and
change the C API names.
Note the NATIVE_SIMULATOR_IF decoaration on LLVMFuzzerTestOneInput():
that forces the function to be included in the first-stage zephyr.elf
link (otherwise it would be dropped as Zephyr/SOF itself doesn't
reference the entry point) and to be visible as a global symbol to the
libfuzzer instrumentation layer.
Signed-off-by: Andy Ross <andyross@google.com>
Upstream Zephyr moved the LLVM fuzzer entry point out of the arch
layer and made it an app responsibility, so we broke. Add back the
support here that got removed.
Fixes#9101
Signed-off-by: Andy Ross <andyross@google.com>
There was no need to use the external "timeout" command + some
complicated exit code logic, libFuzzer has that feature built-in. Switch
to it and delete a few good line.
Add an option to use the built-in, concurrent -jobs feature which saves
a massive amount of time. It has some quirks so do not enable it by
default.
Decrease verbosity by default.
Add in the help message the magic replay command that saves a ton of time.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fixes commit deed9a8808 ("scripts: fuzz: add support for build and
overlays")
The main issue was the way fuzz.sh was trying to parse the overlay
file. Drop that and just pass it as is to `west` and `cmake` instead,
they know what to do with it.
Also:
- Fix invalid syntax in stub_build_all_ipc4.conf
- Make fuzz.sh shellcheck-clean again. Always use shellcheck.
- Temporarily disable `CONFIG_COMP_SMART_AMP` in
stub_build_all_ipc3.conf because `smart_amp.c` does not compile (in
any configuration)
```
sof/src/audio/smart_amp/smart_amp.c:748:9: error:
no member named 'in_channels' in 'struct smart_amp_data'
sad->in_channels = audio_stream_get_channels(&source_buffer->stream);
```
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Add support to specify an overlay file to use with the fuzz script and
another flag to build without fuzzing
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Don't rely on some semi-random default value.
The final `zephyr/.config` and binaries are strictly identical.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
- Create new setup() function
- Separate export for set -e compatibility
- Don't use the generic `build` directory but a more specific
`build-fuzz` instead.
- De-hardcode zephyr path thanks to west
- shellcheck clean
Signed-off-by: Marc Herbert <marc.herbert@intel.com>