Imagine that you have an object code file from an untrusted source. You want to run this code to know the result of its computation, and you want the code to perform fast, so setting up a whole virtual machine is a last resort. You also want nothing to happen to your system after the code is run.
Having that in mind, as far as I understand, that code would not be able to do any harm if you restrict the number of interrupts for it or disable interrupts whatsoever. One way to ensure there are no interrupts in code is to scan it instruction-wise and refuse to run if there is at least one
int instruction in it. That will solve the problem, but this approach will as well disallow any system calls, and the code with no system calls is scarcely useful. If the running side decides to allow that code which only invokes some whitelisted interrupts, then the running side needs to be sure that the running code does not change itself in run time. If it does change, then each instruction to run needs to be re-scanned, what would impact performance.
It would be nice to have some kind of gateway between host and guest interrupts, which could translate guest interrupts to possibly different host interrupts or refuse to do so. Are there any solutions or researches available for this topic?