reverie-rs / reverie

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

Systrace cannot be run from other directories #13

Closed rrnewton closed 5 years ago

rrnewton commented 5 years ago

Minor:

Right now if I run systrace from a different directory, it gets into trouble trying to find the hardcoded shared object path:


thread 'main' panicked at 'unable to load libsystrace.so: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.```

And this happens even *if* `LD_LIBRARY_PATH` is set to include `systrace/lib` containing `libsystrace.so`.

IMHO the solution to this is to:

 - add `--tool` explicitly as a required argument (https://github.com/iu-parfunc/systrace/issues/12), for finding libdet.so or whatever.
 - add another CLI argument for finding libsystrace.so and/or respect LD_LIBRARY_PATH

@wangbj what do you think is best for the latter one?
wangbj commented 5 years ago

I'm possibly biased against LD_LIBRARY_PATH: LD_LIBRARY_PATH considered harmful

Do you think it would be more explicit if we add a --library-path (instead of --tool), with default value of library_path equals $(cwd)/lib?

wangbj commented 5 years ago

Another argument against LD_LIBRARY_PATH is we need LD_PRELOAD for our tracees, not sys trace itself.

wangbj commented 5 years ago

fixed by f054f2b146ee2aa2041a14d97e3279fe499d7129. caller can specify --library-path to set path where libdet.so and libsystrace.so are located.