5 ms·
When Spectre first came out, my prediction was basically that the only effective mitigation would be to move the untrusted code into another address space. This
by jcranmer 8y ago
When Spectre first came out, my prediction was basically that the only effective mitigation would be to move the untrusted code into another address space. This post reinforces that they have exhausted all other options:
> Our research reached the conclusion that, in principle, untrusted code can read a process’s entire address space using Spectre and side channels. Software mitigations reduce the effectiveness of many potential gadgets, but are not efficient or comprehensive. The only effective mitigation is to move sensitive data out of the process’s address space.
Probably the most effective hardware mitigation would be to shift the isolation to a page-level granularity, so that you could say that speculation is disabled for memory in specific pages.
- zzzcpan 8y agoNote, they talk about retrofitting mitigations into the web browser running javascript, not in general. It's hard to find a reason why software mitigations wouldn't work for a language and a compiler designed from scratch for it.
- reubenmorais 8y agoMitigating Spectre only makes sense if you’re doing it in a VM (e.g. operating system, web browser, processor), a system that loads and executes untrusted code. Not in a language or a compiler. If your language/compiler doesn’t allow the coder to exploit Spectre, they’ll just use another language/compiler.
- zzzcpan 8y agoThe problem is much bigger than that. Today pretty much all mainstream languages rely on untrusted modules ecosystems, untrusted github projects, etc. If we were to create language level boundaries to address those problems, we would need to deal with Spectre as well. Either way, my point was that it's absolutely possible to fully mitigate Spectre in software. A particular group of people just found it too hard to do for the things they work on. Doesn't mean the same applies to anything else.
- monocasa 8y agoI think the most effective hardware mitigation would be to bring back rings 1 and 2. Don't disable speculation, but instead give multiple hardware security contexts that get protected the same way that meltdown gets fixed (or wasn't a problem to begin with depending on the chip).
- kccqzy 8y agoAnd now suddenly your browser needs root and needs to run in kernel mode?
- monocasa 8y ago...no, the kernel would provide safe access to those.
- Aearnus 8y agoThe attack surface of the kernel is much larger than the attack surface of a browser. Not saying this is a bad idea, but it definitely opens up much more room for much more serious attacks.
- monocasa 8y agoThe browser already mitigates this via the normal system call sandboxing on the various OSes. And something like this already existed, 32bit chrome would play games with the LDT on OSes that allowed that to build a better sandbox. It's just that the LDT more or less disappeared on x86_64.
- bluGill 8y agoRing 1 and 2, while rarely used on x86 have meaning that is not appropriate for what is needed here. What I want is a new ring-4. Ring-4 is like ring-3, except that cache attacks are mitigated (disable speculative execution is the obvious option, but there might be something else that I don't know of). Ring-3 code can put parts of itself in ring-4 mode as required.
- reitzensteinm 8y agoIf you're going to modify the processor to add a feature to prevent speculative reads from the same address space when you control the JIT, why not add an instruction that enters a mode that passes the address of all reads and writes through an implicit mask until it has been switched off. This would outright prevent code generated by the JIT to do out of bounds speculative loads directly, it would just load a rewritten address from within the restricted region. Instead you'd have to trick an API call (which would be executed without the restriction) in to doing it for you.
- doctorpangloss 8y agoWhy not create a chip that accelerates compilation? Or like those old Java cores on phones, accelerates the web browser's parsing, compilation and code execution needs? We already ship H.264 decoders on everything. And vendors are sort of settling on, Chrome/WebKit rules all. Why not just standardize the model in the hardware? On the other hand, image and video codecs are actually chock full of security issues nobody bothers to exploit.
- monocasa 8y agoHardware isn't magical go faster juice. Doing compilation 'in hardware' isn't any faster than doing it in software.
- verall 8y agoVideo processing is generally a parallel bandwidth-heavy task with predictable memory access patterns whereas compilation is NOT. Thus video processing lends well to hardware implementations. Additionally everything h.265/VP8 or later was designed with people from HW companies on the committees and thus the algorithms were adjusted specifically to benefit HW impl. Compilation is extremely configurable, Chrome wants to push out updates to its JS parser every month, there are like a million reasons this isnt done in hardware.
- kllrnohj 8y ago> Probably the most effective hardware mitigation would be to shift the isolation to a page-level granularity, so that you could say that speculation is disabled for memory in specific pages. What's wrong with the hardware mitigation of just using multiple processes? It already exists, it already works, and it already has decades of tooling & infrastructure built around it.
- sievebrain 8y agoIt's very expensive. Site isolation in Chrome explodes memory pressure on the system. Language enforced confidentiality is a lot less resource intensive.
- kllrnohj 8y ago> It's very expensive. Processes? They don't need to be expensive, as proven by Linux. Trivially cheap enough to do one per site origin in a browser, anyway. > Site isolation in Chrome explodes memory pressure on the system. How do you figure? Code pages are shared, after all. Only duplicate heap would be an issue, but shared memory exists and can mitigate that if there's read-only data to be shared. So what memory pressure is "exploded"? > Language enforced confidentiality is a lot less resource intensive. Not at all clear-cut or self-supporting. What resource(s) is it less intensive on, and what are you using to support such a claim? CPU time is a resource, too, after all. All this software-injected mitigations and maskings aren't free.
- kevingadd 8y agoThe experience of literally every browser vendor does not support your claim that it is 'trivially cheap'. Problems worth thinking about: Sharing jitted code across processes (including runtime-shared things like standard library APIs) - lots of effort has gone into optimizing this for V8. Startup time due to unsharable data. Again lots of effort goes into optimizing this. Cost of page tables per process. (This is bad on every OS I know of even if it's cheaper on some OSes). Cost of setting up process state like page tables (perhaps small, but still not free) Cost of context switches. For browsers with aggressive process isolation this can be a lot. Cost of fetching content from disk cache into per-process in-memory cache. This used to be very significant in Chrome, they did something recent to optimize it. We're talking 10-40 ms per request from context switches and RPC. Most importantly the risk of having processes OOM killed is significant and goes up the more processes you have. This is especially bad on Android and iOS but can be an issue on Linux too. ASLR and other security mitigations also mean you're touching some pages to do relocation at startup, aren't you? You're paying that for dozens of processes now.
- jasonhansel 8y agoIs it actually possible to enforce this degree of isolation in all cases? It seems like you need to separate everything influenced by user input from anything containing secrets.