Some errors and stability issues affect the PKCS11 TA which happens after several xtest runs.
This issue can be seen on multiple LS and i.MX board with following commits:
optee_os: d803b88
optee_client: OP-TEE/optee_client@df537dd
optee_test: OP-TEE/optee_test@5b319f8
This issue can be reproduced without CAAM driver.
Please do the following to reproduce the issue:
i=0; while xtest -l 15 pkcs11; do ((i++)) && echo "$i"; done
ISSUE #1: The PKCS11 TA runs out of memory when generating the RSA keys.
The default heap size of the TA seems not enough to do several test runs.
Increasing the TA heap size seems to solve the issue:
ta/pkcs11/sub.mk
-CFG_PKCS11_TA_HEAP_SIZE ?= (16 * 1024)
+CFG_PKCS11_TA_HEAP_SIZE ?= (64 * 1024)
ISSUE #2: TA panicked with code 0xffff0006
The following TA crash would sometime appear after few xtest runs:
o pkcs11_1021.18 RSA-3072: Sign & verify tests - oneshot - CKM_RSA_PKCS
E/TC:? 0
E/TC:? 0 TA panicked with code 0xffff0006
E/LD: Status of TA fd02c9da-306c-48c7-a49c-bbd827ae86ee
E/LD: arch: aarch64
E/LD: region 0: va 0x40004000 pa 0xfe200000 size 0x002000 flags rw-s (ldelf)
E/LD: region 1: va 0x40006000 pa 0xfe202000 size 0x008000 flags r-xs (ldelf)
E/LD: region 2: va 0x4000e000 pa 0xfe20a000 size 0x001000 flags rw-s (ldelf)
E/LD: region 3: va 0x4000f000 pa 0xfe20b000 size 0x004000 flags rw-s (ldelf)
E/LD: region 4: va 0x40013000 pa 0xfe20f000 size 0x001000 flags r--s
E/LD: region 5: va 0x40014000 pa 0xfe249000 size 0x002000 flags rw-s (stack)
E/LD: region 6: va 0x40016000 pa 0xffc01000 size 0x003000 flags rw-- (param)
E/LD: region 7: va 0x40031000 pa 0x00001000 size 0x025000 flags r-xs [0]
E/LD: region 8: va 0x40056000 pa 0x00026000 size 0x014000 flags rw-s [0]
E/LD: [0] fd02c9da-306c-48c7-a49c-bbd827ae86ee @ 0x40031000
E/LD: Call stack:
E/LD: 0x40043910
E/LD: 0x4003aae8
E/LD: 0x40039504
E/LD: 0x40031af8
E/LD: 0x400457a4
E/LD: 0x4003e900
/home/nxf28159/work/imx-optee-test/host/xtest/pkcs11_1000.c:6520: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxf28159/work/imx-optee-test/host/xtest/pkcs11_1000.c:6582: C_DestroyObject(session, private_key) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxf28159/work/imx-optee-test/host/xtest/pkcs11_1000.c:6584: C_DestroyObject(session, public_key) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1021.18 FAILED
/home/nxf28159/work/imx-optee-test/host/xtest/pkcs11_1000.c:6636: C_CloseSession(session) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1021 FAILED
* pkcs11_1007 PKCS11: Check operations release at session closure
E/TA: allocate_tee_operation:262 TEE_AllocateOp. failed 0x10000010 0 0x80
created sessions count: 69
E/TC:?? 00
E/TC:?? 00 TA panicked with code 0xffff0007
E/LD: Status of TA fd02c9da-306c-48c7-a49c-bbd827ae86ee
E/LD: arch: aarch64
E/LD: region 0: va 0x40004000 pa 0xfc200000 size 0x002000 flags rw-s (ldelf)
E/LD: region 1: va 0x40006000 pa 0xfc202000 size 0x008000 flags r-xs (ldelf)
E/LD: region 2: va 0x4000e000 pa 0xfc20a000 size 0x001000 flags rw-s (ldelf)
E/LD: region 3: va 0x4000f000 pa 0xfc20b000 size 0x004000 flags rw-s (ldelf)
E/LD: region 4: va 0x40013000 pa 0xfc20f000 size 0x001000 flags r--s
E/LD: region 5: va 0x40014000 pa 0xfc250000 size 0x002000 flags rw-s (stack)
E/LD: region 6: va 0x40016000 pa 0x209116e000 size 0x001000 flags rw-- (param)
E/LD: region 7: va 0x40077000 pa 0x00001000 size 0x02a000 flags r-xs [0]
E/LD: region 8: va 0x400a1000 pa 0x0002b000 size 0x016000 flags rw-s [0]
E/LD: [0] fd02c9da-306c-48c7-a49c-bbd827ae86ee @ 0x40077000
E/LD: Call stack:
E/LD: 0x4008755c
E/LD: 0x40077f90
E/LD: 0x4007d2f8
E/LD: 0x4007e304
E/LD: 0x40077b38
E/LD: 0x4008c1e4
E/LD: 0x400853bc
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:1562: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:1562: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:1562: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:1562: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:1562: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
o pkcs11_1022.35 RSA-4096: Sign & verify - oneshot - RSA-PSS/SHA1
E/TC:?? 00
E/TC:?? 00 TA panicked with code 0xffff0006
E/LD: Status of TA fd02c9da-306c-48c7-a49c-bbd827ae86ee
E/LD: arch: aarch64
E/LD: region 0: va 0x40004000 pa 0xfc200000 size 0x002000 flags rw-s (ldelf)
E/LD: region 1: va 0x40006000 pa 0xfc202000 size 0x008000 flags r-xs (ldelf)
E/LD: region 2: va 0x4000e000 pa 0xfc20a000 size 0x001000 flags rw-s (ldelf)
E/LD: region 3: va 0x4000f000 pa 0xfc20b000 size 0x004000 flags rw-s (ldelf)
E/LD: region 4: va 0x40013000 pa 0xfc20f000 size 0x001000 flags r--s
E/LD: region 5: va 0x40014000 pa 0xfc250000 size 0x002000 flags rw-s (stack)
E/LD: region 6: va 0x40016000 pa 0x2092288e30 size 0x002000 flags rw-- (param)
E/LD: region 7: va 0x40018000 pa 0x2091c25000 size 0x001000 flags rw-- (param)
E/LD: region 8: va 0x40019000 pa 0x2091c24000 size 0x001000 flags rw-- (param)
E/LD: region 9: va 0x40086000 pa 0x00001000 size 0x02a000 flags r-xs [0]
E/LD: region 10: va 0x400b0000 pa 0x0002b000 size 0x016000 flags rw-s [0]
E/LD: [0] fd02c9da-306c-48c7-a49c-bbd827ae86ee @ 0x40086000
E/LD: Call stack:
E/LD: 0x400994b0
E/LD: 0x40090330
E/LD: 0x4008ed54
E/LD: 0x40086bfc
E/LD: 0x4009b1e4
E/LD: 0x400943bc
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:6938: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:6965: C_DestroyObject(session, private_key) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:6967: C_DestroyObject(session, public_key) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1022.35 FAILED
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:7019: C_CloseSession(session) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1022 FAILED
o pkcs11_1020.6 Test Wrap/Unwrap with indirect template
E/TA: assertion 'bn->bh.bsize < 0' failed at lib/libutils/isoc/bget.c:1042 in brel()
E/TC:?? 00
E/TC:?? 00 TA panicked with code 0xffff0000
E/LD: Status of TA fd02c9da-306c-48c7-a49c-bbd827ae86ee
E/LD: arch: aarch64
E/LD: region 0: va 0x40004000 pa 0xfc200000 size 0x002000 flags rw-s (ldelf)
E/LD: region 1: va 0x40006000 pa 0xfc202000 size 0x008000 flags r-xs (ldelf)
E/LD: region 2: va 0x4000e000 pa 0xfc20a000 size 0x001000 flags rw-s (ldelf)
E/LD: region 3: va 0x4000f000 pa 0xfc20b000 size 0x004000 flags rw-s (ldelf)
E/LD: region 4: va 0x40013000 pa 0xfc20f000 size 0x001000 flags r--s
E/LD: region 5: va 0x40014000 pa 0xfc250000 size 0x002000 flags rw-s (stack)
E/LD: region 6: va 0x40017000 pa 0x00001000 size 0x02a000 flags r-xs [0]
E/LD: region 7: va 0x40041000 pa 0x0002b000 size 0x016000 flags rw-s [0]
E/LD: region 8: va 0x40057000 pa 0x209115c000 size 0x001000 flags rw-- (param)
E/LD: region 9: va 0x40058000 pa 0x2094cf0bb0 size 0x001000 flags rw-- (param)
E/LD: region 10: va 0x40059000 pa 0x209258f000 size 0x001000 flags rw-- (param)
E/LD: [0] fd02c9da-306c-48c7-a49c-bbd827ae86ee @ 0x40017000
E/LD: Call stack:
E/LD: 0x40026680
E/LD: 0x40032504
E/LD: 0x4001f0a0
E/LD: 0x4001ff60
E/LD: 0x40017d24
E/LD: 0x4002c1e4
E/LD: 0x400253bc
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:6134: rv has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1020.6 FAILED
/home/nxa19713/linux-factory/optee-test/host/xtest/pkcs11_1000.c:6277: C_CloseSession(session) has an unexpected value: 0x5 = CKR_GENERAL_ERROR, expected 0x0 = CKR_OK
pkcs11_1020 FAILED
Everytime a different PKCS11 test raises this TA crash. Any idea what is going wrong in this ?
Regards,
Sahil Malhotra
Some errors and stability issues affect the PKCS11 TA which happens after several xtest runs.
This issue can be seen on multiple LS and i.MX board with following commits:
optee_os: d803b88
optee_client: OP-TEE/optee_client@df537dd
optee_test: OP-TEE/optee_test@5b319f8
This issue can be reproduced without CAAM driver.
Please do the following to reproduce the issue:
i=0; while xtest -l 15 pkcs11; do ((i++)) && echo "$i"; doneISSUE #1: The PKCS11 TA runs out of memory when generating the RSA keys.
The default heap size of the TA seems not enough to do several test runs.
Increasing the TA heap size seems to solve the issue:
ISSUE #2: TA panicked with code 0xffff0006
The following TA crash would sometime appear after few xtest runs:
Everytime a different PKCS11 test raises this TA crash. Any idea what is going wrong in this ?
Regards,
Sahil Malhotra