Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

afl-fuzz: Incorrectly detecting CPU frequency scaling governor #50

@willmcpherson2

Description

@willmcpherson2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions