v0.0.3
Changelog
π Breaking changes π
-
injector: Remove link-time dependency on__environ, inject environment variables once at startup via setenv instead of overriding libc's getenv function. (#166) This removes the declarationextern var __environ: [*]u8from the injector, that is, the dependency on the__environpointer symbol exported by libc.Motivation: The injector may be linked to binaries that, while dynamically linked, do not link any libc. This would result in the injector preventing the program from starting due to a linker error, effectively crashing the application under monitoring.
This change introduces a way to look up the
dlsymsymbol, and then in turn throughdlsymthe__environandsetenvsymbols. This happens at runtime in an initialization step, by inspecting the process' memory and finding thedlsymsymbol in memory. This allows us to read and manipulate the process environment without depending on any external symbols at link time. More importantly, we have the option to stand down if looking updlsym// fails, and let the host process continue, instead of crashing it at startup.