-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fuzz: improve fuzz performance for accesslog and route #8397
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
Conversation
Signed-off-by: Asra Ali <[email protected]>
/review @htuch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very promising speedups :)
std::vector<AccessLog::FormatterProviderPtr> formatters = | ||
AccessLog::AccessLogFormatParser::parse(input.format()); | ||
AccessLog::AccessLogFormatParser::parse(replaceInvalidCharacters(input.format())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have PGV annotations for this rather than substitution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I have this PR out specifically for that purpose because I'd like to have a PGV constraints for string to not_contain
a null character, I bumped it last week, but will do again.
bufbuild/protoc-gen-validate#253
Actually a lot of time is being spend replacing invalid characters across all fuzzers and it'd be nice to either have this PGV constraint, or specifically guide mutations to not contain nulls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe remove this for now and then wait until bufbuild/protoc-gen-validate#253 lands; I agree that the PGV constraint is the right long term solution, not only for performance, but because Envoy will reject bad configs on the wire when we add these annotations to the API.
@@ -48,6 +47,10 @@ cleanRouteConfig(envoy::api::v2::RouteConfiguration route_config) { | |||
// remove from each request and response that get routed through it. This replaces invalid | |||
// header characters in these fields. | |||
virtual_host = replaceInvalidHeaders<envoy::api::v2::route::VirtualHost>(virtual_host); | |||
// Replace invalid characters from the list of domains matched to this virtual host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
@@ -69,9 +72,9 @@ cleanRouteConfig(envoy::api::v2::RouteConfiguration route_config) { | |||
|
|||
// TODO(htuch): figure out how to generate via a genrule from config_impl_test the full corpus. | |||
DEFINE_PROTO_FUZZER(const test::common::router::RouteTestCase& input) { | |||
static NiceMock<Envoy::StreamInfo::MockStreamInfo> stream_info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Signed-off-by: Asra Ali <[email protected]>
a287c5e
to
56c6a6d
Compare
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This PR includes some performance improvements to route_fuzz_test. gMock objects that are unmodified are now static (see recommendation by libFuzzer: https://llvm.org/docs/LibFuzzer.html#startup-initialization) Exec/sec on my local machine with libFuzzer: route_fuzz_test: 17 exec/sec -> 850 exec/sec Risk level: Low Signed-off-by: Asra Ali <[email protected]>
This PR includes some performance improvements to
route_fuzz_test
.Exec/sec on my local machine with libFuzzer:
route_fuzz_test
: 17 exec/sec -> 850 exec/secRisk level: Low
Signed-off-by: Asra Ali [email protected]