Skip to content

s390/uvdevice: Expose secret UVCs

Steffen Eiden kvm linux-s390 lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest7 patches 1 replyIn review
  2. v46 patches 5 repliesSuperseded
  3. v36 patches 5 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v26 patches6 repliesSuperseded
v15 patches7 repliesSuperseded

Changes in v5 from the cover letter

* fix Kconfig for uvdevice
* add PATCH to always export uv_info
* fix oopsie
see diff below

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7s390/uv: Always export uv_infoarch/s390/kernel/uv.c+9 -11 reply
2/7s390/uvdevice: Add info IOCTLarch/s390/include/uapi/asm/uvdevice.h drivers/s390/char/Kconfig drivers/s390/char/uvdevice.c+112 -90 replies
3/7s390/uvdevice: Add 'Add Secret' UVCarch/s390/include/asm/uv.h arch/s390/include/uapi/asm/uvdevice.h drivers/s390/char/uvdevice.c+81 -00 replies
4/7s390/uvdevice: Add 'List Secrets' UVCarch/s390/include/asm/uv.h arch/s390/include/uapi/asm/uvdevice.h drivers/s390/char/uvdevice.c+59 -00 replies
5/7s390/uvdevice: Add 'Lock Secret Store' UVCarch/s390/include/asm/uv.h arch/s390/include/uapi/asm/uvdevice.h drivers/s390/char/uvdevice.c+44 -00 replies
6/7s390/uv: replace scnprintf with sysfs_emitarch/s390/kernel/uv.c+26 -320 replies
7/7s390/uv: Update query for secret-UVCsarch/s390/boot/uv.c arch/s390/include/asm/uv.h arch/s390/kernel/uv.c+55 -20 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchJanosch Frank
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/7] s390/uvdevice: Expose secret UVCs

IBM Secure Execution guests may want to inject secrets into the Ultravisor(UV). Also they should be able to know which secrets the UV possesses and prevent the further addition of more secrets.

Therefore, add three new Ultravisor-Calls and expose them via the uvdevice: Add Secret, List Secrets, and Lock Secrets. The uvdevice still acts as the messenger only and does not inspect or modify the requests. Only some sanity checks are made to prevent the kernel from corruption.
Also add a new IOCTL to get information about the supported UV-calls of the uvdevice. As userspace wants to know which secrets, types, etc. are supported expose the corresponding UV Query info data to userspace via sysfs.

The series contains:
* A patch to export uv_info unconditionally
* A new info IOCTL, giving information about the capabilities of the uvdevice and UV
* 3 patches adding new Ultravisor-Calls and expose them to userspace
* A patch replacing scnprintf with sysfs_emit in arch/s390/kernel/uv.c
* A patch with an Ultravisor Query Info update for the new secret related information

Changes for v5:
* fix Kconfig for uvdevice
* add PATCH to always export uv_info
* fix oopsie
see diff below

Changes for v4:
* more nits from Janosch

Changes for v3:
* misc nits from Janosch

Changes for v2:
* use __set_bit instead of the atomic set_bit (Heiko)
* add a patch for replacing scnprintf with sysfs_emit in arch/s390/kernel/uv.c (Heiko)
* use scnprintf instead of sysfs_emit for the new sysfs entries in the last patch (Heiko)
* use hex values in struct definitions (Claudio)

Steffen

DIFF v4->v5

arch/s390/boot/uv.c +1 -1
index cdffc395f1cd..1e66d2cbb096 100644
@@ -50,7 +50,7 @@ void uv_query_info(void)
 		uv_info.supp_add_secret_req_ver = uvcb.supp_add_secret_req_ver;
 		uv_info.supp_add_secret_pcf = uvcb.supp_add_secret_pcf;
 		uv_info.supp_secret_types = uvcb.supp_secret_types;
-		uv_info.max_secrets = uvcb.max_secrets
+		uv_info.max_secrets = uvcb.max_secrets;
 	}
 
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
arch/s390/kernel/uv.c +9 -1
index 0687fc0360fe..6a0153289ace 100644
@@ -23,12 +23,20 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif
 
+/*
+ * uv_info contains both host and guest information but it's currently only
+ * expected to be used within modules if it's the KVM module or for
+ * any PV guest module.
+ *
+ * The kernel itself will write these values once in uv_query_info()
+ * and then make some of them readable via a sysfs interface.
+ */
 struct uv_info __bootdata_preserved(uv_info);
+EXPORT_SYMBOL(uv_info);
 
 #if IS_ENABLED(CONFIG_KVM)
 int __bootdata_preserved(prot_virt_host);
 EXPORT_SYMBOL(prot_virt_host);
-EXPORT_SYMBOL(uv_info);
 
 static int __init uv_init(phys_addr_t stor_base, unsigned long stor_len)
 {
drivers/s390/char/Kconfig +1 -1
index 80c4e5101c97..8a03af5ee5b3 100644
@@ -96,7 +96,7 @@ config SCLP_OFB
 config S390_UV_UAPI
 	def_tristate m
 	prompt "Ultravisor userspace API"
-	depends on S390
+	depends on S390 && (KVM || PROTECTED_VIRTUALIZATION_GUEST)
 	help
 	  Selecting exposes parts of the UV interface to userspace
 	  by providing a misc character device at /dev/uv.
drivers/s390/char/uvdevice.c +1 -1
index 79f694e04ac4..144cd2e03590 100644
@@ -78,7 +78,7 @@ static int uvio_uvdev_info(struct uvio_ioctl_cb *uv_ioctl)
 		return -EFAULT;
 
 	uv_ioctl->uv_rc = UVC_RC_EXECUTED;
-	return  0;
+	return 0;
 }
 
 static int uvio_build_uvcb_attest(struct uv_cb_attest *uvcb_attest, u8 *arcb,

END DIFFv4->v5

Steffen Eiden (7):
s390/uv: Always export uv_info
s390/uvdevice: Add info IOCTL
s390/uvdevice: Add 'Add Secret' UVC
s390/uvdevice: Add 'List Secrets' UVC
s390/uvdevice: Add 'Lock Secret Store' UVC
s390/uv: replace scnprintf with sysfs_emit
s390/uv: Update query for secret-UVCs

 arch/s390/boot/uv.c                   |   4 +
 arch/s390/include/asm/uv.h            |  32 +++-
 arch/s390/include/uapi/asm/uvdevice.h |  53 +++++-
 arch/s390/kernel/uv.c                 | 108 ++++++++----
 drivers/s390/char/Kconfig             |   2 +-
 drivers/s390/char/uvdevice.c          | 231 +++++++++++++++++++++++++-
 6 files changed, 386 insertions(+), 44 deletions(-)
Signature · 1 line
2.40.1