Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next/20200922/v5 #5433

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 45 additions & 41 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -472,47 +472,6 @@
# options


AC_ARG_ENABLE(fuzztargets,
AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
AM_CONDITIONAL([RUST_BUILD_STD], [test "x$enable_fuzztargets" = "xyes" && echo $rust_compiler_version | grep -q nightly])
AC_PROG_CXX
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled])
AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
CFLAGS_ORIG=$CFLAGS
CFLAGS="-Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
[AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
[])
CFLAGS=$CFLAGS_ORIG
AC_LANG_PUSH(C++)
tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
LIB_FUZZING_ENGINE=-fsanitize=fuzzer
AC_SUBST(LIB_FUZZING_ENGINE)
])
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
(void)Data;
(void)Size;
return 0;
}
]])],
[ AC_MSG_RESULT(yes)
has_sanitizefuzzer=yes],
[ AC_MSG_RESULT(no) ]
)
_AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
AC_LANG_POP()
])

AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])

# enable the running of unit tests
AC_ARG_ENABLE(unittests,
AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),[enable_unittests=$enableval],[enable_unittests=no])
Expand Down Expand Up @@ -2662,6 +2621,51 @@ fi
])
AC_SUBST(RUST_FEATURES)

AC_ARG_ENABLE(fuzztargets,
AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
AM_CONDITIONAL([RUST_BUILD_STD], [test "x$enable_fuzztargets" = "xyes" && echo "$rust_compiler_version" | grep -q nightly])
AC_PROG_CXX
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
AS_IF([test "x$CARGO_BUILD_TARGET" = "x" && echo "$rust_compiler_version" | grep -q nightly], [
CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu
AC_SUBST(CARGO_BUILD_TARGET)
])
AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled])
AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
CFLAGS_ORIG=$CFLAGS
CFLAGS="-Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
[AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
[])
CFLAGS=$CFLAGS_ORIG
AC_LANG_PUSH(C++)
tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
LIB_FUZZING_ENGINE=-fsanitize=fuzzer
AC_SUBST(LIB_FUZZING_ENGINE)
])
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
(void)Data;
(void)Size;
return 0;
}
]])],
[ AC_MSG_RESULT(yes)
has_sanitizefuzzer=yes],
[ AC_MSG_RESULT(no) ]
)
_AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
AC_LANG_POP()
])

AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])

# get revision
if test -f ./revision; then
REVISION=`cat ./revision`
Expand Down
6 changes: 3 additions & 3 deletions doc/userguide/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ EXTRA_DIST = \
what-is-suricata.rst

if HAVE_SURICATA_MAN
man1_MANS = suricata.1
dist_man1_MANS = suricata.1
endif

if HAVE_SPHINXBUILD
man1_MANS = suricata.1
dist_man1_MANS = suricata.1

if HAVE_PDFLATEX
EXTRA_DIST += $(man1_MANS) userguide.pdf
EXTRA_DIST += userguide.pdf
endif

SPHINX_BUILD = sphinx-build -q
Expand Down
19 changes: 17 additions & 2 deletions doc/userguide/partials/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,26 @@
.. option:: --set <key>=<value>

Set a configuration value. Useful for overriding basic
configuration parameters in the configuration. For example, to
change the default log directory::
configuration parameters. For example, to change the default log
directory::

--set default-log-dir=/var/tmp

This option cannot be used to add new entries to a list in the
configuration file, such as a new output. It can only be used to
modify a value in a list that already exists.

For example, to disable the ``eve-log`` in the default
configuration file::

--set outputs.1.eve-log.enabled=no

Also note that the index values may change as the ``suricata.yaml``
is updated.

See the output of ``--dump-config`` for existing values that could
be modified with their index.

.. option:: --engine-analysis

Print reports on analysis of different sections in the engine and
Expand Down
8 changes: 4 additions & 4 deletions rust/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ if HAVE_CARGO_VENDOR
EXTRA_DIST += vendor
endif

if RUST_BUILD_STD
RELEASE = -Z build-std
else
if !DEBUG
RELEASE = --release
endif

if RUST_BUILD_STD
NIGHTLY_ARGS = -Z build-std
endif

if HAVE_LUA
Expand Down Expand Up @@ -42,7 +42,7 @@ else
@rustup_home@ \
CARGO_HOME="$(CARGO_HOME)" \
CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \
$(CARGO) build $(RELEASE) \
$(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \
--features "$(RUST_FEATURES)" $(RUST_TARGET)
endif
$(MAKE) gen/rust-bindings.h
Expand Down
2 changes: 1 addition & 1 deletion src/output-json-alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ static void AlertAddFiles(const Packet *p, JsonBuilder *jb, const uint64_t tx_id
if (tx_id == file->txid) {
if (!isopen) {
isopen = true;
jb_open_array(jb, "fileinfo");
jb_open_array(jb, "files");
}
jb_start_object(jb);
EveFileInfo(jb, file, file->flags & FILE_STORED);
Expand Down
4 changes: 2 additions & 2 deletions src/output-json-anomaly.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ static int AnomalyDecodeEventJson(ThreadVars *tv, JsonAnomalyLogThread *aft,
return TM_ECODE_OK;
}

jb_open_object(js, ANOMALY_EVENT_TYPE);

if (is_ip_pkt) {
EveAddCommonOptions(&aft->json_output_ctx->cfg, p, p->flow, js);
}

jb_open_object(js, ANOMALY_EVENT_TYPE);

if (event_code < DECODE_EVENT_MAX) {
const char *event = DEvents[event_code].event_name;
if (EVENT_IS_DECODER_PACKET_ERROR(event_code)) {
Expand Down