reverie-rs / reverie

trace and intercept linux syscalls.
Other
14 stars 5 forks source link

--library-path shouldn't assume libtrampoline.so and libTOOL.so are in same dir! #31

Closed rrnewton closed 5 years ago

rrnewton commented 5 years ago

This expands on the topic of #29. To reproduce this bug (as of commit e0b8156bdff6336):

$ cd systrace
$ make
$ mkdir ./mytool
$ mv lib/libecho.so mytool/
$ ./bin/systrace --library-path ./mytool/ --tool libecho.so /bin/ls
thread 'main' panicked at 'unable to load libtrampoline.so: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5

That is because the current CLI conflates two things:

I think these are only the same if you're a developer of systrace! If systrace became popular and, e.g. got packaged for apt-get install, presumably you'd have /usr/bin/systrace and then libtrampoline.so in some standard system location. Which implies:

However, I'll revisit the point in #29. I think that since there is only one libTOOL.so, having a search path for it is silly. It's easier to just specify the file directly by its path. So one solution here is for --tool to take a path and --library-path to be renamed and be only for internal bits.

wangbj commented 5 years ago

If we install libsystrace-trampoline.so into standard system location, then we probably don't need --library-path either, because we can search it from system library path, or use LD_LIBRARY_PATH environment variables if libsystrace-trampoline.so is not installed (yet).

wangbj commented 5 years ago

Also, do you think it is a good idea to build libsystrace-trampoline.so and libTOOL.so into a single shared library?

wangbj commented 5 years ago

change pushed in 7da571a.

i.e.:

./systrace --library-path=target/debug --tool=target/debug/libecho.so