Re: [PATCH v2 nft] initial support for the afl++ (american fuzzy lop++) fuzzer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


> +AM_CONDITIONAL([BUILD_AFL], [test "x$enable_fuzzer" = xyes])
> +AS_IF([test "x$enable_fuzzer" != xno], [
> +	AC_DEFINE([HAVE_FUZZER_BUILD], [1], [Define if you want to
> build with fuzzer support])
> +	], [])


could you always define HAVE_FUZZER_BUILD, and check with `#if
HAVE_FUZZER_BUILD`, instead of `#ifdef`.

The benefit is, that compiler will emit a warning, when `#if` is used
and the variable doesn't exist (e.g. due to a typo).


something like:

  HAVE_FUZZER_BUILD=0
  if [ "$enable_fuzzer" != no ] ; then
      HAVE_FUZZER_BUILD=1
  fi
  AC_DEFINE_UNQUOTED([HAVE_FUZZER_BUILD], [$HAVE_FUZZER_BUILD], [Whether to build with fuzzer support])




> diff --git a/include/afl++.h b/include/afl++.h
> new file mode 100644
> index 000000000000..28244dcaaf62
> --- /dev/null
> +++ b/include/afl++.h
> @@ -0,0 +1,49 @@
> +#ifndef _NFT_AFLPLUSPLUS_H_
> +#define _NFT_AFLPLUSPLUS_H_
> +
> +#include <nftables/libnftables.h>
> +#include <config.h>

<config.h> should always be included as very first in all sources. For
example, it brings `_GNU_SOURCE`, which enables certain features in
libc headers. If you define _GNU_SOURCE somewhere in the middle of a
list of #include, it becomes cumbersome to be sure which libc header
version we have.

Similarly, `src/afl++.c` also must include <config.h> as first.

But note, we should not actually include <config.h> at all. Instead,
`#include <nft.h>` as first (which takes care of getting this right).
Also, only include <nft.h> in C-sources (as first). Thereby, all C
sources can rely to have what <nft.h> provides. Furthermore, since
header files are only indirectly compiled by being included from C
sources, they also can rely on having <nft.h>.






I would avoid the "++" in filenames. E.g. it's a special character for
regexes (depending on regex syntax).






[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux