This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
Ensure custom target_options
are always passed last to the fuzzer
#2952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2941.
It is possible for users to supply
target_options
which could interfere with the normal arguments that we pass. For example-ignore_remaining_args=1
might be used when the user has custom options they need to parse inLLVMFuzzerInitialize
.To prevent these from interfering with our options, change the LibFuzzer code so that custom arguments are always passed last.
This required two additional arguments to the
build_std_command
function:extra_args
supplies any extra arguments needed by the system, for example, when testing the runnability of a fuzzer we pass-help=1
. This is needed to be able to insert the argument before any custom args.custom_arg_filter
can be supplied to perform any modifications on the custom arguments if needed. Since LibFuzzer arguments are last-one-wins, if we always pass custom args last, when we want to forcibly override the custom arguments we will need to remove them. Currently this is only used to remove any-runs=X
arguments that are supplied when we are performing a single-input run.