Using ptrace to write a program supervisor in userspace

99封情书 提交于 2019-12-12 13:27:39

问题


I'll looking for advice/resources to write a program that can intercept system calls from a programm to supervise it's filesystem, network, etc access.

The aim of this is to write an online judge, so that untrusted code can be run safely on a server.

This is on linux, and I would prefer to write C++ or a scripting langauge (ruby, python, etc), and a library would be great!

Thanks.


回答1:


This looks like a good place to start. http://www.linuxjournal.com/article/6100




回答2:


You can't safely use ptrace() to sandbox a hostile application.

The application can always use multiple threads with deliberate race conditions to alter syscall arguments passed via pointers (eg. a filename) after you've inspected them but before the kernel looks at them.



来源:https://stackoverflow.com/questions/3642370/using-ptrace-to-write-a-program-supervisor-in-userspace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!