From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B9BDC433F5 for ; Sat, 25 Dec 2021 11:16:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9147383028; Sat, 25 Dec 2021 12:16:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bxd89ywG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7FEAE83039; Sat, 25 Dec 2021 12:16:36 +0100 (CET) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA016804C8 for ; Sat, 25 Dec 2021 12:16:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x530.google.com with SMTP id b13so41991135edd.8 for ; Sat, 25 Dec 2021 03:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SBngQfO4S3OTMQJ6CVGXK0GmayQu2qVcsaEdqzNZ/Fc=; b=bxd89ywG521w6U8uNoB3SxdnswFM/18xgW6ANYUa/RcoHqEXtCTMevk+SZ+JK7Xkf6 7lvcKzVO9emkjroNuabwJ9ZF9Fc9+/pnN6ZrIFWN8u5n8JYvnUwxz1FZm/E5z4m8dDYv 2xEas6ppRsj4Ay1LXf/diEPGs2BDp+VvBGaJOrxGx8KhqWBmAfaLR11o5ovORaj7xaKU hhBX+TjxqnoAmgIJXhh2F9y/bDmpZWR3vY5B03nuGGKhV4OQwOiRGR8vX0nBMLN39hv3 7UpF32hS+eNenxUVPKH95uvsmeOd3wz8j1ma2yYMIkMxCGqmM/O4I15fTvqjng8VkVJB Fr+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SBngQfO4S3OTMQJ6CVGXK0GmayQu2qVcsaEdqzNZ/Fc=; b=R2owj1K7PSPvx2xtjgW3O1bE98cCWnrTAlnmMQ+cO92+CXNzW++dcYWKJ9wm2neWsb yoTeYTfue82wmtsiJkbbiAuGi5zA3Mn7hpxqUEbXgpNW4YzQN9UxemN7byD05J7ISn7+ 2H5lLUJ5Hp11lZSP9wHTS4poQ9HaPQ1Clj8tm/sBcDvVoE5Y6USAVjwyjuE3nfhlr/yj /SbJFge/KHbZd7zh2oJbo6Bk5SsgBBDPl8Wh784hgSEBwgwhwGsajmOzo7fspVNW7ZQX L1k492bwISLdde81ooItxATSIcOjLFJdLVB9EHbcuqqvrXORu2JzafeySTF2kYosFjUb Dg+g== X-Gm-Message-State: AOAM53365VR/cpxy4kqGBMXbZpRm4MfMvLkTlIRH3ECsIdbC2qKD6CQf 0SibcVST0YMFaP0IWd9wYzD2jA== X-Google-Smtp-Source: ABdhPJwxrIzET39Yl/1YwKEOH3IcU/3EejAHCLFqP6SwOOe4ZUVEsJreIxE8k1JuBf7FEKuaMkK2Mg== X-Received: by 2002:a17:907:3f84:: with SMTP id hr4mr8059317ejc.443.1640430992477; Sat, 25 Dec 2021 03:16:32 -0800 (PST) Received: from hades (athedsl-4461669.home.otenet.gr. [94.71.4.85]) by smtp.gmail.com with ESMTPSA id ht16sm3411004ejc.4.2021.12.25.03.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Dec 2021 03:16:31 -0800 (PST) Date: Sat, 25 Dec 2021 13:16:29 +0200 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: Ilias Apalodimas , Ying-Chun Liu , Jens Wiklander , Alexander Graf , u-boot@lists.denx.de Subject: Re: [PATCH v2] efi_loader: Don't limit the StMM buffer size explicitly Message-ID: References: <20211224080841.98906-1-ilias.apalodimas@linaro.org> <93e2906d-33a5-34b4-38f3-aad27a4aef36@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93e2906d-33a5-34b4-38f3-aad27a4aef36@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean > > [...] > > rc = tee_invoke_func(conn.tee, &arg, 2, param); > > tee_shm_free(shm); > > + /* > > + * Although the max payload is configurable on StMM, we only share > > + * four pages from OP-TEE for the non-secure buffer used to communicate > > + * with StMM. OP-TEE will reject anything bigger than that and will > > + * return. So le'ts at least warn users > > + */ > > tee_close_session(conn.tee, conn.session); > > - if (rc || arg.ret != TEE_SUCCESS) > > + if (rc || arg.ret != TEE_SUCCESS) { > > tee_close_session(): Will arg.ret be valid if rc != 0? Depends when tee_invoke_func() failed. But why do we care? The connection needs to close regardless and we then have to reason with the error. Regards /Ilias > > Best regards > > Heinrich > > > + if (arg.ret == TEE_ERROR_EXCESS_DATA) > > + log_err("Variable payload too large\n"); > > return EFI_DEVICE_ERROR; > > + } > > > > switch (param[1].u.value.a) { > > case ARM_SVC_SPM_RET_SUCCESS: > > @@ -255,15 +263,6 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size) > > goto out; > > } > > *size = var_payload->size; > > - /* > > - * Although the max payload is configurable on StMM, we only share a > > - * single page from OP-TEE for the non-secure buffer used to communicate > > - * with StMM. Since OP-TEE will reject to map anything bigger than that, > > - * make sure we are in bounds. > > - */ > > - if (*size > OPTEE_PAGE_SIZE) > > - *size = OPTEE_PAGE_SIZE - MM_COMMUNICATE_HEADER_SIZE - > > - MM_VARIABLE_COMMUNICATE_SIZE; > > /* > > * There seems to be a bug in EDK2 miscalculating the boundaries and > > * size checks, so deduct 2 more bytes to fulfill this requirement. Fix >