Skip to content

Commit 4697e4a

Browse files
committed
description for AFL_MAX_DET_EXTRAS added
2 parents 92b1f9c + bbf0020 commit 4697e4a

File tree

20 files changed

+128
-90
lines changed

20 files changed

+128
-90
lines changed

GNUmakefile

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ BIN_PATH = $(PREFIX)/bin
2424
HELPER_PATH = $(PREFIX)/lib/afl
2525
DOC_PATH = $(PREFIX)/share/doc/afl
2626
MISC_PATH = $(PREFIX)/share/afl
27-
MAN_PATH = $(PREFIX)/man/man8
27+
MAN_PATH = $(PREFIX)/share/man/man8
2828

2929
PROGNAME = afl
3030
VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
@@ -33,7 +33,7 @@ VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f
3333

3434
PROGS = afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
3535
SH_PROGS = afl-plot afl-cmin afl-cmin.bash afl-whatsup afl-system-config
36-
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) afl-as.8
36+
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) afl-as.8 afl-g++.8
3737
ASAN_OPTIONS=detect_leaks=0
3838

3939
ifeq "$(findstring android, $(shell $(CC) --version 2>/dev/null))" ""
@@ -62,7 +62,10 @@ ifneq "$(shell uname)" "Darwin"
6262
endif
6363
endif
6464
# OS X does not like _FORTIFY_SOURCE=2
65-
CFLAGS_OPT += -D_FORTIFY_SOURCE=2
65+
# _FORTIFY_SOURCE=2 does not like -O0
66+
ifndef DEBUG
67+
CFLAGS_OPT += -D_FORTIFY_SOURCE=2
68+
endif
6669
endif
6770

6871
ifeq "$(shell uname)" "SunOS"
@@ -204,7 +207,10 @@ else
204207
endif
205208

206209
ifneq "$(filter Linux GNU%,$(shell uname))" ""
210+
# _FORTIFY_SOURCE=2 does not like -O0
211+
ifndef DEBUG
207212
override CFLAGS += -D_FORTIFY_SOURCE=2
213+
endif
208214
LDFLAGS += -ldl -lrt
209215
endif
210216

@@ -368,78 +374,78 @@ ready:
368374
@echo "[+] Everything seems to be working, ready to compile."
369375

370376
afl-gcc: src/afl-gcc.c $(COMM_HDR) | test_x86
371-
$(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS)
377+
$(CC) $(CFLAGS) $(CPPFLAGS) src/$@.c -o $@ $(LDFLAGS)
372378
set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $$i; done
373379

374380
afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86
375-
$(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS)
381+
$(CC) $(CFLAGS) $(CPPFLAGS) src/$@.c -o $@ $(LDFLAGS)
376382
ln -sf afl-as as
377383

378384
src/afl-performance.o : $(COMM_HDR) src/afl-performance.c include/hash.h
379-
$(CC) -Iinclude $(SPECIAL_PERFORMANCE) -O3 -fno-unroll-loops -c src/afl-performance.c -o src/afl-performance.o
385+
$(CC) $(CFLAGS) $(CPPFLAGS) -Iinclude $(SPECIAL_PERFORMANCE) -O3 -fno-unroll-loops -c src/afl-performance.c -o src/afl-performance.o
380386

381387
src/afl-common.o : $(COMM_HDR) src/afl-common.c include/common.h
382-
$(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-common.c -o src/afl-common.o
388+
$(CC) $(CFLAGS) $(CFLAGS_FLTO) $(CPPFLAGS) -c src/afl-common.c -o src/afl-common.o
383389

384390
src/afl-forkserver.o : $(COMM_HDR) src/afl-forkserver.c include/forkserver.h
385-
$(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-forkserver.c -o src/afl-forkserver.o
391+
$(CC) $(CFLAGS) $(CFLAGS_FLTO) $(CPPFLAGS) -c src/afl-forkserver.c -o src/afl-forkserver.o
386392

387393
src/afl-sharedmem.o : $(COMM_HDR) src/afl-sharedmem.c include/sharedmem.h
388-
$(CC) $(CFLAGS) $(CFLAGS_FLTO) -c src/afl-sharedmem.c -o src/afl-sharedmem.o
394+
$(CC) $(CFLAGS) $(CFLAGS_FLTO) $(CPPFLAGS) -c src/afl-sharedmem.c -o src/afl-sharedmem.o
389395

390396
afl-fuzz: $(COMM_HDR) include/afl-fuzz.h $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o | test_x86
391-
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o $@ $(PYFLAGS) $(LDFLAGS)
397+
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) $(CPPFLAGS) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o $@ $(PYFLAGS) $(LDFLAGS)
392398

393399
afl-showmap: src/afl-showmap.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o $(COMM_HDR) | test_x86
394-
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o -o $@ $(LDFLAGS)
400+
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(CPPFLAGS) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o -o $@ $(LDFLAGS)
395401

396402
afl-tmin: src/afl-tmin.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o $(COMM_HDR) | test_x86
397-
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o $@ $(LDFLAGS)
403+
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(CPPFLAGS) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o $@ $(LDFLAGS)
398404

399405
afl-analyze: src/afl-analyze.c src/afl-common.o src/afl-sharedmem.o src/afl-performance.o $(COMM_HDR) | test_x86
400-
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-performance.o -o $@ $(LDFLAGS)
406+
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(CPPFLAGS) src/$@.c src/afl-common.o src/afl-sharedmem.o src/afl-performance.o -o $@ $(LDFLAGS)
401407

402408
afl-gotcpu: src/afl-gotcpu.c src/afl-common.o $(COMM_HDR) | test_x86
403-
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) src/$@.c src/afl-common.o -o $@ $(LDFLAGS)
409+
$(CC) $(CFLAGS) $(COMPILE_STATIC) $(CFLAGS_FLTO) $(CPPFLAGS) src/$@.c src/afl-common.o -o $@ $(LDFLAGS)
404410

