s390: Ultravisor device
v4 cover s390: Ultravisor device
This series adds an Ultravisor(UV) device letting the userspace send some Ultravisor calls to the UV. Currently two calls are supported. Query Ultravisor Information (QUI) and
Receive Attestation Measurement (Attest[ation]).
The UV device is implemented as a miscdevice accepting only IOCTLs. The IOCTL cmd specifies the UV call and the IOCTL arg the request and response data depending on the UV call.
The device driver writes the UV response in the ioctl argument data.
The 'uvdevice' does no checks on the request beside faulty userspace addresses, if sizes are in a sane range before allocating in kernel space, and other tests that prevent the system from corruption. Especially, no checks are made, that will be performed by the UV anyway (E.g. 'invalid command' in case of attestation on unsupported hardware). These errors are reported back to userspace using the UV return code field.
The first patch introduces the new device as a module configured to be compiled directly into the kernel (y) similar to the s390 SCLP and CHSH miscdevice modules. The second atch introduces Kselftests which verify error paths of the ioctl.
@Greg
There is now a userspace tool "pvattest" that uses the new device:
https://github.com/ibm-s390-linux/s390-tools/tree/for-2.22
We are currently discussing some nits regarding the processing of certificates and the user interface and add the tool to s390-tools/master afterwards.
However, the interface to the kernel is fixed.
The tool (pvattest) will be in s390-tools 2.22 that accompanies linux 5.18.
You will be most interested in S390-tools/pvattest/src/uvio.{h,c} and S390-tools/pvattest/src/pvattest.c
v3->v4:
* Dropped the QUI related patches, as we agreed that we do not want to expose the QUI-UVC to userspace for now.
* Kconfig option was misplaced inside the S390 TAPE group ->fixed
* Some nits fixed:
* dropped the X from S390X in the uvdevice.h guard
* fixes kernel doc style issue in uvdevice.c
v2->v3:
The main change is that QUI is now introduced after Attestation as we might not want pick it. Also the Kselftest patch is splitted into Attestation and QUI so that they can be picked without requiring QUI support of the uvdevice.
* dropped the Kconfig dependency
* reorganized the series:
- Patch 1 now covers the introduction of the uvdevice and Attestation
- Patch 2 adds QUI to uvdevice
- Patch 3/4 add Kselftests for Attestation and QUI
* fixed some nits
* added some comments
v1->v2:
* ioctl returns -ENOIOCTLCMD in case of a invalid ioctl command
* streamlined reserved field test
* default Kconfig is y instead of m
* improved selftest documentation
Steffen Eiden (2):
drivers/s390/char: Add Ultravisor io device
selftests: drivers/s390x: Add uvdevice tests
MAINTAINERS | 3 + arch/s390/include/asm/uv.h | 23 +- arch/s390/include/uapi/asm/uvdevice.h | 51 ++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 +++++++++++++++++ tools/testing/selftests/Makefile | 1 + tools/testing/selftests/drivers/.gitignore | 1 + .../selftests/drivers/s390x/uvdevice/Makefile | 22 ++ .../selftests/drivers/s390x/uvdevice/config | 1 + .../drivers/s390x/uvdevice/test_uvdevice.c | 276 ++++++++++++++++++ 11 files changed, 652 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/uapi/asm/uvdevice.h create mode 100644 drivers/s390/char/uvdevice.c create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/Makefile create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/config create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c
Signature · 1 line
2.30.2
PATCH v4 1/2 drivers/s390/char: Add Ultravisor io device
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.
The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
--- MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 ++++++++++++++++++++++++++ 6 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/uapi/asm/uvdevice.h create mode 100644 drivers/s390/char/uvdevice.c
MAINTAINERS +2 -0
@@ -10781,9 +10781,11 @@ F: Documentation/virt/kvm/s390* F: arch/s390/include/asm/gmap.h F: arch/s390/include/asm/kvm* F: arch/s390/include/uapi/asm/kvm* +F: arch/s390/include/uapi/asm/uvdevice.h F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c +F: drivers/s390/char/uvdevice.c F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/
arch/s390/include/asm/uv.h +22 -1
@@ -2,7 +2,7 @@/* * Ultravisor Interfaces * -* Copyright IBM Corp. 2019 +* Copyright IBM Corp. 2019, 2022 * * Author(s): * Vasily Gorbik <[email protected]>
@@ -52,6 +52,7 @@#define UVC_CMD_UNPIN_PAGE_SHARED 0x0342#define UVC_CMD_SET_SHARED_ACCESS 0x1000#define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 +#define UVC_CMD_RETR_ATTEST 0x1020/* Bits in installed uv calls */ enum uv_cmds_inst {
@@ -76,6 +77,7 @@ enum uv_cmds_inst {BIT_UVC_CMD_UNSHARE_ALL =20 ,BIT_UVC_CMD_PIN_PAGE_SHARED =21 ,BIT_UVC_CMD_UNPIN_PAGE_SHARED =22 , + BIT_UVC_CMD_RETR_ATTEST = 28, }; enum uv_feat_ind {
@@ -219,6 +221,25 @@ struct uv_cb_share {u64 reserved28; } __packed__aligned(8) ; +/* Retrieve Attestation Measurement */ +struct uv_cb_attest { +struct uv_cb_header header;/* 0x0000 */ +u64 reserved08[2 ];/* 0x0008 */ +u64 arcb_addr;/* 0x0018 */ +u64 cont_token;/* 0x0020 */ +u8 reserved28[6 ];/* 0x0028 */ +u16 user_data_len;/* 0x002e */ +u8 user_data[256 ];/* 0x0030 */ +u32 reserved130[3 ];/* 0x0130 */ +u32 meas_len;/* 0x013c */ +u64 meas_addr;/* 0x0140 */ +u8 config_uid[16 ];/* 0x0148 */ +u32 reserved158;/* 0x0158 */ +u32 add_data_len;/* 0x015c */ +u64 add_data_addr;/* 0x0160 */ +u64 reserved168[4 ];/* 0x0168 */ +} __packed__aligned(8) ; +static inline int __uv_call (unsigned long r1,unsigned long r2) {int cc;
arch/s390/include/uapi/asm/uvdevice.h new file +51 -0
51 lines not on this page · raw message
drivers/s390/char/Kconfig +10 -0
@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element. +config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present. + config S390_TAPE def_tristate m prompt "S/390 tape device support"
drivers/s390/char/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_MONREADER) += monreader.o obj-$(CONFIG_MONWRITER) += monwriter.o obj-$(CONFIG_S390_VMUR) += vmur.o obj-$(CONFIG_CRASH_DUMP) += sclp_sdias.o zcore.o +obj-$(CONFIG_S390_UV_UAPI) += uvdevice.o hmcdrv-objs := hmcdrv_mod.o hmcdrv_dev.o hmcdrv_ftp.o hmcdrv_cache.o diag_ftp.o sclp_ftp.o obj-$(CONFIG_HMC_DRV) += hmcdrv.o
drivers/s390/char/uvdevice.c new file +264 -0
264 lines not on this page · raw message
Signature · 1 line
2.30.2
Claudio Imbrenda
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 391 lines · On Tue, 10 May 2022 14:47:23 +0000 Steffen Eiden <[email protected]> wrote:
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
Signed-off-by Steffen Eiden <[email protected]>Reviewed-by Janosch Frank <[email protected]>--- MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 ++++++++++++++++++++++++++ 6 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/uapi/asm/uvdevice.h create mode 100644 drivers/s390/char/uvdevice.cMAINTAINERS +2
-0@@ -10781,9 +10781,11 @@ F: Documentation/virt/kvm/s390* F: arch/s390/include/asm/gmap.h F: arch/s390/include/asm/kvm* F: arch/s390/include/uapi/asm/kvm* +F: arch/s390/include/uapi/asm/uvdevice.h F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c +F: drivers/s390/char/uvdevice.c F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/arch/s390/include/asm/uv.h +22
-1@@ -2,7 +2,7 @@/* * Ultravisor Interfaces * -* Copyright IBM Corp. 2019 +* Copyright IBM Corp. 2019, 2022 * * Author(s): * Vasily Gorbik <[email protected]> @@ -52,6 +52,7 @@#define UVC_CMD_UNPIN_PAGE_SHARED 0x0342#define UVC_CMD_SET_SHARED_ACCESS 0x1000#define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 +#define UVC_CMD_RETR_ATTEST 0x1020/* Bits in installed uv calls */ enum uv_cmds_inst {@@ -76,6 +77,7 @@ enum uv_cmds_inst {BIT_UVC_CMD_UNSHARE_ALL =20 ,BIT_UVC_CMD_PIN_PAGE_SHARED =21 ,BIT_UVC_CMD_UNPIN_PAGE_SHARED =22 , + BIT_UVC_CMD_RETR_ATTEST = 28, }; enum uv_feat_ind {@@ -219,6 +221,25 @@ struct uv_cb_share {u64 reserved28; } __packed__aligned(8) ; +/* Retrieve Attestation Measurement */ +struct uv_cb_attest { +struct uv_cb_header header;/* 0x0000 */ +u64 reserved08[2 ];/* 0x0008 */ +u64 arcb_addr;/* 0x0018 */ +u64 cont_token;/* 0x0020 */ +u8 reserved28[6 ];/* 0x0028 */ +u16 user_data_len;/* 0x002e */ +u8 user_data[256 ];/* 0x0030 */ +u32 reserved130[3 ];/* 0x0130 */ +u32 meas_len;/* 0x013c */ +u64 meas_addr;/* 0x0140 */ +u8 config_uid[16 ];/* 0x0148 */ +u32 reserved158;/* 0x0158 */ +u32 add_data_len;/* 0x015c */ +u64 add_data_addr;/* 0x0160 */ +u64 reserved168[4 ];/* 0x0168 */ +} __packed__aligned(8) ; +static inline int __uv_call (unsigned long r1,unsigned long r2) {int cc;arch/s390/include/uapi/asm/uvdevice.h new file +51
-0@@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* Copyright IBM Corp. 2022 +* Author(s): Steffen Eiden <[email protected]> +*/ +#ifndef __S390_ASM_UVDEVICE_H +#define __S390_ASM_UVDEVICE_H + +#include <linux/types.h> + +struct uvio_ioctl_cb { +__u32 flags; +__u16 uv_rc;/* UV header rc value */ +__u16 uv_rrc;/* UV header rrc value */ +__u64 argument_addr;/* Userspace address of uvio argument */ +__u32 argument_len; +__u8 reserved14[0x40 -0x14 ];/* must be zero */ +}; + +#define UVIO_ATT_USER_DATA_LEN 0x100 +#define UVIO_ATT_UID_LEN 0x10 +struct uvio_attest { +__u64 arcb_addr;/* 0x0000 */ +__u64 meas_addr;/* 0x0008 */ +__u64 add_data_addr;/* 0x0010 */ +__u8 user_data[UVIO_ATT_USER_DATA_LEN ];/* 0x0018 */ +__u8 config_uid[UVIO_ATT_UID_LEN ];/* 0x0118 */ +__u32 arcb_len;/* 0x0128 */ +__u32 meas_len;/* 0x012c */ +__u32 add_data_len;/* 0x0130 */ +__u16 user_data_len;/* 0x0134 */ +__u16 reserved136;/* 0x0136 */ +}; + +/* +* The following max values define an upper length for the IOCTL in/out buffers. +* However, they do not represent the maximum the Ultravisor allows which is +* often way smaller. By allowing larger buffer sizes we hopefully do not need +* to update the code with every machine update. It is therefore possible for +* userspace to request more memory than actually used by kernel/UV. +*/ +#define UVIO_ATT_ARCB_MAX_LEN 0x100000 +#define UVIO_ATT_MEASUREMENT_MAX_LEN 0x8000 +#define UVIO_ATT_ADDITIONAL_MAX_LEN 0x8000 + +#define UVIO_DEVICE_NAME "uv" +#define UVIO_TYPE_UVC 'u' + +#define UVIO_IOCTL_ATT _IOWR(UVIO_TYPE_UVC, 0x01, struct uvio_ioctl_cb) + +#endif /* __S390_ASM_UVDEVICE_H */ drivers/s390/char/Kconfig +10
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element. +config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present. + config S390_TAPE def_tristate m prompt "S/390 tape device support"drivers/s390/char/Makefile +1
-0@@ -48,6 +48,7 @@ obj-$(CONFIG_MONREADER) += monreader.o obj-$(CONFIG_MONWRITER) += monwriter.o obj-$(CONFIG_S390_VMUR) += vmur.o obj-$(CONFIG_CRASH_DUMP) += sclp_sdias.o zcore.o +obj-$(CONFIG_S390_UV_UAPI) += uvdevice.o hmcdrv-objs := hmcdrv_mod.o hmcdrv_dev.o hmcdrv_ftp.o hmcdrv_cache.o diag_ftp.o sclp_ftp.o obj-$(CONFIG_HMC_DRV) += hmcdrv.odrivers/s390/char/uvdevice.c new file +199
-0@@ -0,0 +1,264 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright IBM Corp. 2022 +* Author(s): Steffen Eiden <[email protected]> +* +* This file provides a Linux misc device to give userspace access to some +* Ultravisor (UV) functions. The device only accepts IOCTLs and will only +* be present if the Ultravisor facility (158) is present. +* +* When userspace sends a valid IOCTL uvdevice will copy the input data to +* kernel space, do some basic validity checks to avoid kernel/system +* corruption. Any other check that the Ultravisor does will not be done by +* the uvdevice to keep changes minimal when adding new functionalities +* to existing UV-calls. +* After the checks uvdevice builds a corresponding +* Ultravisor Call Control Block, and sends the request to the Ultravisor. +* Then, it copies the response, including the return codes, back to userspace. +* It is the responsibility of the userspace to check for any error issued +* by UV and to interpret the UV response. The uvdevice acts as a communication +* channel for userspace to the Ultravisor. +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/miscdevice.h> +#include <linux/types.h> +#include <linux/stddef.h> +#include <linux/vmalloc.h> +#include <linux/slab.h> + +#include <asm/uvdevice.h> +#include <asm/uv.h> + +static int uvio_build_uvcb_attest (struct uv_cb_attest *uvcb_attest,u8 *arcb, +u8 *meas,u8 *add_data,struct uvio_attest *uvio_attest) +{ +void __user *user_buf_arcb = (void __user *)uvio_attest->arcb_addr; + +if (copy_from_user (arcb, user_buf_arcb, uvio_attest->arcb_len)) +return -EFAULT ; + + uvcb_attest->header.len =sizeof (*uvcb_attest); + uvcb_attest->header.cmd =UVC_CMD_RETR_ATTEST ; + uvcb_attest->arcb_addr = (u64 )arcb; + uvcb_attest->cont_token =0 ; + uvcb_attest->user_data_len = uvio_attest->user_data_len; +memcpy (uvcb_attest->user_data, uvio_attest->user_data,sizeof (uvcb_attest->user_data)); + uvcb_attest->meas_len = uvio_attest->meas_len; + uvcb_attest->meas_addr = (u64 )meas; + uvcb_attest->add_data_len = uvio_attest->add_data_len; + uvcb_attest->add_data_addr = (u64 )add_data; + +return 0 ; +} + +static int uvio_copy_attest_result_to_user (struct uv_cb_attest *uvcb_attest, +struct uvio_ioctl_cb *uv_ioctl, +u8 *measurement,u8 *add_data, +struct uvio_attest *uvio_attest) +{ +struct uvio_attest __user *user_uvio_attest = (void __user *)uv_ioctl->argument_addr; +void __user *user_buf_add = (void __user *)uvio_attest->add_data_addr; +void __user *user_buf_meas = (void __user *)uvio_attest->meas_addr; +void __user *user_buf_uid = &user_uvio_attest->config_uid; + +if (copy_to_user (user_buf_meas, measurement, uvio_attest->meas_len)) +return -EFAULT ; +if (add_data &©_to_user (user_buf_add, add_data, uvio_attest->add_data_len)) +return -EFAULT ; +if (copy_to_user (user_buf_uid, uvcb_attest->config_uid,sizeof (uvcb_attest->config_uid))) +return -EFAULT ; +return 0 ; +} + +static int get_uvio_attest (struct uvio_ioctl_cb *uv_ioctl,struct uvio_attest *uvio_attest) +{ +u8 __user *user_arg_buf = (u8 __user *)uv_ioctl->argument_addr; + +if (copy_from_user (uvio_attest, user_arg_buf,sizeof (*uvio_attest))) +return -EFAULT ; + +if (uvio_attest->arcb_len >UVIO_ATT_ARCB_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->arcb_len ==0 ) +return -EINVAL ; +if (uvio_attest->meas_len >UVIO_ATT_MEASUREMENT_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->meas_len ==0 ) +return -EINVAL ; +if (uvio_attest->add_data_len >UVIO_ATT_ADDITIONAL_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->reserved136) +return -EINVAL ; +return 0 ; +} + +/** +* uvio_attestation() - Perform a Retrieve Attestation Measurement UVC. +* +* @uv_ioctl: ioctl control block +* +* uvio_attestation() does a Retrieve Attestation Measurement Ultravisor Call. +* It verifies that the given userspace addresses are valid and request sizes +* are sane. Every other check is made by the Ultravisor (UV) and won't result +* in a negative return value. It copies the input to kernelspace, builds the +* request, sends the UV-call, and copies the result to userspace. +* +* The Attestation Request has two input and two outputs. +* ARCB and User Data are inputs for the UV generated by userspace. +* Measurement and Additional Data are outputs for userspace generated by UV. +* +* The Attestation Request Control Block (ARCB) is a cryptographically verified +* and secured request to UV and User Data is some plaintext data which is +* going to be included in the Attestation Measurement calculation. +* +* Measurement is a cryptographic measurement of the callers properties, +* optional data configured by the ARCB and the user data. If specified by the +* ARCB, UV will add some Additional Data to the measurement calculation. +* This Additional Data is then returned as well. +* +* If the Retrieve Attestation Measurement UV facility is not present, +* UV will return invalid command rc. This won't be fenced in the driver +* and does not result in a negative return value. +* +* Context: might sleep +* +* Return: 0 on success or a negative error code on error. +*/ +static int uvio_attestation (struct uvio_ioctl_cb *uv_ioctl) +{ +struct uv_cb_attest *uvcb_attest =NULL ; +struct uvio_attest *uvio_attest =NULL ; +u8 *measurement =NULL ; +u8 *add_data =NULL ; +u8 *arcb =NULL ; +int ret; + + ret = -EINVAL ; +if (uv_ioctl->argument_len !=sizeof (*uvio_attest)) + goto out; + + ret = -ENOMEM ; + uvio_attest =kzalloc (sizeof (*uvio_attest),GFP_KERNEL ); +if (!uvio_attest) + goto out; + + ret =get_uvio_attest (uv_ioctl, uvio_attest); +if (ret) + goto out; + + ret = -ENOMEM ; + arcb =kvzalloc (uvio_attest->arcb_len,GFP_KERNEL ); + measurement =kvzalloc (uvio_attest->meas_len,GFP_KERNEL ); +if (!arcb || !measurement) + goto out; + +if (uvio_attest->add_data_len) { + add_data =kvzalloc (uvio_attest->add_data_len,GFP_KERNEL ); +if (!add_data) + goto out; + } + + uvcb_attest =kzalloc (sizeof (*uvcb_attest),GFP_KERNEL ); +if (!uvcb_attest) + goto out; + + ret =uvio_build_uvcb_attest (uvcb_attest, arcb, measurement, add_data, uvio_attest); +if (ret) + goto out; + +uv_call_sched (0 , (u64 )uvcb_attest); + + uv_ioctl->uv_rc = uvcb_attest->header.rc; + uv_ioctl->uv_rrc = uvcb_attest->header.rrc; + + ret =uvio_copy_attest_result_to_user (uvcb_attest, uv_ioctl, measurement, add_data, + uvio_attest); +out: +kvfree (arcb); +kvfree (measurement); +kvfree (add_data); +kfree (uvio_attest); +kfree (uvcb_attest); +return ret; +} + +static int uvio_copy_and_check_ioctl (struct uvio_ioctl_cb *ioctl,void __user *argp) +{ +if (copy_from_user (ioctl, argp,sizeof (*ioctl))) +return -EFAULT ; +if (ioctl->flags !=0 ) +return -EINVAL ; +if (memchr_inv (ioctl->reserved14,0 ,sizeof (ioctl->reserved14))) +return -EINVAL ; + +return 0 ; +} + +/*
drivers/s390/char/uvdevice.c line 209
Quoted 10 lines
drivers/s390/char/uvdevice.c new file +10
-0+* IOCTL entry point for the Ultravisor device. +*/ +static long uvio_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +void __user *argp = (void __user *)arg; +struct uvio_ioctl_cb *uv_ioctl; +long ret; + + ret = -ENOMEM ; + uv_ioctl =vzalloc (sizeof (*uv_ioctl));
struct uvio_ioctl_cb is rather small, couldn't you just allocate it on the stack?
Quoted 55 lines
drivers/s390/char/uvdevice.c new file +55
-0+if (!uv_ioctl) + goto out; + +switch (cmd) { +case UVIO_IOCTL_ATT : + ret =uvio_copy_and_check_ioctl (uv_ioctl, argp); +if (ret) + goto out; + ret =uvio_attestation (uv_ioctl); +break ; +default : + ret = -ENOIOCTLCMD ; +break ; + } +if (ret) + goto out; + +if (copy_to_user (argp, uv_ioctl,sizeof (*uv_ioctl))) + ret = -EFAULT ; + + out: +vfree (uv_ioctl); +return ret; +} + +static const struct file_operations uvio_dev_fops = { + .owner =THIS_MODULE , + .unlocked_ioctl = uvio_ioctl, + .llseek = no_llseek, +}; + +static struct miscdevice uvio_dev_miscdev = { + .minor =MISC_DYNAMIC_MINOR , + .name =UVIO_DEVICE_NAME , + .fops = &uvio_dev_fops, +}; + +static void __exit uvio_dev_exit(void) +{ +misc_deregister (&uvio_dev_miscdev); +} + +static int __init uvio_dev_init (void ) +{ +if (!test_facility (158 )) +return -ENXIO ; +return misc_register (&uvio_dev_miscdev); +} + +module_init (uvio_dev_init); +module_exit (uvio_dev_exit); + +MODULE_AUTHOR ("IBM Corporation" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Ultravisor UAPI driver" );
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
On 5/12/22 16:33, Claudio Imbrenda wrote:
[snip]
Quoted 5 lines
Quoted 5 lines
drivers/s390/char/uvdevice.c new file +5
-0+/* +* IOCTL entry point for the Ultravisor device. +*/ +static long uvio_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{
Quoted 9 lines
drivers/s390/char/uvdevice.c line 209
Quoted 6 lines
drivers/s390/char/uvdevice.c new file +6
-0+void __user *argp = (void __user *)arg; +struct uvio_ioctl_cb *uv_ioctl; +long ret; + + ret = -ENOMEM ; + uv_ioctl =vzalloc (sizeof (*uv_ioctl));struct
uvio_ioctl_cbis rather small, couldn't you just allocate it on the stack?
IIRC it was on stack in some previous version. We then had a discussion earlier about this triggered by the inverse comment and decided to not use the stack.
[snip]
Claudio Imbrenda
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 18 lines · On Fri, 13 May 2022 09:45:39 +0200 Steffen Eiden <[email protected]> wrote:
On 5/12/22 16:33, Claudio Imbrenda wrote:
[snip]
Quoted 5 lines
Quoted 5 lines
drivers/s390/char/uvdevice.c new file +5
-0+/* +* IOCTL entry point for the Ultravisor device. +*/ +static long uvio_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{Quoted 9 lines
drivers/s390/char/uvdevice.c line 209
Quoted 6 lines
drivers/s390/char/uvdevice.c new file +6
-0+void __user *argp = (void __user *)arg; +struct uvio_ioctl_cb *uv_ioctl; +long ret; + + ret = -ENOMEM ; + uv_ioctl =vzalloc (sizeof (*uv_ioctl));struct
uvio_ioctl_cbis rather small, couldn't you just allocate it on the stack?
Quoted 3 lines
IIRC it was on stack in some previous version. We then had a discussion earlier about this triggered by the inverse comment and decided to not use the stack.
ok fair enough
but what's the reason for a vzalloc instead of a kzalloc, when the allocation is surely going to be small?
Quoted 3 lines
[snip]
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 21 lines · Claudio Imbrenda
Quoted 18 lines · On Fri, 13 May 2022 09:45:39 +0200 Steffen Eiden <[email protected]> wrote:
On 5/12/22 16:33, Claudio Imbrenda wrote:
[snip]
Quoted 14 lines
drivers/s390/char/uvdevice.c line 209
Quoted 11 lines
drivers/s390/char/uvdevice.c new file +11
-0+/* +* IOCTL entry point for the Ultravisor device. +*/ +static long uvio_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +void __user *argp = (void __user *)arg; +struct uvio_ioctl_cb *uv_ioctl; +long ret; + + ret = -ENOMEM ; + uv_ioctl =vzalloc (sizeof (*uv_ioctl));struct
uvio_ioctl_cbis rather small, couldn't you just allocate it on the stack?
Quoted 9 lines
Quoted 3 lines
IIRC it was on stack in some previous version. We then had a discussion earlier about this triggered by the inverse comment and decided to not use the stack.
ok fair enough
but what's the reason for a vzalloc instead of a kzalloc, when the allocation is surely going to be small?
We had no strong reasons against or for vzalloc/kzalloc. If you want me to change it to kzalloc I can do it. I still have no strong opinion on that.
Quoted 1 line
Quoted 1 line
[snip]
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
In reply to Steffen EidenThis patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.
The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
---
After some private discussion "struct uvio_ioctl_cb uv_ioctl" in "uvio_ioctl()" is now in the stack.
MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 257 ++++++++++++++++++++++++++ 6 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/uapi/asm/uvdevice.h create mode 100644 drivers/s390/char/uvdevice.c
MAINTAINERS +2 -0
@@ -10781,9 +10781,11 @@ F: Documentation/virt/kvm/s390* F: arch/s390/include/asm/gmap.h F: arch/s390/include/asm/kvm* F: arch/s390/include/uapi/asm/kvm* +F: arch/s390/include/uapi/asm/uvdevice.h F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c +F: drivers/s390/char/uvdevice.c F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/
arch/s390/include/asm/uv.h +22 -1
@@ -2,7 +2,7 @@/* * Ultravisor Interfaces * -* Copyright IBM Corp. 2019 +* Copyright IBM Corp. 2019, 2022 * * Author(s): * Vasily Gorbik <[email protected]>
@@ -52,6 +52,7 @@#define UVC_CMD_UNPIN_PAGE_SHARED 0x0342#define UVC_CMD_SET_SHARED_ACCESS 0x1000#define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 +#define UVC_CMD_RETR_ATTEST 0x1020/* Bits in installed uv calls */ enum uv_cmds_inst {
@@ -76,6 +77,7 @@ enum uv_cmds_inst {BIT_UVC_CMD_UNSHARE_ALL =20 ,BIT_UVC_CMD_PIN_PAGE_SHARED =21 ,BIT_UVC_CMD_UNPIN_PAGE_SHARED =22 , + BIT_UVC_CMD_RETR_ATTEST = 28, }; enum uv_feat_ind {
@@ -219,6 +221,25 @@ struct uv_cb_share {u64 reserved28; } __packed__aligned(8) ; +/* Retrieve Attestation Measurement */ +struct uv_cb_attest { +struct uv_cb_header header;/* 0x0000 */ +u64 reserved08[2 ];/* 0x0008 */ +u64 arcb_addr;/* 0x0018 */ +u64 cont_token;/* 0x0020 */ +u8 reserved28[6 ];/* 0x0028 */ +u16 user_data_len;/* 0x002e */ +u8 user_data[256 ];/* 0x0030 */ +u32 reserved130[3 ];/* 0x0130 */ +u32 meas_len;/* 0x013c */ +u64 meas_addr;/* 0x0140 */ +u8 config_uid[16 ];/* 0x0148 */ +u32 reserved158;/* 0x0158 */ +u32 add_data_len;/* 0x015c */ +u64 add_data_addr;/* 0x0160 */ +u64 reserved168[4 ];/* 0x0168 */ +} __packed__aligned(8) ; +static inline int __uv_call (unsigned long r1,unsigned long r2) {int cc;
arch/s390/include/uapi/asm/uvdevice.h new file +51 -0
51 lines not on this page · raw message
drivers/s390/char/Kconfig +10 -0
@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element. +config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present. + config S390_TAPE def_tristate m prompt "S/390 tape device support"
drivers/s390/char/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_MONREADER) += monreader.o obj-$(CONFIG_MONWRITER) += monwriter.o obj-$(CONFIG_S390_VMUR) += vmur.o obj-$(CONFIG_CRASH_DUMP) += sclp_sdias.o zcore.o +obj-$(CONFIG_S390_UV_UAPI) += uvdevice.o hmcdrv-objs := hmcdrv_mod.o hmcdrv_dev.o hmcdrv_ftp.o hmcdrv_cache.o diag_ftp.o sclp_ftp.o obj-$(CONFIG_HMC_DRV) += hmcdrv.o
drivers/s390/char/uvdevice.c new file +257 -0
257 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 8 lines · On Mon, 16 May 2022 11:33:35 +0000 Steffen Eiden <[email protected]> wrote:
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.
Quoted 6 lines
The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
Signed-off-by Steffen Eiden <[email protected]>Reviewed-by Janosch Frank <[email protected]>
Quoted 438 lines
---
After some private discussion "structuvio_ioctl_cbuv_ioctl" in "uvio_ioctl()" is now in the stack.MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 257 ++++++++++++++++++++++++++ 6 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/uapi/asm/uvdevice.h create mode 100644 drivers/s390/char/uvdevice.cMAINTAINERS +2
-0@@ -10781,9 +10781,11 @@ F: Documentation/virt/kvm/s390* F: arch/s390/include/asm/gmap.h F: arch/s390/include/asm/kvm* F: arch/s390/include/uapi/asm/kvm* +F: arch/s390/include/uapi/asm/uvdevice.h F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c +F: drivers/s390/char/uvdevice.c F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/arch/s390/include/asm/uv.h +22
-1@@ -2,7 +2,7 @@/* * Ultravisor Interfaces * -* Copyright IBM Corp. 2019 +* Copyright IBM Corp. 2019, 2022 * * Author(s): * Vasily Gorbik <[email protected]> @@ -52,6 +52,7 @@#define UVC_CMD_UNPIN_PAGE_SHARED 0x0342#define UVC_CMD_SET_SHARED_ACCESS 0x1000#define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 +#define UVC_CMD_RETR_ATTEST 0x1020/* Bits in installed uv calls */ enum uv_cmds_inst {@@ -76,6 +77,7 @@ enum uv_cmds_inst {BIT_UVC_CMD_UNSHARE_ALL =20 ,BIT_UVC_CMD_PIN_PAGE_SHARED =21 ,BIT_UVC_CMD_UNPIN_PAGE_SHARED =22 , + BIT_UVC_CMD_RETR_ATTEST = 28, }; enum uv_feat_ind {@@ -219,6 +221,25 @@ struct uv_cb_share {u64 reserved28; } __packed__aligned(8) ; +/* Retrieve Attestation Measurement */ +struct uv_cb_attest { +struct uv_cb_header header;/* 0x0000 */ +u64 reserved08[2 ];/* 0x0008 */ +u64 arcb_addr;/* 0x0018 */ +u64 cont_token;/* 0x0020 */ +u8 reserved28[6 ];/* 0x0028 */ +u16 user_data_len;/* 0x002e */ +u8 user_data[256 ];/* 0x0030 */ +u32 reserved130[3 ];/* 0x0130 */ +u32 meas_len;/* 0x013c */ +u64 meas_addr;/* 0x0140 */ +u8 config_uid[16 ];/* 0x0148 */ +u32 reserved158;/* 0x0158 */ +u32 add_data_len;/* 0x015c */ +u64 add_data_addr;/* 0x0160 */ +u64 reserved168[4 ];/* 0x0168 */ +} __packed__aligned(8) ; +static inline int __uv_call (unsigned long r1,unsigned long r2) {int cc;arch/s390/include/uapi/asm/uvdevice.h new file +51
-0@@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* Copyright IBM Corp. 2022 +* Author(s): Steffen Eiden <[email protected]> +*/ +#ifndef __S390_ASM_UVDEVICE_H +#define __S390_ASM_UVDEVICE_H + +#include <linux/types.h> + +struct uvio_ioctl_cb { +__u32 flags; +__u16 uv_rc;/* UV header rc value */ +__u16 uv_rrc;/* UV header rrc value */ +__u64 argument_addr;/* Userspace address of uvio argument */ +__u32 argument_len; +__u8 reserved14[0x40 -0x14 ];/* must be zero */ +}; + +#define UVIO_ATT_USER_DATA_LEN 0x100 +#define UVIO_ATT_UID_LEN 0x10 +struct uvio_attest { +__u64 arcb_addr;/* 0x0000 */ +__u64 meas_addr;/* 0x0008 */ +__u64 add_data_addr;/* 0x0010 */ +__u8 user_data[UVIO_ATT_USER_DATA_LEN ];/* 0x0018 */ +__u8 config_uid[UVIO_ATT_UID_LEN ];/* 0x0118 */ +__u32 arcb_len;/* 0x0128 */ +__u32 meas_len;/* 0x012c */ +__u32 add_data_len;/* 0x0130 */ +__u16 user_data_len;/* 0x0134 */ +__u16 reserved136;/* 0x0136 */ +}; + +/* +* The following max values define an upper length for the IOCTL in/out buffers. +* However, they do not represent the maximum the Ultravisor allows which is +* often way smaller. By allowing larger buffer sizes we hopefully do not need +* to update the code with every machine update. It is therefore possible for +* userspace to request more memory than actually used by kernel/UV. +*/ +#define UVIO_ATT_ARCB_MAX_LEN 0x100000 +#define UVIO_ATT_MEASUREMENT_MAX_LEN 0x8000 +#define UVIO_ATT_ADDITIONAL_MAX_LEN 0x8000 + +#define UVIO_DEVICE_NAME "uv" +#define UVIO_TYPE_UVC 'u' + +#define UVIO_IOCTL_ATT _IOWR(UVIO_TYPE_UVC, 0x01, struct uvio_ioctl_cb) + +#endif /* __S390_ASM_UVDEVICE_H */ drivers/s390/char/Kconfig +10
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element. +config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present. + config S390_TAPE def_tristate m prompt "S/390 tape device support"drivers/s390/char/Makefile +1
-0@@ -48,6 +48,7 @@ obj-$(CONFIG_MONREADER) += monreader.o obj-$(CONFIG_MONWRITER) += monwriter.o obj-$(CONFIG_S390_VMUR) += vmur.o obj-$(CONFIG_CRASH_DUMP) += sclp_sdias.o zcore.o +obj-$(CONFIG_S390_UV_UAPI) += uvdevice.o hmcdrv-objs := hmcdrv_mod.o hmcdrv_dev.o hmcdrv_ftp.o hmcdrv_cache.o diag_ftp.o sclp_ftp.o obj-$(CONFIG_HMC_DRV) += hmcdrv.odrivers/s390/char/uvdevice.c new file +257
-0@@ -0,0 +1,257 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright IBM Corp. 2022 +* Author(s): Steffen Eiden <[email protected]> +* +* This file provides a Linux misc device to give userspace access to some +* Ultravisor (UV) functions. The device only accepts IOCTLs and will only +* be present if the Ultravisor facility (158) is present. +* +* When userspace sends a valid IOCTL uvdevice will copy the input data to +* kernel space, do some basic validity checks to avoid kernel/system +* corruption. Any other check that the Ultravisor does will not be done by +* the uvdevice to keep changes minimal when adding new functionalities +* to existing UV-calls. +* After the checks uvdevice builds a corresponding +* Ultravisor Call Control Block, and sends the request to the Ultravisor. +* Then, it copies the response, including the return codes, back to userspace. +* It is the responsibility of the userspace to check for any error issued +* by UV and to interpret the UV response. The uvdevice acts as a communication +* channel for userspace to the Ultravisor. +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/miscdevice.h> +#include <linux/types.h> +#include <linux/stddef.h> +#include <linux/vmalloc.h> +#include <linux/slab.h> + +#include <asm/uvdevice.h> +#include <asm/uv.h> + +static int uvio_build_uvcb_attest (struct uv_cb_attest *uvcb_attest,u8 *arcb, +u8 *meas,u8 *add_data,struct uvio_attest *uvio_attest) +{ +void __user *user_buf_arcb = (void __user *)uvio_attest->arcb_addr; + +if (copy_from_user (arcb, user_buf_arcb, uvio_attest->arcb_len)) +return -EFAULT ; + + uvcb_attest->header.len =sizeof (*uvcb_attest); + uvcb_attest->header.cmd =UVC_CMD_RETR_ATTEST ; + uvcb_attest->arcb_addr = (u64 )arcb; + uvcb_attest->cont_token =0 ; + uvcb_attest->user_data_len = uvio_attest->user_data_len; +memcpy (uvcb_attest->user_data, uvio_attest->user_data,sizeof (uvcb_attest->user_data)); + uvcb_attest->meas_len = uvio_attest->meas_len; + uvcb_attest->meas_addr = (u64 )meas; + uvcb_attest->add_data_len = uvio_attest->add_data_len; + uvcb_attest->add_data_addr = (u64 )add_data; + +return 0 ; +} + +static int uvio_copy_attest_result_to_user (struct uv_cb_attest *uvcb_attest, +struct uvio_ioctl_cb *uv_ioctl, +u8 *measurement,u8 *add_data, +struct uvio_attest *uvio_attest) +{ +struct uvio_attest __user *user_uvio_attest = (void __user *)uv_ioctl->argument_addr; +void __user *user_buf_add = (void __user *)uvio_attest->add_data_addr; +void __user *user_buf_meas = (void __user *)uvio_attest->meas_addr; +void __user *user_buf_uid = &user_uvio_attest->config_uid; + +if (copy_to_user (user_buf_meas, measurement, uvio_attest->meas_len)) +return -EFAULT ; +if (add_data &©_to_user (user_buf_add, add_data, uvio_attest->add_data_len)) +return -EFAULT ; +if (copy_to_user (user_buf_uid, uvcb_attest->config_uid,sizeof (uvcb_attest->config_uid))) +return -EFAULT ; +return 0 ; +} + +static int get_uvio_attest (struct uvio_ioctl_cb *uv_ioctl,struct uvio_attest *uvio_attest) +{ +u8 __user *user_arg_buf = (u8 __user *)uv_ioctl->argument_addr; + +if (copy_from_user (uvio_attest, user_arg_buf,sizeof (*uvio_attest))) +return -EFAULT ; + +if (uvio_attest->arcb_len >UVIO_ATT_ARCB_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->arcb_len ==0 ) +return -EINVAL ; +if (uvio_attest->meas_len >UVIO_ATT_MEASUREMENT_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->meas_len ==0 ) +return -EINVAL ; +if (uvio_attest->add_data_len >UVIO_ATT_ADDITIONAL_MAX_LEN ) +return -EINVAL ; +if (uvio_attest->reserved136) +return -EINVAL ; +return 0 ; +} + +/** +* uvio_attestation() - Perform a Retrieve Attestation Measurement UVC. +* +* @uv_ioctl: ioctl control block +* +* uvio_attestation() does a Retrieve Attestation Measurement Ultravisor Call. +* It verifies that the given userspace addresses are valid and request sizes +* are sane. Every other check is made by the Ultravisor (UV) and won't result +* in a negative return value. It copies the input to kernelspace, builds the +* request, sends the UV-call, and copies the result to userspace. +* +* The Attestation Request has two input and two outputs. +* ARCB and User Data are inputs for the UV generated by userspace. +* Measurement and Additional Data are outputs for userspace generated by UV. +* +* The Attestation Request Control Block (ARCB) is a cryptographically verified +* and secured request to UV and User Data is some plaintext data which is +* going to be included in the Attestation Measurement calculation. +* +* Measurement is a cryptographic measurement of the callers properties, +* optional data configured by the ARCB and the user data. If specified by the +* ARCB, UV will add some Additional Data to the measurement calculation. +* This Additional Data is then returned as well. +* +* If the Retrieve Attestation Measurement UV facility is not present, +* UV will return invalid command rc. This won't be fenced in the driver +* and does not result in a negative return value. +* +* Context: might sleep +* +* Return: 0 on success or a negative error code on error. +*/ +static int uvio_attestation (struct uvio_ioctl_cb *uv_ioctl) +{ +struct uv_cb_attest *uvcb_attest =NULL ; +struct uvio_attest *uvio_attest =NULL ; +u8 *measurement =NULL ; +u8 *add_data =NULL ; +u8 *arcb =NULL ; +int ret; + + ret = -EINVAL ; +if (uv_ioctl->argument_len !=sizeof (*uvio_attest)) + goto out; + + ret = -ENOMEM ; + uvio_attest =kzalloc (sizeof (*uvio_attest),GFP_KERNEL ); +if (!uvio_attest) + goto out; + + ret =get_uvio_attest (uv_ioctl, uvio_attest); +if (ret) + goto out; + + ret = -ENOMEM ; + arcb =kvzalloc (uvio_attest->arcb_len,GFP_KERNEL ); + measurement =kvzalloc (uvio_attest->meas_len,GFP_KERNEL ); +if (!arcb || !measurement) + goto out; + +if (uvio_attest->add_data_len) { + add_data =kvzalloc (uvio_attest->add_data_len,GFP_KERNEL ); +if (!add_data) + goto out; + } + + uvcb_attest =kzalloc (sizeof (*uvcb_attest),GFP_KERNEL ); +if (!uvcb_attest) + goto out; + + ret =uvio_build_uvcb_attest (uvcb_attest, arcb, measurement, add_data, uvio_attest); +if (ret) + goto out; + +uv_call_sched (0 , (u64 )uvcb_attest); + + uv_ioctl->uv_rc = uvcb_attest->header.rc; + uv_ioctl->uv_rrc = uvcb_attest->header.rrc; + + ret =uvio_copy_attest_result_to_user (uvcb_attest, uv_ioctl, measurement, add_data, + uvio_attest); +out: +kvfree (arcb); +kvfree (measurement); +kvfree (add_data); +kfree (uvio_attest); +kfree (uvcb_attest); +return ret; +} + +static int uvio_copy_and_check_ioctl (struct uvio_ioctl_cb *ioctl,void __user *argp) +{ +if (copy_from_user (ioctl, argp,sizeof (*ioctl))) +return -EFAULT ; +if (ioctl->flags !=0 ) +return -EINVAL ; +if (memchr_inv (ioctl->reserved14,0 ,sizeof (ioctl->reserved14))) +return -EINVAL ; + +return 0 ; +} + +/* +* IOCTL entry point for the Ultravisor device. +*/ +static long uvio_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +void __user *argp = (void __user *)arg; +struct uvio_ioctl_cb uv_ioctl = { }; +long ret; + +switch (cmd) { +case UVIO_IOCTL_ATT : + ret =uvio_copy_and_check_ioctl (&uv_ioctl, argp); +if (ret) +return ret; + ret =uvio_attestation (&uv_ioctl); +break ; +default : + ret = -ENOIOCTLCMD ; +break ; + } +if (ret) +return ret; + +if (copy_to_user (argp, &uv_ioctl,sizeof (uv_ioctl))) + ret = -EFAULT ; + +return ret; +} + +static const struct file_operations uvio_dev_fops = { + .owner =THIS_MODULE , + .unlocked_ioctl = uvio_ioctl, + .llseek = no_llseek, +}; + +static struct miscdevice uvio_dev_miscdev = { + .minor =MISC_DYNAMIC_MINOR , + .name =UVIO_DEVICE_NAME , + .fops = &uvio_dev_fops, +}; + +static void __exit uvio_dev_exit(void) +{ +misc_deregister (&uvio_dev_miscdev); +} + +static int __init uvio_dev_init (void ) +{ +if (!test_facility (158 )) +return -ENXIO ; +return misc_register (&uvio_dev_miscdev); +} + +module_init (uvio_dev_init); +module_exit (uvio_dev_exit); + +MODULE_AUTHOR ("IBM Corporation" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Ultravisor UAPI driver" );
Janosch Frank
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
In reply to Steffen EidenQuoted 8 lines · Steffen Eiden
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.
Quoted 6 lines
The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
Signed-off-by Steffen Eiden <[email protected]>Reviewed-by Janosch Frank <[email protected]>
I'd like to pick this if I'm allowed to fix the two white space problems below.
Quoted 8 lines
--- MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 ++++++++++++++++++++++++++ 6 files changed, 350 insertions(+), 1 deletion(-)
Quoted 5 lines
create mode 100644
arch/s390/include/uapi/asm/uvdevice.hcreate mode 100644drivers/s390/char/uvdevice.c+#endif /*
__S390_ASM_UVDEVICE_H*/
There are two spaces between the "endif" and the "/"
Quoted 8 lines
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element.
[...]
Quoted 1 line
+ *
uvio_attestation()does a Retrieve Attestation Measurement Ultravisor Call.
Double space
Quoted 5 lines
+ * It verifies that the given userspace addresses are valid and request sizes
+ * are sane. Every other check is made by the Ultravisor (UV) and won't result
+ * in a negative return value. It copies the input to kernelspace, builds the
+ * request, sends the UV-call, and copies the result to userspace.
+ *
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 9 lines · Janosch Frank
Quoted 8 lines · Steffen Eiden
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.
Quoted 8 lines
Quoted 6 lines
The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
Signed-off-by Steffen Eiden <[email protected]>Reviewed-by Janosch Frank <[email protected]>I'd like to pick this if I'm allowed to fix the two white space problems below.
I am fine with that.
Thank you.
Quoted 39 lines
Quoted 8 lines
---
MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++-arch/s390/include/uapi/asm/uvdevice.h| 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 ++++++++++++++++++++++++++Quoted 6 lines
6 files changed, 350 insertions(+), 1 deletion(-)create mode 100644
arch/s390/include/uapi/asm/uvdevice.hcreate mode 100644drivers/s390/char/uvdevice.c+#endif /*
__S390_ASM_UVDEVICE_H*/There are two spaces between the "endif" and the "/"
Quoted 7 lines
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFBThis option enables the Open-for-Business interface to the s390 Service Element.
[...]
Quoted 2 lines
+ *
uvio_attestation()does a Retrieve Attestation Measurement Ultravisor Call.Double space
Quoted 8 lines
+ * It verifies that the given userspace addresses are valid and request sizes
+ * are sane. Every other check is made by the Ultravisor (UV) and won't result
+ * in a negative return value. It copies the input to kernelspace, builds the
+ * request, sends the UV-call, and copies the result to userspace.
+ *
Janosch Frank
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 16 lines · Steffen Eiden
Quoted 13 lines · Janosch Frank
Quoted 12 lines · Steffen Eiden
This patch adds a new miscdevice to expose some Ultravisor functions to userspace. Userspace can send IOCTLs to the uvdevice that will then emit a corresponding Ultravisor Call and hands the result over to userspace. The uvdevice is available if the Ultravisor Call facility is present.
Userspace can call the Retrieve Attestation Measurement Ultravisor Call using IOCTLs on the uvdevice.The uvdevice will do some sanity checks first. Then, copy the request data to kernel space, build the UVCB, perform the UV call, and copy the result back to userspace.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Steffen Eiden <[email protected]>Reviewed-by Janosch Frank <[email protected]>I'd like to pick this if I'm allowed to fix the two white space problems below.
I am fine with that.
Thanks, picked
Quoted 42 lines
Thank you.
Quoted 39 lines
Quoted 9 lines
--- MAINTAINERS | 2 + arch/s390/include/asm/uv.h | 23 ++- arch/s390/include/uapi/asm/uvdevice.h | 51 +++++ drivers/s390/char/Kconfig | 10 + drivers/s390/char/Makefile | 1 + drivers/s390/char/uvdevice.c | 264 ++++++++++++++++++++++++++ 6 files changed, 350 insertions(+), 1 deletion(-)Quoted 5 lines
create mode 100644
arch/s390/include/uapi/asm/uvdevice.hcreate mode 100644drivers/s390/char/uvdevice.c+#endif /*
__S390_ASM_UVDEVICE_H*/There are two spaces between the "endif" and the "/"
Quoted 7 lines
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element.[...]
Quoted 2 lines
+ *
uvio_attestation()does a Retrieve Attestation Measurement Ultravisor Call.Double space
Quoted 8 lines
+ * It verifies that the given userspace addresses are valid and request sizes
+ * are sane. Every other check is made by the Ultravisor (UV) and won't result
+ * in a negative return value. It copies the input to kernelspace, builds the
+ * request, sends the UV-call, and copies the result to userspace.
+ *
Heiko Carstens
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
In reply to Steffen EidenQuoted 7 lines · Steffen Eiden
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element.
drivers/s390/char/Kconfig config SCLP_OFB · line 111
Quoted 10 lines
drivers/s390/char/Kconfig +9
-0+config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present.
Is there a reason why this is default "y"? If you think this should be compiled into the kernel if used, then why allow to make it a module at all?
Instead you could get rid of a couple if lines of code.
Janosch Frank
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 9 lines · Heiko Carstens
Quoted 8 lines · Steffen Eiden
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFB This option enables the Open-for-Business interface to the s390 Service Element.
Quoted 14 lines
drivers/s390/char/Kconfig config SCLP_OFB · line 111
Quoted 9 lines
drivers/s390/char/Kconfig +9
-0+config S390_UV_UAPI + def_tristate y + prompt "Ultravisor userspace API" + help + Selecting exposes parts of the UV interface to userspace + by providing a misc character device at /dev/uv. + Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present.Is there a reason why this is default "y"? If you think this should be compiled into the kernel if used, then why allow to make it a module at all?
Instead you could get rid of a couple if lines of code.
There was a lot of discussion around this already and the "Y" was chosen as auto-loading this is a pain and therefore the SCLP and CHSC-Misc set it to Y and we took that as an example (Steffen spoke to Peter to get guidance).
I'm sure that we want the possibility to have this as a module. Personally I'd choose "m" over "y" since the module is only useful for a very small amount of users.
Re: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 24 lines · Janosch Frank
Quoted 14 lines · Heiko Carstens
Quoted 13 lines · Steffen Eiden
drivers/s390/char/Kconfig +0
-0@@ -100,6 +100,16 @@ config SCLP_OFBThis option enables the Open-for-Business interface to the s390 Service Element.
+configS390_UV_UAPI
+def_tristatey
+ prompt "Ultravisor userspace API"
+ help
+ Selecting exposes parts of the UV interface to userspace + by providing a misc character device at/dev/uv.Quoted 8 lines
Quoted 3 lines
+ Using IOCTLs one can interact with the UV. + The device is only available if the Ultravisor + Facility (158) is present.
Is there a reason why this is default "y"? If you think this should be compiled into the kernel if used, then why allow to make it a module at all?
Instead you could get rid of a couple if lines of code.
Quoted 3 lines
There was a lot of discussion around this already and the "Y" was chosen as auto-loading this is a pain and therefore the SCLP and CHSC-Misc set it to Y and we took that as an example (Steffen spoke to Peter to get guidance).
I'm sure that we want the possibility to have this as a module. Personally I'd choose "m" over "y" since the module is only useful for a very small amount of users.
I am fine with changing "y" to "m".
Steffen
Heiko Carstens
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
In reply to Janosch FrankQuoted 8 lines · Janosch Frank
Quoted 7 lines
drivers/s390/char/Kconfig config SCLP_OFB · line 111
Quoted 2 lines
drivers/s390/char/Kconfig +2
-0+ The device is only available if the Ultravisor + Facility (158) is present.Is there a reason why this is default "y"? If you think this should be compiled into the kernel if used, then why allow to make it a module at all?
Instead you could get rid of a couple if lines of code.
Quoted 7 lines
There was a lot of discussion around this already and the "Y" was chosen as auto-loading this is a pain and therefore the SCLP and CHSC-Misc set it to Y and we took that as an example (Steffen spoke to Peter to get guidance).
I'm sure that we want the possibility to have this as a module. Personally I'd choose "m" over "y" since the module is only useful for a very small amount of users.
Why not simply use module_cpu_feature_match() to implement auto module loading like we do it for the crypto modules? That would require that either the uv facility is represented within elf hwcaps, or alternatively the s390 implementation of cpu_feature() needs to be changed to work with cpu facilities instead of hwcap bits. (see arch/s390/include/asm/cpufeature.h)
This doesn't look too difficult. Or was there a reason not to go this route?
Janosch Frank
maintainerRe: [PATCH v4 1/2] drivers/s390/char: Add Ultravisor io device
Quoted 17 lines · Heiko Carstens
Quoted 8 lines · Janosch Frank
Quoted 7 lines
drivers/s390/char/Kconfig config SCLP_OFB · line 111
Quoted 2 lines
drivers/s390/char/Kconfig +2
-0+ The device is only available if the Ultravisor + Facility (158) is present.Is there a reason why this is default "y"? If you think this should be compiled into the kernel if used, then why allow to make it a module at all?
Instead you could get rid of a couple if lines of code.Quoted 7 lines
There was a lot of discussion around this already and the "Y" was chosen as auto-loading this is a pain and therefore the SCLP and CHSC-Misc set it to Y and we took that as an example (Steffen spoke to Peter to get guidance).
I'm sure that we want the possibility to have this as a module. Personally I'd choose "m" over "y" since the module is only useful for a very small amount of users.
Quoted 8 lines
Why not simply use
module_cpu_feature_match()to implement auto module loading like we do it for the crypto modules? That would require that either the uv facility is represented within elf hwcaps, or alternatively the s390 implementation ofcpu_feature()needs to be changed to work with cpu facilities instead of hwcap bits. (seearch/s390/include/asm/cpufeature.h)This doesn't look too difficult. Or was there a reason not to go this route?
I'd guess we looked into the wrong direction for auto-load.
We'll look into that for 5.20 but we'll take this patch with the "m" tristate for 5.19.
Thanks for the pointer and review.
PATCH v4 2/2 selftests: drivers/s390x: Add uvdevice tests
In reply to Steffen EidenAdds some selftests to test ioctl error paths of the uv-uapi. The Kconfig S390_UV_UAPI must be selected and the Ultravisor facility must be available. The test can be executed by non-root, however, the uvdevice special file /dev/uv must be accessible for reading and writing which may imply root privileges.
./test-uv-device
TAP version 13
1..6
# Starting 6 tests from 3 test cases.
# RUN uvio_fixture.att.fault_ioctl_arg ...
# OK uvio_fixture.att.fault_ioctl_arg
ok 1 uvio_fixture.att.fault_ioctl_arg
# RUN uvio_fixture.att.fault_uvio_arg ...
# OK uvio_fixture.att.fault_uvio_arg
ok 2 uvio_fixture.att.fault_uvio_arg
# RUN uvio_fixture.att.inval_ioctl_cb ...
# OK uvio_fixture.att.inval_ioctl_cb
ok 3 uvio_fixture.att.inval_ioctl_cb
# RUN uvio_fixture.att.inval_ioctl_cmd ...
# OK uvio_fixture.att.inval_ioctl_cmd
ok 4 uvio_fixture.att.inval_ioctl_cmd
# RUN attest_fixture.att_inval_request ...
# OK attest_fixture.att_inval_request
ok 5 attest_fixture.att_inval_request
# RUN attest_fixture.att_inval_addr ...
# OK attest_fixture.att_inval_addr
ok 6 attest_fixture.att_inval_addr
# PASSED: 6 / 6 tests passed.
# Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0
--- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/drivers/.gitignore | 1 + .../selftests/drivers/s390x/uvdevice/Makefile | 22 ++ .../selftests/drivers/s390x/uvdevice/config | 1 + .../drivers/s390x/uvdevice/test_uvdevice.c | 276 ++++++++++++++++++ 6 files changed, 302 insertions(+) create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/Makefile create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/config create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c
MAINTAINERS +1 -0
@@ -10786,6 +10786,7 @@ F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c F: drivers/s390/char/uvdevice.c +F: tools/testing/selftests/drivers/s390x/uvdevice/ F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/
tools/testing/selftests/Makefile +1 -0
@@ -10,6 +10,7 @@ TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug TARGETS += drivers/dma-buf +TARGETS += drivers/s390x/uvdevice TARGETS += efivarfs TARGETS += exec TARGETS += filesystems
tools/testing/selftests/drivers/.gitignore +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only /dma-buf/udmabuf +/s390x/uvdevice/test_uvdevice
tools/testing/selftests/drivers/s390x/uvdevice/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +include ../../../../../build/Build.include + +UNAME_M := $(shell uname -m) + +ifneq ($(UNAME_M),s390x) +nothing: +.PHONY: all clean run_tests install +.SILENT: +else + +TEST_GEN_PROGS := test_uvdevice + +top_srcdir ?= ../../../../../.. +KSFT_KHDR_INSTALL := 1 +khdr_dir = $(top_srcdir)/usr/include +LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include + +CFLAGS += -Wall -Werror -static -I$(khdr_dir) -I$(LINUX_TOOL_ARCH_INCLUDE) + +include ../../../lib.mk + +endif
tools/testing/selftests/drivers/s390x/uvdevice/config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_S390_UV_UAPI=y
tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c new file +276 -0
276 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH v4 2/2] selftests: drivers/s390x: Add uvdevice tests
Quoted 22 lines · Steffen Eiden
Adds some selftests to test ioctl error paths of the uv-uapi. The
KconfigS390_UV_UAPImust be selected and the Ultravisor facility must be available. The test can be executed by non-root, however, the uvdevice special file/dev/uvmust be accessible for reading and writing which may imply root privileges../test-uv-device
TAP version 13
1..6
# Starting 6 tests from 3 test cases.
# RUN uvio_fixture.att.fault_ioctl_arg ...
# OK uvio_fixture.att.fault_ioctl_arg
ok 1 uvio_fixture.att.fault_ioctl_arg
# RUN uvio_fixture.att.fault_uvio_arg ...
# OK uvio_fixture.att.fault_uvio_arg
ok 2 uvio_fixture.att.fault_uvio_arg
# RUN uvio_fixture.att.inval_ioctl_cb ...
# OK uvio_fixture.att.inval_ioctl_cb
ok 3 uvio_fixture.att.inval_ioctl_cb
# RUN uvio_fixture.att.inval_ioctl_cmd ...
# OK uvio_fixture.att.inval_ioctl_cmd
ok 4 uvio_fixture.att.inval_ioctl_cmd
Quoted 8 lines
# RUN attest_fixture.att_inval_request ...
# OK attest_fixture.att_inval_request
ok 5 attest_fixture.att_inval_request
# RUN attest_fixture.att_inval_addr ...
# OK attest_fixture.att_inval_addr
ok 6 attest_fixture.att_inval_addr
# PASSED: 6 / 6 tests passed.
# Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0
Maybe we shouldn't add the result like this in the commit message. The test order may change and it may become invalid soon. Just put it after the commit message.
Quoted 57 lines
Signed-off-by Steffen Eiden <[email protected]>Acked-by Janosch Frank <[email protected]>--- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/drivers/.gitignore | 1 + .../selftests/drivers/s390x/uvdevice/Makefile | 22 ++ .../selftests/drivers/s390x/uvdevice/config | 1 + .../drivers/s390x/uvdevice/test_uvdevice.c | 276 ++++++++++++++++++ 6 files changed, 302 insertions(+) create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/Makefile create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/config create mode 100644 tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.cMAINTAINERS +1
-0@@ -10786,6 +10786,7 @@ F: arch/s390/kernel/uv.c F: arch/s390/kvm/ F: arch/s390/mm/gmap.c F: drivers/s390/char/uvdevice.c +F: tools/testing/selftests/drivers/s390x/uvdevice/ F: tools/testing/selftests/kvm/*/s390x/ F: tools/testing/selftests/kvm/s390x/tools/testing/selftests/Makefile +1
-0@@ -10,6 +10,7 @@ TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug TARGETS += drivers/dma-buf +TARGETS += drivers/s390x/uvdevice TARGETS += efivarfs TARGETS += exec TARGETS += filesystemstools/testing/selftests/drivers/.gitignore +1
-0@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only /dma-buf/udmabuf +/s390x/uvdevice/test_uvdevicetools/testing/selftests/drivers/s390x/uvdevice/Makefile new file +5
-0@@ -0,0 +1,22 @@ +include ../../../../../build/Build.include + +UNAME_M := $(shell uname -m) + +ifneq ($(UNAME_M),s390x)
tools/testing/selftests/drivers/s390x/uvdevice/Makefile line 15
Quoted 10 lines
tools/testing/selftests/drivers/s390x/uvdevice/Makefile new file +10
-0+nothing: +.PHONY: all clean run_tests install +.SILENT: +else + +TEST_GEN_PROGS := test_uvdevice + +top_srcdir ?= ../../../../../.. +KSFT_KHDR_INSTALL := 1 +khdr_dir = $(top_srcdir)/usr/include
This doesn't work in different build cases. Please use $(KHDR_INCLUDES) instead.
tools/testing/selftests/drivers/s390x/uvdevice/Makefile line 16
Quoted 1 line
tools/testing/selftests/drivers/s390x/uvdevice/Makefile new file +1
-0+LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
Which header files do you need from here? I'm not sure what is the purpose of the header files in $(top_srcdir)/tools/arch and where they are used.
Quoted 6 lines
tools/testing/selftests/drivers/s390x/uvdevice/Makefile new file +6
-0+ +CFLAGS += -Wall -Werror -static -I$(khdr_dir) -I$(LINUX_TOOL_ARCH_INCLUDE) + +include ../../../lib.mk + +endif
Signature · 1 line
Muhammad Usama Anjum