cncf / cncf-fuzzing

✨🔐 CNCF Fuzzers
https://cncf.io/projects
Apache License 2.0
111 stars 41 forks source link

Fix missing runc-dmz failure for runc #458

Closed fish98 closed 1 year ago

fish98 commented 1 year ago

The following error would occur when building fuzz driver FuzzStateApi for runc after migrating go version to 1.21.0, which would lead to building failure.

Running go-fuzz -tags gofuzz -func FuzzStateApi -o state_api_fuzzer.a github.com/opencontainers/runc/libcontainer
libcontainer/dmz/dmz_linux.go:21:12: pattern runc-dmz: no matching files found
failed to build packages:exit status 1
ERROR:__main__:Building fuzzers failed.

AFAIU, the reason is runc requires runc-dmz binary available for building in libcontainer/dmz/dmz_linux.go, while go build process would ignore go:generate when the target file is not directly used.

Although it would not be the best approach to fix the error, the error is fixed by manually running the compiling for runc-dmz before building the fuzz driver.

PS. Compile with default ossfuzz CFLAGS would trigger ASAN and DWARF errors, leading to compile failure.

cyphar commented 1 year ago

If you compile runc with runc_nodmz, the build error will go away (but of course, it means you couldn't fuzz runc-dmz -- though I think none of our fuzzers touch any of the code that would use runc-dmz).

fish98 commented 1 year ago

If you compile runc with runc_nodmz, the build error will go away (but of course, it means you couldn't fuzz runc-dmz -- though I think none of our fuzzers touch any of the code that would use runc-dmz).

Many thanks for your response. I do believe that we do not have the need for fuzzing runc-dmz. However, based on the building process of oss-fuzz and my experimental results, it appears that adding the "compile runc with runc_nodmz" option does not help with a successful compilation of the FuzzStateApi fuzzer. I used the following building command with environment setting:

python infra/helper.py shell runc # outside
export BUILDTAGS="runc_nodmz" # one at a time
export RUNC_DMZ=legacy
compile

I have not yet found a better solution to address this building failure. Please do advise if I misunderstood your suggestion. Thank you 😺