From 24dd35ef96ad1948132cee998d5e0909cfa2a5fc Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:05:07 +0100 Subject: macos ci --- test/test-llvm.sh | 10 +++++----- test/test-pre.sh | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test-llvm.sh b/test/test-llvm.sh index aa40c5ed..cb1849b1 100755 --- a/test/test-llvm.sh +++ b/test/test-llvm.sh @@ -68,24 +68,24 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && { ../afl-clang-fast -DTEST_SHARED_OBJECT=1 -z defs -fPIC -shared -o test-instr.so ../test-instr.c > /dev/null 2>&1 test -e test-instr.so && { $ECHO "$GREEN[+] llvm_mode shared object with -z defs compilation succeeded" - test `uname -s` = 'Linux' && LIBS=-ldl : + test `uname -s` = 'Linux' && LIBS=-ldl ../afl-clang-fast -o test-dlopen.plain test-dlopen.c ${LIBS} > /dev/null 2>&1 test -e test-dlopen.plain && { $ECHO "$GREEN[+] llvm_mode test-dlopen compilation succeeded" - echo 0 | TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ./test-dlopen.plain > /dev/null 2>&1 + echo 0 | DYLD_INSERT_LIBRARIES=./test-instr.so LD_PRELOAD=./test-instr.so TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ./test-dlopen.plain > /dev/null 2>&1 if [ $? -ne 0 ]; then $ECHO "$RED[!] llvm_mode test-dlopen exits with an error" CODE=1 fi - echo 0 | TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o test-dlopen.plain.0 -r -- ./test-dlopen.plain > /dev/null 2>&1 - TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o test-dlopen.plain.1 -r -- ./test-dlopen.plain < /dev/null > /dev/null 2>&1 + echo 0 | AFL_PRELOAD=./test-instr.so TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o test-dlopen.plain.0 -r -- ./test-dlopen.plain > /dev/null 2>&1 + AFL_PRELOAD=./test-instr.so TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o test-dlopen.plain.1 -r -- ./test-dlopen.plain < /dev/null > /dev/null 2>&1 test -e test-dlopen.plain.0 -a -e test-dlopen.plain.1 && { diff test-dlopen.plain.0 test-dlopen.plain.1 > /dev/null 2>&1 && { $ECHO "$RED[!] llvm_mode test-dlopen instrumentation should be different on different input but is not" CODE=1 } || { $ECHO "$GREEN[+] llvm_mode test-dlopen instrumentation present and working correctly" - TUPLES=`echo 0|TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-dlopen.plain 2>&1 | grep Captur | awk '{print$3}'` + TUPLES=`echo 0|AFL_PRELOAD=./test-instr.so TEST_DLOPEN_TARGET=./test-instr.so AFL_QUIET=1 ../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-dlopen.plain 2>&1 | grep Captur | awk '{print$3}'` test "$TUPLES" -gt 3 -a "$TUPLES" -lt 12 && { $ECHO "$GREEN[+] llvm_mode test-dlopen run reported $TUPLES instrumented locations which is fine" } || { diff --git a/test/test-pre.sh b/test/test-pre.sh index e12d95be..b8b286e5 100755 --- a/test/test-pre.sh +++ b/test/test-pre.sh @@ -105,14 +105,14 @@ test -n "$TRAVIS_OS_NAME" && { export ASAN_OPTIONS=detect_leaks=0:allocator_may_return_null=1:abort_on_error=1:symbolize=1 } -export AFL_LLVM_INSTRUMENT=AFL +#export AFL_LLVM_INSTRUMENT=AFL # AFL mode makes dlopen not link on macos # on OpenBSD we need to work with llvm from /usr/local/bin test -e /usr/local/bin/opt && { - export PATH="/usr/local/bin:${PATH}" + test `uname -s` = 'Darwin' || export PATH="/usr/local/bin:${PATH}" } # on MacOS X we prefer afl-clang over afl-gcc, because -# afl-gcc does not work there +# afl-gcc does not work there (it is a symlink from clang) test `uname -s` = 'Darwin' -o `uname -s` = 'FreeBSD' && { AFL_GCC=afl-clang } || { -- cgit 1.4.1 From 8521eb841364a06914b3ea7d8090b69d9de1dcd4 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:15:53 +0100 Subject: debug ci --- .github/workflows/ci.yml | 2 -- test/test-basic.sh | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23afc8f3..120c5afb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,6 @@ jobs: - uses: actions/checkout@v2 - name: install run: brew install make gcc - - name: debug - run: ls -l /usr/local/bin/g* - name: fix install run: cd /usr/local/bin; ln -s gcc-11 gcc; ln -s g++-11 g++; which gcc; gcc -v - name: build diff --git a/test/test-basic.sh b/test/test-basic.sh index c39faa74..393e47ea 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -48,6 +48,8 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc $ECHO "$GREEN[+] ${AFL_GCC} hardened mode succeeded and is working" } || { $ECHO "$RED[!] ${AFL_GCC} hardened mode is not hardened" + env | egrep 'AFL|PATH|LLVM' + AFL_DEBUG=1 AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c CODE=1 } rm -f test-compcov.harden -- cgit 1.4.1 From 649076600dc1db265de43c3bc2d7a3bcf0aa4b5c Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:24:03 +0100 Subject: debug ci --- test/test-basic.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/test-basic.sh b/test/test-basic.sh index 393e47ea..c87239d9 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -50,6 +50,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc $ECHO "$RED[!] ${AFL_GCC} hardened mode is not hardened" env | egrep 'AFL|PATH|LLVM' AFL_DEBUG=1 AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c + grep -Eqa 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden && echo found CODE=1 } rm -f test-compcov.harden -- cgit 1.4.1 From 146eb32c3116cac81870b99750306a6df5e8061c Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:49:31 +0100 Subject: make tests working on macos --- test/test-basic.sh | 2 +- test/test-gcc-plugin.sh | 2 +- test/test-llvm.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test-basic.sh b/test/test-basic.sh index c87239d9..ef6c9bb5 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -162,7 +162,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CODE=1 } test -e test-compcov.harden && { - grep -Eq$GREPAOPTION 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden > /dev/null 2>&1 && { + nm test-compcov.harden | grep -Eq 'stack_chk_fail|fstack-protector-all|fortified' > /dev/null 2>&1 && { $ECHO "$GREEN[+] ${AFL_GCC} hardened mode succeeded and is working" } || { $ECHO "$RED[!] ${AFL_GCC} hardened mode is not hardened" diff --git a/test/test-gcc-plugin.sh b/test/test-gcc-plugin.sh index 50d83e40..95ae9c47 100755 --- a/test/test-gcc-plugin.sh +++ b/test/test-gcc-plugin.sh @@ -40,7 +40,7 @@ test -e ../afl-gcc-fast -a -e ../afl-compiler-rt.o && { } test -e test-compcov.harden.gccpi && test_compcov_binary_functionality ./test-compcov.harden.gccpi && { - grep -Eq$GREPAOPTION 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden.gccpi > /dev/null 2>&1 && { + nm test-compcov.harden.gccpi | grep -Eq 'stack_chk_fail|fstack-protector-all|fortified' > /dev/null 2>&1 && { $ECHO "$GREEN[+] gcc_plugin hardened mode succeeded and is working" } || { $ECHO "$RED[!] gcc_plugin hardened mode is not hardened" diff --git a/test/test-llvm.sh b/test/test-llvm.sh index cb1849b1..ddbee378 100755 --- a/test/test-llvm.sh +++ b/test/test-llvm.sh @@ -110,7 +110,7 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && { CODE=1 } test -e test-compcov.harden && test_compcov_binary_functionality ./test-compcov.harden && { - grep -Eq$GREPAOPTION 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden > /dev/null 2>&1 && { + nm test-compcov.harden | grep -Eq 'stack_chk_fail|fstack-protector-all|fortified' > /dev/null 2>&1 && { $ECHO "$GREEN[+] llvm_mode hardened mode succeeded and is working" } || { $ECHO "$RED[!] llvm_mode hardened mode is not hardened" -- cgit 1.4.1 From 2d9e0f56b05e05ef7a485ccca95753a686535fb6 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:54:19 +0100 Subject: debug ci --- test/test-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-basic.sh b/test/test-basic.sh index ef6c9bb5..2c8ea122 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -50,7 +50,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc $ECHO "$RED[!] ${AFL_GCC} hardened mode is not hardened" env | egrep 'AFL|PATH|LLVM' AFL_DEBUG=1 AFL_HARDEN=1 ../${AFL_GCC} -o test-compcov.harden test-compcov.c - grep -Eqa 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden && echo found + nm test-compcov.harden CODE=1 } rm -f test-compcov.harden -- cgit 1.4.1 From a91d445b5f89175ab3e7fd183a46c23011d2e1bc Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 26 Dec 2021 01:55:52 +0100 Subject: make tests working on macos --- test/test-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-basic.sh b/test/test-basic.sh index 2c8ea122..bec42b4d 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -44,7 +44,7 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CODE=1 } test -e test-compcov.harden && { - grep -Eq$GREPAOPTION 'stack_chk_fail|fstack-protector-all|fortified' test-compcov.harden > /dev/null 2>&1 && { + nm test-compcov.harden | grep -Eq 'stack_chk_fail|fstack-protector-all|fortified' > /dev/null 2>&1 && { $ECHO "$GREEN[+] ${AFL_GCC} hardened mode succeeded and is working" } || { $ECHO "$RED[!] ${AFL_GCC} hardened mode is not hardened" -- cgit 1.4.1