xtest fails on IMX8MPLUS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

xtest fails on IMX8MPLUS

1,378 Views
z23cc
Contributor I

On the imx8MPLUS-BB development board, install optee, run xtest on it, and the following error occurs below.

z23cc_0-1725417836722.png

Later on, I modified r = ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_SECURITY, res) into r = ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_GENERIC, res), and then found the following problem again.


z23cc_1-1725417906601.png

z23cc_2-1725418162989.png

Very confused, don't know how to solve it


Best Regards!





0 Kudos
Reply
3 Replies

560 Views
krzysztof-buczak-red
Contributor II

Old thread and you probably don't care about the answer anymore, but maybe other folks would have the same issue and come upon this post.

In my case switching to another software revision seems to solve the issue. When I was on optee-os and x-test 6.6.52-2.2.0 ("4.4.0"), the test failed the same way as you presented. On optee-os and x-test 6.12.49-2.2.0 ("4.8.0") this is no longer reproducing.

Remember to use NXP github repos for optee and x-test if you are building from scratch:

https://github.com/nxp-imx/imx-optee-test

https://github.com/nxp-imx/imx-optee-os

0 Kudos
Reply

513 Views
krzysztof-buczak-red
Contributor II

Actually, this is the commit that fixed my issue (present on 6.12, not present on 6.6):

commit c6c7967f74d4c6267750b3ff42067c004f8cad33
Author: Jens Wiklander <jens.wiklander@linaro.org>
Date:   Fri Dec 13 10:01:33 2024 +0100

    core: pta: secstore: decrease TA buffer
    
    install_ta() uses a buffer allocated from the heap while hashing a TA
    while installing it. The buffer size is 8kB which is a bit large to
    reliably allocate from the heap, so decrease it to 1kB.
    
    Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
    Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
    Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

