mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 11:28:08 +00:00
nyx test for CI
This commit is contained in:
@ -124,6 +124,9 @@ void bind_to_free_cpu(afl_state_t *afl) {
|
||||
}
|
||||
|
||||
WARNF("Not binding to a CPU core (AFL_NO_AFFINITY set).");
|
||||
#ifdef __linux__
|
||||
if (afl->fsrv.nyx_mode) { afl->fsrv.nyx_bind_cpu_id = 0; }
|
||||
#endif
|
||||
return;
|
||||
|
||||
}
|
||||
@ -151,6 +154,9 @@ void bind_to_free_cpu(afl_state_t *afl) {
|
||||
} else {
|
||||
|
||||
OKF("CPU binding request using -b %d successful.", afl->cpu_to_bind);
|
||||
#ifdef __linux__
|
||||
if (afl->fsrv.nyx_mode) { afl->fsrv.nyx_bind_cpu_id = afl->cpu_to_bind; }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -1915,6 +1915,15 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
bind_to_free_cpu(afl);
|
||||
#endif /* HAVE_AFFINITY */
|
||||
|
||||
#ifdef __linux__
|
||||
if (afl->fsrv.nyx_mode && afl->fsrv.nyx_bind_cpu_id == 0xFFFFFFFF) {
|
||||
|
||||
afl->fsrv.nyx_bind_cpu_id = 0;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__
|
||||
/* Prioritizes performance over power saving */
|
||||
set_scheduler_mode(SCHEDULER_MODE_LOW_LATENCY);
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
. ./test-frida-mode.sh
|
||||
|
||||
. ./test-nyx-mode.sh
|
||||
|
||||
. ./test-unicorn-mode.sh
|
||||
|
||||
. ./test-custom-mutators.sh
|
||||
|
69
test/test-nyx-mode.sh
Executable file
69
test/test-nyx-mode.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./test-pre.sh
|
||||
|
||||
$ECHO "$BLUE[*] Testing: nyx_mode"
|
||||
|
||||
test -e ../libnyx.so && {
|
||||
../afl-cc -o test-instr ../test-instr.c >/dev/null 2>&1
|
||||
test -e test-instr && {
|
||||
{
|
||||
rm -rf nyx-test in out
|
||||
$ECHO "$GREY[*] running nyx_packer"
|
||||
python3 ../nyx_mode/packer/packer/nyx_packer.py \
|
||||
./test-instr \
|
||||
nyx-test \
|
||||
afl \
|
||||
instrumentation \
|
||||
--fast_reload_mode \
|
||||
--purge > /dev/null 2>&1
|
||||
|
||||
test -e nyx-test/test-instr && {
|
||||
|
||||
$ECHO "$GREY[*] running nyx_config_gen"
|
||||
python3 ../nyx_mode/packer/packer/nyx_config_gen.py nyx-test Kernel > /dev/null 2>&1
|
||||
|
||||
test -e nyx-test/config.ron && {
|
||||
sudo modprobe -r kvm-intel
|
||||
sudo modprobe -r kvm
|
||||
sudo modprobe kvm enable_vmware_backdoor=y
|
||||
sudo modprobe kvm-intel
|
||||
#cat /sys/module/kvm/parameters/enable_vmware_backdoor
|
||||
|
||||
mkdir -p in
|
||||
echo 00000 > in/in
|
||||
$ECHO "$GREY[*] running afl-fuzz for nyx_mode, this will take approx 10 seconds"
|
||||
{
|
||||
AFL_DEBUG=1 ../afl-fuzz -i in -o out -V05 -X -- ./nyx-test >>errors 2>&1
|
||||
} >>errors 2>&1
|
||||
test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && {
|
||||
$ECHO "$GREEN[+] afl-fuzz is working correctly with nyx_mode"
|
||||
RUNTIME=`grep execs_done out/default/fuzzer_stats | awk '{print$3}'`
|
||||
rm -rf errors nyx-test test-instr in out
|
||||
} || {
|
||||
echo CUT------------------------------------------------------------------CUT
|
||||
cat errors
|
||||
echo CUT------------------------------------------------------------------CUT
|
||||
$ECHO "$RED[!] afl-fuzz is not working correctly with nyx_mode"
|
||||
CODE=1
|
||||
}
|
||||
} || {
|
||||
$ECHO "$RED[!] nyx_packer failed, likely install requirements not met."
|
||||
CODE=1
|
||||
}
|
||||
} || {
|
||||
$ECHO "$RED[!] nyx_packer failed, likely install requirements not met."
|
||||
CODE=1
|
||||
}
|
||||
#rm -rf test-instr in out errors nyx-test
|
||||
}
|
||||
} || {
|
||||
$ECHO "$RED[!] afl-cc compilation of test targets failed - what is going on??"
|
||||
CODE=1
|
||||
}
|
||||
} || {
|
||||
$ECHO "$YELLOW[-] nyx_mode is not compiled, cannot test"
|
||||
INCOMPLETE=1
|
||||
}
|
||||
|
||||
. ./test-post.sh
|
@ -20,7 +20,7 @@ echo foobar | grep -qE 'asd|oob' 2>/dev/null || { echo Error: grep command does
|
||||
test -e ./test-all.sh || cd $(dirname $0) || exit 1
|
||||
test -e ./test-all.sh || { echo Error: you must be in the test/ directory ; exit 1 ; }
|
||||
export AFL_PATH=`pwd`/..
|
||||
export AFL_NO_AFFINITY=1 # workaround for travis that fails for no avail cores
|
||||
export AFL_TRY_AFFINITY=1 # workaround for travis that fails for no avail cores
|
||||
|
||||
echo 1 > test.1
|
||||
echo 1 > test.2
|
||||
|
Reference in New Issue
Block a user