Organization of a programming contest - Howto compilation and implementation

I am creating a web interface where people can enter simple C code to solve algorithmic programming issues. I use the Ace editor, where people can enter the code, and when they press the start button, the C code is sent to the server, compiled and output back.

How to complete the second part in a safe way. I mean the given C code file, compile it and run it. I cannot trust the code, as I can make sure that it is not harmful and will not harm my system. Also, how to impose memory and time frames.

Is there an existing open source system that I can modify to fit my needs? I did not find anything in my search. Or some pointers on how I should proceed next?

: Found http://cs.sru.edu/~contest/rocktest/ and tried to understand their code, but still looking for better options, preferably in php

+5
source share
5 answers

I recommend the Ideaone API: http://ideone.com/api

+1
source

AppArmor, , . , , xpdf PDF:

#include <tunables/global>

/usr/bin/xpdf {
  #include <abstractions/base>
  #include <abstractions/bash>
  #include <abstractions/X>
  #include <abstractions/fonts>

  /dev/tty rw,
  owner /dev/pts/* rw,
  /etc/papersize r,
  /etc/xpdf/* r,
  /bin/bash ix,
  /usr/bin/xpdf r,
  /usr/bin/xpdf.bin rmix,
  /usr/share/xpdf/** r,
  /usr/share/icons/** r,
  owner /**.pdf r,
  owner /tmp/* rw,
}

, , . ( xpdf , , , . AppArmor - , . )

AppArmor , , :

rlimit as <= 100M,  # limit address space to 100 megabytes

AppArmor Ubuntu, openSUSE, SLES, PLD, Mandriva, Pardis Annvix, . AppArmor Linux 2.6.36 , AppArmor Linux.

SElinux, TOMOYO, SMACK. , SMACK , .

+2

. SO, .

, - .

+1

- .

sytem C. , , ( , malloc , ).

, .

0

uevalrun:

"The main use case for uevalrun is to evaluate the solution programs submitted by participants in programming contests: uevalrun compiles the solution, runs it using the test input, compares its result with the expected output, and writes a status report."

0
source

All Articles