News for hackers. Stuff that matters.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by tptacek on Friday January 05, 2018 @02:01PM (#16080728)
This is great, but remember that it covers Meltdown, not Spectre. Meltdown is the more immediate disaster, but Spectre is the more batshit vulnerability. You really want to get your head around:

* The branch target injection variant of Spectre if you want to get a sense of how amazing this vulnerability is: you can spoof the branch predictor to trick a target process into running arbitrary code in its address space! This is crazy!

* The misprediction variant of Spectre if you want to get a hopeless feeling in the pit of your stomach, since the implications of mispredict are that certain kinds of programs are riddled with a new kind of side channel we didn't really grok until last week, and no upcoming microcode update seems to be in the offing.

You could probably use the same Python conceit to illustrate the other two attacks; someone might take a crack at that.

(I'm not disputing that the R-Pi's aren't vulnerable to Spectre).

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by ploxiln on Friday January 05, 2018 @02:17PM (#16080849)
This covers both Meltdown and Spectre.

> Both vulnerabilities exploit performance features (caching and speculative execution) common to many modern processors to leak data via a so-called side-channel attack. Happily, the Raspberry Pi isn’t susceptible to these vulnerabilities, because of the particular ARM cores that we use.

The reason why Spectre is not a problem is because there is no branch predictor in these simpler arm cores. Instructions are processed in parallel when possible, but not before dependencies, including branch decisions.

EDIT: under "What is speculation?" branch prediction is described. Then in the conclusion: "The lack of speculation in the ARM1176, Cortex-A7, and Cortex-A53 cores used in Raspberry Pi render us immune to attacks of the sort."

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by makomk on Friday January 05, 2018 @05:56PM (#16082512)
A lot of the cheaper Pi-like boards also aren't affected for the same reason, as are lower-end Android phones. The articles claiming it affected every modern CPU were basically mistaken. It was an easy mistake to make, given that ARM's announcement only listed the cores that were affected and had a little note saying everything not listed was unaffected by both Meltdown and Spectre. (There is precisely one ARM-designed core that is affected by Meltdown, a high-end one so new that no chips based on it have been released yet.)
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by davrosthedalek on Friday January 05, 2018 @07:17PM (#16082935)
One could argue that CPUs without branch prediction are not modern in the sense of "modern, state of the art design". The fact that they still produce,e.g. 8051, even "new" overall designs, doesn't make the 8051 modern.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by zzzcpan on Friday January 05, 2018 @07:38PM (#16083040)
Branch prediction is neither new nor modern. Modern state of the art design doesn't actually do branch prediction in hardware at all. I mean look at all the ideas from VLIW architecture, no hardware - no problems.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by haimez on Friday January 05, 2018 @08:54PM (#16083389)
You're being pretty silly by zeroing in on the word modern and then using an equally silly redefinition of it yourself.

Branch prediction isn't new, you're right. But VLIW instructions are equally unmodern and are entirely orthogonal to speculative execution. Sufficiently smart compilers are also no substitute for runtime analysis.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by harlanji on Saturday January 06, 2018 @08:00PM (#16088426)
My CS book (Bryant and O'Hallaron, 2003, p. 399) says Control Data 6600 in 1964 was the first processor w out of order executuon, considered exotic until RS/6000 by IBM in 1990/PowerPC 601 in 1993.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by loeg on Friday January 05, 2018 @02:21PM (#16080883)
There is almost certainly a branch predictor even in these simple ARM cores.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by bunderbunder on Friday January 05, 2018 @03:13PM (#16081266)
Yes. The reference manuals for the cores indicate that they all do.

rpi 1: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301h/dd...

rpi 2: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464d/DD...

rpi 3: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0500d/DD...

As others have indicated further down, though, it won't open up much of a vulnerability unless they are speculatively fetching memory.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by phkahler on Friday January 05, 2018 @02:33PM (#16080978)
There's no reason to predict a branch if you're not going to execute speculatively.

I need to re-read the papers but I think the real problem isn't even speculative execution but allowing speculative cache changes.

The notion that "gadgets" didn't even need to return properly was both amusing and eye opening for me. It doesn't matter because the result will be flushed anyway! ;-)

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by cwzwarich on Friday January 05, 2018 @03:18PM (#16081302)
In an in-order CPU, you can still use a branch predictor to predict what to fetch and decode, so that you don't stall waiting for instruction fetch to finish after you resolve the branch.

In practice, advanced in-order designs contain more local reordering mechanisms, e.g. in the load/store unit, but they lack the unified global abstraction of a reorder buffer. The most successful timing attacks involve a mis-speculated load, so they wouldn't apply to these mechanisms, but it's not completely out of the question that they are also an effective side-channel.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by bazizbaziz on Friday January 05, 2018 @03:04PM (#16081204)
> There's no reason to predict a branch if you're not going to execute speculatively.

Not quite. Branch prediction is typically used on non-speculative architectures in order to avoid pipeline bubbles. (You could argue that pipelining is a form of speculation)

Here is the branch prediction documentation for one of the processors they claim is not vulnerable. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc....

Whether or not they're vulnerable has more to do with how their pipeline is structured. It's possible for an architecture to be vulnerable if a request to the load store unit can be done within the window between post-branch instruction fetch/exec and a branch resolution. Eyeballing the pipeline diagram from the above docs, it looks like you can maybe get a request to the LSU off before the branch resolves. dramatic music

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by fulafel on Saturday January 06, 2018 @07:52AM (#16085065)
Pipelined processors would slowed down considerably without branch prediction: every branch (= loop iteration) would stall the pipeline and instruction prefetch. 20-25% of instructions are branches, so this would mean a 5-10 clock cycle pause every 4 or 5 instructions.

(Simplest cores have only static branch prediction though)

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by kevin_thibedeau on Friday January 05, 2018 @11:13PM (#16083819)
Low end ARM parts keep track of branches to avoid purging cached pages that will be likely be needed soon. That allows them to have decent performance when executing from flash.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by piinbinary on Friday January 05, 2018 @02:30PM (#16080953)
(Asking for my own edification) What does the output of branch predictor get used for in a CPU without speculation?
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by quasse on Friday January 05, 2018 @03:21PM (#16081335)
Avoiding having to empty the instruction pipeline when a branch happens and restart. My favorite simple video explaining pipeline is still this old Apple one from back in the early 2000s:

https://youtu.be/PKF9GOE2q38?t=237

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by msbarnett on Friday January 05, 2018 @03:28PM (#16081385)
In a pipelined CPU, you want to start the memory fetches for which instructions to next feed into the instruction decoder, before the branch instruction has finished the execute stage. Otherwise every branch incurs a pipeline bubble.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by PeterisP on Friday January 05, 2018 @04:59PM (#16082100)
If you're doing speculative memory fetches, wouldn't that also leave a measurable impact on the cache?

Simply instead of MOV AX, [something that depends on secret value] as in the original Meltdown paper you'd need to use JMP [something that depends on secret value] to trigger the memory fetch in a branch that's not going to be used.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by msbarnett on Friday January 05, 2018 @05:35PM (#16082377)
Yeah, it's not 100% obvious to me that you couldn't stage some variant of Spectre against even this more limited form of speculation.

In the comments on the article the author argues: "Why don’t speculative instruction (and data) fetches introduce a vulnerability? Because unlike speculative execution they don’t lead to a separation between a read instruction and the process (whether a hardware page fault or a software bounds check) that determines whether that read instruction is allowed."

but that would seem to be confusing the details of Spectre with Meltdown (which is happening a lot right now). Spectre doesn't depend on unauthorized reads succeeding.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by simias on Friday January 05, 2018 @05:55PM (#16082509)
Not if you're just trying to avoid a bubble in you pipeline and not actually executing the opcodes speculatively. In this situation the code will be loaded (and probably decoded etc...) but not executed before the CPU made sure that the branch was actually taken. If it's not the pipeline is flushed and a bubble is introduced after all. It's not as efficient as executing speculatively out of order but at least if you predict correctly you avoid the cost of stalling the CPU on every conditional branch until it's resolved.

ARM also has an other trick for that, every opcode in the (full, non-Thumb) instruction set has a condition code that can let you execute an instruction conditionally based on the flags state without requiring an explicit branch. This way from the CPU perspective the flow of the code is linear, it's only late in the pipeline that the condition code is evaluated and the instruction discarded if it doesn't mach the flags. This way you're sure you'll never have a bubble no matter what, although the downside is that you end up fetching instructions that may end up not being executed so it's only worth it for "short" branches.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by msbarnett on Friday January 05, 2018 @06:36PM (#16082732)
> Not if you're just trying to avoid a bubble in you pipeline and not actually executing the opcodes speculatively. In this situation the code will be loaded (and probably decoded etc...) but not executed before the CPU made sure that the branch was actually taken.

Here's what I'm trying to figure out. Let's say there's a JIT-generated instruction that I, an attacker, am interested in learning but cannot directly read from my position in the sandbox. If I can influence the instruction fetch speculator to issue a load for that instruction, then AFAICT it doesn't matter that it never makes it as far as the execute stage -- merely the act of fetching it for decode will have had a side-effect I can probably exploit into determining what it was.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by simias on Saturday January 06, 2018 @04:54AM (#16084612)
Oh yeah you can do that, but I'm not sure if you can extract something useful out of this. Basically you can know whether or not a branch was speculatively loaded by timing the time it takes to go over it (if it was loaded by mistake it'll slow down execution). But then where do you go from there? Execution timings are not supposed to be secret.

I can't really imagine how you can construct an attack based on that, but maybe I lack imagination.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by cwzwarich on Friday January 05, 2018 @03:22PM (#16081338)
It is used to determine which instructions to fetch and decode, so that you don't have to wait until the branch is resolved to query the instruction cache, instruction TLB, MMU, DRAM, etc. If the branch was mispredicted, you have to stall to wait for this to complete.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by ploxiln on Friday January 05, 2018 @02:28PM (#16080940)
Ah, that's good to know ... a comment below mentioned a "BTAC" (branch target access cache).

Is it just used for getting instructions into the L1i cache then?

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by tptacek on Friday January 05, 2018 @02:19PM (#16080869)
I'm not arguing that R-Pi's are vulnerable to Spectre.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by ploxiln on Friday January 05, 2018 @02:20PM (#16080880)
You're arguing that this article does not cover Spectre.

It does ... it just doesn't have to fully describe spectre to show why the raspi is not affected.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by pslam on Friday January 05, 2018 @05:53PM (#16082492)
At least in the case of Cortex A-7, there's about 2-3 cycles (maybe 3-4 instructions with dual-issuing) before a branch mis-predict causes a pipeline flush. You can maybe fit a couple of loads into that time, and maybe one of them will result in a Dcache fill. Other in-order cores in the Cortex-A line have similar Dcache side-effect under mis-predict. It's not clear whether this actually leads to speculated Dcache fills, though.

So it's possible that some of the Raspberry Pi versions are in fact vulnerable to (much weaker versions of) Meltdown and Spectre.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by claytonjy on Friday January 05, 2018 @02:11PM (#16080807)
I too would love to see the continuation you suggest. This was a great article, and I was sad to see it end, since I was hoping to grok a little more about the technical differences between Meltdown and Spectre.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by JdeBP on Friday January 05, 2018 @05:11PM (#16082206)
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by tptacek on Friday January 05, 2018 @08:19PM (#16083231)
Those updates cover Meltdown and Spectre 2, not Spectre 1.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by fyi1183 on Friday January 05, 2018 @04:48PM (#16081998)
If you don't feel overwhelmed enough by the misprediction variant of Spectre yet, consider that the cache side effect of speculation is actually desirable in most normal cases, because it helps prime caches with data that is likely to be used in the correct branch as well. Just turning it off is not the right way to solve this.

Perhaps this will finally provide enough incentives to model data sensitivity in the type systems of practical programming languages.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by astrange on Saturday January 06, 2018 @12:03AM (#16083941)
It would be hard to model data-dependent timing of an actual CPU. Integer division is variable time on lots of architectures, but on ARM even multiplication timing is data-dependent! And on desktops you could cause a even mov instruction to stall a few cycles if you can run something before it that uses all the renamed registers - there might be a way to turn this into data dependence and observe it from the perf counters…
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by fyi1183 on Saturday January 06, 2018 @03:03AM (#16084345)
You don't need to model the timing though.

What I'm saying with the type system comment is this: the cache side effects of speculation are desirable most of the time but not always. We should find a way to model data sensitivity in the type system so that a compiler can automatically choose to generate a side-effect-free code sequence where the side effects must be avoided (this assumes a future with ISA extensions that allow telling the CPU to prevent such side effects by blocking the speculative execution).

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by sitkack on Saturday January 06, 2018 @01:38AM (#16084161)
All shortcuts leak information. Anything with the equivalent of an early return leaks information.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by DannyBee on Friday January 05, 2018 @06:16PM (#16082629)
It's not all that hopeless, actually.

Let's ignore meltdown, which seems solvable in hardware with no obvious performance loss (assuming amd's existence proof is correct), and concentrate on spectre, which everyone thinks means the world is ending.

One thing to note is that compilers have been safely speculating instructions for years. Shocking, i know :) Processors could too.

They just weren't. One of the cardinal rules of safe speculation is that you can't speculate an instruction unless you can prove it has no observable side-effects (ie possibly faulting, or in this case, ending up in cache), or that the side-effects are the precisely the same whether you speculate it or not (where "precisely the same" generally includes some notion of ordering of side-effect occurrence. i'm not going to get into all the various intricacies)

IE

  a+b -> safe to speculate, has no side effects
  load a -> generally unsafe, has possible observable side effects

  if foo:
    load a
  else
    load a 
  -> safe to speculate load a to right above the if, it must always be executed, and in this example, side-effects will be the same.
 
  if foo:
    load a
  -> not safe to speculate load a above the if, it may not execute
Compilers generally did not speculate loads, mainly because they can fault at that level[1]. The fault comes from the processor though.

So processors were/are assuming that speculation of loads, calls, etc, had no side effects because they could "throw away the results". As the processor controlled the faulting, it could just throw away the fault and pretend it never happened.

These two attacks are just proving that is not true, and the side-effects of computation themselves are observable.

The end result should be the same. Processors speculate more like compilers do: only in safe situations.

The idea that you have to give up all speculative execution seems very wrong.

You only have to give it up in cases where there are possibly observable side-effects and it's not guaranteed they will always happen.

The upshot is the most likely outcome is that both processors and compilers will work harder to speculate.

Compilers will get called upon to do more safe speculation.

Processors will have to grow the logic to determine when speculation is safe (or figure out a way to actually undo all side effects, which is fairly hard).

Now, the downside is the most useful speculation is obviously to hide load/store latency, and those things are the hardest to reason about safety.

But like i said, compilers have been doing it for many years at this point. Our hardware brethren just found out the hard way that they are likely to start having to do it too, and that there are more observable side-effects than they thought.

[1] Some JITs do it and catch the result in a fault handler if it turns out badly. I expect someone is going to discover ways to exploit all of these basically instantly. These will not be fixed by processor related fixes because they are not processor directed.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by gpderetta on Saturday January 06, 2018 @12:12AM (#16083964)
Considering that on average you have a branch every 5 instructions and the reorder buffer of high performance OoO CPU is in the order of a hundred of instruction, such a CPU is pretty much running under speculation all the time (often of multiple branches at the same time).

Not being able to fetch new cachelines when under speculation would be a huge blow, as exposing memory level parallelism is one of the most important features of OoO CPUs.

Edit: also fetching a cacheline is not really undoable as it is observable from other CPUs via the coherency protocol: i.e. while it might be possible to hide to the local cpu that a cacheline was loaded under a failed speculation, the effect can be still observed by another core by noticing that an exclusive line is now shared (by timing for example the latency of an atomic instruction)

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by DannyBee on Saturday January 06, 2018 @02:20AM (#16084273)
"Considering that on average you have a branch every 5 instructions and the reorder buffer of high performance OoO CPU is in the order of a hundred of instruction, such a CPU is pretty much running under speculation all the time (often of multiple branches at the same time)."

Yes, it is. Remember, again, that the vast majority of those instructions can still be speculated, because the vast majority of instructions are not loads or stores.

Now, certainly, the expensive ones are loads and stores, but i'm just pointing out that the hundreds of instructions you are talking about in the buffer are mostly not loads and stores.

It's true that lowering memory level parallelism would be a huge blow, as the vast majority of time in well-tuned cpu bound apps is usually spent in stalls waiting for memory (otherwise, if it's really just arithmetic bound, it may make more sense to run it on a GPU or something), and this would just increase it.

The real question is what percent can you prove are safe to speculate, and at what point can you prove that safety (ie assuming it must be dynamically speculated, can you prove safety with enough cycles left that it matters). If you have 5 instructions, yeah, no, probably not.. But it may also be the case that the execution environment can prove it safe for you as the program executes and tell you.

I expect getting back this performance is going to be done using a variety of methods, some cooperation between jits/compilers and processors, and possibly some weird abstractions around marking memory you want to protect or not (IE not speculate around).

I mean, in the absolute worst case, you could make loads/stores take constant time and speculate as much as you like :)

It's just that this has a much higher performance cost right now than not speculating at all (by a few orders of magnitude)

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by gpderetta on Saturday January 06, 2018 @08:08AM (#16085111)
I doubt that any CPU manufacturer is going to go first in crippling its memory subsystem.

I think realistically the only safe and not completely performance crippling workaround will be, at the very least, to run any untrusted code under a separate address space (assuming that the cpu is immune from meltdown). That doesn't necessarily require a full blown separate process, but something like memory protection keys might work.

The alternative is full static analysis and source level annotations, which realistically is only going to be done for very few programs and will still be error prone.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by DannyBee on Saturday January 06, 2018 @01:37PM (#16086727)
Yeah, i don't disagree at all. Something like this what i meant by "cooperation" (lfence or equivalent for code that can't be isolated but must be protected) + "weird abstractions" (IE back to segmented land we go)
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by gpderetta on Saturday January 06, 2018 @05:45PM (#16087904)
Forgot about segments! Time to resurrect them on x86-64 cpus?
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by drivebycomment on Friday January 05, 2018 @09:23PM (#16083483)
Just giving up speculation entirely is too much of a performance penalty. So one possible solution is: when you know it was a misspeculation, processor can just kick cache lines out of cache if the speculation caused the cache line to be loaded (probably you only need to do this at the last level cache closest to the memory). More states to track, but not impossible.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by DannyBee on Saturday January 06, 2018 @02:44AM (#16084318)
This only works if it's not observable by other cores/CPUs (IE you have no shared cache coherency).

Otherwise, they can observe it before you roll it back due to the way the coherency protocols work.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by tptacek on Friday January 05, 2018 @08:22PM (#16083241)
I don't think it really is hopeless. But what makes Spectre 1 "scary" is that it's situational: you want to serialize instructions predicating some loads --- unbounded offsets based on attacker-controlled data --- but all of them. You presumably don't want your compiler to lfence every basic block containing a load.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by rbanffy on Friday January 05, 2018 @06:27PM (#16082690)
> You only have to give it up in cases where there are possibly observable side-effects and it's not guaranteed they will always happen.

> Compilers will get called upon to do more safe speculation

Compilers can also emit code that minimizes those situations. Also, extending the ISA with an instruction modifier that signals that otherwise innocent instruction has indeed observable side effects (ideally the processor should know that, but, if the compiler already knows it, a runtime check can be skipped.

> Processors will have to grow the logic to determine when speculation is safe

In many cases, this would be as simple as flagging the micro-op as unsafe and pause the speculation at that point.

For Meltdown, the just-add-silicon approach could be to never share cache between privileged and unprivileged code. To extend that to Spectre, never share cache across different PIDs (but, then, the ISA will have to know what a PID is). Since that would reduce the effective cache effectiveness, caches will have to grow.

Fun times ahead.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by astrange on Saturday January 06, 2018 @12:05AM (#16083950)
Intel CPUs do already have PCID (PID-tagged page table cache) to make switching processes cheaper.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by rbanffy on Saturday January 06, 2018 @04:44AM (#16084584)
Shouldn't that protect against Spectre?
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by krylon on Saturday January 06, 2018 @04:29PM (#16087563)
If I understand it correctly, Spectre only works within a single address space.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by rbanffy on Saturday January 06, 2018 @05:41PM (#16087890)
Well... I never expected one part of my process not to be able to peek into what the others are doing.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by krylon on Saturday January 06, 2018 @05:53PM (#16087942)
One example would be malicious Javascript - or WebAssembly - strolling through your browser's memory looking for passwords to send home to the mothership. Or other sensitive information, like credit card numbers and so forth.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by rbanffy on Sunday January 07, 2018 @09:38AM (#16090972)
It's clearly a mistake to make all these different programs from different sources share a single security context.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by sillysaurus3 on Friday January 05, 2018 @07:11PM (#16082909)
By the way, didn't cperciva point out this vuln way back in 2005? http://www.daemonology.net/papers/htt.pdf

Actually that seems to be rather different, but still similar-ish. They both use threads to exploit memory caches in an unexpected way.

I thought he deserved a mention since no one really took it seriously back then. https://it.slashdot.org/story/05/05/13/0520214/hyperthreadin...

http://freerepublic.com/focus/f-news/1406913/posts

"The recent Hyper-Threading vulnerability announcement has generated a fair amount of discussion since it was released. KernelTrap has an interesting article quoting Linux creator Linus Torvalds who recently compared the vulnerability to similar issues with early SMP and direct-mapped caches suggesting, "it doesn't seem all that worrying in real life." Colin Percival, who published a recent paper on the vulnerability, strongly disagreed with Linus' assessment saying, "it is at times like this that Linux really suffers from having a single dictator in charge; when Linus doesn't understand a problem, he won't fix it, even if all the cryptographers in the world are standing against him."

Always found that amusing.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by tptacek on Friday January 05, 2018 @08:18PM (#16083228)
Cache timing goes back to at least 2005 with Osvik and Tromer. This isn't a simple cache timing bug, though.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by cperciva on Saturday January 06, 2018 @01:05AM (#16084095)
Cache timing goes back to 2005 with Percival. I published a couple weeks before them. :-)
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by idlewords on Saturday January 06, 2018 @04:52AM (#16084607)
Yeah, but did you ever win a Putnam?
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by cperciva on Saturday January 06, 2018 @05:48PM (#16087919)
Just the once, though.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by nickpsecurity on Sunday January 07, 2018 @02:29PM (#16092183)
"Cache timing goes back to at least 2005 with Osvik and Tromer. This isn't a simple cache timing bug, though." (tptacek)

"Cache timing goes back to 2005 with Percival. I published a couple weeks before them. :-)" (cpercival)

Cache timing goes back to the VAX Security Kernel (early 1990's) designed for those A1 certification requirements that tptacek calls useless, "red tape." One of the mandated techniques was covert, channel analysis of whole system. They found lots of side channels in hardware and software they tried to mitigate. Hu found one in CPU caches following with a design to mitigate it. That was presented in 1992.

https://news.ycombinator.com/item?id=16083384

Since Hu is paywalled, see (b) "cache-type covert timing channels" in his patent:

https://www.google.ch/patents/US5574912

So, one of INFOSEC's founders (Paul Karger) did the first, secure VMM for non-mainframe machines. The team followed the security certification procedures discovering a pile of threats that required fixes from microcode for clean virtualization to mitigation of cache, timing channels. They published that. Most security professionals outside high assurance sector and CompSci ignored and/or talked crap about their work presumably without reading it. Those same folks reported later on virtualization stacks hit in 2000's with the attack from 1992 on new software with weaker security than KVM/370 done in 1978. Now, another attack making waves uses the 1992 weakness combined with another problem they discovered by looking at what interacts with it. That might have been discovered earlier if they did that with x86 like high-assurance security (aka "red tape") did in 1995 for B3/A1 requirements with them spotting potential for SMM and cache issues:

https://pdfs.semanticscholar.org/2209/42809262c17b6631c0f653...

Note: High-assurance security was avoiding x86 wherever allowed by market for stuff like what's in that report. As report notes with exemplar systems, market often forced it to detriment of security. Their identification of SMM as a potential attack vector preempted Invisible Things by quite a bit of lead time. That was typical in this kind of work since TCSEC require thoroughness.

In 2016, one team surveyed the components plus research on them in a modern CPU. Researchers had spotted branching as a potential, timing channel pretty quickly after CPU's got mainstream attention.

https://eprint.iacr.org/2016/613.pdf

So, a team following B3 or A1 requirements of TCSEC for hardware like in 1990-1995 would've identified the cache channels (as done in 1992) plus other risky components. They'd have applied a temporal or non-interference analysis like they did with secure TCB's in 1990's to early 2000's. A combination of human eyeballs plus model-checking or proving for interference might have found recent attacks, too, given prior problems found in ordering or information flow violations. This is a maybe but I say focusing on interactions with known-risks would've sped discovery with high probability. Far as resources, it would be one team doing this on one grant using standard, certification techniques from mid-1980's on a CPU others analyzed in mid-1990's say it was bad for security due to the cache leaking secrets, too many privileged modes, various components implemented poorly, and so on.

I keep posting this stuff on HN, Lobste.rs, and so on since it's apparently (a) unknown to most new people in the security field for who knows what reason or (b) dismissed by some of them based on the recommendations of popular, security professionals who have clearly never read any of it or built a secure, hardware/software system. I'm assuming you were unaware of the prior work given your scrypt work brilliantly addressed a problem at root cause quite like Karger et al did when they approached security problems. The old work's importance is clear as I see yet again well-known, security professionals are citing attack vectors discovered, mitigated, and published in the 1990's like it was a 2005 thing. How much you want to bet there's more problems they already solved in their security techniques and certifications that we'd profit from applying instead of ignoring?

I encourage all security professionals to read up on prior work in tagged/capability machines, MLS kernels, covert channel analysis, secure virtualization, trusted paths, hardware security analysis, and so on. History keeps repeating. It's why I stay beating this drum on every forum.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by cperciva on Sunday January 07, 2018 @03:56PM (#16092654)
If you read my 2005 paper, you'll see that I devoted a section to providing the background on covert channels, dating back to Lampson's 1973 paper on the topic. I was very much aware of that earlier work.

My paper was the first to demonstrate that microarchitectural side channels could be used to steal cryptologically significant information from another process, as opposed to using a covert channel to deliberately transmit information.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by nickpsecurity on Sunday January 07, 2018 @05:26PM (#16093084)
Hmm. It's possible you made a previously-unknown distinction but I'm not sure. The Ware Report that started INFOSEC field in 1970 put vulnerabilities in three categories: "accidental disclosures, deliberate penetration, and physical attack." The diagram on Figure 3 (p 6) shows with radiation and crosstalk risks they were definitely considering hardware problems and side channels at least for EMSEC. When talking of that stuff, they usually treat it as a side effect of program design rather than deliberate.

https://csrc.nist.gov/csrc/media/publications/conference-pap...

Prior and current work usually models secure operation as a superset of safe/correct operation. Schell, Karger, and others prioritized defeating deliberate penetration with their mechanisms since (a) you had to design for malice from the beginning and (b) defeating one takes care of the other as a side effect. They'd consider the ability for any Sender to leak to any Receiver to be a vulnerability if that flow violates the security policy. That's something they might not have spelled out since they habitually avoided accidental leaks with mechanisms. Then again, you might be right where they never thought of it while working on the superset model. It's possible. I'm leaning toward they already considered side channels to be covert channels given descriptions from the time:

"A covert channel is typically a side effect of the proper functioning of software in the trusted computing base (TCB) of a multilevel system... Also, as we explain later, malicious users can exploit some special kinds of covert channels directly without using any Trojan horse at all."

"Avoiding all covert channels in multilevel processors would require static, delayed, or manual allocation of all the following resources: processor time, space in physical memory, service time from the memory bus, kernel service time, service time from all multilevel processes, and all storage within the address spaces of the kernel and the multilevel processes. We doubt that this can be achieved in a practical, general purpose processor. "

https://csrc.nist.gov/CSRC/media/Publications/conference-pap...

The description is it's incidental problem from normal, software functioning that can be maliciously exploited with or without a Trojan horse. They focus on penetration attempts since that was culture of time (rightly so!) but know it can be incidental. They also know in second quote just how bad the problem is with later work finding covert channels in all of that. Hu did the timing channels in caches that same year. Wray made a SRM replacement for timing channels year before. They were all over this area but without a clear solution that wouldn't kill the performance or pricing. We may never find one if talking timing channels or just secure sharing of physical resources.

Now far as your work, I just read it for refresher. It seems to assume, not prove, that the prior research never considered incidental disclosure. Past that, you do a great job identifying and demonstrating the problem. I want to be extra clear here I'm not claiming you didn't independently discover this or do something of value: I give researchers like you plenty credit elsewhere on researching practical problems, identifying solutions, and sharing them. I'm also grateful for those like you who deploy alternatives to common tech like scrypt and tarsnap. Much respect.

My counter is directed at the misinformation than you personally. My usual activity. I'm showing this was a well-known problem with potential mitigations presented at security conferences, one product was actually built to avoid it, it was higly cited with subsequent work in high-security imitating some of its ideas, these prior works/research is not getting to new ones concerned about similar problems, some people in security field are also discouraging or misrepresenting it on top of that, and I'm giving the forerunners their due credit plus raising awareness of that research to potentially speed up development of next, new ideas. My theory is people like you might build even greater things if you know about prior discoveries in problems and solutions, esp on root causes behind multiple problems. That I keep seeing prior problems re-identified makes me think it's true.

So, I just wanted to make that clear as I was mainly debunking this recent myth of cache-based, timing channels being a 2005 problem. It was rediscovered in 2005, perhaps under a new focus on incidental leaks, in a field where majority of breakers or professionals either didn't read much prior work or went out of their way to avoid it depending on who they are. Others and I studying such work also have posted that specific project in many forums for around a decade. You'd think people would've have checked out or tried to imitate something in early secure VMM's or OS's by now when trying to figure out how to secure VMM's or OS's. For some reason, they don't in majority of industry and FOSS. Your own conclusion echos that problem of apathy:

"Sadly, in the six months since this work was first quietly circulated within the operating system security community, and the four months since it was first publicly disclosed, some vendors failed to provide any response."

In case you wondered, that was also true in the past. Only the vendors intending to certify under higher levels of TCSEC looked for or mitigated covert channels. The general market didn't care. There's a reason: the regulations for acquisition said they wouldn't get paid their five to six digit licensing fees unless they proved to evaluators they applied the security techniques (eg covert-channel analysis). They also knew the evaluators would re-run what they could of the analyses and tests to look for bullshit. It's why I'm in favor of security regulations and certifications since they worked under TCSEC. Just gotta keep what worked while ditching bullshit like excess paperwork, overly prescriptive, and so on. DO-178B/DO-178C has been really good, too.

Whereas, understanding why FOSS doesn't give a shit I'm not sure on. My hypothesis is cultural attitudes, how security knowledge disseminates in the groups, and rigorous analysis of simplified software not being fun to most developers versus piles of features they can quickly throw together in favorite language. Curious what your thoughts are on FOSS side of it given FOSS model always had highest potential for high-security given labor advantage. Far as high-security, it never delivered it even once with all strong FOSS made by private parties (esp in academia) or companies that open-sourced it after the fact. Proprietary has them beat from kernels to usable languages several to nothing.

Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown by frik on Friday January 05, 2018 @05:42PM (#16082419)
Thanks for the confirmation and inside info!

Yesterday we only guessed it https://news.ycombinator.com/item?id=16069740 based on ARM CPU list,

the RPi 1-3 CPUs

  ARM11, Cortex-A7, Cortex-A53
aren't in the list.

Affected ARM cores:

  Cortex-R7, Cortex-R8, Cortex-A8, Cortex-A9, Cortex A15, 
  Cortex-A17, Cortex-A57, Cortex-A72, Cortex-A73, Cortex-A75
https://developer.arm.com/support/security-update

(I tried to post it 3 hours ago, but HN is rate-limiting my posts, oh well)