mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
oss-fuzz: update to use different fuzz builder
This commit is contained in:
parent
db7192f873
commit
5059a5a714
2 changed files with 55 additions and 65 deletions
2
go.sum
2
go.sum
|
|
@ -299,8 +299,6 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO
|
||||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64=
|
|
||||||
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
|
|
|
||||||
114
oss-fuzz.sh
114
oss-fuzz.sh
|
|
@ -48,38 +48,25 @@ DOG
|
||||||
cd -
|
cd -
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_native_go_fuzzer() {
|
|
||||||
fuzzer=$1
|
|
||||||
function=$2
|
|
||||||
path=$3
|
|
||||||
tags="-tags gofuzz"
|
|
||||||
|
|
||||||
if [[ $SANITIZER == *coverage* ]]; then
|
|
||||||
coverbuild $path $function $fuzzer $coverpkg
|
|
||||||
else
|
|
||||||
go-118-fuzz-build $tags -o $fuzzer.a -func $function $path
|
|
||||||
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function compile_fuzzer() {
|
function compile_fuzzer() {
|
||||||
path=$GOPATH/src/github.com/ethereum/go-ethereum/$1
|
package=$1
|
||||||
function=$2
|
function=$2
|
||||||
fuzzer=$3
|
fuzzer=$3
|
||||||
|
|
||||||
|
path=$GOPATH/src/$1
|
||||||
|
|
||||||
echo "Building $fuzzer"
|
echo "Building $fuzzer"
|
||||||
cd $path
|
cd $path
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
go install github.com/AdamKorcz/go-118-fuzz-build@latest
|
go mod tidy
|
||||||
go get github.com/AdamKorcz/go-118-fuzz-build/testing
|
go get github.com/holiman/gofuzz-shim/testing
|
||||||
|
|
||||||
# Test if file contains a line with "func $function(" and "testing.F".
|
if [[ $SANITIZER == *coverage* ]]; then
|
||||||
if [ $(grep -r "func $function(" $path | grep "testing.F" | wc -l) -eq 1 ]
|
coverbuild $path $function $fuzzer $coverpkg
|
||||||
then
|
|
||||||
build_native_go_fuzzer $fuzzer $function $path
|
|
||||||
else
|
else
|
||||||
echo "Could not find the function: func ${function}(f *testing.F)"
|
gofuzz-shim --func $function --package $package -o $fuzzer.a
|
||||||
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Check if there exists a seed corpus file
|
## Check if there exists a seed corpus file
|
||||||
|
|
@ -92,51 +79,56 @@ function compile_fuzzer() {
|
||||||
cd -
|
cd -
|
||||||
}
|
}
|
||||||
|
|
||||||
export PROJPATH=$GOPATH/src/github.com/ethereum/go-ethereum
|
go install github.com/holiman/gofuzz-shim@latest
|
||||||
|
|
||||||
compile_fuzzer accounts/abi FuzzABI fuzzAbi
|
#compile_fuzzer accounts/abi FuzzABI fuzzAbi
|
||||||
|
compile_fuzzer github.com/ethereum/go-ethereum/accounts/abi FuzzABI fuzzAbi
|
||||||
|
|
||||||
# See https://github.com/AdamKorcz/go-118-fuzz-build#using-test-utils-from-other-_testgo-files
|
#compile_fuzzer common/bitutil FuzzEncoder fuzzBitutilEncoder
|
||||||
# If we want to use code from '.._test.go'-files, we need to remove the _test suffix.
|
compile_fuzzer github.com/ethereum/go-ethereum/common/bitutil FuzzEncoder fuzzBitutilEncoder
|
||||||
mv $PROJPATH/common/bitutil/compress_test.go $PROJPATH/common/bitutil/compress_test_xx.go
|
|
||||||
compile_fuzzer common/bitutil FuzzEncoder fuzzBitutilEncoder
|
|
||||||
compile_fuzzer common/bitutil FuzzDecoder fuzzBitutilDecoder
|
|
||||||
|
|
||||||
compile_fuzzer core/vm/runtime FuzzVmRuntime fuzzVmRuntime
|
#compile_fuzzer common/bitutil FuzzDecoder fuzzBitutilDecoder
|
||||||
compile_fuzzer core/vm FuzzPrecompiledContracts fuzzPrecompiledContracts
|
compile_fuzzer github.com/ethereum/go-ethereum/common/bitutil FuzzDecoder fuzzBitutilDecoder
|
||||||
|
|
||||||
compile_fuzzer core/types/ FuzzRLP fuzzRlp
|
#compile_fuzzer core/vm/runtime FuzzVmRuntime fuzzVmRuntime
|
||||||
|
compile_fuzzer github.com/ethereum/go-ethereum/core/vm/runtime FuzzVmRuntime fuzzVmRuntime
|
||||||
|
|
||||||
compile_fuzzer tests/fuzzers/bn256 FuzzAdd fuzzBn256Add
|
#compile_fuzzer core/vm FuzzPrecompiledContracts fuzzPrecompiledContracts
|
||||||
compile_fuzzer tests/fuzzers/bn256 FuzzMul fuzzBn256Mul
|
compile_fuzzer github.com/ethereum/go-ethereum/core/vm FuzzPrecompiledContracts fuzzPrecompiledContracts
|
||||||
compile_fuzzer tests/fuzzers/bn256 FuzzPair fuzzBn256Pair
|
|
||||||
compile_fuzzer tests/fuzzers/keystore Fuzz fuzzKeystore
|
|
||||||
compile_fuzzer tests/fuzzers/txfetcher Fuzz fuzzTxfetcher
|
|
||||||
compile_fuzzer tests/fuzzers/trie Fuzz fuzzTrie
|
|
||||||
compile_fuzzer tests/fuzzers/stacktrie Fuzz fuzzStackTrie
|
|
||||||
compile_fuzzer tests/fuzzers/difficulty Fuzz fuzzDifficulty
|
|
||||||
compile_fuzzer tests/fuzzers/les Fuzz fuzzLes
|
|
||||||
compile_fuzzer tests/fuzzers/secp256k1 Fuzz fuzzSecp256k1
|
|
||||||
compile_fuzzer tests/fuzzers/vflux FuzzClientPool fuzzClientPool
|
|
||||||
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG1Add fuzz_g1_add
|
#compile_fuzzer core/types/ FuzzRLP fuzzRlp
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG1Mul fuzz_g1_mul
|
compile_fuzzer github.com/ethereum/go-ethereum/core/types FuzzRLP fuzzRlp
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG1MultiExp fuzz_g1_multiexp
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG2Add fuzz_g2_add
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG2Mul fuzz_g2_mul
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzG2MultiExp fuzz_g2_multiexp
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzPairing fuzz_pairing
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzMapG1 fuzz_map_g1
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzMapG2 fuzz_map_g2
|
|
||||||
|
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG1Add fuzz_cross_g1_add
|
#compile_fuzzer tests/fuzzers/bn256 FuzzAdd fuzzBn256Add
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG1MultiExp fuzz_cross_g1_multiexp
|
#compile_fuzzer tests/fuzzers/bn256 FuzzMul fuzzBn256Mul
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG2Add fuzz_cross_g2_add
|
#compile_fuzzer tests/fuzzers/bn256 FuzzPair fuzzBn256Pair
|
||||||
compile_fuzzer tests/fuzzers/bls12381 FuzzCrossPairing fuzz_cross_pairing
|
#compile_fuzzer tests/fuzzers/keystore Fuzz fuzzKeystore
|
||||||
|
#compile_fuzzer tests/fuzzers/txfetcher Fuzz fuzzTxfetcher
|
||||||
|
#compile_fuzzer tests/fuzzers/trie Fuzz fuzzTrie
|
||||||
|
#compile_fuzzer tests/fuzzers/stacktrie Fuzz fuzzStackTrie
|
||||||
|
#compile_fuzzer tests/fuzzers/difficulty Fuzz fuzzDifficulty
|
||||||
|
#compile_fuzzer tests/fuzzers/les Fuzz fuzzLes
|
||||||
|
#compile_fuzzer tests/fuzzers/secp256k1 Fuzz fuzzSecp256k1
|
||||||
|
#compile_fuzzer tests/fuzzers/vflux FuzzClientPool fuzzClientPool
|
||||||
|
|
||||||
compile_fuzzer tests/fuzzers/snap FuzzARange fuzz_account_range
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG1Add fuzz_g1_add
|
||||||
compile_fuzzer tests/fuzzers/snap FuzzSRange fuzz_storage_range
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG1Mul fuzz_g1_mul
|
||||||
compile_fuzzer tests/fuzzers/snap FuzzByteCodes fuzz_byte_codes
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG1MultiExp fuzz_g1_multiexp
|
||||||
compile_fuzzer tests/fuzzers/snap FuzzTrieNodes fuzz_trie_nodes
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG2Add fuzz_g2_add
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG2Mul fuzz_g2_mul
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzG2MultiExp fuzz_g2_multiexp
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzPairing fuzz_pairing
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzMapG1 fuzz_map_g1
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzMapG2 fuzz_map_g2
|
||||||
|
|
||||||
compile_fuzzer crypto/blake2b Fuzz fuzzBlake2b
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG1Add fuzz_cross_g1_add
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG1MultiExp fuzz_cross_g1_multiexp
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzCrossG2Add fuzz_cross_g2_add
|
||||||
|
#compile_fuzzer tests/fuzzers/bls12381 FuzzCrossPairing fuzz_cross_pairing
|
||||||
|
|
||||||
|
#compile_fuzzer tests/fuzzers/snap FuzzARange fuzz_account_range
|
||||||
|
#compile_fuzzer tests/fuzzers/snap FuzzSRange fuzz_storage_range
|
||||||
|
#compile_fuzzer tests/fuzzers/snap FuzzByteCodes fuzz_byte_codes
|
||||||
|
#compile_fuzzer tests/fuzzers/snap FuzzTrieNodes fuzz_trie_nodes
|
||||||
|
|
||||||
|
#compile_fuzzer crypto/blake2b Fuzz fuzzBlake2b
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue