Re: [PATCH v2 2/2] s390/uv: Provide host-key hashes in sysfs

From: Janosch Frank
Date: Tue Oct 08 2024 - 08:12:34 EST


On 10/2/24 6:04 PM, Steffen Eiden wrote:
Utilize the new Query Ultravisor Keys UVC to give user space the
information which host-keys are installed on the system.

Create a new sysfs directory 'firmware/uv/keys' that contains the hash
of the host-key and the backup host-key of that system. Additionally,
the file 'all' contains the response from the UVC possibly containing
more key-hashes than currently known.

Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>

Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>

Two nits below.

---
arch/s390/include/asm/uv.h | 16 +++++++++
arch/s390/kernel/uv.c | 71 ++++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+)


[...]

+struct uv_key_hash {
+ u64 dword[4];
+} __packed __aligned(8);
+
+#define UVC_QUERY_KEYS_IDX_HK 0
+#define UVC_QUERY_KEYS_IDX_BACK_HK 1
+
+/* Query Ultravisor Keys */
+struct uv_cb_query_keys {
+ struct uv_cb_header header; /* 0x0000 */
+ u64 reserved08[3]; /* 0x0008 */
+ struct uv_key_hash keys[15]; /* 0x0020 */

s/keys/key_hash/ or something similar?

+} __packed __aligned(8);


We could add a static size assert here.