4 ms·
Not calling it a bug is ridiculous, it breaks x86 memory protection totally.
by throwaway2048 9y ago
Not calling it a bug is ridiculous, it breaks x86 memory protection totally.
- rayiner 9y agoWhat does “x86 memory protection” mean? What promises does the hardware make to the software?
- pcwalton 9y agoThat software in ring 3 cannot read memory in ring 0 unless the appropriate permission bits on the page table entries are set.
- rayiner 9y agoI don't think the spec actually makes that guarantee anywhere. It says that a page fault will be generated if a memory access violates page protection bits, but doesn't discuss any other potential side effects. The closest thing I can find is Intel Architecture Reference Manual Volume 3, Section 5.1.1: > With page-level protection (as with segment-level protection) each memory reference is checked to verify that protection checks are satisfied. All checks are made before the memory cycle is started, and any violation prevents the cycle from starting and results in a page-fault exception being generated. Because checks are performed in parallel with address translation, there is no performance penalty. If you read section 11 on caching, the terminology "memory cycle" seems to exclude cache access. Indeed, Volume 3, Section 11.7 explicitly warns that implicit caching might happen that you would not expect: > Implicit caching occurs when a memory element is made potentially cacheable, although the element may never have been accessed in the normal von Neumann sequence. Implicit caching occurs on the P6 and more recent processor families due to aggressive prefetching, branch prediction, and TLB miss handling.
- pcwalton 9y agoThe spec isn't really relevant to the point I'm making. I'm talking about what the purpose of the design is. Memory protection as a feature exists in order to (among other things) prevent code in ring 3 from reading data in ring 0 that ring 0 has not explicitly granted permission to read. If the implementation fails to do that, then it's failed to achieve its goal, and the whole exercise is pointless—why include the silicon at all? Documented bugs are still bugs. Again to use the crypto analogy: An implementation of, say, RSA that uses timing-sensitive memcmp to compare signatures would follow the RSA specification. But everyone would agree that such software has a severe bug.