什么是将共享库注入另一个过程并在没有ld_preload的该库中调用函数的简便方法?
我正在尝试找到一种将.SO文件注入另一个过程的方法。此.SO文件包含用于Sigsegv的替换处理程序,以及用上述替换处理程序替换挂钩过程的Sigsegv处理程序的功能。我想将此.SO文件注入运行过程,以便我可以调用该函数并因此制作,以便Sigsegv不会崩溃应用程序(我正在以VM运行此操作以确保安全)。我已经寻找有关注射.SO文件或更换信号处理程序的信息,但没有任何帮助。我仍然对如何注入共享库而无需使用ld_preload感到困惑。有帮助吗?
I am trying to find a way to inject a .so file into another process. This .so file contains a replacement handler for SIGSEGV and a function for replacing the hooked process's SIGSEGV handler with the aforementioned replacement handler. I want to inject this .so file into a running process so I can call the function and thus make it so that SIGSEGV doesn't crash applications (I am running this in a VM to be safe). I have looked for information on injecting .so files or replacing signal handlers, but none helped for me. I'm still confused on how to inject a shared library without having to use LD_PRELOAD. Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
,如果没有该过程的帮助,您就无法将共享库注入运行过程中 - 可能是通过
dlopen()
。无论如何,这是傻瓜的差事。 您无法通过捕获
sigsegv
来挽救一个过程。如果安装捕获信号并正常返回的处理程序,则程序的后续行为是未定义的。 Segfault不是问题。相反,它是症状。You cannot inject a shared library into a running process without the process's assistance -- probably in the form of the process opening it via
dlopen()
.It's a fool's errand anyway. You cannot rescue a process that segfaults by catching the
SIGSEGV
. If you install a handler that catches the signal and returns normally then the program's subsequent behavior is undefined. The segfault is not the problem. Rather, it is the symptom.