User: Password:
|
|
Subscribe / Log in / New account

Seccomp filters: permission denied

Seccomp filters: permission denied

Posted May 26, 2011 20:42 UTC (Thu) by hmh (subscriber, #3838)
In reply to: Seccomp filters: permission denied by Cyberax
Parent article: Seccomp filters: permission denied

Actually, no.

Seccomp itself works because it has the extremely huge advantage of being extremely strict and limited. It can do what it is supposed to do so well (almost full containment) because the problem set is so small. Jail something utterly and only let it talk to the world outside over a very draconian path, without any capabilities of directly modifying system state (other than consume some very defined system resources).

It is meant to let one implement privsep and tasksep done right on multi-process applications.

The moment you try to make it into a generic syscall firewall, you are likely to start hitting corner cases where you need to keep state (just like a stateful firewall :p) or worse, track complex syscall sequences...


(Log in to post comments)

Seccomp filters: permission denied

Posted May 27, 2011 11:35 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

The problem is, we want SOME containment, quite often we don't want full containment.

For example, MMORPG might have full access to DRI/DRM stack, PulseAudio but very limited access to filesystem. I can do this right now with AppArmor, but it's a bit clumsy in that regard.

Or I might want to be able to pass file handles to seccomped sandbox while it's running.

I don't really mind statefulness in syscall firewall if it helps. Just as I don't mind it in iptables.

Seccomp filters: permission denied

Posted May 27, 2011 13:40 UTC (Fri) by talex (subscriber, #19139) [Link]

How do you get access to DRI/DRM, though? I assume (I don't know) that it's by opening a device file and using the file descriptor.

If so, you don't need any fancy custom syscall rules, just the ability to pass file descriptors to sandboxed processes (so the MMORPG either starts with DRI access before dropping privileges, or starts with a Unix-domain socket over which it can request it from another user-space process).

It seems to me that the only calls we really need to block are the ones that operate on global namespaces rather than on descriptors (e.g. open, connect, kill).

Seccomp filters: permission denied

Posted May 27, 2011 14:07 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

>If so, you don't need any fancy custom syscall rules, just the ability to pass file descriptors to sandboxed processes (so the MMORPG either starts with DRI access before dropping privileges, or starts with a Unix-domain socket over which it can request it from another user-space process).

Won't work. MMORPG also needs to read assets, so it must have access to a part of the filesystem. Also, it might need write access to local preferences storage.

OpenGL drivers also might need to have read access.

Seccomp filters: permission denied

Posted May 27, 2011 15:24 UTC (Fri) by talex (subscriber, #19139) [Link]

Plash solved that problem by sending "open" requests to a helper process, which checked against a policy, opened the file, and sent the FD back. It didn't even require recompiling the application (Plash just substituted a modified libc).

But with Linus' suggestion ("new flags to pathname lookup that say "don't follow symlinks" and "don't follow '..'""), you could allow openat calls and pass in the FD for the subdirectory you wanted it to access, I think.

(Plash doesn't allow processes to hold a directory FD because that would allow them to escape Plash's sandbox, but seccomp mode doesn't need to worry about that. http://plash.beasts.org/wiki/DirectoryFDs)

Seccomp filters: permission denied

Posted May 27, 2011 15:47 UTC (Fri) by nybble41 (subscriber, #55106) [Link]

You would also need to disallow absolute paths, or use a chroot--blocking symlinks and '..' in the kernel's path resolver won't prevent an application from resolving the full path internally. The intended use seems more in line with improving the security of applications which are already trusted, as a guard against accidents.

Seccomp filters: permission denied

Posted May 27, 2011 15:57 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

So we need to rearchitect MMORPG to separate IO requests into a separate process - which might be not easy for game developers writing portable code.

So they'll probably going to write a 'filesystem server' which will have to do path sanitizing, permission checking and so on. Then one might think, why not write something like PulseAudio - a central filesystem server that can be reused by various software so each software won't have to reinvent it. Do you see where we're heading?

Yep. Microkernels.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds