Skip to content

[Logging] Add fuzz-related logs context to corpus pruning task #4774

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ViniciustCosta
Copy link
Collaborator

@ViniciustCosta ViniciustCosta commented Apr 24, 2025

Differently from the tasks instrumented with logs context so far, corpus pruning (and fuzz task) is not based on a testcase. These two in particular operate on top of fuzzers, jobs and fuzz targets. This PR:

  • Creates a new fuzzing-related logs context based on a given fuzzer, job type and fuzz target. Since these metadata are the same as in the testcase-based context (just retrieved from different source), I changed the testcase context to contain only the testcase ID.
  • Added this context manager to corpus pruning task.

@ViniciustCosta ViniciustCosta marked this pull request as ready for review April 24, 2025 17:58
if self == LogContextType.FUZZ:
try:
return FuzzLogStruct(
fuzzer=log_contexts.meta.get('fuzzer_name', 'null'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

WHy not return None instead of "null"?

Copy link
Collaborator Author

@ViniciustCosta ViniciustCosta Apr 25, 2025

Choose a reason for hiding this comment

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

I'm not entirely sure how the gcp logging treats fields that are set to None, my guess is that it omits that field. IMO it's better to have this default value meaning that the information is missing/not applicable than omitting it, which could mean that something went wrong during logging.
( I also used this piece of code as reference: https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/metrics/logs.py#L420 )

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