[RFC 04/12] x86/mm: Add helper functions to manage memory encryption keys

David Howells dhowells at redhat.com
Tue Sep 11 22:56:55 UTC 2018


Alison Schofield <alison.schofield at intel.com> wrote:

> +void mktme_map_set_keyid(int keyid, unsigned int serial)
> +{
> +	mktme_map->serial[keyid] = serial;
> +	mktme_map->mapped_keyids++;
> +}

It appears that 'serial' should be key_serial_t.

Note that you *aren't* allowed to cache key serial numbers inside the kernel.
You must cache the struct key * instead and hold a reference to the key.  This
will prevent the key from being destroyed whilst it is in use.

David



More information about the Linux-security-module-archive mailing list