wmkhoo / taintgrind

A taint-tracking plugin for the Valgrind memory checking tool
GNU General Public License v2.0
247 stars 42 forks source link

[MacOS] Cannot build taintgrind #22

Open tcullum-gpsw opened 6 years ago

tcullum-gpsw commented 6 years ago

Please excuse my ignorance, but the instructions say:

[me@machine ~/valgrind-X.X.X] git clone http://github.com/wmkhoo/taintgrind.git [me@machine ~/valgrind-X.X.X] cd taintgrind [me@machine ~/valgrind-X.X.X/taintgrind] ../autogen.sh [me@machine ~/valgrind-X.X.X/taintgrind] ./configure --prefix=pwd/../inst [me@machine ~/valgrind-X.X.X/taintgrind] make && make install

However, there is no autogen.sh or configure in the repo. There's a configure.ac which I cannot get to run. I do have automake and autoconf but have not used these tools before.

wmkhoo commented 6 years ago

Hi, taintgrind does not include the autogen.sh script, but uses the one that comes with valgrind. Did you install valgrind (http://valgrind.org)?

tcullum-gpsw commented 6 years ago

@wmkhoo no I did not build valgrind because I already have the one installed from the repo (brew install valgrind)... Can I build from source in addition to the valgrind I already have or will that cause conflicts? Thanks.

wmkhoo commented 6 years ago

If you don't want to replace the default installation, you can install it at location you specify using 'configure --prefix=...', which is what the taintgrind installation instructions describe. By the way, I'm afraid that taintgrind is not yet supported on MacOS.

tcullum-gpsw commented 6 years ago

@wmkhoo alright thank you. I got it working, but I just ended up using a Ubuntu VM which I use often anyway and then building everything from sources as specified. Now I just need to learn LLVM bytecode :P . I am familiar with x86-64 and C but I have not had to directly read/interpret LLVM bytecode. It is possible to lift it to C to find out which source lines are tainted?

wmkhoo commented 6 years ago

VEX, which is what valgrind uses, takes a little getting used to. However, if you include debugging symbols during compilation (e.g. gcc -g ...), taintgrind will list the source line. If you want the assembly, @lmrs2 added support for capstone in secretgrind.

wmkhoo commented 5 years ago

Let's try and get taintgrind to build on MacOS.

wmkhoo commented 5 years ago

Getting this error ../coregrind/link_tool_exe_darwin 0x158000000 gcc -o taintgrind-amd64-darwin -arch x86_64 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align -Wno-self-assign -Wno-tautological-compare -mmacosx-version-min=10.5 -fno-stack-protector -O2 -nodefaultlibs -nostartfiles -Wl,-u,start -Wl,-e,start -arch x86_64 taintgrind_amd64_darwin-tnt_syswrap.o taintgrind_amd64_darwin-tnt_main.o taintgrind_amd64_darwin-tnt_translate.o taintgrind_amd64_darwin-copy.o taintgrind_amd64_darwin-tnt_smt2.o taintgrind_amd64_darwin-tnt_asm.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a -lgcc -lcapstone -L./capstone-3.0.4/

link_tool_exe_darwin: /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.6 -o taintgrind-amd64-darwin -u start -e start -image_base 0x158000000 -stack_addr 0x154000000 -stack_size 0x800000 taintgrind_amd64_darwin-tnt_syswrap.o taintgrind_amd64_darwin-tnt_main.o taintgrind_amd64_darwin-tnt_translate.o taintgrind_amd64_darwin-copy.o taintgrind_amd64_darwin-tnt_smt2.o taintgrind_amd64_darwin-tnt_asm.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a

Undefined symbols for architecture x86_64: "_cs_close", referenced from: _vgTaintgrind_asm_release in taintgrind_amd64_darwin-tnt_asm.o "_cs_disasm", referenced from: _vgTaintgrind_asm_guest_pprint in taintgrind_amd64_darwin-tnt_asm.o "_cs_free", referenced from: _vgTaintgrind_asm_guest_pprint in taintgrind_amd64_darwin-tnt_asm.o "_cs_open", referenced from: _vgTaintgrind_asm_init in taintgrind_amd64_darwin-tnt_asm.o ld: symbol(s) not found for architecture x86_64 make[2]: [taintgrind-amd64-darwin] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2

Suspect the problem is with the capstone binary.

lmrs2 commented 5 years ago

I think you're right, these symbols should be defined in capstone library.

On 28/01/2019 23:09, Wei Ming Khoo wrote:

Getting this error `../coregrind/link_tool_exe_darwin 0x158000000 gcc -o taintgrind-amd64-darwin -arch x86_64 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align -Wno-self-assign -Wno-tautological-compare -mmacosx-version-min=10.5 -fno-stack-protector -O2 -nodefaultlibs -nostartfiles -Wl,-u,start -Wl,-e,start -arch x86_64 taintgrind_amd64_darwin-tnt_syswrap.o taintgrind_amd64_darwin-tnt_main.o taintgrind_amd64_darwin-tnt_translate.o taintgrind_amd64_darwin-copy.o taintgrind_amd64_darwin-tnt_smt2.o taintgrind_amd64_darwin-tnt_asm.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a -lgcc -lcapstone -L./capstone-3.0.4/

link_tool_exe_darwin: /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.6 -o taintgrind-amd64-darwin -u start -e start -image_base 0x158000000 -stack_addr 0x154000000 -stack_size 0x800000 taintgrind_amd64_darwin-tnt_syswrap.o taintgrind_amd64_darwin-tnt_main.o taintgrind_amd64_darwin-tnt_translate.o taintgrind_amd64_darwin-copy.o taintgrind_amd64_darwin-tnt_smt2.o taintgrind_amd64_darwin-tnt_asm.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a

Undefined symbols for architecture x86_64: "_cs_close", referenced from: _vgTaintgrind_asm_release in taintgrind_amd64_darwin-tnt_asm.o "_cs_disasm", referenced from: _vgTaintgrind_asm_guest_pprint in taintgrind_amd64_darwin-tnt_asm.o "_cs_free", referenced from: _vgTaintgrind_asm_guest_pprint in taintgrind_amd64_darwin-tnt_asm.o "_cs_open", referenced from: _vgTaintgrind_asm_init in taintgrind_amd64_darwin-tnt_asm.o ld: symbol(s) not found for architecture x86_64 make[2]: [taintgrind-amd64-darwin] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2 `

Suspect the problem is with the capstone binary.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wmkhoo/taintgrind/issues/22#issuecomment-458431058, or mute the thread https://github.com/notifications/unsubscribe-auth/AXiXjuaXXuZoxRtSnXuqSYtVWF-3j329ks5vH_OlgaJpZM4Tzh0j.

wmkhoo commented 5 years ago

Seems to compile for me on High Sierra amd64. Someone else want to give it a go? @tcullum-gpsw ?

tcullum-gpsw commented 5 years ago

Seems to compile for me on High Sierra amd64. Someone else want to give it a go? @tcullum-gpsw ?

Yeah I'll give it a shot and let you know the results... Might take me a few days though my workload has been very high lately :\