User: Added sydr-fuzz target, which uses Sydr tool
.DEFAULT_GOAL := all
+.ONESHELL:
+
LCOV ?= lcov
GENHTML ?= genhtml
CC ?= gcc
@@ -115,6 +117,11 @@ else
STRIPFLAGS ?= -x
endif
+ifeq ($(SYDR),1)
+ SUFFIX := _SYDR$(SUFFIX)
+ OUT_SUFFIX := _SYDR
+endif
+
#
# Search Paths.
#
@@ -233,7 +240,7 @@ OBJS += UserFile.o UserPseudoRandom.o
# Directory where objects will be produced.
# As well, OBJS will be prepended with actual paths.
#
-OUT_DIR := $(DIST)_$(UDK_ARCH)
+OUT_DIR := $(DIST)_$(UDK_ARCH)$(OUT_SUFFIX)
OBJS := $(addprefix $(OUT_DIR)/,$(OBJS))
$(OUT_DIR)/%.o: %.c
@@ -254,6 +261,22 @@ fuzz: $(PRODUCT) FORCE
@$(MKDIR) FUZZDICT
UBSAN_OPTIONS='halt_on_error=1' ./$(PRODUCT) -jobs=$(FUZZ_JOBS) -workers=$(FUZZ_JOBS) -rss_limit_mb=$(FUZZ_MEM) FUZZDICT
+sydr-fuzz: $(PROJECT)$(SUFFIX) $(PROJECT)_SYDR$(SUFFIX) FORCE
+ @rm -rf sydr-work sydr-fuzz.log
+ @cat <<- EOF > sydr-fuzz.toml
+ exit-on-time = 7200
+
+ [sydr]
+ args = "--invert-n 2048 -j 4"
+ target = "$(PROJECT)_SYDR$(SUFFIX) @@"
+ jobs = 1
+
+ [libfuzzer]
+ path = "$(PROJECT)$(SUFFIX)"
+ args = "-jobs=4 -workers=4 -rss_limit_mb=4096 FUZZDICT"
+ EOF
+ sydr-fuzz run -l debug
+
coverage: $(PRODUCT) FORCE
@$(LCOV) --version
@rm -rf COVERAGE
