Compiling fuzzer

electricworry worryelectric at gmail.com
Wed Jul 15 19:11:21 CEST 2020


On Wed, 15 Jul 2020 at 17:29, Alan DeKok <aland at deployingradius.com> wrote:
>
> On Jul 15, 2020, at 11:36 AM, electricworry <worryelectric at gmail.com> wrote:
> >
> > I'm trying to build FreeRADIUS with the fuzzers, but I'm running into
> > some problems. Can anyone please point out what I'm doing wrong?
>
>   v3 doesn't build with a fuzzer.  Only "master" branch has fuzzer support.

Thanks. Indeed, I am on the master branch, fully up to date.

> > First up I appended "CFLAGS += -fsanitize=fuzzer" to Make.inc.in
> > before running ./configure.
>
>   That shouldn't be necessary.  In the "master" branch, see src/bin/fuzzer.mk  You can just follow the instructions in that file.

So, following the instructions in src/bin/fuzzer.mk, I am to modify
Make.inc (so that necessitates running ./configure first) by appending
the required CFLAGS, then build. My steps are:

    make distclean
    ./configure CC=clang
    echo "CFLAGS += -fsanitize=fuzzer" >> Make.inc
    make all

That fails at the point of building src/lib/util/dbuff_tests.c, which
is why I was then looking at the fuzzer-no-link flag:

    LINK build/lib/libfreeradius-soh.la
    CC src/lib/util/dbuff_tests.c
    /usr/bin/ld: build/objs/src/lib/util/dbuff_tests.o: in function
`test_check__':
    /home/projects/freeradius-server/src/freeradius-devel/util/acutest.h:602:
undefined reference to `__sancov_lowest_stack'
    /usr/bin/ld:
/home/projects/freeradius-server/src/freeradius-devel/util/acutest.h:(.text.test_check__[test_check__]+0x129):
undefined reference to `__sancov_lowest_stack'
    /usr/bin/ld:
/home/projects/freeradius-server/src/freeradius-devel/util/acutest.h:607:
undefined reference to `__sanitizer_cov_trace_const_cmp4'
    /usr/bin/ld:
/home/projects/freeradius-server/src/freeradius-devel/util/acutest.h:612:
undefined reference to `__sanitizer_cov_trace_const_cmp4'
    <snip />

I am using Linux Mint 20 and clang is version 10. The instructions in
src/bin/fuzzer.mk don't seem to be foolproof in my case,
unfortunately.


More information about the Freeradius-Devel mailing list