[ovs-dev] [PATCH 1/2] oss-fuzz: Fix fuzzer flags in CFLAGS.

William Tu u9012063 at gmail.com
Wed May 13 13:06:28 UTC 2020


On Tue, May 12, 2020 at 8:44 AM William Tu <u9012063 at gmail.com> wrote:
>
> Thanks for taking a look.
>
> On Tue, May 12, 2020 at 8:41 AM Ilya Maximets <i.maximets at ovn.org> wrote:
> >
> > On 5/12/20 5:22 PM, William Tu wrote:
> > > When running fuzzer locally by doing
> > >  $ ./configure CC=clang CFLAGS="-g -O2 -fsanitize=fuzzer-no-link -Werror"
> >
> > Hmm... Why passing 'fuzzer-no-link' to replace it inside the make script?
>
> the configure fails i`f passing as "-fsanitize=fuzzer"
> configure: error: C compiler cannot create executables
> See `config.log' for more details
>
> configure:4079: checking whether the C compiler works
> configure:4101: clang -g -O2 -fsanitize=fuzzer -Werror   conftest.c  >&5
> /tmp/conftest-67bd49.o: In function `main':
> /root/ovs/conftest.c:14: multiple definition of `main'
> /usr/lib/llvm-8/lib/clang/8.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerMain.cpp.o):FuzzerMain.cpp:(.text.main+0x0):
> first defined here
> /usr/lib/llvm-8/lib/clang/8.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerMain.cpp.o):
> In function `main':
> FuzzerMain.cpp:(.text.main+0x12): undefined reference to
> `LLVMFuzzerTestOneInput'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> configure:4105: $? = 1
> configure:4143: result: no
> configure: failed program was:
>
> >
> > >  $ make oss-fuzz-targets
> >
> > AFAIK, oss-fuzz-targets are for Google's oss-fuzz project and not for
> > local usage.
>
> We're thinking about adding more tests under tests/oss-fuzz/
> so need to make it work locally first.
>
Some context:
People told me that using fuzzer can detect integer wraparound/overflow
bug, something like this meter bucket issue.
https://mail.openvswitch.org/pipermail/ovs-dev/2020-May/370291.html

So I start to look at how clang fuzzer works in OVS. It requires us to pick
the fuzzer target function, and in this meter bucket case, it's pretty hard to
do it.

Regards,
William


More information about the dev mailing list