Skip to main content

Linux sandbox

Linux sandbox


I am trying to build an evaluation system for algorithmic problems. The user will have to solve a  problem which receives its input data through standard input and prints a solution to standard out.

The goal is to solve the given problem within some predefined memory and time constraints.
When a user thinks he solved a problem, he submits it for evaluation.

There are two problems when evaluating users source code:
  1. Execution of the compiled source code must be done in an isolated way (jailing the application), such that the executable cant harm the host (operating system that is running user process). There are several ways how the process could harm the host: use all available memory or disk space, exceed maximum number of threads or processes on the system (or other kernel structures), run for a very long time (infinite loop), access files it isnt supposed to (maybe a solution file).
  2. Measuring the resources that the application used during its execution, such as time and memory (heap, stack).
This post will concentrate on the approaches to solve the first step - making a jail.
  1. Monitor every system call a process makes using the ptrace() system call. This enables the process called tracer to be notified before and after every system call his tracee makes. At this point the tracer can decide whether to allow it or not.
    Problem is how to decide which system calls are allowed, and this list changes during the tracees execution. Beginning sequence of system calls contains dangerous system calls that must be disabled when the process is completely loaded into the memory.
    Ptrace() also enables inspecting every signal that is received by the tracee, and is able to read tracees memory. These two features will probably not be used in this approach.

    This approach works well for languages that are translated to machine code, because they are executed directly, but Java and Python (and many others) are problematic because they are executed through a different executable (virtual machine or interpreter). This means that these executables would have to be traced, and this is not possible, because they often do forbidden things, like reading files, creating multiple threads. We wouldnt be able to determine if the users code did this, or virtual machine by itself.
    There are also workarounds for that problem, like compiling java with gcj to machine code or python with various python to C++ compilers (nuitka, cython).
    Thus, the main concern is difficulties with adding support for another language.
  2. Try putting the application in a container that has no means of interacting with the rest of the system, which is accomplished using different namespaces for process IDs, network, IPC structures (semaphores, shared memory...), file system mount, UTS (system name - uname), user and group ids. If a process cant reference anything outside of the jail than it isnt able to do any harm.
    Cgroups are way of limiting resources of a process group.
    These two mechanisms are used by various tools that implement application jailing, one of these tools is lxc.
    The approach with the lxc is more flexible, because it doesnt limit applications inside the container in any way, since they cant do any harm to the outside world, maybe only crash the jail they are in. If the applications arent limited, then they can be executed using a support program, like java virtual machine or python interpreter, which wasnt possible in the first approach.
The second approach using namespace separation and cgroups is a better way to go, because it is more extensible than the first approach using ptrace, primarily in terms of adding support for another language.

The Moe contest environment is an already existing solution to this problem. It has to modes of isolation. The old one is ptrace, and the new one is using linux namespaces. Lxc was built on top of the linux namespaces and that makes these two approaches similar.

These are the reasons for studying lxc in more detail.

download file now

download
alternative link download

Popular posts from this blog

Mini Militia ReAL DuAL WiELD MOD 3 06 by ARSHAD

Mini Militia ReAL DuAL WiELD MOD 3 06 by ARSHAD Most of my friends and sites visitors request me to create a Dual Wield MOD + Pro pack... I DONE IT......... Features:- � Propack Unlocked � Unlimited Ammo OR Bullets � ReAL DuAL WiELD MOD ( Bugs fixed now its working) � No Reload � One shot Kill ( 4 Bullets per shot ) � Unlimited Boost � Unlimited Bombs � No one can see u in Solo Play Mod Screenshots:- Click below for Download Use Chrome or other default browser for download this mod Dont Use Uc Mini Wait 5 seconds and Skip ad download  file  now

Gta Vice City Ps2 Zip

gta vice city ps2 zip Read and see articles about gta vice city ps2 zip, because you can find the info on this site. in this post there are 8 data picture for gta vice city ps2 zip . for that, if you need more than 8 tips, you have come to the right place. in topic gta vice city ps2 zip we have more data with including how to, tutorial and article up to 3+ info. After you listen and understand what is in the article, you can also download it. so don't worry because your problem will be solved here. Looking 3+ secret info for Gta Vice City Ps Zip and you can enter lots of other information from gta vice city ps2 zip, More than 3+ content that can be obtained like gta vice city san andreas android or list below : hd skins gta vice city • gta vice city san andreas android • grand theft auto vice city stories review playstation • gta place vice city stories psp screenshots • detailed map radar mod gta san andreas •...

Download Sony Vegas Pro 11 Kuyhaa

download sony vegas pro 11 kuyhaa Read and see articles about download sony vegas pro 11 kuyhaa, because you can find the info on this site. in this post there are 8 data picture for download sony vegas pro 11 kuyhaa . for that, if you need more than 8 tips, you have come to the right place. in topic download sony vegas pro 11 kuyhaa we have more data with including how to, tutorial and article up to 4+ info. After you listen and understand what is in the article, you can also download it. so don't worry because your problem will be solved here. Looking 4+ secret info for Sony Vegas Pro Kuyhaa and you can enter lots of other information from download sony vegas pro 11 kuyhaa, More than 4+ content that can be obtained like sony vegas studio hd platinum or list below : sony vegas pro • sony vegas pro beginners tutorial youtube • buy sony vegas studio hd platinum • sony vegas pro crack work bit bit youtube • sony vega...