Skip to content
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

[DO NOT MERGE][kubernetes] try building Go fuzz targets with the standard gofuzz. #3616

Closed
wants to merge 4 commits into from

Conversation

Dor1s
Copy link
Contributor

@Dor1s Dor1s commented Apr 10, 2020

related to #3614

tracking bug: #2714

@TravisBuddy
Copy link

Travis tests have failed

Hey @Dor1s,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

View build log

./infra/travis/travis_build.py
Building project kubernetes
Running command: python /home/travis/build/google/oss-fuzz/infra/helper.py build_fuzzers kubernetes --engine libfuzzer --sanitizer address --architecture x86_64
Running: docker build -t gcr.io/oss-fuzz/kubernetes projects/kubernetes

Step 1/7 : FROM gcr.io/oss-fuzz-base/base-builder
latest: Pulling from oss-fuzz-base/base-builder






















Digest: sha256:8cdab7a8c67482d480981df37f50ea5939b9cfafdbef2d6070ea23d397c06e95
Status: Downloaded newer image for gcr.io/oss-fuzz-base/base-builder:latest
 ---> 929ba879128c
Step 2/7 : ENV GOPATH /gopath
 ---> Running in eb43caf8797a
Removing intermediate container eb43caf8797a
 ---> 2e5c5d0adf04
Step 3/7 : RUN go get -u -d github.com/dvyukov/go-fuzz/...
 ---> Running in 7ed017c05158
Removing intermediate container 7ed017c05158
 ---> 1fe9be1e7f75
Step 4/7 : RUN go get github.com/ianlancetaylor/demangle
 ---> Running in 573d0e875fc9
Removing intermediate container 573d0e875fc9
 ---> 503f40875a0e
Step 5/7 : RUN git clone --depth 1 https://github.com/kubernetes/kubernetes.git /gopath/src/k8s.io/kubernetes
 ---> Running in 74f499535cde
Cloning into '/gopath/src/k8s.io/kubernetes'...
Removing intermediate container 74f499535cde
 ---> 43078911f261
Step 6/7 : WORKDIR /gopath/src/k8s.io/kubernetes
 ---> Running in 0f871147594a
Removing intermediate container 0f871147594a
 ---> a7fdbe09a284
Step 7/7 : COPY build.sh $SRC/build.sh
 ---> 35d863819052
Successfully built 35d863819052
Successfully tagged gcr.io/oss-fuzz/kubernetes:latest
Keeping existing build artifacts as-is (if any).
Running: docker run --rm --privileged -i --cap-add SYS_PTRACE -e FUZZING_ENGINE=libfuzzer -e SANITIZER=address -e ARCHITECTURE=x86_64 -v /home/travis/build/google/oss-fuzz/build/out/kubernetes:/out -v /home/travis/build/google/oss-fuzz/build/work/kubernetes:/work -t gcr.io/oss-fuzz/kubernetes
---------------------------------------------------------------
Compiling libFuzzer to /usr/lib/libFuzzingEngine.a... ar: creating /usr/lib/libFuzzingEngine.a
 done.
CC=clang
CXX=clang++
CFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link
CXXFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++
---------------------------------------------------------------
+ set -o nounset
+ set -o pipefail
+ set -o errexit
+ set -x
+ compile_fuzzer yaml FuzzDurationStrict
+ local pkg=yaml
+ local function=FuzzDurationStrict
+ local fuzzer=yaml_FuzzDurationStrict
+ gofuzz -libfuzzer -func FuzzDurationStrict -o yaml_FuzzDurationStrict.a k8s.io/kubernetes/test/fuzz/yaml
/src/build.sh: line 30: gofuzz: command not found
Building fuzzers failed.
Failed projects: kubernetes
TravisBuddy Request Identifier: 9fe7a780-7b84-11ea-92ec-4d91dbb50c9a

@TravisBuddy
Copy link

Travis tests have failed

Hey @Dor1s,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

View build log

./infra/travis/travis_build.py
Building project kubernetes
Running command: python /home/travis/build/google/oss-fuzz/infra/helper.py build_fuzzers kubernetes --engine libfuzzer --sanitizer address --architecture x86_64
Running: docker build -t gcr.io/oss-fuzz/kubernetes projects/kubernetes

Step 1/7 : FROM gcr.io/oss-fuzz-base/base-builder
latest: Pulling from oss-fuzz-base/base-builder






















Digest: sha256:8cdab7a8c67482d480981df37f50ea5939b9cfafdbef2d6070ea23d397c06e95
Status: Downloaded newer image for gcr.io/oss-fuzz-base/base-builder:latest
 ---> 929ba879128c
Step 2/7 : ENV GOPATH /gopath
 ---> Running in 295d21e3bb7b
Removing intermediate container 295d21e3bb7b
 ---> 5f905358b812
Step 3/7 : RUN go get -u -d github.com/dvyukov/go-fuzz/...
 ---> Running in 59c57f2f7a85
Removing intermediate container 59c57f2f7a85
 ---> fefe8ccecfda
