Page Protection

Original Address Page Protection Keys

Page Protection

Page Protection Keys (page protection key)

Since the write error, memory corruption issue is a complex multi-threaded applications. For example, each part of the code is not in the database applications need to have the same privilege level. Log writer should have the privilege to write the log buffer, but on the other pages should have only read privileges. Similarly, the application producer and consumer threads thread has some critical data structures used, the producer thread can be given additional rights consumers thread on a particular page.

Based memory protection page can be used to enhance the application. However, the page table change is costly for performance, because these changes require translation look-aside buffer (TLB) TLB fault and subsequent faults. Protection key provides a user-level, page size way to grant and revoke access, without changing the page table.

Key providing protection for the user domain 16 pages, using a page table bits 62:59 of leaf nodes (e.g., PTE) to identify the protection domain (PKEY). Each protection domain has two special permission bits in register a new thread called PKRU in. In the memory access, the page table lookup protection domain (PKEY) is used to determine access, and determine the appropriate protection domain specific permission from PKRU register contents to see whether to grant access and write access. Only when the protection key and a legacy page permissions are allowed to access before allowing access. Protection key violation will be a new page fault error code bits reported as a page fault. Protection key superuser page invalid, but superuser access to the user accessing the page with the user subject to the same checks.

Here Insert Picture Description
FIG access the memory data is protected with the key of FIG. 将PKEY与PKRU通过与门.

To benefit from the protection key, the need to support virtual machine management, operating systems and compilers. With this feature it does not affect performance because it is an extension of memory management architecture.

Published 48 original articles · won praise 18 · views 8755

Guess you like

Origin blog.csdn.net/weixin_44395686/article/details/105314178