Repository navigation
fuzz: add libFuzzer harnesses and OSS-Fuzz build script for nstun and mount options - #418
Open
phenomenon0 wants to merge 1 commit into
Open
phenomenon0 wants to merge 1 commit into
phenomenon0 wants to merge 1 commit into
Conversation
… mount options Add standalone, dependency-free libFuzzer targets (no protobuf or libnl required) and OSS-Fuzz packaging to address google#309 (part 2: libFuzzer / OSS-Fuzz): - fuzz/nstun_packet_fuzzer.cc: fuzzes IPv4, IPv6, IPv6 extension-header chains, UDP4/6, ICMP4/6, and ICMP reply/error framing in both raw and structure-aware checksum/source-IP fixup modes with zero host socket creation. - fuzz/nstun_encap_fuzzer.cc + fuzz/nstun_encap.dict: fuzzes SOCKS5 auth/connect reply parsing, HTTP CONNECT header framing/reply parsing, and SOCKS5 UDP IPv4/IPv6 unwrapping with subspan bounds invariants. - fuzz/mnt_options_fuzzer.cc: fuzzes mnt::extractGenericMountOptions() with VFS flag-isolation and idempotency invariants. - fuzz/standalone_driver.cc + fuzz/corpus/: standalone GCC/Clang corpus smoke runner and initial seed corpora. - infra/oss-fuzz/build.sh + Makefile targets (fuzz, fuzz-smoke): OSS-Fuzz build script and protobuf-free Make targets. Refs google#309.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds standalone, dependency-free libFuzzer harnesses (no
protobuforlibnlrequired), seed corpora, a dictionary,Makefiletargets (fuzzandfuzz-smoke), and aninfra/oss-fuzz/build.shscript fornsjail's untrusted input parsers (addressing #309 part 2: libFuzzer / OSS-Fuzz).Based directly on
masterwith zero conflicts against #417:fuzz/nstun_packet_fuzzer.cc: Fuzzesnstun::handle_ip4(),nstun::handle_ip6(),skip_ipv6_ext_headers(),handle_udp4/6(),handle_icmp4/6(), and ICMP error/echo reply construction (send_to_guest_v()stub validates MTU bounds and touches every emitted byte for sanitizer coverage). Supports both raw malformed frames and a structure-aware checksum/source-IP fixup mode to reach deep L4/ICMP paths without creating real host sockets or leaking file descriptors.fuzz/nstun_encap_fuzzer.cc+fuzz/nstun_encap.dict: Fuzzesparse_socks5_auth_reply(),parse_socks5_connect_reply(),find_end_of_headers(),parse_http_connect_reply(), andsocks5_udp_unwrap_for_flow()(IPv4 & IPv6) with subspan bounds invariants.fuzz/mnt_options_fuzzer.cc: Fuzzesmnt::extractGenericMountOptions()with VFS flag-isolation and idempotency invariants.fuzz/standalone_driver.cc+fuzz/corpus/: Standalone POSIX C++20 (-fno-exceptions) corpus runner + initial seed corpora somake fuzz-smokeworks with GCC or Clang.infra/oss-fuzz/build.sh+Makefile: Standard OSS-Fuzz build script ($CXX $CXXFLAGS $LIB_FUZZING_ENGINE,*_seed_corpus.zip,.dict) and protobuf-freemake fuzz/make fuzz-smoketargets.Testing
make fuzz-smoke(GCC 15.2.1,-std=c++20 -fno-exceptions -Wall -Wextra -Werror, withoutprotobuf/libnl): all 3 targets compiled with 0 warnings and passed all seed corpora (nstun_packet: 6 seeds,nstun_encap: 8 seeds,mnt_options: 4 seeds).infra/oss-fuzz/build.shend-to-end (built all 3 binaries, packaged all 3*_seed_corpus.ziparchives, and installednstun_encap_fuzzer.dict).50,000per target) with-D_GLIBCXX_ASSERTIONS -D_FORTIFY_SOURCE=3 -fstack-protector-strong: 0 crashes, 0 fd leaks.