reverie-rs / reverie

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

Proof of concept checklist #1

Closed rrnewton closed 5 years ago

rrnewton commented 5 years ago

@wangbj has already taken this prototype pretty far. Here's a checklist and what's left (feel free to edit/correct):

rrnewton commented 5 years ago

@gatoWololo - this is a place we need to sync up. The low-level JITed code in the trampoline needs to match conventions on the memory layout of the structs pointed to by the arguments to the handler function.

They will have no types in the low-level JIT'd code, but should have a matching type in the Rust code (with a corresponding pragma to control the layout).

wangbj commented 5 years ago

in the trampoline: set up a call to the handler function in the trampoline: add a pointer to the register file as an argument before calling the handler function

This is already possible, you can call register_syscall_hook

https://github.com/iu-parfunc/systrace/blob/c6377541d3b377f8ea92794851fadfe0d609d3c8/src/syscallbuf.c#L92

to register a customized hook. though the caller must be also in the same address space as libpreload.so.

rrnewton commented 5 years ago

Great, check it off! ;-)

rrnewton commented 5 years ago

I think the last two in that original list are debatable:

For now, I'm running on the assumption that existing thread local storage (TLS) approaches will be good enough for us to cheaply figure out who we are / where we're running from inside the captured_syscall callback. Perhaps microbenchmark results will prove me wrong on this! I haven't benchmarked TLS in a while, but I did before when releasing a Haskell lib for it.