Kernel Storage-Protection Keys
Kernel storage-protection keys provide a storage-protection mechanism for the kernel and kernel extensions.
- Each virtual memory page is assigned a small integer protection key, which represents a required access authority to make the page readable or writable in the current context.
- A register, the authority mask register, is used to encode the access authority of the current context.
In all cases, a running thread can modify its authority mask register, and hence its authority to access specific memory classes. In AIX® environment, the storage-protection mechanism can catch programming errors caused by inadvertent storage overlays. When you write a program using storage protection keys, the program can voluntarily subdivide its memory for protection purposes, decreasing the likelihood that an accidental reference to memory goes undetected. Such undetected errors can be difficult to debug; however, by coding to detect them as they occur, a program can improve its reliability, availability, and serviceability characteristics.
- Incorrect reference to application memory by the kernel
- Incorrect reference to kernel private memory by key-safe kernel extensions
- Incorrect reference to kernel extension private memory by the kernel
- Incorrect reference to memory controlled by one kernel subsystem by another
- Key-unsafe kernel extensions
- Key-unsafe kernel extensions are traditional extensions that were
written without regard to storage key protection. When loaded in a
key-safe environment, such extensions are automatically run with wide
access authority to provide binary compatibility. With the ability
to access essentially all kernel memory without restrictions, key-unsafe
kernel extensions can continue to function, even though they might
violate the protection domain of the kernel.
In some other cases key-unsafe kernel extensions can cause system crashes therefore it is highly recommended that kernel extensions should be made key-safe before running. See Making a Kernel Extension Key Safe.
- Key-safe kernel extensions
- Key-safe kernel extensions do not directly refer to either the internal data structures of the kernel or user space addresses. See Making a Kernel Extension Key Safe.
- Key-protected kernel extensions
- Key-protected kernel extensions can coexist with the key-protected kernel environment, and also become key-protected by identifying and protecting their own private data. To place kernel extension data in key-protected memory, see Designing the Key Protection in a Key-protected Kernel Extension.