I recommend
UML
If you are really serious about security for running untrusted code on a system try it. Far better than any amount of userspace security, chrooting, uid management or thread tracking. I keep a whole bunch of User Mode Linux filesystems
of our development and production images, running new code in
a VM makes me feel relaxed about what would otherwise be very stressful operations. The most you can lose is a copy of a COW file.