panda-re / lava

LAVA: Large-scale Automated Vulnerability Addition
Other
371 stars 60 forks source link

Can't run setup.py #18

Closed benjaminjellison closed 5 years ago

benjaminjellison commented 5 years ago

Downloading the latest version and running setup.py, I eventually run into this error:

/usr/lib/llvm-3.3/bin/llvm-link: panda/plugins/taint2/taint_ops_llvm.bc: error: Global not a pointer type!
/usr/lib/llvm-3.3/bin/llvm-link: error loading file 'panda/plugins/taint2/taint_ops_llvm.bc'
/usr/lib/llvm-3.3/bin/llvm-link: panda/plugins/taint2/taint_ops_llvm.bc: error: Global not a pointer type!
/usr/lib/llvm-3.3/bin/llvm-link: error loading file 'panda/plugins/taint2/taint_ops_llvm.bc'
/home/lava/lava/panda/src/panda/plugins/taint2/Makefile:36: recipe for target 'panda/plugins/panda_taint2_ops.bc' failed
make[2]: *** [panda/plugins/panda_taint2_ops.bc] Error 1
/home/lava/lava/panda/src/panda/Makefile.panda.target:42: recipe for target 'plugin-taint2' failed
make[1]: *** [plugin-taint2] Error 2
/home/lava/lava/panda/src/panda/plugins/taint2/Makefile:36: recipe for target 'panda/plugins/panda_taint2_ops.bc' failed
make[2]: *** [panda/plugins/panda_taint2_ops.bc] Error 1
/home/lava/lava/panda/src/panda/Makefile.panda.target:42: recipe for target 'plugin-taint2' failed
make[1]: *** [plugin-taint2] Error 2
Makefile:324: recipe for target 'subdir-x86_64-softmmu' failed
make: *** [subdir-x86_64-softmmu] Error 2
make: *** Waiting for unfinished jobs....
Makefile:324: recipe for target 'subdir-i386-softmmu' failed
make: *** [subdir-i386-softmmu] Error 2

Any idea what's going on?

benjaminjellison commented 5 years ago

Anyone had a chance to look at this yet? I'm going through the scripts, but no luck yet.

moyix commented 5 years ago

Sorry about this. From a quick look it seems like the .bc files are probably being compiled with a version of clang that doesn't match the LLVM version that's being used to link them (3.3). Could you run V=1 make and look for the clang invocation to see which clang it's using?

benjaminjellison commented 5 years ago

Sorry, I was out of the office for a couple days. I had been running clang 3.8, so I installed clang 3.3, but I still get the same error. I tried running make v=1 in a subdirectory (e.g. panda/build), but I only see things like CLANG ppc-softmmu/fpu/softfloat.bc2. I haven't used the v=1 option, is there something I'm missing?

moyix commented 5 years ago

Hmm, with V=1 it should print out lines like this:

/home/moyix/git/llvm/Release/bin/clang -I/home/moyix/git/panda_merge/tcg -I/home/moyix/git/panda_merge/tcg/i386 -I/home/moyix/git/panda_merge/linux-headers -I/home/moyix/git/panda_merge/build/linux-headers -I. -I/home/moyix/git/panda_merge -I/home/moyix/git/panda_merge/include -I/home/moyix/git/panda_merge/panda/include -I/usr/include/pixman-1 -I/home/moyix/git/panda_merge/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -D_GNU_SOURCE -I/usr/include/ncursesw -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I/usr/include/spice-server -I/usr/include/spice-1 -I/usr/include/cacard -I/usr/include/libusb-1.0 -I../linux-headers -I.. -I/home/moyix/git/panda_merge/target/i386 -DNEED_CPU_H -I/home/moyix/git/panda_merge/include -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O2 -I../target/i386 -MMD -MP -MT fpu/softfloat.bc2 -MF fpu/softfloat.d -c -emit-llvm -o fpu/softfloat.bc2 /home/moyix/git/panda_merge/fpu/softfloat.c

Which should help you see which clang it's using.

benjaminjellison commented 5 years ago

Sorry, I was using a lower case v, which makes all the difference. Here are the lines I get now:

/usr/bin/clang -I/home/lava/lava/panda/src/tcg -I/home/lava/lava/panda/src/tcg/i386 ...

Running /usr/bin/clang --version results in this:

Ubuntu clang version 3.3-16ubuntu1ppa1~xenial (branches/release_33) (based on LLVM 3.3)
Target: x86_64-pc-linux-gnu
Thread model: posix
moyix commented 5 years ago

Hmm, so it should be using LLVM/clang 3.3 for both compiling and linking. Just to double check, have you tried removing the build directory and rebuilding to make sure there isn't anything left over from a previous build?

benjaminjellison commented 5 years ago

Deleting the build directory and starting over worked. I'm apparently two for two on "ideas I should've noticed/tried myself." It has run all the way to completion on toy, so I'm excited to start working with it!

moyix commented 5 years ago

Great! Glad to hear things are working :)