]> www.infradead.org Git - users/dwmw2/linux.git/commit
s390/pkey: Add function to enforce pkey handler modules load
authorHarald Freudenberger <freude@linux.ibm.com>
Thu, 22 Aug 2024 09:32:21 +0000 (11:32 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 29 Aug 2024 20:56:34 +0000 (22:56 +0200)
commit177b621bf0685e8733fa6a7c796865f4200a6e2f
tree6f165b307249cac7f846ade7924de9ba719520a6
parent2fc401b94434ae97d1c9c1283fcf816c1ad9457c
s390/pkey: Add function to enforce pkey handler modules load

There is a use case during early boot with an secure key encrypted
root file system where the paes cipher may try to derive a protected
key from secure key while the AP bus is still in the process of
scanning the bus and building up the zcrypt device drivers. As the
detection of CEX cards also triggers the modprobe of the pkey handler
modules, these modules may come into existence too late.

Yet another use case happening during early boot is for use of an
protected key encrypted swap file(system). There is an ephemeral
protected key read via sysfs to set up the swap file. But this only
works when the pkey_pckmo module is already in - which may happen at a
later time as the load is triggered via CPU feature.

This patch introduces a new function pkey_handler_request_modules()
and invokes it which unconditional tries to load in the pkey handler
modules. This function is called for the in-kernel API to derive a
protected key from whatever and in the sysfs API when the first
attempt to simple invoke the handler function failed.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/pkey_api.c
drivers/s390/crypto/pkey_base.c
drivers/s390/crypto/pkey_base.h
drivers/s390/crypto/pkey_sysfs.c