Skip to content

Commit

Permalink
Add new fuzz_*features.conf files to add more CONFIG_ when fuzzing
Browse files Browse the repository at this point in the history
The goal of these new files is to:
1. Fuzz more code
2. Reduce the configuration gap between fuzzed SOF and the real thing.

See the fuzz_features.conf header for more details.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Aug 27, 2024
1 parent e907da1 commit 891c219
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/configs/fuzz_IPC3_features.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# See main file fuzz_features.conf
4 changes: 4 additions & 0 deletions app/configs/fuzz_IPC4_features.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# See main file fuzz_features.conf

CONFIG_COMP_UP_DOWN_MIXER=y
CONFIG_COMP_ARIA=y
48 changes: 48 additions & 0 deletions app/configs/fuzz_features.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The goal of this file is to:
# 1. Fuzz more code
# 2. Reduce the gap between fuzzed SOF and the real thing.

# KConfig warnings are NOT fatal so you must always INSPECT build logs when changing
# .conf files. See https://github.com/thesofproject/sof/issues/9386

# Note 1. is not as simple as enabling as many CONFIG_ as possible. Enabling some CONFIG_
# can technically _disable_ some code paths. But the opposite is more common so let's add
# more.

# In the longer term we should have some more elaborate configuration framework to reduce
# duplicate/diverge between fuzzing and production but also across product
# generations. Something like config fragments including each other? Not something as
# complicated as Yocto fragments but something more flexible than
# https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf
#
# Discuss in https://github.com/thesofproject/sof/issues/9386

# Many of these features are too far from IPC to make any fuzzing difference. But as long
# as they reduce the size of the textual difference between build-fuzz/zephyr/.config and
# build-xxx/zephyr/.config, they make that manual comparison easier which is still a win.


CONFIG_COUNTER=y

CONFIG_PROBE=y

CONFIG_CRYPTO=y

CONFIG_LOG_TIMESTAMP_64BIT=y
CONFIG_MM_DRV=y

CONFIG_DMA=y

CONFIG_DAI=y

CONFIG_PM_DEVICE=y
CONFIG_POWER_DOMAIN=y

CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_CROSSOVER=y
CONFIG_COMP_DRC=y
CONFIG_COMP_KPB=y

CONFIG_MATH_LUT_SINE_FIXED=y
CONFIG_MATH_EXP=y
CONFIG_MATH_IIR_DF2T=y
5 changes: 4 additions & 1 deletion scripts/fuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage:
$0 -b -- -DEXTRA_CONF_FILE=stub_build_all_ipc4.conf -DEXTRA_CFLAGS="-O0 -g3" ...
$0 -t 500 -- -DEXTRA_CONF_FILE=stub_build_all_ipc3.conf ...
-4 Appends: -- -DCONFIG_IPC_MAJOR_4=y
-4 Appends: -- -DCONFIG_IPC_MAJOR_4=y + fuzz_IPC4_features.conf
-3 Also accepted but is already the default.
-p Delete build-fuzz/ first ("pristine")
-b Do not run/fuzz: stop after the build.
Expand Down Expand Up @@ -111,6 +111,9 @@ main()
# https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf
local conf_files_list='prj.conf;boards/native_sim_libfuzzer.conf'

conf_files_list+=';configs/fuzz_features.conf'
conf_files_list+=";configs/fuzz_IPC${IPC}_features.conf"

# Note there's never any reason to delete fuzz_corpus/.
# Don't trust `west build -p` because it is not 100% unreliable,
# especially not when doing unusual toolchain things.
Expand Down

0 comments on commit 891c219

Please sign in to comment.