Return-Path: Received: from mail-pl0-x236.google.com ([2607:f8b0:400e:c01::236]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1fQHkv-0001yc-4g for speck@linutronix.de; Tue, 05 Jun 2018 21:36:33 +0200 Received: by mail-pl0-x236.google.com with SMTP id 30-v6so2144446pld.13 for ; Tue, 05 Jun 2018 12:36:33 -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 t3-v6sm19244606pfk.161.2018.06.05.12.36.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 12:36:25 -0700 (PDT) Sender: Linus Torvalds Date: Tue, 5 Jun 2018 12:36:24 -0700 (PDT) From: Linus Torvalds Subject: [MODERATED] Re: ARCH_CAPABILITIES note In-Reply-To: Message-ID: References: <0eca849b-fd6b-e42f-6c83-3c930d644bba@redhat.com> <3b6d8d03-945e-4efc-7baa-a7ecedfd2366@linux.intel.com> <51a5e275-67c2-5638-21e9-a3992ba1de0b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Tue, 5 Jun 2018, speck for Thomas Gleixner wrote: > > Te LFENCE in the entry code is not protecting any of these, except a > straight return to user space speculation. I think people are just talking about the plain SSB attack where a user store in the store buffer is bypassed, and the kernel reads an old stale value. I do not actually believe this is an attack at all. Users can use threads to show kernel multiple values at any kernel memory read time, so the attack is bogus. The other possible store buffer attack is one that does *NOT* bypass the store buffer, but instead depends on the kernel reading a "trusted" kernel value that was in the store buffer because user space polluted *kernel* data, and the store is still speculative, and has not been killed yet (because Intel stupidly kills memory ops in _retirement_, not at execution time, which is why Meltdown happened). IOW, I believe a user process could in theory do - slow load followed by conditional that is mispredicted - within the covers of that slow load and mispredict, do: - speculative store to kernel space - speculative system call - kernel will now *HIT* in the store buffer and see the user-supplied value for something that should be safe but I'm not sure that the above is actually possible. But *if* the above is possible, then it allows user space to possibly pollute some very early kernel data structure reads, if user space just knows the addresses. And by "very early kernel data striucture reads" I mean things like the percpu stack pointer read in the entry trampoline. But we have those %cr3 movement things there that probably stop things like that. Anyway, that happens even before the retpoline. And again, I think this whole thing is confused by there being so many *different* issues. The store buffer *bypass*, the possible store buffer *poisoning*, the possible interactions with loading return addresses from stack as a result of such poisoning, the odd (and still not fully explained) second version of "v1" that I haven't seen the whitepaper for, etc etc etc. I really would prefer that people give way more concrete examples, and stop with the handwaving. *Anything* can happen when you combine four different security issues. Can we agree that we always give real hard examples, not some hand-wavy "read after read after store buffer bypass"? Linus