cpu scaling updated for newer kernels
MODIFY
afl-fuzz.c
afl-fuzz.c
@@ -11531,8 +11531,22 @@ static void check_cpu_governor(void) {
if (getenv("AFL_SKIP_CPUFREQ")) return;
+ if (cpu_aff > 0)
+ snprintf(tmp, sizeof(tmp), "%s%d%s", "/sys/devices/system/cpu/cpu", cpu_aff, "/cpufreq/scaling_governor");
+ else
+ snprintf(tmp, sizeof(tmp), "%s", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "r");
- if (!f) return;
+ if (!f) {
+ if (cpu_aff > 0)
+ snprintf(tmp, sizeof(tmp), "%s%d%s", "/sys/devices/system/cpu/cpufreq/policy", cpu_aff, "/scaling_governor");
+ else
+ snprintf(tmp, sizeof(tmp), "%s", "/sys/devices/system/cpu/cpufreq/policy0/scaling_governor");
+ f = fopen(tmp, "r");
+ }
+ if (!f) {
+ WARNF("Could not check CPU scaling governor");
+ return;
+ }
ACTF("Checking CPU scaling governor...");
@@ -12160,13 +12174,11 @@ int main(int argc, char** argv) {
if (g_now > g_max) g_now = 0;
w_now = (w_init - w_end)*(g_max - g_now) / (g_max)+w_end;
- for (tmp_swarm = 0; tmp_swarm < swarm_num; tmp_swarm++)
- {
+ for (tmp_swarm = 0; tmp_swarm < swarm_num; tmp_swarm++) {
double total_puppet_temp = 0.0;
swarm_fitness[tmp_swarm] = 0.0;
- for (i = 0; i < operator_num; i++)
- {
+ for (i = 0; i < operator_num; i++) {
stage_finds_puppet[tmp_swarm][i] = 0;
probability_now[tmp_swarm][i] = 0.0;
x_now[tmp_swarm][i] = ((double)(random() % 7000)*0.0001 + 0.1);
@@ -12186,8 +12198,7 @@ int main(int argc, char** argv) {
double x_temp = 0.0;
- for (i = 0; i < operator_num; i++)
- {
+ for (i = 0; i < operator_num; i++) {
probability_now[tmp_swarm][i] = 0.0;
v_now[tmp_swarm][i] = w_now * v_now[tmp_swarm][i] + RAND_C * (L_best[tmp_swarm][i] - x_now[tmp_swarm][i]) + RAND_C * (G_best[i] - x_now[tmp_swarm][i]);
@@ -12201,8 +12212,7 @@ int main(int argc, char** argv) {
x_temp += x_now[tmp_swarm][i];
}
- for (i = 0; i < operator_num; i++)
- {
+ for (i = 0; i < operator_num; i++) {
x_now[tmp_swarm][i] = x_now[tmp_swarm][i] / x_temp;
if (likely(i != 0))
probability_now[tmp_swarm][i] = probability_now[tmp_swarm][i - 1] + x_now[tmp_swarm][i];

MODIFY
afl-gcc.c
afl-gcc.c
@@ -308,11 +308,10 @@ int main(int argc, char** argv) {
if (isatty(2) && !getenv("AFL_QUIET")) {
SAYF(cCYA "afl-cc" VERSION cRST " by <lcamtuf@google.com>\n");
+ SAYF(cYEL "[!] " cBRI "WARNING: " cRST "afl-gcc is deprecated, gcc_plugin is faster, llvm_mode even faster\n");
} else be_quiet = 1;
- SAYF(cYEL "[!] " cBRI "WARNING: " cRST "afl-gcc is deprecated, gcc_plugin is faster, llvm_mode even faster\n");
-
if (argc < 2) {
SAYF("\n"

MODIFY
afl-system-config
afl-system-config
@@ -7,8 +7,11 @@ sysctl -w kernel.sched_autogroup_enabled=1
sysctl -w kernel.sched_migration_cost_ns=50000000
sysctl -w kernel.sched_latency_ns=250000000
echo never > /sys/kernel/mm/transparent_hugepage/enabled
-echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor > /dev/null
+test -e /sys/devices/system/cpu/cpufreq/scaling_governor && echo performance | tee /sys/devices/system/cpu/cpufreq/scaling_governor
+test -e /sys/devices/system/cpu/cpufreq/policy0/scaling_governor && echo performance | tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor
+test -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor && echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
test -e /sys/devices/system/cpu/intel_pstate/no_turbo && echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
+test -e /sys/devices/system/cpu/cpufreq/boost && echo 1 > /sys/devices/system/cpu/cpufreq/boost
echo
echo It is recommended to boot the kernel with lots of security off - if you are running a machine that is in a secured network - so set this:
echo '/etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT="ibpb=off ibrs=off kpti=off l1tf=off mds=off mitigations=off no_stf_barrier noibpb noibrs nopcid nopti nospec_store_bypass_disable nospectre_v1 nospectre_v2 pcid=off pti=off spec_store_bypass_disable=off spectre_v2=off stf_barrier=off"'

MODIFY
docs/ChangeLog
docs/ChangeLog
@@ -17,7 +17,9 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
Version ++2.52d (tbd):
-----------------------------
- - Using the old ineffective afl-gcc will now show a deprecation warning
+ - updated afl-fuzz and afl-system-config for new scaling governor location
+ in modern kernels
+ - using the old ineffective afl-gcc will now show a deprecation warning
- all queue, hang and crash files now have their discovery time in their name
- if llvm_mode was compiled, afl-clang/afl-clang++ will point to these
instead of afl-gcc

cpu scaling updated for newer kernels