Step 4/7 : RUN go get github.com/ianlancetaylor/demangle
 ---> Running in b0e52b25f383
Removing intermediate container b0e52b25f383
 ---> 11f4faad3356
Step 5/7 : RUN git clone --depth 1 https://github.com/kubernetes/kubernetes.git /gopath/src/k8s.io/kubernetes
 ---> Running in 1b515fee33fb
Cloning into '/gopath/src/k8s.io/kubernetes'...
Removing intermediate container 1b515fee33fb
 ---> 6c481cc865c4
Step 6/7 : WORKDIR /gopath/src/k8s.io/kubernetes
 ---> Running in ce69ce7142da
Removing intermediate container ce69ce7142da
 ---> da4e93a8f922
Step 7/7 : COPY build.sh $SRC/build.sh
 ---> a6af2b589d19
Successfully built a6af2b589d19
Successfully tagged gcr.io/oss-fuzz/kubernetes:latest
Keeping existing build artifacts as-is (if any).
Running: docker run --rm --privileged -i --cap-add SYS_PTRACE -e FUZZING_ENGINE=libfuzzer -e SANITIZER=address -e ARCHITECTURE=x86_64 -v /home/travis/build/google/oss-fuzz/build/out/kubernetes:/out -v /home/travis/build/google/oss-fuzz/build/work/kubernetes:/work -t gcr.io/oss-fuzz/kubernetes
---------------------------------------------------------------
Compiling libFuzzer to /usr/lib/libFuzzingEngine.a... ar: creating /usr/lib/libFuzzingEngine.a
 done.
CC=clang
CXX=clang++
CFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link
CXXFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++
---------------------------------------------------------------
+ set -o nounset
+ set -o pipefail
+ set -o errexit
+ set -x
+ compile_fuzzer yaml FuzzDurationStrict
+ local pkg=yaml
+ local function=FuzzDurationStrict
+ local fuzzer=yaml_FuzzDurationStrict
+ gofuzz-build -libfuzzer -func FuzzDurationStrict -o yaml_FuzzDurationStrict.a k8s.io/kubernetes/test/fuzz/yaml
/src/build.sh: line 30: gofuzz-build: command not found
Building fuzzers failed.
Failed projects: kubernetes
TravisBuddy Request Identifier: d45812b0-7b85-11ea-92ec-4d91dbb50c9a

@TravisBuddy
Copy link

Travis tests have failed

Hey @Dor1s,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

View build log

./infra/travis/travis_build.py
Building project kubernetes
Running command: python /home/travis/build/google/oss-fuzz/infra/helper.py build_fuzzers kubernetes --engine libfuzzer --sanitizer address --architecture x86_64
Running: docker build -t gcr.io/oss-fuzz/kubernetes projects/kubernetes

Step 1/7 : FROM gcr.io/oss-fuzz-base/base-builder
latest: Pulling from oss-fuzz-base/base-builder





















Digest: sha256:30fafa37ab86341c371d20e7b682906b6ecdcf3532f9f3261336a1c0c033cfb8
Status: Downloaded newer image for gcr.io/oss-fuzz-base/base-builder:latest
 ---> fb160319f3a7
Step 2/7 : ENV GOPATH /gopath
 ---> Running in 58472d4bb515
Removing intermediate container 58472d4bb515
 ---> e915492f1555
Step 3/7 : RUN go get -u -d github.com/dvyukov/go-fuzz/...
 ---> Running in f5c4280a22bd
Removing intermediate container f5c4280a22bd
 ---> fb4c918aac5b
Step 4/7 : RUN go get github.com/ianlancetaylor/demangle
 ---> Running in 19d81bef9291
Removing intermediate container 19d81bef9291
 ---> 4c168b5a8ca4
Step 5/7 : RUN git clone --depth 1 https://github.com/kubernetes/kubernetes.git /gopath/src/k8s.io/kubernetes
 ---> Running in 5c76119d2990
Cloning into '/gopath/src/k8s.io/kubernetes'...
Removing intermediate container 5c76119d2990
 ---> 8fa3aa9f1181
Step 6/7 : WORKDIR /gopath/src/k8s.io/kubernetes
 ---> Running in fbaaa171ca76
Removing intermediate container fbaaa171ca76
 ---> c0abcd678a15
Step 7/7 : COPY build.sh $SRC/build.sh
 ---> 44f16a29d5f3
Successfully built 44f16a29d5f3
Successfully tagged gcr.io/oss-fuzz/kubernetes:latest
Keeping existing build artifacts as-is (if any).
Running: docker run --rm --privileged -i --cap-add SYS_PTRACE -e FUZZING_ENGINE=libfuzzer -e SANITIZER=address -e ARCHITECTURE=x86_64 -v /home/travis/build/google/oss-fuzz/build/out/kubernetes:/out -v /home/travis/build/google/oss-fuzz/build/work/kubernetes:/work -t gcr.io/oss-fuzz/kubernetes
---------------------------------------------------------------
Compiling libFuzzer to /usr/lib/libFuzzingEngine.a... ar: creating /usr/lib/libFuzzingEngine.a
 done.
