Skip to content

Conversation

htuch
Copy link
Member

@htuch htuch commented Aug 1, 2018

Fuzzer for the H2 codec. This is similar in structure to
//test/common/http/http2:codec_impl_test, where a client H2 codec is wired via
shared memory to a server H2 codec and stream actions are applied. We fuzz the
various client/server H2 codec API operations and in addition apply fuzzing at
the wire level by modeling explicit mutation, reordering and drain operations
on the connection buffers between client and server.

Part of #508.

Risk Level: Low
Testing: Tested with corpus under bazel test and under oss-fuzz Docker image.
~640 cases per second with python infra/helper.py build_fuzzers
--sanitizer=address envoy && python infra/helper.py run_fuzzer
envoy codec_impl_fuzz_test. Test corpus has 87.9% coverage of
http2/codec_impl.cc.

Signed-off-by: Harvey Tuch htuch@google.com

htuch added 2 commits August 1, 2018 11:15
Fuzzer for the H2 codec. This is similar in structure to
//test/common/http/http2:codec_impl_test, where a client H2 codec is wired via
shared memory to a server H2 codec and stream actions are applied. We fuzz the
various client/server H2 codec API operations and in addition apply fuzzing at
the wire level by modeling explicit mutation, reordering and drain operations
on the connection buffers between client and server.

Part of envoyproxy#508.

Risk Level: Low
Testing: Tested with corpus under bazel test and under oss-fuzz Docker image.
~500 cases per second with python infra/helper.py build_fuzzers
--sanitizer=address envoy <envoy path> && python infra/helper.py run_fuzzer
envoy codec_impl_fuzz_test. Test corpus has 87.9% coverage of
http2/codec_impl.cc.

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@mattklein123 mattklein123 self-assigned this Aug 1, 2018
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

This is super cool and awesome. I would just ship it and we can iterate depending on what it finds. Nice work!

uint32_t read_disable_count_{};
};

// Buffer between client and server H2 codecs. This models each write operation
Copy link
Member

Choose a reason for hiding this comment

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

I suppose at some point we might want to actually be able to reorder full h2 frames? I wonder if that would make the fuzzing more effective or not. I'm not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah; based on experience, some of the time you do get full frame reordering due to 1 write per frame, but some of the time it's only partial. In theory, the fuzzer could generate a series of swap actions that performs a full frame swap, but the chance of that happening is lower as the frame fragmentation grows. I'm planning on looking at coverage and other metrics to try and tune this once we land in oss-fuzz and internal runs.

@htuch htuch merged commit 7bf713a into envoyproxy:master Aug 5, 2018
@htuch htuch deleted the h2-codec-fuzz branch August 5, 2018 01:44
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