5 ms·
I 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 con
by monocasa 8y ago
I 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.
- monocasa 8y agoIf you just want to disable speculative execution, you can already do that. Just emit an lfence in front of every load. Of course, you don't want to do that because it'd cut into your execution speed by 10x to 100x. What you want is the ability to keep speculative execution, but not allow the JITed code to speculate based on information in the same process that it shouldn't have access to. To do that requires describing the different security zones to the processor somehow. Why I say that bringing back rings one and two is a good idea is that it gives another context to user mode _and_ kernel mode, so that the kernel can protect itself from BPF style programs at some point.
- bluGill 8y agoThat is why I said ring-4 mitigates the attacks. Ring 1 and 2 already exists on x86, we can't just reassign what they do, which is why I introduced ring-4. Ring-1 and Ring-2 are too powerful for user programs, the web browser should not use them.
- monocasa 8y agoSure you can, it just needs to be opt in. And since x86_64 neutered rings 1 and 2 to the point that they don't really make sense to use anyway, it shouldn't be a big deal for downstream software either.
- gpderetta 8y agoVirtualization hardware can potentially be accessed from userspace [1]. That might be both more fine grained and more performant than a fully separate address space. Failing that maybe it is time to bring back segments. [1]https://github.com/ramonza/dune/blob/master/README https://github.com/ramonza/dune/blob/master/README
- monocasa 8y agoI did a similar thing here, using the a virtualized ring 0 context speed up JITed cross ISA virtualization. https://github.com/monocasa/remu-playground https://github.com/monocasa/remu-playground Because you have to round trip through the host kernel to do anything that leaves that context, it's a bit slower and doesn't really get you the perf gains overall you might think. : / But yeah, segments coming back would be really neat.
- gpderetta 8y agoNice. Intel also support memory protection keys. I wonder if they would be enough. Although they might be affected by meltdown like issues. Does AMD support them?
- monocasa 8y agoThe MPX extensions? AMD never supported them, and I've heard rumors that Intel might be dropping support since support never really took off for it. In addition to the meltdown like effects that probably exist, I'd be afraid of the cache effect side channels of just everything needed to load the base and bounds registers.
- gpderetta 8y agoNot MPX, I think it is called MPK[1]; basically a process can tag each page with a 4 bit identifier (via a kernel provided API) and then, by loading the id on a special register can restrict its own accesses to pages with different keys. [1] https://lwn.net/Articles/689395/ https://lwn.net/Articles/689395/