[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] arm: optee: don't print warning about "wrong" RPC buffer

  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Mon, 5 Oct 2020 09:12:32 +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=QoxAd8gi+GZNq9Lcq2t5WvdxqX9WQ9ewfqYfmUe3/Mg=; b=BZuvlwsunZenyl8uEQd3PxNATQhW+5NoxKiCei6xT4HNkYr+dBLMrY4mS51mtxI0mxanRE12krxmuBckspRPHRG3QsmMB+/tzF4YJTONcpFYJiLNFpTEF48/wpcpKLTz8/1KBkRa+LJxHE2+5IAUUHI8bfhOI2o7XEOA9HRQjw/T18wnmpW+T/ofuv8uicysdpz1gecb5Tt60ms+Eg8YZ634yVARfeqsZuJSuPtyjLKXok0fCRvW3vWsyxsFomvoYo9i2sYwETpsMkS/dgpg3FHhKcmRIJEk2OUfLRReOdLcX1RN6lo3PVwSW8GBi6bqV6VsqFS3DRheFijWWljLDA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxFwJSIKbHI5On33/5odsW1RgwsLb3Z+kwLGSlvn18dpWN3dWekVpAjv1IBzdMjPPCpMs5GirIxeQ705yCThy0svh1FGwZg9hgcScJZ28zZ6zlMx5vx7V2gvNV/4lmHflPvDUeFegPUNERCHkHfY9qNvEaKT0urUQDViHoCZ3/DIY6Cw4qkJRSBB/eO2wImniyf31vTjQy6a0DLiCaZojndIlGqAzBZTXMc412AuZd7q4LBs7dTRCXRaZFtxPscIVKRMDqxnDMFR7+amv/f0FYKWj7NICSYo+3uP5IL14YXQ/c3NONe6L8qsNzoIADm+vnL/zx/+YdbrvzTd5uQb7w==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=epam.com;
  • Cc: "tee-dev@xxxxxxxxxxxxxxxx" <tee-dev@xxxxxxxxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 05 Oct 2020 09:12:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWmveoJ/DTTDqDgE+9I2W9l7TFKg==
  • Thread-topic: [PATCH] arm: optee: don't print warning about "wrong" RPC buffer

OP-TEE mediator tracks cookie value for a last buffer which
was requested by OP-TEE. This tracked value serves one important
purpose: if OP-TEE wants to request another buffer, we know
that it finished importing previous one and we can free page list
associated with it.

Also, we had false premise that OP_TEE will free requested buffers in
reversed order. So we checked rpc_data_cookie during handling
OPTEE_RPC_CMD_SHM_FREE call and printed warning if cookie of buffer
which is requested to be freed differs from last allocated one.

During testing RPMB FS services I discovered, that RPMB code frees
request and response buffers in the same order is it allocated
them. And this is perfectly fine, actually.

So, we are removing mentioned warning message in Xen, as it is
perfectly normal to free buffers in arbitrary order.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
 xen/arch/arm/tee/optee.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 8a39fe33b0..ee85359742 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -1127,25 +1127,7 @@ static int handle_rpc_return(struct optee_domain *ctx,
         if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_FREE )
-            uint64_t cookie = shm_rpc->xen_arg->params[0].u.value.b;
-            free_optee_shm_buf(ctx, cookie);
-            /*
-             * OP-TEE asks to free the buffer, but this is not the same
-             * buffer we previously allocated for it. While nothing
-             * prevents OP-TEE from asking this, it is the strange
-             * situation. This may or may not be caused by a bug in
-             * OP-TEE or mediator. But is better to print warning.
-             */
-            if ( call->rpc_data_cookie && call->rpc_data_cookie != cookie )
-            {
-                gprintk(XENLOG_ERR,
-                        "Saved RPC cookie does not corresponds to OP-TEE's 
(%"PRIx64" != %"PRIx64")\n",
-                        call->rpc_data_cookie, cookie);
-                WARN();
-            }
+            free_optee_shm_buf(ctx, shm_rpc->xen_arg->params[0].u.value.b);
             call->rpc_data_cookie = 0;



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.