Skip to content

Commit 26fb87f

Browse files
steffen-eidenfrankjaa
authored andcommitted
s390/uvdevice: Report additional-data length for attestation
Additional data length in the attestation request is an in/out variable. Software provides the capacity of the buffer. Upon successful request, firmware reports the actual bytes written to the additional data in that field. This information is lost, as the length field was not copied back to userspace before. Attestation might fail, if user space did not specify the exact amount of needed bytes required, as this length is part of the attestation measurement. Signed-off-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20231106124922.3032370-1-seiden@linux.ibm.com Message-Id: <20231106124922.3032370-1-seiden@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
1 parent 98b1cc8 commit 26fb87f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/s390/char/uvdevice.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static int uvio_copy_attest_result_to_user(struct uv_cb_attest *uvcb_attest,
109109
struct uvio_attest *uvio_attest)
110110
{
111111
struct uvio_attest __user *user_uvio_attest = (void __user *)uv_ioctl->argument_addr;
112+
u32 __user *user_buf_add_len = (u32 __user *)&user_uvio_attest->add_data_len;
112113
void __user *user_buf_add = (void __user *)uvio_attest->add_data_addr;
113114
void __user *user_buf_meas = (void __user *)uvio_attest->meas_addr;
114115
void __user *user_buf_uid = &user_uvio_attest->config_uid;
@@ -117,6 +118,8 @@ static int uvio_copy_attest_result_to_user(struct uv_cb_attest *uvcb_attest,
117118
return -EFAULT;
118119
if (add_data && copy_to_user(user_buf_add, add_data, uvio_attest->add_data_len))
119120
return -EFAULT;
121+
if (put_user(uvio_attest->add_data_len, user_buf_add_len))
122+
return -EFAULT;
120123
if (copy_to_user(user_buf_uid, uvcb_attest->config_uid, sizeof(uvcb_attest->config_uid)))
121124
return -EFAULT;
122125
return 0;

0 commit comments

Comments
 (0)