In this section, we highlight some common problems users may face when running Magma or integrating with it. Make sure to check out the FAQ section in case your question is answered there.
workdir/ar/fuzzer/target/program/run/log. It is likely that AFL (and AFL-based fuzzers) are terminating early due to the
Pipe at the beginning of 'core_pattern'error. To fix that:
sudo bash -c 'echo core > /proc/sys/kernel/core_pattern'
rm: cannot remove 'cache': Device or resource busywhen deleting the work directory.
captain/run.shscript does not currently implement an exit handler for cleanup. When it is terminated prematurely (through
Ctrl-Cor a runtime error), it may not unmount the
workdir/cachedirectory automatically. To fix that, just unmount it manually before attempting to remove it:
sudo umount /path/to/workdir/cache rm -r /path/to/workdir/cache
level=error msg="can't add file ... to tar"when building a Magma image.
When building a Docker image, the context of the image is sent to the Docker daemon. In Magma, the context is the root directory of the project, and everything in it and its subdirectories. If your
WORKDIR points somewhere within the context, and if your workdir is not empty, then it will be copied over to the Docker daemon. This may be the root of the issue.
To fix it, move your working directory somewhere outside the project hierarchy, and re-assign your
WORKDIR parameter to point to it.
groupadd: GID '0' already existswhen building a Magma image.
captain/build.shscript as the
rootuser. One reason to do that may be that your normal user account does not have the proper permissions to launch
docker. To fix that, add your current user to the
sudo usermod -aG docker $USER newgrp docker # OR logout and log back in
magma/run.shscript performs a seed pruning phase before launching every campaign, to make sure that no seeds trigger any bugs or crash the target program. If the seed corpus is empty, it means the pruning stage detected all seeds as crashing, and it is more likely that the compiled program just crashes on launch, regardless of the input file. Verify that the compilation process is not flawed and test your target program manually inside the container.
can't find file to patchOR
Hunk #NNN FAILED at MMM
<optimized out>even after I added
-O0 -g -ggdbto the compile flags.
This may be due to AFL's compiler implicitly optimizing the target. From AFL's environment variables document:
By default, the wrapper appends -O3 to optimize builds. Very rarely, this will cause problems in programs built with -Werror, simply because -O3 enables more thorough code analysis and can spew out additional warnings. To disable optimizations, set AFL_DONT_OPTIMIZE.
export AFL_DONT_OPTIMIZE=1 before launching the compiler should do the trick.