LAF_... -> AFL_LLVM_LAF_...
MODIFY
docs/ChangeLog
docs/ChangeLog
@@ -30,6 +30,8 @@ Version ++2.52d (tbd):
- added a -s seed switch to allow afl run with a fixed initial
seed that is not updated. this is good for performance and path discovery
tests as the random numbers are deterministic then
+ - llvm_mode LAF_... env variables can now be specified as AFL_LLVM_LAF_...
+ that is longer but in line with other llvm specific env vars
- ... your idea or patch?

MODIFY
docs/env_variables.txt
docs/env_variables.txt
@@ -89,11 +89,11 @@ Then there are a few specific features that are only available in llvm_mode:
This great feature will split compares to series of single byte comparisons
to allow afl-fuzz to find otherwise rather impossible paths.
- - Setting LAF_SPLIT_SWITCHES will split switch()es
+ - Setting AFL_LLVM_LAF_SPLIT_SWITCHES will split switch()es
- - Setting LAF_TRANSFORM_COMPARES will split string compare functions
+ - Setting AFL_LLVM_LAF_TRANSFORM_COMPARES will split string compare functions
- - Setting LAF_SPLIT_COMPARES will split > 8 bit CMP instructions
+ - Setting AFL_LLVM_LAF_SPLIT_COMPARES will split > 8 bit CMP instructions
See llvm_mode/README.laf-intel for more information.

MODIFY
llvm_mode/Makefile
llvm_mode/Makefile
@@ -110,7 +110,7 @@ endif
test_build: $(PROGS)
@echo "[*] Testing the CC wrapper and instrumentation output..."
- unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=$(CC) LAF_SPLIT_SWITCHES=1 LAF_TRANSFORM_COMPARES=1 LAF_SPLIT_COMPARES=1 ../afl-clang-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS)
+ unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; AFL_QUIET=1 AFL_PATH=. AFL_CC=$(CC) AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast $(CFLAGS) ../test-instr.c -o test-instr $(LDFLAGS)
echo 0 | ../afl-showmap -m none -q -o .test-instr0 ./test-instr
echo 1 | ../afl-showmap -m none -q -o .test-instr1 ./test-instr
@rm -f test-instr

MODIFY
llvm_mode/README.laf-intel
llvm_mode/README.laf-intel
@@ -8,13 +8,13 @@ compile the target project.
The following options exist:
-export LAF_SPLIT_SWITCHES=1 Enables the split-switches pass.
+export AFL_LLVM_LAF_SPLIT_SWITCHES=1 Enables the split-switches pass.
-export LAF_TRANSFORM_COMPARES=1 Enables the transform-compares pass
+export AFL_LLVM_LAF_TRANSFORM_COMPARES=1 Enables the transform-compares pass
(strcmp, memcmp, strncmp, strcasecmp, strncasecmp).
-export LAF_SPLIT_COMPARES=1 Enables the split-compares pass.
+export AFL_LLVM_LAF_SPLIT_COMPARES=1 Enables the split-compares pass.
By default it will split all compares with a bit width <= 64 bits.
You can change this behaviour by setting
- export LAF_SPLIT_COMPARES_BITW=<bit_width>.
+ export AFL_LLVM_LAF_SPLIT_COMPARES_BITW=<bit_width>.

MODIFY
llvm_mode/afl-clang-fast.c
llvm_mode/afl-clang-fast.c
@@ -120,21 +120,21 @@ static void edit_params(u32 argc, char** argv) {
http://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs-with-guards */
// laf
- if (getenv("LAF_SPLIT_SWITCHES")) {
+ if (getenv("LAF_SPLIT_SWITCHES")||getenv("AFL_LLVM_LAF_SPLIT_SWITCHES")) {
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = alloc_printf("%s/split-switches-pass.so", obj_path);
}
- if (getenv("LAF_TRANSFORM_COMPARES")) {
+ if (getenv("LAF_TRANSFORM_COMPARES")||getenv("AFL_LLVM_LAF_TRANSFORM_COMPARES")) {
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = alloc_printf("%s/compare-transform-pass.so", obj_path);
}
- if (getenv("LAF_SPLIT_COMPARES")) {
+ if (getenv("LAF_SPLIT_COMPARES")||getenv("AFL_LLVM_LAF_SPLIT_COMPARES")) {
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";

MODIFY
llvm_mode/split-compares-pass.so.cc
llvm_mode/split-compares-pass.so.cc
@@ -477,6 +477,8 @@ bool SplitComparesTransform::runOnModule(Module &M) {
int bitw = 64;
char* bitw_env = getenv("LAF_SPLIT_COMPARES_BITW");
+ if (!bitw_env)
+ bitw_env = getenv("AFL_LLVM_LAF_SPLIT_COMPARES_BITW");
if (bitw_env) {
bitw = atoi(bitw_env);
}

LAF_... -> AFL_LLVM_LAF_...