Ok I think I understand the subtleties of these attacks now. But: can anyone tell me why the accessibility check for protected memory doesn't happen before the cache loads the contents of RAM? If that happened then none of these attacks would be possible. I got my computer engineering degree in 1999 and ended up going the computer science route making CRUD apps all day. I feel in my gut that some engineer, somewhere,…
The memory access could potentially take a very long time, so it makes sense to start it as early as possible, in parallel with all the other operations. Saving a few cycles on each memory access adds up significantly overall.
Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
81–90 of 232 posts
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#82I've done some cursory searching and not found anything, so I'll ask here: what mechanism is used to measure how long it takes to access a specific address in memory? I assume there is some way to tell the CPU "when memory location X is read, store the current time in register Y" or some such thing. Could anyone share what that mechanism is?
Elsewhere in the thread, someone asked the same question and got an answer: https://news.ycombinator.com/item?id=16080230
Instead of measuring the literal time interval between instructions, the number of cycles between two points is measured (using the RDTSCP instruction).
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#83Earlier quoted context omitted.
There is almost certainly a branch predictor even in these simple ARM cores.
(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
#84Earlier quoted context omitted.
There is almost certainly a branch predictor even in these simple ARM cores.
(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
#85I enjoyed reading this a lot. I wonder why the developers decided to allow reading kernel-memory in the first place. When a scalar processor reads kernel memory, it crashes. When a speculative processor reads kernel memory, it relies on the assumption that the read is never committed to prevent leakage. It takes no expert to realise this is a potentially dangerous decision (and, as becomes clear now, is only valid in…
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#86Ok I think I understand the subtleties of these attacks now. But: can anyone tell me why the accessibility check for protected memory doesn't happen before the cache loads the contents of RAM? If that happened then none of these attacks would be possible. I got my computer engineering degree in 1999 and ended up going the computer science route making CRUD apps all day. I feel in my gut that some engineer, somewhere,…
From what I understand, it does happen on AMD, which is why AMD CPUs are not vulnerable to the more dangerous Meltdown attack (any code reading kernel / hypervisor host memory).
Intel / ARM delays the checks until later, to the time when the speculated instructions are actually finalised and make their results available. This is faster, and loading some memory into the cache is normally invisible to the unprivileged code. The checks would still be done when actually reading that memory. But nobody spent enough time considering the timing side-effects of the cache.
Now even if the protected memory reads are fixed by the OS updates - then it still leaves the Spectre attack - code running in a process reading all of "its own" memory, regardless of any software sandboxing. This means that all sorts of sandboxing methods for javascript interpreters, bytecode interpreters, plugin architectures, etc are insecure. And the OS patches can't help here, because the sandbox isn't in protected memory.
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#87I've been wondering (and haven't seen it addressed anywhere) if these attacks could be used to get the private key out of game consoles. These days I would assume not - that the key would be in a secure enclave - but the current generation of consoles are a few years old now and maybe that's not the case.
The private key used to sign code? No, that wouldn't be in the console at all.
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#88Earlier quoted context omitted.
agreed
Me too. Finally I understand how the leakage works: no actual reading of kernel memory is taking place. Instead, the read-ahead/speculative logic causes one of two addresses in user space to be read, and thus placed in the cache. So, by reading both of them, and checking the time it took, the exploit can indirectly determine one bit (0 or 1) of kernel memory. Scary!
Re: Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
#89Earlier quoted context omitted.
There is almost certainly a branch predictor even in these simple ARM cores.
(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
#90Earlier quoted context omitted.
The memory access could potentially take a very long time, so it makes sense to start it as early as possible, in parallel with all the other operations. Saving a few cycles on each memory access adds up significantly overall.
Right, but at a cost of a leaky cache abstraction. Which is now hugely expensive to work around, making me question how that ever got approved if the security model was clearly leaking at that point (which has been known for the entirety of speculative execution, right?)
Keep in mind that for a very long time, PCs and x86 CPUs were used in environments where either there was a single user with full access, or multiple users that aren't completely adversarial (look at Win95/98's multiuser security model, for example.) Memory protection and other security features served as a barrier to accidents and to "keep the honest honest", not determined adversaries.
They still are today, but this is very different from the shared servers/cloud computing environments which have now become common --- completely mutually untrusting users with possibly adversarial relationships are sharing the same hardware.
This is the reason why all the CPU manufacturers have had some variant of "as designed" in their public comments --- speculative execution was designed with the former model in mind, not the latter.