Skip to content

Commit

Permalink
Remove libfuzzer / afl based builds in favor of go 1.18 fuzz testing (p…
Browse files Browse the repository at this point in the history
…rysmaticlabs#10065)

* Remove libfuzzer / afl based builds in favor of go 1.18 fuzz testing

* rm beacon-fuzz archive

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
prestonvanloon and prylabs-bulldozer[bot] authored Jan 20, 2022
1 parent 49c73e6 commit 7df01fe
Show file tree
Hide file tree
Showing 71 changed files with 25 additions and 12,292 deletions.
15 changes: 1 addition & 14 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,7 @@ build:llvm-asan --config=llvm
build:llvm-asan --config=asan
build:llvm-asan --linkopt -fuse-ld=ld.lld

build:fuzz --define=gotags=libfuzzer
build:fuzz --config=llvm-asan
build:fuzz --copt=-fsanitize=fuzzer-no-link
build:fuzz --linkopt=-fsanitize=fuzzer
build:fuzz --copt=-fno-omit-frame-pointer
build:fuzz --define=FUZZING_ENGINE=libfuzzer
build:fuzz --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
build:fuzz --linkopt -Wl,--no-as-needed
build:fuzz --define=gc_goopts=-d=libfuzzer,checkptr
build:fuzz --run_under=//tools:fuzz_wrapper
build:fuzz --compilation_mode=opt
build:fuzz --define=blst_disabled=true

test:fuzz --local_test_jobs="HOST_CPUS*.5"
build:fuzz --@io_bazel_rules_go//go/config:tags=fuzz

# Build binary with cgo symbolizer for debugging / profiling.
build:cgo_symbolizer --config=llvm
Expand Down
3 changes: 0 additions & 3 deletions .buildkite-bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ build --flaky_test_attempts=5
# Disabled race detection due to unstable test results under constrained environment build kite
# build --features=race

# Disable flaky test detection for fuzzing.
test:fuzz --flaky_test_attempts=1

# Better caching
build:nostamp --nostamp
build:nostamp --workspace_status_command=./hack/workspace_status_ci.sh
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ password.txt
# Dist files
dist

# libfuzzer
oom-*
crash-*

# deepsource cli
bin
9 changes: 0 additions & 9 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,6 @@ common_files = {
"//:README.md": "README.md",
}

string_setting(
name = "gotags",
build_setting_default = "",
values = [
"",
"libfuzzer",
],
)

sh_binary(
name = "prysm_sh",
srcs = ["prysm.sh"],
Expand Down
10 changes: 0 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,6 @@ git_repository(
# Group the sources of the library so that CMake rule have access to it
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""

http_archive(
name = "sigp_beacon_fuzz_corpora",
build_file = "//third_party:beacon-fuzz/corpora.BUILD",
sha256 = "42993d0901a316afda45b4ba6d53c7c21f30c551dcec290a4ca131c24453d1ef",
strip_prefix = "beacon-fuzz-corpora-bac24ad78d45cc3664c0172241feac969c1ac29b",
urls = [
"https://github.com/sigp/beacon-fuzz-corpora/archive/bac24ad78d45cc3664c0172241feac969c1ac29b.tar.gz",
],
)

# External dependencies

http_archive(
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//cmd/beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
],
deps = [
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/blockchain/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//testing:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//async/event:go_default_library",
Expand Down
26 changes: 9 additions & 17 deletions beacon-chain/cache/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
load("@prysm//tools/go:def.bzl", "go_library", "go_test")

# gazelle:exclude committee_disabled.go
# gazelle:exclude proposer_indices_disabled.go
go_library(
name = "go_default_library",
srcs = [
"active_balance.go",
"active_balance_disabled.go", # keep
"attestation_data.go",
"checkpoint_state.go",
"committee.go",
"committee_disabled.go", # keep
"committees.go",
"common.go",
"doc.go",
"error.go",
"proposer_indices.go",
"proposer_indices_disabled.go", # keep
"proposer_indices_type.go",
"skip_slot_cache.go",
"subnet_ids.go",
"sync_committee.go",
"sync_committee_disabled.go", # keep
"sync_committee_head_state.go",
"sync_subnet_ids.go",
] + select({
"//testing/fuzz:fuzzing_enabled": [
"active_balance_disabled.go",
"committee_disabled.go",
"proposer_indices_disabled.go",
"sync_committee_disabled.go",
],
"//conditions:default": [
"active_balance.go",
"committee.go",
"proposer_indices.go",
"sync_committee.go",
],
}),
],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/cache",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
"//tools:__subpackages__",
],
deps = [
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/active_balance.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !libfuzzer
// +build !fuzz

package cache

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/active_balance_disabled.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build libfuzzer
// +build fuzz

package cache

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/committee.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !libfuzzer
// +build !fuzz

package cache

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/committee_disabled.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build libfuzzer
// +build fuzz

// This file is used in fuzzer builds to bypass global committee caches.
package cache
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/proposer_indices.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !libfuzzer
// +build !fuzz

package cache

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/proposer_indices_disabled.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build libfuzzer
// +build fuzz

// This file is used in fuzzer builds to bypass proposer indices caches.
package cache
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/sync_committee.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !libfuzzer
// +build !fuzz

package cache

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/cache/sync_committee_disabled.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build libfuzzer
// +build fuzz

package cache

Expand Down
1 change: 0 additions & 1 deletion beacon-chain/core/blocks/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
"//testing/spectest:__subpackages__",
"//testing/util:__pkg__",
"//validator:__subpackages__",
Expand Down
2 changes: 0 additions & 2 deletions beacon-chain/core/helpers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ go_library(
"//cmd/beacon-chain:__subpackages__",
"//contracts/deposit:__pkg__",
"//crypto/keystore:__pkg__",
"//fuzz:__pkg__",
"//network/forks:__pkg__",
"//proto/prysm/v1alpha1:__subpackages__",
"//proto/prysm/v1alpha1/attestation:__pkg__",
Expand All @@ -29,7 +28,6 @@ go_library(
"//testing/altair:__pkg__",
"//testing/benchmark/benchmark_files:__subpackages__",
"//testing/endtoend/evaluators:__pkg__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
"//testing/spectest:__subpackages__",
"//testing/util:__pkg__",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/core/transition/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ go_library(
"//beacon-chain:__subpackages__",
"//runtime/interop:__pkg__",
"//testing/endtoend:__pkg__",
"//testing/fuzz:__pkg__",
"//testing/spectest:__subpackages__",
"//testing/util:__pkg__",
"//tools/benchmark-files-gen:__pkg__",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/db/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//cmd/beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
"//tools:__subpackages__",
],
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/db/kv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/db/kv",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
"//tools:__subpackages__",
],
deps = [
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/forkchoice/protoarray/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//config/params:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/operations/attestations/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//beacon-chain/operations/attestations/kv:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/operations/slashings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//testing/endtoend:__subpackages__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
],
deps = [
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/operations/voluntaryexits/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/operations/voluntaryexits",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//beacon-chain/state:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/p2p/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//testing/endtoend/evaluators:__pkg__",
"//testing/fuzz:__pkg__",
"//tools:__subpackages__",
],
deps = [
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/p2p/encoder/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//config/params:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/p2p/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//beacon-chain/p2p/encoder:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/powchain/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
deps = [
"//async/event:go_default_library",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ go_library(
"//proto/testing:__subpackages__",
"//slasher/rpc:__subpackages__",
"//testing/benchmark:__pkg__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
"//testing/spectest:__subpackages__",
"//testing/util:__pkg__",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/stategen/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ go_library(
visibility = [
"//beacon-chain:__subpackages__",
"//testing/endtoend:__subpackages__",
"//testing/fuzz:__pkg__",
"//testing/slasher/simulator:__pkg__",
],
deps = [
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/stateutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ go_library(
"//proto/testing:__subpackages__",
"//slasher:__subpackages__",
"//testing:__subpackages__",
"//testing/fuzz:__pkg__",
"//tools/blocktree:__pkg__",
"//tools/pcli:__pkg__",
"//validator/client:__pkg__",
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ go_library(
"//runtime/interop:__subpackages__",
"//slasher/rpc:__subpackages__",
"//testing/benchmark:__pkg__",
"//testing/fuzz:__pkg__",
"//testing/spectest:__subpackages__",
"//testing/util:__pkg__",
"//tools/benchmark-files-gen:__pkg__",
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/sync/fuzz_exports.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build libfuzzer
// +build libfuzzer
//go:build fuzz
// +build fuzz

package sync

Expand Down
1 change: 0 additions & 1 deletion beacon-chain/sync/initial-sync/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing",
visibility = [
"//beacon-chain:__subpackages__",
"//testing/fuzz:__pkg__",
],
)
2 changes: 1 addition & 1 deletion crypto/bls/blst/stub.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build blst_disabled libfuzzer
// +build blst_disabled fuzz

package blst

Expand Down
4 changes: 0 additions & 4 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,6 @@ def prysm_deps():
go_repository(
name = "com_github_ferranbt_fastssz",
importpath = "github.com/ferranbt/fastssz",
nofuzz = True,
replace = "github.com/prysmaticlabs/fastssz",
sum = "h1:BC9nIbhpQMyFlmLUJsVv8/+UewAVIjJegtvgaP9bV/M=",
version = "v0.0.0-20211123050228-97d96f38caae",
Expand Down Expand Up @@ -938,7 +937,6 @@ def prysm_deps():
go_repository(
name = "com_github_ghodss_yaml",
importpath = "github.com/ghodss/yaml",
nofuzz = True,
sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=",
version = "v1.0.0",
)
Expand Down Expand Up @@ -1123,7 +1121,6 @@ def prysm_deps():
go_repository(
name = "com_github_golang_glog",
importpath = "github.com/golang/glog",
nofuzz = True,
sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=",
version = "v0.0.0-20160126235308-23def4e6c14b",
)
Expand Down Expand Up @@ -3995,7 +3992,6 @@ def prysm_deps():
go_repository(
name = "in_gopkg_yaml_v2",
importpath = "gopkg.in/yaml.v2",
nofuzz = True,
sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=",
version = "v2.4.0",
)
Expand Down
2 changes: 1 addition & 1 deletion fuzzbuzz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ base:
language: go
docker_image: golang:latest
build_tags:
- libfuzzer
- fuzz
- blst_disabled
Loading

0 comments on commit 7df01fe

Please sign in to comment.