4 ms·
The entire "ring 1" thing is highly likely false. It's been decades since I last saw anyone using the x86 ring levels and I seriously doubt XNU is using them.
by AshamedCaptain 5y ago
The entire "ring 1" thing is highly likely false. It's been decades since I last saw anyone using the x86 ring levels and I seriously doubt XNU is using them.
In any case, extensions run in the same address space as the rest of the kernel making any such "rings" pointless.
- als0 5y agoRings 1 and 2 don't even exist on AMD64/x86-64.
- zvrba 5y agoYes they do, but segmentation is practically non-existent and page tables distinguish only between rings 0 and rings 1-3. So no, they aren't very useful, but they do exist and, AFAIK, they're still checked in "far" control transfers.
- tzs 5y agoIt's too bad they have been made useless. I'm not fully sure about this, but I think that if you could have two rings for user code so that applications that want to run untrusted code in a sandbox could run the main application in ring 2 and the sandboxed code in ring 3, you could make the application safe from Spectre attacks from the sandboxed code without giving up performance.
- bonzini 5y agoThe point of Spectre attacks is that they use side channel to infer the target's data from communication between the target and the attacking userspace process. This is possible even over the network, so ring 2 wouldn't help much.
- zinekeller 5y agoI mean, recent developments in the Windows/NT architecture uses virtualization to create a three-level "ring" system, so while it's not strictly architectural "rings", it's effectively a tri-ring system. But then, I haven't delved into how macOS in M1 precisely works.
- AshamedCaptain 5y agoVirtualization is indeed the last user of the x86-ring 1 that I remember. But it is much easier to put an entire virtualized kernel in a different ring (x86 or ?) than selectively put pieces and parts of one in different rings, which no one does.
- zinekeller 5y ago> Virtualization is indeed the last user of the x86-ring 1 that I remember. Yes, I know, but I'm referring to hardware virtualization, essentially making "ring -1" "ring 0" and "ring 0" "ring 1".
- mmis1000 5y agoIf you ever want to, it seems you can have a unlimited layer of 'rings' now? I heard that both amd and intel have nested page virtualization in recent products. Besides that, hyperv seems make use of it to achieve paravirtulization?
- bonzini 5y agoXen on 32-bit x86 used the real ring 1. :)
- kmeisthax 5y agoThe funny thing is that the M1 has an undocumented but totally used feature called Guarded Execution[0] that lets you separate parts of the kernel (or hypervisor, if you're in EL2) from one another. Basically, on the M1 each Exception Level now has a regular and a guarded sublevel, with their own page table permissions, and special instructions to enter or exit the guarded execution within the same EL. macOS on the M1 uses this to prohibit most kernel code from touching pagetables. You have to do that from within the guarded sublevel, which kernel extensions can only call into. This is more or less the original intent of x86 rings: to separate an OS kernel out into parts with different permissions and levels of isolation. [0] https://blog.svenpeter.dev/posts/m1_sprr_gxf/ https://blog.svenpeter.dev/posts/m1_sprr_gxf/