Skip to content

Commit 7ab6b22

Browse files
committed
kubevirt: build fuzzers from cncf-fuzzing
Signed-off-by: Adam Korczynski <adam@adalogics.com>
1 parent b0cacbd commit 7ab6b22

File tree

7 files changed

+6
-122
lines changed

7 files changed

+6
-122
lines changed

projects/kubevirt/Dockerfile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717
FROM gcr.io/oss-fuzz-base/base-builder-go
1818
RUN apt update && apt install -y qemu-kvm libvirt-daemon-system
1919
RUN git clone --depth 1 https://github.com/kubevirt/kubevirt
20-
RUN git clone --depth=1 https://github.com/AdamKorcz/go-118-fuzz-build --branch=november-backup
21-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz1 $SRC/kubevirt-fuzz1
22-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz2 $SRC/kubevirt-fuzz2
23-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz3 $SRC/kubevirt-fuzz3
24-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz4 $SRC/kubevirt-fuzz4
25-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz5 $SRC/kubevirt-fuzz5
26-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz6 $SRC/kubevirt-fuzz6
27-
RUN git clone --depth=1 https://github.com/AdamKorcz/kubevirt --branch=fuzz7 $SRC/kubevirt-fuzz7
28-
COPY build.sh fuzz*test.go *.options $SRC/
29-
WORKDIR $SRC/kubevirt
20+
RUN git clone --depth=1 https://github.com/AdamKorcz/go-118-fuzz-build --branch=v2_2 $SRC/go-118-fuzz-build
21+
RUN git clone --depth=1 --branch=2025-work https://github.com/AdamKorcz/go-fuzz-headers-1 $SRC/go-fuzz-headers
22+
ADD cncf-fuzzing $SRC/cncf-fuzzing
23+
COPY build.sh $SRC/
24+
WORKDIR $SRC

projects/kubevirt/FuzzAdmitter.options

Lines changed: 0 additions & 2 deletions
This file was deleted.

projects/kubevirt/FuzzWebhookAdmitters.options

Lines changed: 0 additions & 2 deletions
This file was deleted.

projects/kubevirt/FuzzWebhookMutators.options

Lines changed: 0 additions & 2 deletions
This file was deleted.

projects/kubevirt/build.sh

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,4 @@
1515
#
1616
################################################################################
1717

