Linux Secret Memory "secretmemfd" System Call Remains Under Review
A few months back we wrote of experimental work for creating "secret" memory areas with memfd and now that work has turned into the secretmemfd system call that is under review.
The motivation for this work is for creating memory areas from user-space that are only visible to the process owning said memory and is not mapped for other processes or the kernel page tables. One use-case mentioned in the past was for OpenSSL usage with these secret memory areas for the storing of private keys.
Mike Rapoport of IBM sent out a set of six patches on Monday morning for introducing the secretmemfd system call as the latest on this front for secret memory areas.
Rapoport explained, "The file descriptor is created using a dedicated secretmemfd system call. The desired protection mode for the memory is configured using flags parameter of the system call. The mmap() of the file descriptor created with secretmemfd() will create a "secret" memory mapping. The pages in that mapping will be marked as not present in the direct map and will have desired protection bits set in the user page table. For instance, current implementation allows uncached mappings. Although normally Linux userspace mappings are protected from other users, such secret mappings are useful for environments where a hostile tenant is trying to trick the kernel into giving them access to other tenants mappings. Additionally, the secret mappings may be used as a mean to protect guest memory in a virtual machine host."
These latest secret memory patches can be found on the kernel mailing list.
The motivation for this work is for creating memory areas from user-space that are only visible to the process owning said memory and is not mapped for other processes or the kernel page tables. One use-case mentioned in the past was for OpenSSL usage with these secret memory areas for the storing of private keys.
Mike Rapoport of IBM sent out a set of six patches on Monday morning for introducing the secretmemfd system call as the latest on this front for secret memory areas.
Rapoport explained, "The file descriptor is created using a dedicated secretmemfd system call. The desired protection mode for the memory is configured using flags parameter of the system call. The mmap() of the file descriptor created with secretmemfd() will create a "secret" memory mapping. The pages in that mapping will be marked as not present in the direct map and will have desired protection bits set in the user page table. For instance, current implementation allows uncached mappings. Although normally Linux userspace mappings are protected from other users, such secret mappings are useful for environments where a hostile tenant is trying to trick the kernel into giving them access to other tenants mappings. Additionally, the secret mappings may be used as a mean to protect guest memory in a virtual machine host."
These latest secret memory patches can be found on the kernel mailing list.
14 Comments