Return-path: Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1fC88p-0006Yu-Nm for speck@linutronix.de; Fri, 27 Apr 2018 20:30:44 +0200 Received: by mail-pg0-x22c.google.com with SMTP id p10-v6so2171738pgn.1 for ; Fri, 27 Apr 2018 11:30:43 -0700 (PDT) Received: from i7.lan (c-73-11-52-149.hsd1.or.comcast.net. [73.11.52.149]) by smtp.gmail.com with ESMTPSA id z13sm4125681pfk.156.2018.04.27.11.30.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Apr 2018 11:30:35 -0700 (PDT) Sender: Linus Torvalds Date: Fri, 27 Apr 2018 11:30:34 -0700 (PDT) From: Linus Torvalds Subject: [MODERATED] Re: [PATCH v2] Linux Patch 1/1 In-Reply-To: Message-ID: References: <92c45587-5eb3-2421-6fc1-42e74a715e30@linux.intel.com> <20180427164743.GA14180@pd.tnic> <6e2b14fc-3bf6-071d-6ce2-e518f2c4f069@redhat.com> <20180427173221.GB14180@pd.tnic> <20180427180944.GD75137@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Fri, 27 Apr 2018, speck for Thomas Gleixner wrote: > On Fri, 27 Apr 2018, speck for Thomas Gleixner wrote: > > > > Sure. You set it on that sandbox thing and then the thread which is spawned > > of from there can disable it. Brilliant idea. > > And in fact you want it even inherit on exec because then you can start the > JVM or whatever you want to protect with it disabled and never have to > worry about it again. I don't think that's the attack people are worried about. Basically, for the store buffer bypass, the *only* worry is JIT'ed code. I don't think people expect it to leak from supervisor to user mode, for example, so it's not primarily a protection domain issue. It's almost purely a "I generated code assuming the architecture would actualy execute the code I wrote" issue. That means that it's not like you're really executing "untrusted" code in general. Your jitted code isn't going to just run random sysctl's without any checking or anything like that. You trust your JVM to take care of *those* kinds of security issues. So "user can turn it on and off as they please" is not really an issue. In fact, it could easily be seen as a feature. Making it expensive or hard to turn off the mitigation means that you can't necessarily just turn it on temporarily for the code you really care about. Realistically, a JIT would probably prefer to only turn off store buffer bypass when jumping into JIT'ed code, and then turning it on when coming back. Exactly because it's really not about any "security", it's abnout "I translated untrusted code, and I want _exactly_ the semantics that I did the translations with - everything else I can and do check manually". Linus