]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix CFLAGS passing for new fuzzing tools
authorJouni Malinen <jouni@codeaurora.org>
Fri, 7 Jun 2019 20:57:02 +0000 (23:57 +0300)
committerJouni Malinen <jouni@codeaurora.org>
Tue, 11 Jun 2019 03:34:19 +0000 (06:34 +0300)
src/*/Makefile needs to allow additional CFLAGS values to be provided
from the calling Makefiles so that the clang command line arguments to
enable sanitizers consistently. In addition, it can be useful to be able
to provide CC, CFLAGS, and LDFLAGS from external setup while still
requesing LIBFUZZER=y build. Allow that by not overriding these
variables if they are already set.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/lib.rules
tests/fuzzing/rules.include

index 4ec4711e36acfa23b55ca8a10909a7f4be28c171..a46315442d2acde584aa268762c706b563c76745 100644 (file)
@@ -11,6 +11,7 @@ CFLAGS += -DCONFIG_NO_RANDOM_POOL
 CFLAGS += -DTEST_FUZZ
 endif
 
+CFLAGS += $(FUZZ_CFLAGS)
 CFLAGS += -I.. -I../utils
 
 
index 69548cd74a9d569476e99ab923e8f3d715fec61d..a3b0ee0aa3e176115dd2c47668fb1aedd430a038 100644 (file)
@@ -1,9 +1,21 @@
+FUZZ_CFLAGS =
+
+ifdef LIBFUZZER
+CC ?= clang
+#FUZZ_FLAGS ?= -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
+FUZZ_FLAGS ?= -fsanitize=fuzzer,address
+ifndef CFLAGS
+FUZZ_CFLAGS += $(FUZZ_FLAGS)
+endif
+endif
+
+FUZZ_CFLAGS += -DCONFIG_NO_RANDOM_POOL -DTEST_FUZZ
+export FUZZ_CFLAGS
+CFLAGS ?= -MMD -O2 -Wall -g
+CFLAGS += $(FUZZ_CFLAGS)
 ifdef LIBFUZZER
-CC=clang
-CFLAGS = -MMD -O2 -Wall -g
-CFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
 CFLAGS += -DTEST_LIBFUZZER
-LDFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow
+LDFLAGS += $(FUZZ_FLAGS)
 endif
 
 ifndef CC
@@ -14,13 +26,6 @@ ifndef LDO
 LDO=$(CC)
 endif
 
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-CFLAGS += -DCONFIG_NO_RANDOM_POOL
-CFLAGS += -DTEST_FUZZ
-
 WPAS_SRC=../../../wpa_supplicant
 SRC=../../../src
 
@@ -34,7 +39,7 @@ $(SRC)/common/libcommon.a:
        $(MAKE) -C $(SRC)/common
 
 $(SRC)/crypto/libcrypto.a:
-       $(MAKE) -C $(SRC)/crypto
+       $(MAKE) -C $(SRC)/crypto TEST_FUZZ=y
 
 $(SRC)/eapol_auth/libeapol_auth.a:
        $(MAKE) -C $(SRC)/eapol_auth