4 ms·
This class of problem for seccomp has been known for ages. This makes it quasi-unusable IMO (or reserved for full-contained binaries, maybe in some JIT scenario
by temac 7y ago
This class of problem for seccomp has been known for ages. This makes it quasi-unusable IMO (or reserved for full-contained binaries, maybe in some JIT scenario but probably not a lot else), and even quasi in self-contradiction with the kernel non-regression rules (because by design seccomp can not achieve that in the general case -- at least when you consider the bigger picture that is a classic userspace design and ecosystem, like in a mainstream standard distro). To detail more: under this "standard" model the applications do not often do syscalls themselves, but use intermediate libraries (ex: glibc) that provide (quasi)-Posix and reserve some of the syscalls or even provide syscall like functions that actually use others -- or just start to use new syscalls in new versions to provide higher levels of abstraction. But they do not provide another abstraction to obtain a seccomp-like services suitable for this model. So seccomp is basically unusable in this context, which is one of the most important.
Now the kernel itself made the mistake, proving that the whole idea was not practical; it breaks too easily, and it breaks even when used in most restricted ways or when the whole (non-kernel provided) userspace has been designed for it (which was not a practical condition at all, to begin with).
IMO seccomp should be phased out entirely and eventually replaced by something else. Trying to "fix" it will yield nowhere: it is broken by design, since forever.
- the8472 7y agoOr you could argue that seccomp lacks a libc-like wrapper library with easier to use abstractions around the syscall. Then you would only have to update the library to work with new kernel versions.
- temac 7y agoYes but like I said: this layer does not exist, and to my knowledge nobody intend to create it. It would be a big amount of work too, compared to the pledge approach...
- nwmcsween 7y agoThe other issues: Parent cannot seccomp itself without being highly coupled to the child (filters persist across exec), Different syscall numbers, socketcall, etc, etc make it almost mandatory to use something to build the filter. But there isn't really anything that Linux can replace it with, pledge works because Openbsd controls both libc and the kernel.
- the8472 7y agoThere are precedents for linux shipping associated libraries, e.g. libbf and liburing. But yeah, it's not likely to happen anytime soon.
- viraptor 7y ago> Parent cannot seccomp itself without being highly coupled to the child You can workaround this sometimes though. Unless you actually care about fork with current memory copy, (i.e. you care about spawning new processes only) you can fork a "spawner" process early which is only a thin proxy for pipe->exec commands. You apply seccomp after spawner is ready and you're all good.