[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/arm: optee: allow plain TMEM buffers with NULL address
- To: "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Date: Mon, 18 May 2020 01:53:06 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K8ZTmz7ZkuJd8she9nbYHz8c8nga6+mSjhcSH14/Cso=; b=hRRqk4aosQjGq11MWAjEUwwkd3shu2nMhf284TYrop4ADstuFu7Tq+078L3PRYN8poNDmoUZsYaCLA3Ng8mVeScD/V8ou5o2eIL4zqc6StQ1fXkaaWwz9PSwFRTiRSi9aYiglh9F2yKE3uhEpXoJVGs46UrYbHuYDCUIVGpQmyJaee+8jhwsbJIIJED83GOZi3zGiipJNLoz/5EJtw2l9BxYjBhAiFbuMCTYzmhVWdTAG64ItfEGAD4MQY+UIq9Vcewo8oSmsqE4n1+L35Zv0h6+/kXYHFFbbQOgEZ9KPamAWCtcFQueeee/S1tjbFETNUleDScinkdNpoFY6FGC2g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZXnPSIulmQAA0NeXcpgP3yo/bQ9MYx+SRpwBAk/YYjNW4up4aJflsPPV3hSJSP0LeexEWjuDpnDN3uDHpX5pm3bv1wIcPninXn6YDWImTr3XF3T9KE7s6slFeeldcTf6fE7Lf573pI+iMlM/6R94nohcV6YZx9TOprE7M6vki2bIVIp6JsOn1At+R5LnWVXbq5DiO/dim2fOsN6bIIlv7BcnpyZcijcFaYtXvpLl7Q9iJmztBOU2pvTgPijEyMChe2CIaG/IS8qNk+YJLSxPn1YqVvv2lgmthaGORIaDgc2VvHbEOmHaUYGsA9Xto/P9jmNLxorluwVYfLXs4JzAQ==
- Authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=epam.com;
- Delivery-date: Mon, 18 May 2020 01:53:32 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHWLLcTxhZtogukPEOG78aedSZTLQ==
- Thread-topic: [PATCH] xen/arm: optee: allow plain TMEM buffers with NULL address
Trusted Applications use popular approach to determine required size
of buffer: client provides a memory reference with the NULL pointer to
a buffer. This is so called "Null memory reference". TA updates the
reference with the required size and returns it back to client. Then
client allocates buffer of needed size and repeats the operation.
This behavior is described in TEE Client API Specification, paragraph
3.2.5. Memory References.
OP-TEE represents this null memory reference as a TMEM parameter with
buf_ptr == NULL. This is the only case when we should allow TMEM
buffer without the OPTEE_MSG_ATTR_NONCONTIG flag.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
xen/arch/arm/tee/optee.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index af19fc31f8..fb7d491b25 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -865,9 +865,12 @@ static int translate_params(struct optee_domain
*ctx,
}
else
{
- gdprintk(XENLOG_WARNING, "Guest tries to use old tmem
arg\n");
- ret = -EINVAL;
- goto out;
+ if ( call->xen_arg->params[i].u.tmem.buf_ptr )
+ {
+ gdprintk(XENLOG_WARNING, "Guest tries to use old
tmem arg\n");
+ ret = -EINVAL;
+ goto out;
+ }
}
break;
case OPTEE_MSG_ATTR_TYPE_NONE:
|