Add basic fuzzing with afl++
This commit is contained in:
parent
df948b18c6
commit
55f6dff543
16
Makefile
16
Makefile
@ -1,4 +1,4 @@
|
|||||||
.PHONY: all clean clean-objects run sanitize validate
|
.PHONY: all clean clean-objects clean-reports run sanitize validate fuzz
|
||||||
|
|
||||||
CC=clang
|
CC=clang
|
||||||
LD=clang
|
LD=clang
|
||||||
@ -9,8 +9,8 @@ SOURCES = $(shell find src/ -type f -name '*.c')
|
|||||||
OBJECTS = $(SOURCES:.c=.o)
|
OBJECTS = $(SOURCES:.c=.o)
|
||||||
DEPENDENCIES = $(SOURCES:.c=.d)
|
DEPENDENCIES = $(SOURCES:.c=.d)
|
||||||
TARGET?=oas
|
TARGET?=oas
|
||||||
OUTPUTS=oas oas-asan oas-msan
|
OUTPUTS=oas oas-asan oas-msan oas-afl
|
||||||
RUNARGUMENTS=-tokens test.asm
|
RUNARGUMENTS?=-tokens tests/input/valid.asm
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
@ -18,6 +18,12 @@ all: $(TARGET)
|
|||||||
run: $(TARGET)
|
run: $(TARGET)
|
||||||
./$(TARGET) $(RUNARGUMENTS)
|
./$(TARGET) $(RUNARGUMENTS)
|
||||||
|
|
||||||
|
fuzz:
|
||||||
|
make CC="afl-clang-fast" LD="afl-clang-fast" TARGET="oas-afl" clean-objects all
|
||||||
|
make clean-objects
|
||||||
|
mkdir -p reports/afl
|
||||||
|
afl-fuzz -i tests/input -o reports/afl -m none -- ./oas-afl -tokens @@
|
||||||
|
|
||||||
sanitize:
|
sanitize:
|
||||||
make CFLAGS="$(CFLAGS) -fsanitize=address,undefined" LDFLAGS="-fsanitize=address,undefined" TARGET="oas-asan" clean-objects all
|
make CFLAGS="$(CFLAGS) -fsanitize=address,undefined" LDFLAGS="-fsanitize=address,undefined" TARGET="oas-asan" clean-objects all
|
||||||
make CFLAGS="$(CFLAGS) -fsanitize=memory -fsanitize-memory-track-origins=2" LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" TARGET="oas-msan" clean-objects all
|
make CFLAGS="$(CFLAGS) -fsanitize=memory -fsanitize-memory-track-origins=2" LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" TARGET="oas-msan" clean-objects all
|
||||||
@ -37,6 +43,8 @@ $(TARGET): $(OBJECTS)
|
|||||||
clean-objects:
|
clean-objects:
|
||||||
rm -f $(OBJECTS) $(DEPENDENCIES)
|
rm -f $(OBJECTS) $(DEPENDENCIES)
|
||||||
|
|
||||||
|
clean-reports:
|
||||||
|
rm -rf reports/
|
||||||
|
|
||||||
clean: clean-objects
|
clean: clean-objects
|
||||||
rm -f $(TARGET) $(OUTPUTS)
|
rm -f $(TARGET) $(OUTPUTS)
|
||||||
rm -rf reports/
|
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Start with static analysis
|
# Start with static analysis
|
||||||
scan-build -o reports/ -plist-html --status-bugs make clean all
|
make clean all
|
||||||
|
mkdir -p reports/static-analysis
|
||||||
|
scan-build -o reports/static-analysis/ -plist-html --status-bugs make all
|
||||||
|
|
||||||
# Run the sanitizer builds and valgrind
|
# Run the sanitizer builds and valgrind
|
||||||
make clean sanitize all
|
make clean sanitize all
|
||||||
|
Loading…
x
Reference in New Issue
Block a user