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

centipede: create workdir in prepare instead of the constructor #4674

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

paulsemel
Copy link
Collaborator

It turns out that the same class can be used for different fuzzing rounds, and the parent directory of the temp dir is being cleared in between each round. For that reason, we need to re-create a workdir in prepare.

@paulsemel paulsemel force-pushed the fix-workdir-being-cleared branch from 8f3cd8b to d90e9d0 Compare February 7, 2025 14:23
@alhijazi alhijazi self-requested a review February 7, 2025 14:27
It turns out that the same class can be used for different fuzzing
rounds, and the parent directory of the temp dir is being cleared in
between each round. For that reason, we need to re-create a workdir in
`prepare`.
@paulsemel paulsemel force-pushed the fix-workdir-being-cleared branch from d90e9d0 to 9587d42 Compare February 7, 2025 14:30
@alhijazi
Copy link
Collaborator

alhijazi commented Feb 7, 2025

For engine fuzzers (do_engine_fuzzing in fuzz_task.py [1]):
we run the fuzzing engine in multiple rounds (run_engine_fuzzer[2])
at the end of each round, run_engine_fuzzer cleans up the temp directory using fuzzer_utils.cleanup()[3]
This deletes centipede's workdir [4]

[1]

for fuzzing_round in range(_get_max_testcases()):

[2]https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py#L1212
[3]https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py#L1262
[4]
self.workdir = self._create_temp_dir('workdir')

@paulsemel
Copy link
Collaborator Author

For engine fuzzers (do_engine_fuzzing in fuzz_task.py [1]): we run the fuzzing engine in multiple rounds (run_engine_fuzzer[2]) at the end of each round, run_engine_fuzzer cleans up the temp directory using fuzzer_utils.cleanup()[3] This deletes centipede's workdir [4]

[1]

for fuzzing_round in range(_get_max_testcases()):

[2]https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py#L1212
[3]https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py#L1262
[4]

self.workdir = self._create_temp_dir('workdir')

Indeed, that's what's happening and why this change is necessary, thanks for making this crystal clear!

Copy link
Collaborator

@jonathanmetzman jonathanmetzman left a comment

Choose a reason for hiding this comment

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

lgtm

@jonathanmetzman jonathanmetzman merged commit 77ea427 into google:master Feb 7, 2025
7 checks passed
letitz pushed a commit that referenced this pull request Feb 10, 2025
centipede: create workdir in prepare instead of the constructor

It turns out that the same class can be used for different fuzzing
rounds, and the parent directory of the temp dir is being cleared in
between each round. For that reason, we need to re-create a workdir in
prepare.
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.

3 participants