Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disallow system calls while running a program in a sandbox environment?

I was checking out codepad.org and a while(1) fork gave the following output.

Disallowed system call: SYS_fork

Check this link for exact details. http://codepad.org/rNR9mMVv

Googling more, I got to to know that they also disable system call using sockets.

Disallowed system call: SYS_socketcall

Can anyone tell me how one can disable certain system calls before running the program in a sandboxed environment?

like image 779
sp2hari Avatar asked Dec 11 '10 11:12

sp2hari


2 Answers

By replacing runtime libraries with mocks that have empty stubs or exception throwers instead of real functions?

like image 79
Daniel Mošmondor Avatar answered Oct 28 '22 01:10

Daniel Mošmondor


If you're willing to pay the performance penalty, ptrace() can be used for this. There's another way I cannot seem to find right now.

like image 37
Joshua Avatar answered Oct 28 '22 01:10

Joshua