Skip to content

Conversation

@phi-go
Copy link
Contributor

@phi-go phi-go commented Mar 18, 2025

Add a statefulness detection step as part of coverage measurement to detect if the fuzz target is stateful. Compare the coverage measurement output by running the corpus in two different orders, if the target is not stateful there should be no difference.

Comparisons can be done by comparing the coverage summary data which is less computationally expensive and requires less memory, however it is also much less accurate. Another option is implemented comparing the number of executions for each region. Though anything provided by the coverage measurement result should be straightforward to implement.

To make use of this information in later stages, the log file and json data file with the differences are written into a subdirectory of the $LOGS_DIR.

Here is a sample output:

/src/sudo/plugins/sudoers/toke.c: 6347:5   - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6347:9   - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6347:25  - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6347:26  -  8132 != 8131
/src/sudo/plugins/sudoers/toke.c: 6348:2   -  8132 != 8131
/src/sudo/plugins/sudoers/toke.c: 6348:18  - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6351:1   - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6352:5   - 657005 != 657004
/src/sudo/plugins/sudoers/toke.c: 6352:21  - 657005 != 657004
Target IS stateful.

@maflcko
Copy link
Contributor

maflcko commented Mar 18, 2025

Just for reference, any project that has afl enabled should have a metric "stabilty" on https://oss-fuzz.com/fuzzer-stats. The statistic will tell how good or bad the stability of a given fuzz target is.

@phi-go
Copy link
Contributor Author

phi-go commented Mar 18, 2025

Yes, fair point. However, to my understanding oss-fuzz mostly uses libFuzzer where this is not available. Nor is it easy to extract where exactly this instability happens for the afl variant, which seems quite useful if one wants to investigate the cause.

@phi-go phi-go force-pushed the push-smnzyykzxuow branch 2 times, most recently from 0af8848 to 2c36a26 Compare June 23, 2025 09:29
@phi-go phi-go force-pushed the push-smnzyykzxuow branch from 2c36a26 to 9ea1c17 Compare June 23, 2025 09:30
@phi-go phi-go marked this pull request as ready for review June 23, 2025 09:35
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.

2 participants