Closed chrisruk closed 1 year ago
It looks like those errors are being caused by libFuzzer being linked as a shared library in Atheris, as opposed to being statically linked into the executable.
I'm not very familiar with ARM, so I don't know what would be needed to allow libFuzzer to be linked dynamically.
However, it's possible you can avoid this problem by linking libFuzzer directly into Python. Follow these instructions:
https://github.com/google/atheris/blob/master/native_extension_fuzzing.md#option-2-linking-libfuzzer-into-python
Then, modify Atheris' setup.py to remove the atheris.core_with_libfuzzer
extension (you want the atheris.core_without_libfuzzer
one) and remove everything in build_extensions()
after # Deploy versions of ASan and UBSan that have been merged with libFuzzer
.
Thanks for your help I read through the native extension doc and re-read the readme, and tried compiling llvm to see if that fixed my issue.
In case anyone else wants to install atheris on ARM/Raspberry Pi, I did -
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;compiler-rt' -G "Unix Makefiles" ../llvm
make -j 4 # This step is very slow
sudo make install
git clone https://github.com/google/atheris.git
cd atheris
CLANG_BIN="/usr/local/bin/clang" LIBFUZZER_LIB="/usr/local/lib/clang/16.0.0/lib/linux/libclang_rt.fuzzer_no_main-armhf.a" pip3 install .
When doing a simple test, I got -
ImportError: /home/pi/.local/lib/python3.9/site-packages/atheris/core_with_libfuzzer.cpython-39-arm-linux-gnueabihf.so: undefined symbol: __atomic_load_8
This could be fixed by doing -
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 python3.9 ex.py
Look forward to playing with atheris now!
Hey @chrisruk after following your instructions I'm running into an Illegal Instruction
error:
$ LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 python3.9 fuzz.py
INFO: Using built-in libfuzzer
Illegal instruction
Any idea on what is going wrong?
I'm using a Pi Zero armv6
with clang 13.0.1
.
Hi,
I'm just wondering if anyone might be able to point me in the right direction, with installing atheris on ARM (using a raspberry pi 4, with the 32 bit OS).
I installed llvm/clang 11.
And am doing:
But get:
By changing:
The error seems to go away, but I get a linker err:
Any suggestions would be most appreciated!