Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building libav with aflgo #111

Open
irfanariq opened this issue Dec 22, 2021 · 3 comments
Open

Building libav with aflgo #111

irfanariq opened this issue Dec 22, 2021 · 3 comments

Comments

@irfanariq
Copy link

Hi,

I would like to fuzz avconv from libav with AFLGo. These are the commands I used to build libav:

export AFLGO=path/to/aflgo
export CC=$AFLGO/afl-clang-fast
export CXX=$AFLGO/afl-clang-fast
cd path/to/libav
mkdir temp; mkdir obj-aflgo
export TMP_DIR=$PWD/temp
export LDFLAGS=-lpthread
export ADDITIONAL="-targets=$TMP_DIR/BBtargets.txt -outdir=$TMP_DIR -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"
cd obj-aflgo
../configure --cc=$CC --prefix=`pwd` --extra-cflags="$ADDITIONAL" --disable-shared

However, I got a C compiler test failed error saying temp/test.o: file not recognized: File format not recognized. I guess that the test failed because afl-clang-fast generate the IR bitcode instead of the ELF object file. I have read #69 and #71, and they suggest using --host-cflags. So, I changed the configure command to:

../configure --cc=$CC --prefix=`pwd` --host-cflags="$ADDITIONAL" --disable-shared --disable-doc

Using the above configure command, configuring the makefile and building the libav can be done successfully but afl-clang-fast does not generate the dot-files. The BBnames.txt and BBcalls.txt are also empty. Therefore, I cannot calculate the distance.

Would you please help me to build libav with aflgo?

Here is the commit hash of the libav and the BBtargets.txt :

Commuit hash : c4642788e83b0858bca449f9b6e71ddb015dfa5d
BBtargets.txt:

libavcodec/aacdec.c:2578
libavcodec/aacdec.c:2631
libavcodec/aacdec.c:2666
libavcodec/aacdec.c:2944
libavcodec/aacdec.c:3010
libavcodec/decode.c:336
libavcodec/decode.c:387
libavcodec/decode.c:405
libavcodec/decode.c:466
libavformat/utils.c:1950
libavformat/utils.c:2459
avtools/avconv_opt.c:821
avtools/avconv_opt.c:2467
avtools/avconv_opt.c:2504
avtools/avconv.c:2953

Thank you.

@strongcourage
Copy link
Collaborator

Hi @irfanariq, currently I don't have AFLGo in my laptop, so I am not able to test it. Can you fuzz libav using the hash and the targets in #69?

@irfanariq
Copy link
Author

irfanariq commented Dec 22, 2021

Hi @strongcourage, thank you for your response. I have tried the hash and target in #69 but afl-clang-fast still does not generate the dot-files. BBcalls.txt, BBnames.txt, Fnames.txt, and Ftargets.txt are empty too. So, I still can not calculate the distance.

@vannussina
Copy link

Are there any new ideas on this issue? I'm experiencing the same both with ffmpeg and libav. Seems like the ADDITIONAL flag passed via --hostc-flags does not reach aflgo-clang and it skips its first run where it should create CFG and CG and solely executes distance instrumentation. I tried several configurations for configure but either no distance files were created or compilation failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants