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

[MacOS] Cannot build taintgrind #22

Open
tcullum-gpsw opened this issue May 5, 2018 · 10 comments
Open

[MacOS] Cannot build taintgrind #22

tcullum-gpsw opened this issue May 5, 2018 · 10 comments

Comments

@tcullum-gpsw
Copy link

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
Copy link
Owner

wmkhoo commented May 6, 2018

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
Copy link
Author

tcullum-gpsw commented May 6, 2018

@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
Copy link
Owner

wmkhoo commented May 7, 2018

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
Copy link
Author

@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
Copy link
Owner

wmkhoo commented May 8, 2018

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 wmkhoo changed the title Cannot build taintgrind [MacOS] Cannot build taintgrind Nov 13, 2018
@wmkhoo
Copy link
Owner

wmkhoo commented Jan 29, 2019

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

@wmkhoo
Copy link
Owner

wmkhoo commented Jan 29, 2019

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
Copy link

lmrs2 commented Jan 30, 2019 via email

@wmkhoo
Copy link
Owner

wmkhoo commented Feb 11, 2019

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

@tcullum-gpsw
Copy link
Author

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 :\

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