Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SKIP SOF-TEST] Add new -i3/-i4 flags + fuzz_*features.conf files to add more CONFIG_ when fuzzing #9409

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Aug 27, 2024

3 commits, see messages.

The goal of these new files is to:

  1. Fuzz more code
  2. Reduce the configuration gap between fuzzed SOF and the real thing.

cc:

@marc-hb
Copy link
Collaborator Author

marc-hb commented Aug 27, 2024

Fixes for warnings in https://github.com/thesofproject/sof/actions/runs/10569644939/job/29282813058?pr=9409 already submitted in #9405. No other warning.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One lint warning, otherwise looks good.

.github/workflows/build_all.yml Outdated Show resolved Hide resolved
scripts/fuzz.sh Outdated
@@ -85,10 +87,13 @@ main()
local BUILD_ONLY=false
local FUZZER_STDOUT=/dev/stdout # bashism
local TEST_DURATION=3
local IPC=3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once this lands it will possibly break oss-fuzz

Please send a PR right after to fix https://github.com/google/oss-fuzz/blob/master/projects/sound-open-firmware/build.sh

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was afraid of something like this :-(

It will be even worse than "break" because -DCONFIG_IPC_MAJOR_3=y will silently take precedence over CONFIG_IPC_MAJOR_4 inside -DEXTRA_CONF_FILE=stub_build_all_ipc4.conf.

So this PR here is breaking backwards compatibility... I considered leaving some "undefined" IPC version in place but that would have added significant complexity.

There is one simpler thing I can do: drop the IPC=3 default and make either -3 or -4 required. So this will still break backwards compatibility but NOT silently. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine, we go without a build for a day is not an issue. Backwards compatibility is not as much as an issue since we are worried about fuzzing going forward primarily and reproducibility rather than bisecability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine, we go without a build for a day is not an issue.

You will go with a build. But the IPC4 fuzzing will actually fuzz IPC3 silently.

The more I think about it, the less I like it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this PR here is breaking backwards compatibility... I considered leaving some "undefined" IPC version in place but that would have added significant complexity.

So it wasn't that complex after all.

Full backwards compatibility now, zero regression.

@marc-hb marc-hb marked this pull request as draft August 27, 2024 22:14
@marc-hb marc-hb changed the title [SKIP SOF-TEST] Add new fuzz_*features.conf files to add more CONFIG_ when fuzzing [SKIP SOF-TEST] Add new -3/-4 flags + fuzz_*features.conf files to add more CONFIG_ when fuzzing Aug 27, 2024
@marc-hb marc-hb marked this pull request as ready for review August 28, 2024 06:12
CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
CONFIG_COMP_CROSSOVER=y
CONFIG_COMP_DRC=y
CONFIG_COMP_KPB=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything should be one here, even if its only a stub, can you turn everything on?

Copy link
Collaborator Author

@marc-hb marc-hb Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into some Kconfig warnings when trying to enable more stuff and I'm running a bit out of SOF time... the main purpose of this PR is really to set the scripting "framework" in place so people who know better can come and just tweak the CONFIG_... / features. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep that is fine

Copy link
Collaborator Author

@marc-hb marc-hb Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A long time ago, I tried to find some -Werr option in kconfiglib.py but there is none, at least none for this. Because most people don't look at build logs, I'm afraid it means that CONFIG_ warnings and messes will never stop creeping in, see some examples in:

This comment is NOT fuzzer-specific unfortunately.

scripts/fuzz.sh Outdated
case "$opt" in
3) IPC=3;;
4) IPC=4;;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can they be made mutually-exclusive? Or make it --ipc=4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are possible but I think this script is growing too big. libfuzzer works well but it has been deprecated by LLVM. The more complex is this script, the more effort to maintain it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to -i3 / -i 4, small enough change and keeps the code simple and short. It's not actually mutually exclusive (last one still wins) but it's more obvious that you're doing something wrong.

CONFIG_DAI=y

CONFIG_PM_DEVICE=y
CONFIG_POWER_DOMAIN=y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually want / need to fuzz-test Zephyr Kconfig options or only SOF?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a long comment at the top of this file... too long? :-)
Does line 20 answer the question?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was confusing things a bit. For some reason I decided that for fuzzing tests we also randomise .config, which isn't the case, is it? Our fuzzing .config is fully deterministic so it can be fixed as close to the production one as only possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's the idea.

Even if we wanted to do it somewhere, kconfiglib.py has unfortunately no "randconfig" ability. At least not the last time I checked.

Only a shortcut for now but allow more IPC version-dependent logic
later.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
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 <marc.herbert@intel.com>
@marc-hb marc-hb changed the title [SKIP SOF-TEST] Add new -3/-4 flags + fuzz_*features.conf files to add more CONFIG_ when fuzzing [SKIP SOF-TEST] Add new -i3/-i4 flags + fuzz_*features.conf files to add more CONFIG_ when fuzzing Aug 30, 2024
Stop hardcoding -DCONFIG_IPC_MAJOR_x=y and use the new -3 and -4 fuzz.sh
CLI flags.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@lgirdwood lgirdwood merged commit ff57b79 into thesofproject:main Sep 2, 2024
43 checks passed
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.

5 participants