Skip to content

Ensure rss_limit_mb is set to 0 for all Chromium/Google tasks - #5466

Open
tbantikyan wants to merge 2 commits into
masterfrom
ensure-no-memory-limit
Open

tbantikyan wants to merge 2 commits into
masterfrom
ensure-no-memory-limit

Conversation

@tbantikyan

Copy link
Copy Markdown
Contributor

Bug: crbug.com/555763447

In order to ensure that no memory limit is present for our fuzzing engines, the rss_limit_mb flag must be set to 0. This was not being done for corpus pruning tasks and for testcases that were manually uploaded.

@tbantikyan
tbantikyan requested review from a team as code owners September 11, 2026 14:29
@tbantikyan tbantikyan self-assigned this Sep 11, 2026
@tbantikyan
tbantikyan requested a review from g-ortuno September 11, 2026 14:29
Bug: crbug.com/555763447

In order to ensure that no memory limit is present for our fuzzing
engines, the `rss_limit_mb` flag must be set to 0. This was not being
done for corpus pruning tasks and for testcases that were manually
uploaded.
@tbantikyan
tbantikyan force-pushed the ensure-no-memory-limit branch from 49f4eef to be55e5d Compare September 14, 2026 14:20

@g-ortuno g-ortuno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Phew that was hard. I didn't get to look at the libfuzzer tests yet!

Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/fuzzer.py Outdated
Comment thread src/clusterfuzz/_internal/bot/tasks/utasks/corpus_pruning_task.py
Comment thread src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py
workdir = engine_common.create_temp_fuzzing_dir('workdir')
timeout = max_time + _CLEAN_EXIT_SECS
args = [
minimize_arguments = self._get_arguments(target_path)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IIUC, this gets the current arguments for the fuzzer. Does that mean this would return timeout_per_input? If so, we probably want to override it like we do in the reproduce task.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does return timeout_per_input. I'm thinking it makes more sense to delete the argument than to do what reproduce is doing. In deleting, we are preserving the functionality that existed before this CL, as the timeout_per_input value is not set in this method. Also, I think that changing environment variables is a little like working with global variables and makes the code harder to reason about, so I'd prefer to avoid it.

Comment thread src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py
"""
runner = libfuzzer.get_runner(target_path)
libfuzzer.set_sanitizer_options(target_path)
arguments = fuzzer_options.FuzzerArguments.from_list(arguments)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Apparently, from_list can return None if a regex fails, can we assert arguments is not None?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I moved this logic into _add_rss_limit_if_missing.

I made it return arguments with no changes if from_list returns None, as I don't want to introduce a failures to tasks that previously were not failing. I'm not sure how common it is that we'd get an invalid regex; if it's uncommon enough, I'm thinking it's fine to forgo setting rss_limit_mb.

Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/engine.py Outdated
# get_fuzz_timeout returns a negative value.
return -fuzz_timeout

def _add_rss_limit_if_missing(self, target_path, arguments):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The changes in this file are defensive, right? We use --rss_limit_mb=0 as the default value, which is stored in the DB; when we retrieve the arguments and pass them to the functions in these file as arguments, they will use the default value already.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In many cases, what you said is correct. The changes are important for uploaded testcases, though, as those will not already have --rss_limit_mb=0.

Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/engine.py
Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/fuzzer.py Outdated
- Handle case where `fuzzer_options.FuzzerArguments.from_list` returns None
- Factor `rss_limit_mb` logic out from `get_arguments` method
- Improve centipede/engine.py documentation with FIXME and clarity comment

@tbantikyan tbantikyan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PTAL.

Comment thread src/clusterfuzz/_internal/bot/tasks/utasks/corpus_pruning_task.py
Comment thread src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py
Comment thread src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py
# get_fuzz_timeout returns a negative value.
return -fuzz_timeout

def _add_rss_limit_if_missing(self, target_path, arguments):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In many cases, what you said is correct. The changes are important for uploaded testcases, though, as those will not already have --rss_limit_mb=0.

Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/engine.py
"""
runner = libfuzzer.get_runner(target_path)
libfuzzer.set_sanitizer_options(target_path)
arguments = fuzzer_options.FuzzerArguments.from_list(arguments)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I moved this logic into _add_rss_limit_if_missing.

I made it return arguments with no changes if from_list returns None, as I don't want to introduce a failures to tasks that previously were not failing. I'm not sure how common it is that we'd get an invalid regex; if it's uncommon enough, I'm thinking it's fine to forgo setting rss_limit_mb.

Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/engine.py Outdated
Comment thread src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/fuzzer.py Outdated
workdir = engine_common.create_temp_fuzzing_dir('workdir')
timeout = max_time + _CLEAN_EXIT_SECS
args = [
minimize_arguments = self._get_arguments(target_path)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does return timeout_per_input. I'm thinking it makes more sense to delete the argument than to do what reproduce is doing. In deleting, we are preserving the functionality that existed before this CL, as the timeout_per_input value is not set in this method. Also, I think that changing environment variables is a little like working with global variables and makes the code harder to reason about, so I'd prefer to avoid it.

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