405411

406412
# document all mutations and only do one run (use with only one input file!)
407413
document: $(COMM_HDR) include/afl-fuzz.h $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-performance.o | test_x86
408-
$(CC) -D_DEBUG=\"1\" -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.c src/afl-performance.o -o afl-fuzz-document $(PYFLAGS) $(LDFLAGS)
414+
$(CC) -D_DEBUG=\"1\" -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) $(CPPFLAGS) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.c src/afl-performance.o -o afl-fuzz-document $(PYFLAGS) $(LDFLAGS)
409415

410416
test/unittests/unit_maybe_alloc.o : $(COMM_HDR) include/alloc-inl.h test/unittests/unit_maybe_alloc.c $(AFL_FUZZ_FILES)
411-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -c test/unittests/unit_maybe_alloc.c -o test/unittests/unit_maybe_alloc.o
417+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -c test/unittests/unit_maybe_alloc.c -o test/unittests/unit_maybe_alloc.o
412418

413419
unit_maybe_alloc: test/unittests/unit_maybe_alloc.o
414-
@$(CC) $(CFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_maybe_alloc.o -o test/unittests/unit_maybe_alloc $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
420+
@$(CC) $(CFLAGS) $(CPPFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_maybe_alloc.o -o test/unittests/unit_maybe_alloc $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
415421
./test/unittests/unit_maybe_alloc
416422

417423
test/unittests/unit_hash.o : $(COMM_HDR) include/alloc-inl.h test/unittests/unit_hash.c $(AFL_FUZZ_FILES) src/afl-performance.o
418-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -c test/unittests/unit_hash.c -o test/unittests/unit_hash.o
424+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -c test/unittests/unit_hash.c -o test/unittests/unit_hash.o
419425

420426
unit_hash: test/unittests/unit_hash.o src/afl-performance.o
421-
@$(CC) $(CFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf $^ -o test/unittests/unit_hash $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
427+
@$(CC) $(CFLAGS) $(CPPFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf $^ -o test/unittests/unit_hash $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
422428
./test/unittests/unit_hash
423429

424430
test/unittests/unit_rand.o : $(COMM_HDR) include/alloc-inl.h test/unittests/unit_rand.c $(AFL_FUZZ_FILES) src/afl-performance.o
425-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -c test/unittests/unit_rand.c -o test/unittests/unit_rand.o
431+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -c test/unittests/unit_rand.c -o test/unittests/unit_rand.o
426432

427433
unit_rand: test/unittests/unit_rand.o src/afl-common.o src/afl-performance.o
428-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf $^ -o test/unittests/unit_rand $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
434+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf $^ -o test/unittests/unit_rand $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
429435
./test/unittests/unit_rand
430436

431437
test/unittests/unit_list.o : $(COMM_HDR) include/list.h test/unittests/unit_list.c $(AFL_FUZZ_FILES)
432-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -c test/unittests/unit_list.c -o test/unittests/unit_list.o
438+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -c test/unittests/unit_list.c -o test/unittests/unit_list.o
433439

434440
unit_list: test/unittests/unit_list.o
435-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_list.o -o test/unittests/unit_list $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
441+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_list.o -o test/unittests/unit_list $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
436442
./test/unittests/unit_list
437443

438444
test/unittests/unit_preallocable.o : $(COMM_HDR) include/alloc-inl.h test/unittests/unit_preallocable.c $(AFL_FUZZ_FILES)
439-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -c test/unittests/unit_preallocable.c -o test/unittests/unit_preallocable.o
445+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -c test/unittests/unit_preallocable.c -o test/unittests/unit_preallocable.o
440446

441447
unit_preallocable: test/unittests/unit_preallocable.o
442-
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_preallocable.o -o test/unittests/unit_preallocable $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
448+
@$(CC) $(CFLAGS) $(ASAN_CFLAGS) $(CPPFLAGS) -Wl,--wrap=exit -Wl,--wrap=printf test/unittests/unit_preallocable.o -o test/unittests/unit_preallocable $(LDFLAGS) $(ASAN_LDFLAGS) -lcmocka
443449
./test/unittests/unit_preallocable
444450

445451
unit_clean:
@@ -566,7 +572,8 @@ source-only: all
566572
%.8: %
567573
@echo .TH $* 8 $(BUILD_DATE) "afl++" > $@
568574
@echo .SH NAME >> $@
569-
@echo .B $* >> $@
575+
@echo -n ".B $* \- " >> $@
576+
@./$* -h 2>&1 | head -n 1 | sed -e "s/$$(printf '\e')[^m]*m//g" >> $@
570577
@echo >> $@
571578
@echo .SH SYNOPSIS >> $@
572579
@./$* -h 2>&1 | head -n 3 | tail -n 1 | sed 's/^\.\///' >> $@

TODO.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# TODO list for AFL++
22

3-
## Roadmap 2.67+
3+
## Roadmap 2.68+
44

55
- AFL_MAP_SIZE for qemu_mode and unicorn_mode
66
- CPU affinity for many cores? There seems to be an issue > 96 cores
77
- afl-plot to support multiple plot_data
8+
- afl_custom_fuzz_splice_optin()
9+
- intel-pt tracer
10+
- honor -O flags and -fno-unroll-loops in afl-cc
811

912
## Further down the road
1013

custom_mutators/radamsa/GNUmakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ libradamsa.a: libradamsa.c radamsa.h
1515
@echo " ***************************************************************"
1616
@echo " * Compiling libradamsa, wait some minutes (~3 on modern CPUs) *"
1717
@echo " ***************************************************************"
18-
$(CC) -fPIC $(CFLAGS) -I $(CUR_DIR) -o libradamsa.a -c libradamsa.c
18+
$(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -I $(CUR_DIR) -o libradamsa.a -c libradamsa.c
1919

2020
radamsa-mutator.so: radamsa-mutator.c libradamsa.a
21-
$(CC) $(CFLAGS) -g -I. -I../../include -shared -fPIC -c radamsa-mutator.c
22-
$(CC) $(CFLAGS) -shared -fPIC -o radamsa-mutator.so radamsa-mutator.o libradamsa.a
21+
$(CC) $(CFLAGS) $(CPPFLAGS) -g -I. -I../../include -shared -fPIC -c radamsa-mutator.c
22+
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC -o radamsa-mutator.so radamsa-mutator.o libradamsa.a
2323

2424
test: libradamsa.a libradamsa-test.c
25-
$(CC) $(CFLAGS) -I $(CUR_DIR) -o libradamsa-test libradamsa-test.c libradamsa.a
25+
$(CC) $(CFLAGS) $(CPPFLAGS) -I $(CUR_DIR) -o libradamsa-test libradamsa-test.c libradamsa.a
2626
./libradamsa-test libradamsa-test.c | grep "library test passed"
2727
rm /tmp/libradamsa-*.fuzz
2828

docs/Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ sending a mail to <[email protected]>.
416416
- big code refactoring:
417417
* all includes are now in include/
418418
* all afl sources are now in src/ - see src/README.md
419-
* afl-fuzz was splitted up in various individual files for including
419+
* afl-fuzz was split up in various individual files for including
420420
functionality in other programs (e.g. forkserver, memory map, etc.)
421421
for better readability.
422422
* new code indention everywhere

docs/env_variables.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ checks or alter some of the more exotic semantics of the tool:
384384
Note that this setting inhibits some of the user-friendly diagnostics
385385
normally done when starting up the forkserver and causes a pretty
386386
significant performance drop.
387+
388+
- Setting AFL_MAX_DET_EXTRAS changes the count of dictionary enties/extras
389+
(default 200), after which the entries will be used probabilistically.
390+
So, if the dict/extras file (`-x`) contains more tokens than this threshold,
391+
not all of the tokens will be used in each fuzzing step, every time.
392+
Instead, there is a chance that the entry will be skipped during fuzzing.
393+
This makes sure that the fuzzer doesn't spend all its time only inserting
394+
the extras, but will still do other mutations. However, it decreases the
395+
likelyhood for each token to be inserted, before the next queue entrie is fuzzed.
396+
Either way, all tokens will be used eventually, in a longer fuzzing campaign.
387397

388398
- Outdated environment variables that are that not supported anymore:
389399
AFL_DEFER_FORKSRV

gcc_plugin/GNUmakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PREFIX ?= /usr/local
2424
HELPER_PATH ?= $(PREFIX)/lib/afl
2525
BIN_PATH ?= $(PREFIX)/bin
2626
DOC_PATH ?= $(PREFIX)/share/doc/afl
27-
MAN_PATH ?= $(PREFIX)/man/man8
27+
MAN_PATH ?= $(PREFIX)/share/man/man8
2828

2929
VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
3030

@@ -111,21 +111,21 @@ test_deps:
111111
@echo "[+] All set and ready to build."
112112

113113
afl-common.o: ../src/afl-common.c
114-
$(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
114+
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
115115

116116
../afl-gcc-fast: afl-gcc-fast.c afl-common.o | test_deps
117-
$(CC) -DAFL_GCC_CC=\"$(CC)\" -DAFL_GCC_CXX=\"$(CXX)\" $(CFLAGS) $< afl-common.o -o $@ $(LDFLAGS)
117+
$(CC) -DAFL_GCC_CC=\"$(CC)\" -DAFL_GCC_CXX=\"$(CXX)\" $(CFLAGS) $(CPPFLAGS) $< afl-common.o -o $@ $(LDFLAGS)
118118
ln -sf afl-gcc-fast ../afl-g++-fast
119119

120120
../afl-gcc-pass.so: afl-gcc-pass.so.cc | test_deps
121121
$(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
122122

123123
../afl-gcc-rt.o: afl-gcc-rt.o.c | test_deps
124-
$(CC) $(CFLAGS_SAFE) -fPIC -c $< -o $@
124+
$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -fPIC -c $< -o $@
125125

126126
test_build: $(PROGS)
127127
@echo "[*] Testing the CC wrapper and instrumentation output..."
128-
unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ../afl-gcc-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS)
128+
unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ../afl-gcc-fast $(CFLAGS) $(CPPFLAGS) ../test-instr.c -o test-instr $(LDFLAGS)
129129
# unset AFL_USE_ASAN AFL_USE_MSAN; AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ../afl-gcc-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS)
130130
ASAN_OPTIONS=detect_leaks=0 ../afl-showmap -m none -q -o .test-instr0 ./test-instr </dev/null
131131
echo 1 | ASAN_OPTIONS=detect_leaks=0 ../afl-showmap -m none -q -o .test-instr1 ./test-instr

gcc_plugin/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PREFIX ?= /usr/local
2424
HELPER_PATH ?= $(PREFIX)/lib/afl
2525
BIN_PATH ?= $(PREFIX)/bin
2626
DOC_PATH ?= $(PREFIX)/share/doc/afl
27-
MAN_PATH ?= $(PREFIX)/man/man8
27+
MAN_PATH ?= $(PREFIX)/share/man/man8
2828

2929
VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
3030
VERSION:sh= grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2

include/afl-fuzz.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,13 +1027,17 @@ static inline u32 rand_below(afl_state_t *afl, u32 limit) {
10271027

10281028
}
10291029

1030-
/* Modulo is biased - we don't want our fuzzing to be biased so let's do it right, see
1031-
https://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator
1032-
*/
1033-
u64 unbiased_rnd;
1030+
/* Modulo is biased - we don't want our fuzzing to be biased so let's do it
1031+
right. See:
1032+
https://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator
1033+
*/
1034+
u64 unbiased_rnd;
10341035
do {
1036+
10351037
unbiased_rnd = rand_next(afl);
1038+
10361039
} while (unlikely(unbiased_rnd >= (UINT64_MAX - (UINT64_MAX % limit))));
1040+
10371041
return unbiased_rnd % limit;
10381042

10391043
}

libdislocator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ all: libdislocator.so
2828

2929
VPATH = ..
3030
libdislocator.so: libdislocator.so.c ../config.h
31-
$(CC) $(CFLAGS) -shared -fPIC libdislocator.so.c -o ../$@ $(LDFLAGS)
31+
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC libdislocator.so.c -o ../$@ $(LDFLAGS)
3232

3333
.NOTPARALLEL: clean
3434

libtokencap/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
PREFIX ?= /usr/local
1717
HELPER_PATH = $(PREFIX)/lib/afl
1818
DOC_PATH ?= $(PREFIX)/share/doc/afl
19-
MAN_PATH ?= $(PREFIX)/man/man8
19+
MAN_PATH ?= $(PREFIX)/share/man/man8
2020

2121
VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2)
2222

@@ -70,7 +70,7 @@ all: $(TARGETS)
7070

7171
VPATH = ..
7272
libtokencap.so: libtokencap.so.c ../config.h
73-
$(CC) $(CFLAGS) -shared -fPIC $< -o ../$@ $(LDFLAGS)
73+
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC $< -o ../$@ $(LDFLAGS)
7474

7575
.NOTPARALLEL: clean
7676

0 commit comments

Comments
 (0)