Skip to content

Commit

Permalink
kubevirt: add more upstream fuzzers (#13074)
Browse files Browse the repository at this point in the history
Adds three fuzzers. These take a long time (about 2 minutes) to start,
so we need to increase the timeout for all three fuzzers.

Signed-off-by: Adam Korczynski <[email protected]>
  • Loading branch information
AdamKorcz authored Feb 19, 2025
1 parent 22bf164 commit 1692bd0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/kubevirt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz3 $SR
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz4 $SRC/kubevirt-fuzz4
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz5 $SRC/kubevirt-fuzz5
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz6 $SRC/kubevirt-fuzz6
COPY build.sh fuzz*test.go $SRC/
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz7 $SRC/kubevirt-fuzz7
COPY build.sh fuzz*test.go *.options $SRC/
WORKDIR $SRC/kubevirt
2 changes: 2 additions & 0 deletions projects/kubevirt/FuzzAdmitter.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[libfuzzer]
timeout=250
2 changes: 2 additions & 0 deletions projects/kubevirt/FuzzWebhookAdmitters.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[libfuzzer]
timeout=250
2 changes: 2 additions & 0 deletions projects/kubevirt/FuzzWebhookMutators.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[libfuzzer]
timeout=250
7 changes: 7 additions & 0 deletions projects/kubevirt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ cp $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/drain/disruptionbudget/fuzz_tes
cp $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/migration/fuzz_test.go $SRC/kubevirt/pkg/virt-controller/watch/migration/
cp $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/pool/fuzz_test.go $SRC/kubevirt/pkg/virt-controller/watch/pool/
cp $SRC/kubevirt-fuzz6/pkg/virt-operator/resource/generate/install/fuzz_test.go $SRC/kubevirt/pkg/virt-operator/resource/generate/install/
cp $SRC/kubevirt-fuzz7/pkg/virt-api/webhooks/mutating-webhook/fuzz_test.go $SRC/kubevirt/pkg/virt-api/webhooks/mutating-webhook/
cp $SRC/kubevirt-fuzz7/pkg/virt-api/webhooks/validating-webhook/fuzz_test.go $SRC/kubevirt/pkg/virt-api/webhooks/validating-webhook/

printf "package webhooks\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > pkg/util/webhooks/register_fuzz_dep.go
go mod tidy
Expand All @@ -37,6 +39,9 @@ go mod edit -replace github.com/AdamKorcz/go-118-fuzz-build="$SRC"/go-118-fuzz-b
go mod tidy
go mod vendor

compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-api/webhooks/mutating-webhook FuzzWebhookMutators FuzzWebhookMutators
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-api/webhooks/validating-webhook FuzzWebhookAdmitters FuzzWebhookAdmitters
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-api/webhooks/fuzz FuzzAdmitter FuzzAdmitter
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-operator/resource/generate/install FuzzLoadInstallStrategyFromCache FuzzLoadInstallStrategyFromCache
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-controller/watch/node FuzzExecute FuzzNodeWatchExecute
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-controller/watch/vm FuzzExecute FuzzVMWatchExecute
Expand All @@ -52,3 +57,5 @@ compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/certificates/triple/cert FuzzK

mv $SRC/fuzz_loadInstallStrategyFromBytes_test.go ./pkg/virt-operator/resource/generate/install/
compile_native_go_fuzzer kubevirt.io/kubevirt/pkg/virt-operator/resource/generate/install FuzzLoadInstallStrategyFromBytes FuzzLoadInstallStrategyFromBytes

cp $SRC/*.options $OUT/

0 comments on commit 1692bd0

Please sign in to comment.