CC=clang
CXX=clang++
CFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link
CXXFLAGS=-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++
---------------------------------------------------------------
+ set -o nounset
+ set -o pipefail
+ set -o errexit
+ set -x
+ compile_fuzzer yaml FuzzDurationStrict
+ local pkg=yaml
+ local function=FuzzDurationStrict
+ local fuzzer=yaml_FuzzDurationStrict
+ go build -buildmode c-archive -gcflags all=-d=libfuzzer -func FuzzDurationStrict -o yaml_FuzzDurationStrict.a k8s.io/kubernetes/test/fuzz/yaml
flag provided but not defined: -func
usage: go build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.
Building fuzzers failed.
Failed projects: kubernetes
TravisBuddy Request Identifier: c1488190-7b86-11ea-92ec-4d91dbb50c9a

@TravisBuddy
Copy link

Travis tests have failed

Hey @Dor1s,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

View build log

./infra/travis/travis_build.py
Building project kubernetes
Running command: python /home/travis/build/google/oss-fuzz/infra/helper.py build_fuzzers kubernetes --engine libfuzzer --sanitizer address --architecture x86_64
Running: docker build -t gcr.io/oss-fuzz/kubernetes projects/kubernetes

Step 1/7 : FROM gcr.io/oss-fuzz-base/base-builder
latest: Pulling from oss-fuzz-base/base-builder





















Digest: sha256:30fafa37ab86341c371d20e7b682906b6ecdcf3532f9f3261336a1c0c033cfb8
Status: Downloaded newer image for gcr.io/oss-fuzz-base/base-builder:latest
 ---> fb160319f3a7
Step 2/7 : ENV GOPATH /gopath
 ---> Running in 0820d1bef39c
Removing intermediate container 0820d1bef39c
 ---> 9f0d4577a601
Step 3/7 : RUN go get -u -d github.com/dvyukov/go-fuzz/...
 ---> Running in 1ccb495f43d6
Removing intermediate container 1ccb495f43d6
 ---> 66e675838bdc
Step 4/7 : RUN go get github.com/ianlancetaylor/demangle
 ---> Running in 42ac9ee4b7ac
Removing intermediate container 42ac9ee4b7ac
 ---> a809083fcd20
Step 5/7 : RUN git clone --depth 1 https://github.com/kubernetes/kubernetes.git /gopath/src/k8s.io/kubernetes
 ---> Running in c7fb00ee5c0d
Cloning into '/gopath/src/k8s.io/kubernetes'...
Removing intermediate container c7fb00ee5c0d
 ---> 4c1a35d0e634
Step 6/7 : WORKDIR /gopath/src/k8s.io/kubernetes
 ---> Running in 27a47cbeb0c7
Removing intermediate container 27a47cbeb0c7
 ---> 412ed347d597
Step 7/7 : COPY build.sh $SRC/build.sh
 ---> 36da6dc05cbf
Successfully built 36da6dc05cbf
Successfully tagged gcr.io/oss-fuzz/kubernetes:latest
Keeping existing build artifacts as-is (if any).
Running: docker run --rm --privileged -i --cap-add SYS_PTRACE -e FUZZING_ENGINE=libfuzzer -e SANITIZER=address -e ARCHITECTURE=x86_64 -v /home/travis/build/google/oss-fuzz/build/out/kubernetes:/out -v /home/travis/build/google/oss-fuzz/build/work/kubernetes:/work -t gcr.io/oss-fuzz/kubernetes
---------------------------------------------------------------
Compiling libFuzzer to /usr/lib/libFuzzingEngine.a... Building fuzzers failed.
Failed projects: kubernetes
TravisBuddy Request Identifier: 5e98e020-7b87-11ea-92ec-4d91dbb50c9a

@@ -27,7 +27,8 @@ function compile_fuzzer {
local fuzzer="${pkg}_${function}"

# Instrument all Go files relevant to this fuzzer
go-fuzz-build -libfuzzer -func "${function}" -o "${fuzzer}.a" "k8s.io/kubernetes/test/fuzz/${pkg}"
go build -buildmode c-archive -gcflags all=-d=libfuzzer -tags=libfuzzer \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lukasz-milewski @mdempsky when you get a chance, could you please take a look at guide us on the right way to build Go fuzz targets using the standard toolchain -- we want to migrate off github.com/dvyukov/go-fuzz/go-fuzz-build as it shouldn't be needed anymore //cc @inferno-chromium

this PR is just for testing purposes, once we figure out the right way we'll have a unified command / script in the base-builder image. All current Go projects will be migrated to it and the documentation for new projects will be updated.

Thanks for your help!

Copy link
Collaborator

Choose a reason for hiding this comment

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

#3633 works, but @lukasz-milewski @mdempsky need to confirm if we should do that way or if this should go in an official module.

@Dor1s
Copy link
Contributor Author

Dor1s commented Apr 14, 2020

Superseded by #3633 and #3638.

@Dor1s Dor1s closed this Apr 14, 2020
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.

3 participants