Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在设计一个判断系统,它启动一个新进程,然后限制新进程的 cpu 时间和内存使用量。
为保证安全,有些系统调用不能与新进程一起使用,如fork、clone等。
我尝试使用 libseccomp 来限制系统调用,但是,我不知道如何为特定进程设置规则。如果我在判断进程中设置规则,加载规则后,判断进程也仅限于调用这些系统调用,那么我就不能fork和execv新进程。
现在我得到了答案,seccomp还可以加参数限制,比如execve的第一个参数必须是具体路径。
整个代码在github
https://github.com/QingdaoU/Judger