fdu-sec / NestFuzz

A structure-aware grey box fuzzer based on modeling the input processing logic.
Apache License 2.0
156 stars 12 forks source link

Fail to build GPAC-2.0.0 in the ipl-modeling phase #10

Closed Hanseltu closed 1 month ago

Hanseltu commented 1 month ago

Hi,

Thanks for the nice project.

I tried to run the motivating example from the paper (MP4Box) but failed. The issue comes from the dependence on the zlib package. I can successfully compile the following code suggested by the configure file in the gpac project with gcc -lz test.c, so I think the zlib library is well-installed on my local machine (ubuntu 20.04, gcc-9.4).

$cat test.c
#include <string.h>
#include <stdio.h>
#include <zlib.h>
int main( void ) { if (strcmp(zlibVersion(), ZLIB_VERSION)) { puts("zlib version differs !!!"); return 1; } return 0; }

Also, I checked the locations of libz libraries:

$ locate libz.so
/usr/lib/x86_64-linux-gnu/libz.so
/usr/lib/x86_64-linux-gnu/libz.so.1
/usr/lib/x86_64-linux-gnu/libz.so.1.2.11

But when I run with CC=xx/NestFuzz/ipl-modeling/install/test-clang CXX=xx/NestFuzz/ipl-modeling/install/test-clang++ ./configure --disable-shared, I got the error error: zlib not found on system or in local libs.

Did you encounter the above issue?

I also tried to enforce to let the variable has_zlib=''sysmtem'', the execution of ./configure works well but I got the following errors when I executed make in the following

clang -o ../../bin/gcc/gpac main.o -L../../bin/gcc -lgpac -Wl,-rpath,$ORIGIN -Wl,-rpath-link,../../bin/gcc -L/usr/lib/x86_64-linux-gnu -Wl,--warn-common -lz -Xclang -load -Xclang /home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/pass/libLoopHandlingPass.so -mllvm -chunk-exploitation-list=/home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/rules/exploitation_list.txt -Xclang -load -Xclang /home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/pass/libDFSanPass.so -mllvm -chunk-dfsan-abilist=/home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/rules/angora_abilist.txt -mllvm -chunk-dfsan-abilist=/home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/rules/dfsan_abilist.txt -pie -fpic -Qunused-arguments -fno-discard-value-names -g -O0 -Wl,--whole-archive /home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/lib/libdfsan_rt-x86_64.a -Wl,--no-whole-archive -Wl,--dynamic-list=/home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/lib/libdfsan_rt-x86_64.a.syms /home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/lib/libruntime.so /home/haoxin/research/structured-fuzz/NestFuzz/ipl-modeling/install/lib/libDFSanIO.a -lstdc++ -lrt -Wl,--no-as-needed -Wl,--gc-sections -ldl -lpthread -lm 
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$uncompress'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$crc32'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$inflateReset'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$deflateInit_'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$inflateInit2_'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$inflate'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$inflateInit_'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$deflateSetDictionary'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$inflateEnd'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$deflateInit2_'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$deflate'
/usr/bin/ld: ../../bin/gcc/libgpac.so: undefined reference to `dfs$deflateEnd'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile:57: gpac] Error 1
make[2]: Leaving directory '/home/haoxin/research/structured-fuzz/benchmarks/mp4-gpac/gpac-model/applications/gpac'
make[1]: *** [Makefile:41: apps] Error 2
make[1]: Leaving directory '/home/haoxin/research/structured-fuzz/benchmarks/mp4-gpac/gpac-model/applications'
make: *** [Makefile:14: all] Error 2

Could you please share a bit about how you run or what building commands you used to run GPAC? Thank you so much for your help!

Best regards, Haoxin

Mech0n commented 1 month ago

It's a DFSan use problem, You need to use NestFuzz compile zlib if you want fuzz zlib, if you don't want fuzz zlib, you can set the abi list in ANGORA_TAINT_RULE_LIST for zlib.

Hanseltu commented 1 month ago

Thank you @Mech0n, the issue is resolved now. Have a nice day ~