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? First up I appended "CFLAGS += -fsanitize=fuzzer" to Make.inc.in before running ./configure. Next I had to amend my configure command so that clang is used: ./configure CC=clang Next I ran into linking issues because not all binaries have LibFuzzer targets (as I would expect) so I appended again to Make.inc.in "LDFLAGS += -fsanitize=fuzzer-no-link" (which is probably the wrong direction). At the stage of compiling src/bin/fuzzer.c I get an error: CC src/bin/fuzzer.c src/bin/fuzzer.c:111:25: error: use of undeclared identifier 'dl_module_loader' dl_search_path_prepend(dl_module_loader->dl_loader, lib_dir); What am I missing? Looking at the makefiles it looks like it should build out of the box but I seem to be missing something.
On Jul 15, 2020, at 11:36 AM, electricworry <worryelectric@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.
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.
Next I had to amend my configure command so that clang is used:
./configure CC=clang
Yes, that should be good.
Next I ran into linking issues because not all binaries have LibFuzzer targets (as I would expect) so I appended again to Make.inc.in "LDFLAGS += -fsanitize=fuzzer-no-link" (which is probably the wrong direction). At the stage of compiling src/bin/fuzzer.c I get an error:
Just follow the instructions in the fuzzer.mk file.
What am I missing? Looking at the makefiles it looks like it should build out of the box but I seem to be missing something.
The fuzzer tools do NOT build automatically out of the box. They are not (yet) part of the automated regression tests. Alan DeKok.
On Wed, 15 Jul 2020 at 17:29, Alan DeKok <aland@deployingradius.com> wrote:
On Jul 15, 2020, at 11:36 AM, electricworry <worryelectric@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.
On Jul 15, 2020, at 1:11 PM, electricworry <worryelectric@gmail.com> wrote:
Thanks. Indeed, I am on the master branch, fully up to date.
OK.
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:
I don't see that. I did push a fix for fuzzer.c.
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.
You should be able to do: $ make fuzzer_radius And then run it. Alan DeKok.
On Wed, 15 Jul 2020 at 18:35, Alan DeKok <aland@deployingradius.com> wrote:
I did push a fix for fuzzer.c.
Thanks, that fixes my second issue. :)
You should be able to do:
$ make fuzzer_radius
And then run it.
Ah yes, that works thank you! I was running make all as I took "re-build *all* of the source" literally. I can confirm that (with your latest push) I can build the fuzzers. Explicit steps for anyone like me: $ make distclean $ ./configure CC=clang $ echo "CFLAGS += -fsanitize=fuzzer" >> Make.inc $ make fuzzer_radius && make fuzzer_dhcpv4 && make fuzzer_dhcpv6 $ mkdir corp-radius $ scripts/build/fuzzer Cheers!
participants (2)
-
Alan DeKok -
electricworry