diff --git a/core/pta/secstor_ta_mgmt.c b/core/pta/secstor_ta_mgmt.c
index 162de43be..b8dc9283c 100644
--- a/core/pta/secstor_ta_mgmt.c
+++ b/core/pta/secstor_ta_mgmt.c
@@ -44,7 +44,7 @@ static TEE_Result install_ta(struct shdr *shdr, const uint8_t *nw,
        struct tee_tadb_ta_write *ta;
        void *hash_ctx = NULL;
        size_t offs;
-       const size_t buf_size = 2 * 4096;
+       const size_t buf_size = 1024;
        void *buf;
        struct tee_tadb_property property;
        struct shdr_bootstrap_ta bs_ta;

 

0 Kudos
Reply

1,318 Views
jimmychan
NXP TechSupport
NXP TechSupport

Which version of BSP are you using?

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1946787%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Extest%20fails%20on%20IMX8MPLUS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1946787%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EOn%20the%20imx8MPLUS-BB%20development%20board%2C%20install%20optee%2C%20run%20xtest%20on%20it%2C%20and%20the%20following%20error%20occurs%20below.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22z23cc_0-1725417836722.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_0-1725417836722.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_0-1725417836722.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F296954i9692AC81AC1A4989%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22z23cc_0-1725417836722.png%22%20alt%3D%22z23cc_0-1725417836722.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ELater%20on%2C%20I%20modified%20r%20%3D%20ADBG_EXPECT_TEEC_RESULT(c%2C%20TEEC_ERROR_SECURITY%2C%20res)%20into%20r%20%3D%20ADBG_EXPECT_TEEC_RESULT(c%2C%20TEEC_ERROR_GENERIC%2C%20res)%2C%20and%20then%20found%20the%20following%20problem%20again.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22z23cc_1-1725417906601.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_1-1725417906601.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_1-1725417906601.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F296955i92AE950093625799%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22z23cc_1-1725417906601.png%22%20alt%3D%22z23cc_1-1725417906601.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22z23cc_2-1725418162989.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_2-1725418162989.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22z23cc_2-1725418162989.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F296956iFB7CD8BCF1863A4A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22z23cc_2-1725418162989.png%22%20alt%3D%22z23cc_2-1725418162989.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EVery%20confused%2C%20don't%20know%20how%20to%20solve%20it%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EBest%20Regards!%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2326471%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20xtest%20fails%20on%20IMX8MPLUS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2326471%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EOld%20thread%20and%20you%20probably%20don't%20care%20about%20the%20answer%20anymore%2C%20but%20maybe%20other%20folks%20would%20have%20the%20same%20issue%20and%20come%20upon%20this%20post.%3C%2FP%3E%3CP%3EIn%20my%20case%20switching%20to%20another%20software%20revision%20seems%20to%20solve%20the%20issue.%20When%20I%20was%20on%20optee-os%20and%20x-test%26nbsp%3B%3CSTRONG%3E6.6.52-2.2.0%20(%224.4.0%22)%3C%2FSTRONG%3E%2C%20the%20test%20failed%20the%20same%20way%20as%20you%20presented.%20On%20optee-os%20and%20x-test%26nbsp%3B%3CSTRONG%3E6.12.49-2.2.0%20(%224.8.0%22)%3C%2FSTRONG%3E%26nbsp%3Bthis%20is%20no%20longer%20reproducing.%3C%2FP%3E%3CP%3ERemember%20to%20use%20NXP%20github%20repos%20for%20optee%20and%20x-test%20if%20you%20are%20building%20from%20scratch%3A%3C%2FP%3E%3CP%3E-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx%2Fimx-optee-test%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx%2Fimx-optee-test%3C%2FA%3E%3C%2FP%3E%3CP%3E-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx%2Fimx-optee-os%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx%2Fimx-optee-os%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1948694%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20xtest%20fails%20on%20IMX8MPLUS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1948694%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWhich%20version%20of%20BSP%20are%20you%20using%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2327209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20xtest%20fails%20on%20IMX8MPLUS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2327209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EActually%2C%20this%20is%20the%20commit%20that%20fixed%20my%20issue%20(present%20on%206.12%2C%20not%20present%20on%206.6)%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-cpp%22%3E%3CCODE%3Ecommit%20c6c7967f74d4c6267750b3ff42067c004f8cad33%0AAuthor%3A%20Jens%20Wiklander%20%3CJENS.WIKLANDER%3E%0ADate%3A%20%20%20Fri%20Dec%2013%2010%3A01%3A33%202024%20%2B0100%0A%0A%20%20%20%20core%3A%20pta%3A%20secstore%3A%20decrease%20TA%20buffer%0A%20%20%20%20%0A%20%20%20%20install_ta()%20uses%20a%20buffer%20allocated%20from%20the%20heap%20while%20hashing%20a%20TA%0A%20%20%20%20while%20installing%20it.%20The%20buffer%20size%20is%208kB%20which%20is%20a%20bit%20large%20to%0A%20%20%20%20reliably%20allocate%20from%20the%20heap%2C%20so%20decrease%20it%20to%201kB.%0A%20%20%20%20%0A%20%20%20%20Signed-off-by%3A%20Jens%20Wiklander%20%3CJENS.WIKLANDER%3E%0A%20%20%20%20Acked-by%3A%20Jerome%20Forissier%20%3CJEROME.FORISSIER%3E%0A%20%20%20%20Reviewed-by%3A%20Etienne%20Carriere%20%3CETIENNE.CARRIERE%3E%0A%0Adiff%20--git%20a%2Fcore%2Fpta%2Fsecstor_ta_mgmt.c%20b%2Fcore%2Fpta%2Fsecstor_ta_mgmt.c%0Aindex%20162de43be..b8dc9283c%20100644%0A---%20a%2Fcore%2Fpta%2Fsecstor_ta_mgmt.c%0A%2B%2B%2B%20b%2Fcore%2Fpta%2Fsecstor_ta_mgmt.c%0A%40%40%20-44%2C7%20%2B44%2C7%20%40%40%20static%20TEE_Result%20install_ta(struct%20shdr%20*shdr%2C%20const%20uint8_t%20*nw%2C%0A%20%20%20%20%20%20%20%20struct%20tee_tadb_ta_write%20*ta%3B%0A%20%20%20%20%20%20%20%20void%20*hash_ctx%20%3D%20NULL%3B%0A%20%20%20%20%20%20%20%20size_t%20offs%3B%0A-%20%20%20%20%20%20%20const%20size_t%20buf_size%20%3D%202%20*%204096%3B%0A%2B%20%20%20%20%20%20%20const%20size_t%20buf_size%20%3D%201024%3B%0A%20%20%20%20%20%20%20%20void%20*buf%3B%0A%20%20%20%20%20%20%20%20struct%20tee_tadb_property%20property%3B%0A%20%20%20%20%20%20%20%20struct%20shdr_bootstrap_ta%20bs_ta%3B%3C%2FETIENNE.CARRIERE%3E%3C%2FJEROME.FORISSIER%3E%3C%2FJENS.WIKLANDER%3E%3C%2FJENS.WIKLANDER%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E