Skip to content

Add a monitor_fuzz.py script - #9069

Merged
tlively merged 2 commits into
mainfrom
fuzz-opt-wrapper
Sep 2, 2026
Merged

Add a monitor_fuzz.py script#9069
tlively merged 2 commits into
mainfrom
fuzz-opt-wrapper

Conversation

@tlively

@tlively tlively commented Sep 2, 2026

Copy link
Copy Markdown
Member

This script runs and monitors fuzz_opt.py for up to a given number of iterations, redirecting its output to a rotating log file and printing its progress to stdout once a minute. When it detects that the fuzzer has found a bug, it prints the iteration number and the seed so the bug can be reproduced.

This script is nicer to run in agent harnesses than raw fuzz_opt.py because agents can easily run the fuzzer for X iterations and can show the progress without overly polluting the context.

This script runs and monitors fuzz_opt.py for up to a given number of iterations, redirecting its output to a rotating log file and printing its progress to stdout once a minute. When it detects that the fuzzer has found a bug, it prints the iteration number and the seed so the bug can be reproduced.

This script is nicer to run in agent harnesses than raw fuzz_opt.py because agents can easily run the fuzzer for X iterations and can show the progress without overly polluting the context.
@tlively
tlively requested a review from a team as a code owner September 2, 2026 06:18
@tlively
tlively requested review from kripken and removed request for a team September 2, 2026 06:18
Comment thread scripts/monitor_fuzz.py Outdated
except Exception:
try:
_, hard = resource.getrlimit(resource.RLIMIT_STACK)
resource.setrlimit(resource.RLIMIT_STACK, (hard, hard))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be in fuzz_opt.py?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe. If we want to use this everywhere and worry less about recursion limits, it's probably a good idea. But OTOH maybe it makes sense to want to get our recursion limits right.

I'd lean toward removing this entirely. I can continue to use ulimit -s unlimited when fuzzing with my LTO build that is known to blow the stack. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't feel strongly. I'm ok with removing it entirely or moving it to the other script.

lgtm with one of those

(but keeping it here strikes me as odd, as this is just "higher-level" than the other script, and this is a low-level workaround)

Comment thread .gitignore Outdated
.cache/*

# Generated by scripts/monitor_fuzz.py
/fuzz.log

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps put this in out/test/ like the fuzzer's own temp files?

@tlively
tlively merged commit 180bae3 into main Sep 2, 2026
16 checks passed
@tlively
tlively deleted the fuzz-opt-wrapper branch September 2, 2026 22:49
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