1

Recently I compiled a program in GNU MIX. The program is rather simple and only contains an unconditional jump to the only instruction, which is essentially a infinite loop.

The problem is, when I run the program using the mixvm, the system hangs. That may be a separate issue and I may just submit a bug report to GNU MIX. Even executing the following doesn't help

mixvm -r infiniteloop.mix & sleep 5 && killall mixvm

My question is, is there a simple way to execute a program that may possibly hang the computer in a sandboxed environment so that it only hangs the sandbox?

I am looking for an approach that does not require setting up virtual machines. I am not sure whether this should be identified as "malicious code" as I trust the program won't do anything concerning the security issues like stealing my password or wiping my disk. The only issue with it is that it may hang the computer irrecoverably (the only way to recover is forced reboot or possibly (I didn't try it) sending a SysRq).

I am running Ubuntu 16.04.4 LTS.

I am not so familiar with virtualization so please feel free to correct me if there's something obvious that I happen to miss.

2

there's a program you can run from bash called

cpulimit

and here's the documentation on it

http://manpages.ubuntu.com/manpages/xenial/man1/cpulimit.1.html

And I'm copying their first example


EXAMPLES Assuming you have started foo --bar and you find out with top(1) or ps(1) that this process uses all your CPU time you can either

   # cpulimit -e foo -l 50
          limits the CPU usage of the process by acting on the  executable
          program file (note: the argument "--bar" is omitted)
  • Not actually a sandboxed solution but may still be helpful in this specific case. Thank you very much. I will test it later. – Weijun Zhou Mar 4 '18 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.