Messages in this thread | | | Date | Wed, 28 Oct 2020 15:03:14 -0700 | From | Kees Cook <> | Subject | Re: [seccomp] Request for a "enable on execve" mode for Seccomp filters |
| |
On Wed, Oct 28, 2020 at 12:49:36PM -0400, Rich Felker wrote: > On Wed, Oct 28, 2020 at 01:42:13PM +0100, Jann Horn wrote: > > +luto just in case he has opinions on this > > > > On Wed, Oct 28, 2020 at 12:18 PM Camille Mougey <commial@gmail.com> wrote: > > > From my understanding, there is no way to delay the activation of > > > seccomp filters, for instance "until an _execve_ call". > > > [...] > > > I only see hackish ways to restrict the use of _execve_ in a > > > non-cooperative executable. These methods seem globally bypassables > > > and not satisfactory from a security point of view. > > > > You're just focusing on execve() - I think it's important to keep in > > mind what happens after execve() for normal, dynamically-linked > > binaries: The next step is that the dynamic linker runs, and it will > > poke around in the file system with access() and openat() and fstat(), > > it will mmap() executable libraries into memory, it will mprotect() > > some memory regions, it will set up thread-local storage (e.g. using > > arch_prctl(); even if the process is single-threaded), and so on. > > > > The earlier you install the seccomp filter, the more of these steps > > you have to permit in the filter. And if you want the filter to take > > effect directly after execve(), the syscalls you'll be forced to > > permit are sufficient to cobble something together in userspace that > > effectively does almost the same thing as execve(). > > I would assume you use SECCOMP_RET_USER_NOTIF to implement policy for > controlling these operations and allowing only the ones that are valid > during dynamic linking. This also allows you to defer application of > the filter until after execve. So unless I'm missing some reason why > this doesn't work, I think the requested functionality is already > available.
Oof. Yeah, that's possible, but I view it as kind of not the point of USER_NOTIF -- I'd rather design a workable solution for the delayed-apply case.
-- Kees Cook
| |