Linux 用户态执行

发布于 2024-10-03 17:38:56 字数 510 浏览 0 评论 0原文

我需要一个 C 库,它允许我 exec() 静态链接的二进制文件,而不调用 execve() 系统调用。系统调用不起作用的原因是二进制文件不可执行,并且不可能使其在该系统上可执行。对于动态链接的二进制文件,运行 /lib/ld-linux.so.2 progname 可以解决问题,但在我的静态链接的二进制文件上会出现段错误。

我在 http://archive.cert 上找到了 ul_exec 1.1。 uni-stuttgart.de/bugtraq/2004/01/msg00002.html ,但这似乎在我的系统上其自己的 Hello, World 二进制文件出现了段错误。

一种选择是制作二进制文件的副本,使副本可执行,然后调用 execve()。我正在寻找一种不需要这样的副本的解决方案(由于性能原因)。

I need a C library which lets me exec() a statically linked binary, without invoking the execve() system call. The reason why the system call wouldn't work is that the binary file is not executable, and it's not possible to make it executable on that system. For dynamically linked binaries, running /lib/ld-linux.so.2 progname does the trick, but that segfaults on my statically linked binary.

I've found ul_exec 1.1 on http://archive.cert.uni-stuttgart.de/bugtraq/2004/01/msg00002.html , but that seems to segfault for its own Hello, World binary on my system.

One option would be to make a copy of the binary, make the copy executable, and call execve(). I'm looking for a solution which doesn't need such a copy (because of performance reasons).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

此生挚爱伱 2024-10-10 17:38:57

有一篇很好的简短 wiki 文章,其中包含一些未完全生产就绪的实现: http://plash.beasts .org/wiki/UserModeExec

There is a good short wiki article with some not-completely-production-ready implementations: http://plash.beasts.org/wiki/UserModeExec

望笑 2024-10-10 17:38:56

我已经更新了 Grugq 的 userland exec 以与现代 x86 Linux 配合使用。我从头开始编写了一个 x86_64 userland exec。

I've updated The Grugq's userland exec to work with modern x86 Linuxes. I wrote an x86_64 userland exec from scratch.

私野 2024-10-10 17:38:56

那么将执行位映射到任何指定文件的用户模式文件系统(例如使用 python-fuse)怎么样?这会对性能造成太大影响吗?

then how about a usermode filesystem (using python-fuse for example) that maps the execute bit to any file specified? would that be too much of a performance hit?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文