18-
cd "$SRC"/kubevirt
19-
20-
cp -r $SRC/kubevirt-fuzz1/pkg/virt-operator/resource/apply/fuzz $SRC/kubevirt/pkg/virt-operator/resource/apply/
21-
cp -r $SRC/kubevirt-fuzz2/pkg/virt-controller/watch/clone/fuzz $SRC/kubevirt/pkg/virt-controller/watch/clone/
22-
cp -r $SRC/kubevirt-fuzz2/pkg/virt-controller/watch/clone/utils_fuzz.go $SRC/kubevirt/pkg/virt-controller/watch/clone/
23-
cp -r $SRC/kubevirt-fuzz3/pkg/virt-controller/watch/vm/fuzz $SRC/kubevirt/pkg/virt-controller/watch/vm/
24-
cp -r $SRC/kubevirt-fuzz3/pkg/virt-controller/watch/vmi/fuzz $SRC/kubevirt/pkg/virt-controller/watch/vmi/
25-
mv $SRC/kubevirt/pkg/virt-controller/watch/vm/patchreactor_test.go $SRC/kubevirt/pkg/virt-controller/watch/vm/patchreactor.go
26-
mv $SRC/kubevirt/pkg/virt-controller/watch/vm/updatereactor_test.go $SRC/kubevirt/pkg/virt-controller/watch/vm/updatereactor.go
27-
28-
cp -r $SRC/kubevirt-fuzz4/pkg/virt-controller/watch/node/fuzz $SRC/kubevirt/pkg/virt-controller/watch/node/
29-
cp -r $SRC/kubevirt-fuzz4/pkg/virt-controller/watch/node/util.go $SRC/kubevirt/pkg/virt-controller/watch/node/
30-
cp -r $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/drain/disruptionbudget/fuzz $SRC/kubevirt/pkg/virt-controller/watch/drain/disruptionbudget/
31-
cp -r $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/migration/fuzz $SRC/kubevirt/pkg/virt-controller/watch/migration/
32-
cp -r $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/pool/fuzz $SRC/kubevirt/pkg/virt-controller/watch/pool/
33-
cp -r $SRC/kubevirt-fuzz5/pkg/virt-controller/watch/pool/util.go $SRC/kubevirt/pkg/virt-controller/watch/pool/
34-
cp -r $SRC/kubevirt-fuzz6/pkg/virt-operator/resource/generate/install/fuzz $SRC/kubevirt/pkg/virt-operator/resource/generate/install/
35-
cp -r $SRC/kubevirt-fuzz7/pkg/virt-api/webhooks/mutating-webhook/fuzz_test.go $SRC/kubevirt/pkg/virt-api/webhooks/mutating-webhook/
36-
cp -r $SRC/kubevirt-fuzz7/pkg/virt-api/webhooks/validating-webhook/fuzz_test.go $SRC/kubevirt/pkg/virt-api/webhooks/validating-webhook/
37-
38-
go mod tidy
39-
go work vendor
40-
41-
find . -type f -name "fuzz_suite_test.go" -delete
42-
rm pkg/virt-operator/resource/generate/install/install_suite_test.go
43-
# this t.Fail() is not OSS-Fuzz friendly and creates false crashes
44-
sed -i 's/t\.Fail()/return/g' pkg/virt-api/webhooks/fuzz/fuzz_test.go
45-
# remove logging from fuzzer
46-
sed -i 's/fmt\.Println(string(j))/_ = j/g' pkg/virt-api/webhooks/fuzz/fuzz_test.go
47-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-api/webhooks/mutating-webhook FuzzWebhookMutators FuzzWebhookMutators
48-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-api/webhooks/validating-webhook FuzzWebhookAdmitters FuzzWebhookAdmitters
49-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-api/webhooks/fuzz FuzzAdmitter FuzzAdmitter
50-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-operator/resource/generate/install/fuzz FuzzLoadInstallStrategyFromCache FuzzLoadInstallStrategyFromCache
51-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/node/fuzz FuzzExecute FuzzNodeWatchExecute
52-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/vm/fuzz FuzzExecute FuzzVMWatchExecute
53-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/vmi/fuzz FuzzExecute FuzzVMIWatchExecute
54-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/clone/fuzz FuzzVMCloneController FuzzVMCloneController
55-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-operator/resource/apply/fuzz FuzzReconciler FuzzVirtOperatorResApplyReconciler
56-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/drain/disruptionbudget/fuzz FuzzExecute FuzzWatchDrainDisruptionBudgetExecute
57-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/migration/fuzz FuzzExecute FuzzWatchMigrationExecute
58-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-controller/watch/pool/fuzz FuzzExecute FuzzWatchPoolExecute
59-
60-
mv $SRC/fuzz_test.go ./pkg/certificates/triple/cert/
61-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/certificates/triple/cert FuzzKeyParsers FuzzKeyParsers
62-
63-
mv $SRC/fuzz_loadInstallStrategyFromBytes_test.go ./pkg/virt-operator/resource/generate/install/
64-
compile_native_go_fuzzer_v2 kubevirt.io/kubevirt/pkg/virt-operator/resource/generate/install FuzzLoadInstallStrategyFromBytes FuzzLoadInstallStrategyFromBytes
65-
66-
cp $SRC/*.options $OUT/
18+
$SRC/cncf-fuzzing/projects/kubevirt/build.sh

projects/kubevirt/fuzz_loadInstallStrategyFromBytes_test.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

projects/kubevirt/fuzz_test.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)