Skip to content

Commit b643fc1

Browse files
committed
1 parent 5dabddf commit b643fc1

File tree

6 files changed

+4585
-22
lines changed

6 files changed

+4585
-22
lines changed

src/main/c/yarp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ test.c
2222
a.out
2323

2424
/ext/yarp/api_node.c
25+
/fuzz/output/
2526
/include/yarp/ast.h
2627
/java/org/yarp/AbstractNodeVisitor.java
2728
/java/org/yarp/Loader.java

src/main/c/yarp/Makefile.in

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Q1 = $(V:1=)
66
Q = $(Q1:0=@)
77
ECHO1 = $(V:1=@ :)
88
ECHO = $(ECHO1:0=@ echo)
9+
FUZZ_OUTPUT_DIR = $(shell pwd)/fuzz/output
910

1011
SOEXT := $(shell ruby -e 'puts RbConfig::CONFIG["SOEXT"]')
1112

@@ -42,6 +43,32 @@ build/static/%.o: src/%.c Makefile $(HEADERS)
4243
$(Q) mkdir -p $(@D)
4344
$(Q) $(CC) $(DEBUG_FLAGS) -DYP_STATIC $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
4445

46+
build/fuzz.%: $(SOURCES) fuzz/%.c fuzz/fuzz.c
47+
$(ECHO) "building $* fuzzer"
48+
$(ECHO) "building main fuzz binary"
49+
$(Q) AFL_HARDEN=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^
50+
$(ECHO) "building cmplog binary"
51+
$(Q) AFL_HARDEN=1 AFL_LLVM_CMPLOG=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@.cmplog $^
52+
53+
build/fuzz.heisenbug.%: $(SOURCES) fuzz/%.c fuzz/heisenbug.c
54+
$(Q) AFL_HARDEN=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^
55+
56+
fuzz-debug:
57+
$(ECHO) "entering debug shell"
58+
$(Q) docker run -it --rm -e HISTFILE=/yarp/fuzz/output/.bash_history -v $(shell pwd):/yarp -v $(FUZZ_OUTPUT_DIR):/fuzz_output yarp/fuzz
59+
60+
fuzz-docker-build: fuzz/docker/Dockerfile
61+
$(ECHO) "building docker image"
62+
$(Q) docker build -t yarp/fuzz fuzz/docker/
63+
64+
fuzz-run-%: FORCE fuzz-docker-build
65+
$(ECHO) "running $* fuzzer"
66+
$(Q) docker run --rm -v $(shell pwd):/yarp yarp/fuzz /bin/bash -c "FUZZ_FLAGS=\"$(FUZZ_FLAGS)\" make build/fuzz.$*"
67+
$(ECHO) "starting AFL++ run"
68+
$(Q) mkdir -p $(FUZZ_OUTPUT_DIR)/$*
69+
$(Q) docker run -it --rm -v $(shell pwd):/yarp -v $(FUZZ_OUTPUT_DIR):/fuzz_output yarp/fuzz /bin/bash -c "./fuzz/$*.sh /fuzz_output/$*"
70+
FORCE:
71+
4572
clean:
4673
$(Q) rm -f -r build
4774

src/main/c/yarp/config.h.in

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* config.h.in. Generated from configure.ac by autoheader. */
2+
3+
/* Define to 1 if you have the `mmap' function. */
4+
#undef HAVE_MMAP
5+
6+
/* Define to 1 if you have the `snprintf' function. */
7+
#undef HAVE_SNPRINTF
8+
9+
/* Define to 1 if you have the `strncasecmp' function. */
10+
#undef HAVE_STRNCASECMP
11+
12+
/* Define to the address where bug reports for this package should be sent. */
13+
#undef PACKAGE_BUGREPORT
14+
15+
/* Define to the full name of this package. */
16+
#undef PACKAGE_NAME
17+
18+
/* Define to the full name and version of this package. */
19+
#undef PACKAGE_STRING
20+
21+
/* Define to the one symbol short name of this package. */
22+
#undef PACKAGE_TARNAME
23+
24+
/* Define to the home page for this package. */
25+
#undef PACKAGE_URL
26+
27+
/* Define to the version of this package. */
28+
#undef PACKAGE_VERSION
29+
30+
/* YP_VERSION */
31+
#undef YP_VERSION
32+
33+
/* YP_VERSION_MAJOR */
34+
#undef YP_VERSION_MAJOR
35+
36+
/* YP_VERSION_MINOR */
37+
#undef YP_VERSION_MINOR
38+
39+
/* YP_VERSION_PATCH */
40+
#undef YP_VERSION_PATCH
41+
42+
/* _XOPEN_SOURCE */
43+
#undef _XOPEN_SOURCE

0 commit comments

Comments
 (0)