Thank you for answers. After some research I figured out that AppArmor fits my needs quite well. However, even if I disable access to the kernel internals and filesystem, one problem is left unsolved: can untrusted program access any other X server resource except its own window? Suppose I am running something infected in the background and entering something confidential in a gnome application, can the virus take a screenshot? For the sake of clarity, running the untrusted program is more of necessity, not a mere convenience.