Return-path: Received: from mta.outflux.net ([2001:19d0:2:6:c0de:0:736d:7471] helo=smtp.outflux.net) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fE16P-00047g-5s for speck@linutronix.de; Thu, 03 May 2018 01:24:03 +0200 Received: from www.outflux.net (serenity.outflux.net [10.2.0.2]) by vinyl.outflux.net (8.15.2/8.15.2/Debian-3) with ESMTP id w42NNpMe023046 for ; Wed, 2 May 2018 16:23:52 -0700 Date: Wed, 2 May 2018 16:23:51 -0700 From: Kees Cook Subject: [MODERATED] Re: [PATCH SSBv9 3/3] seccomp Message-ID: <20180502232351.GA6017@outflux.net> References: <20180501234135.GE32640@outflux.net> <20180502225046.GU75137@tassilo.jf.intel.com> MIME-Version: 1.0 In-Reply-To: <20180502225046.GU75137@tassilo.jf.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Wed, May 02, 2018 at 03:50:46PM -0700, speck for Andi Kleen wrote: > On Tue, May 01, 2018 at 04:41:35PM -0700, speck for Kees Cook wrote: > > From: Kees Cook > > Subject: [PATCH SSBv9 seccomp 3/3] seccomp: Enable speculation flaw > > mitigations > > > > When speculation flaw mitigations are opt-in (via prctl), using seccomp > > will automatically opt-in to these protections, since using seccomp > > indicates at least some level of sandboxing is desired. > > Hi Kees, > > We had this in our original patches. But after some discussion > with various people we decided it's actually not a good idea and a > separate prctl is better. Right, I'm not suggesting removing the separate prctl. I'm suggesting adding another path to opt into protection. I really don't like that we're doing a completely new interface that software has to opt into. I understand (and mostly agree with) the rationales for doing it this way instead of the "auto" mode, so I'm not opposed "prctl" as the default, but I feel like we could do _something_ smarter. The class of applications that wants this protection overlaps best with seccomp (though, it's not perfect). > - For web browsers which use seccomp today the right fix is to use > site isolation, so they don't need this and it would > be overkill and slow them down unnecessarily. Right. AIUI, SpectreV1 provides easier primitives anyway, so site isolation is already the way forward for this, and is already rolled out in most (all?) browsers. As for slowing them down, they could just as easily choose to use the new prctl() to turn OFF mitigation. :) > - Applications have to be maintained for security problems (otherwise > they will have lots of other problems, like variant 1), so adding > the extra prctl after a proper security shouldn't be that > big a burden. Sure, but it's the coordination of the roll-out that makes me uncomfortable. The application developers will find out about the prctl after the attack goes public, which leaves a window of attack open (and dependent on the release schedules of various organizations, etc). I think we can do better. If we at least attach it to seccomp, then rolling out a new kernel is all that is needed for a large portion of the concerned applications. Similarly, there tends to already exist tooling to turn on seccomp for various process launchers, etc. Nothing I'm aware of lets an admin run an arbitrary prctl(). So for admins that are already using containers with seccomp, they are immediately covered (after kernel updates) and can sort out what needs doing in a relaxed way instead of having their hair on fire beyond doing the kernel update. And admins NOT using a container for their untrusted-input-running-application (for shame) can immediately add a simple seccomp filter (e.g. adding a single line to a systemd service file) can gain the protection without having to figure out how to write a prctl()-setting launcher, etc etc. > - The extra prctl is needed anyways because it's quite > a bit of work to enable seccomp for an application, and also > forbids execing any suid tasks. Yup, totally agreed: we still need the prctl(). I just want to have a better answer than "I hope your software gets updated quickly LOL". -Kees -- Kees Cook @outflux.net