-
Notifications
You must be signed in to change notification settings - Fork 5
Link-method / format for Rust plugins that statically link libc #48
Comments
Creating a |
I find out a hack-ish way to generate freestanding libTOOL.so by using |
I created a simple tool for this issue: https://github.com/wangbj/rust-staticlib-linker |
@rrnewton I don't think it is a good idea anymore (by using
function mov %fs:0x10,%rax , while in mov %fs:0x0,%rax I even tried to patch
So we cannot really make |
we now use |
That's an amazing feat! Rare are two libc's coexisting in one process! |
It is a long term goal to provide libc / standard library functionality for writers of instrumentation tools/plugins. The topic of linking methods is mentioned in other issues:
We've found ourselves constrained by the Rust toolchain, and in particular by a bug with MUSL and the
--crate-type=cdylib
compilation mode. For this issue, we focus on plugins written in Rust. Below is a summary of several strategies and what their respective blockers are. (Please update this directly in addition to commenting below.)--crate-type=cdylib
: aforementioned bug--crate-type=dylib
: undocumented ABI--crate-type=staticlib
: may work, but needs some post-processing or a custom loader method (i.e. not LD_PRELOAD)--crate-type=bin
: similar to staticlib, but we could have a single entrypoint, that, when called, provides some information about the small number of other function addresses of interest within the plugin. The binary would need to contain position-independent code however, similar to the-static-pie
C compiler flag.The idea with a static binary or static library would be to avoid any dependence from the plugin on any symbols in the guest, and provide our own means for the instrumentor (patcher, trampolines) to find the addresses needed within the plugin once it is injected into memory.
The text was updated successfully, but these errors were encountered: