AFL icon indicating copy to clipboard operation
AFL copied to clipboard

afl-fuzz: Incorrectly detecting CPU frequency scaling governor

Open willmcpherson2 opened this issue 5 years ago • 1 comments

AFL version: 2.56b Command: afl-fuzz -i fuzz/ -o findings ./lang @@ OS: Manjaro Linux CPU: Intel Core i5-2400S CPU @ 2.50GHz

On running afl-fuzz I got this message:

Whoops, your system uses on-demand CPU frequency scaling, adjusted
between 1562 and 3222 MHz. Unfortunately, the scaling algorithm in the
kernel is imperfect and can miss the short-lived processes spawned by
afl-fuzz. To keep things moving, run these commands as root:

cd /sys/devices/system/cpu
echo performance | tee cpu*/cpufreq/scaling_governor

You can later go back to the original state by replacing 'performance' with
'ondemand'. If you don't want to change the settings, set AFL_SKIP_CPUFREQ
to make afl-fuzz skip this check - but expect some performance drop.

I followed the directions and fuzzed my program. But when I tried to revert the scaling governors, I got:

[root@will-mac cpu]# echo ondemand | tee cpu*/cpufreq/scaling_governor
ondemand
tee: cpu0/cpufreq/scaling_governor: Invalid argument
tee: cpu1/cpufreq/scaling_governor: Invalid argument
tee: cpu2/cpufreq/scaling_governor: Invalid argument
tee: cpu3/cpufreq/scaling_governor: Invalid argument

After some digging it seems that Sandy Bridge CPUs do not use ondemand. Arch Wiki Forum post I was able to successfully use powersave.

Perhaps the message printed by check_cpu_governor could include the existing value in /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor rather than always printing "on-demand". I would be happy to patch this myself if it is an acceptable solution.

willmcpherson2 avatar Nov 15 '19 12:11 willmcpherson2

@NikParam42 How does that relate to the CPU frequency scaling governor?

willmcpherson2 avatar Nov 18 '19 08:11 willmcpherson2