OP-TEE / optee_os

Trusted side of the TEE
Other
1.6k stars 1.07k forks source link

TEE_ERROR_NOT_SUPPORTED when running xtest --stats --ta #7153

Open ybernsteinoz opened 15 hours ago

ybernsteinoz commented 15 hours ago

Hello, I am using optee on QEMU, I have an app that makes use of the ta. I am interested in measuring the ta memory usage as described here https://github.com/OP-TEE/optee_os/issues/6124

I compile my ta with the flags: CFG_TEE_CORE_MALLOC_DEBUG = y CFG_TEE_TA_MALLOC_DEBUG = y CFG_WITH_STATS=y CFG_TA_STATS=y

But when I run the command xtest --stats --ta I get: xtest: TEEC_InvokeCommand: res 0xffff000a err_orig 0x4 which means TEE_ERROR_NOT_SUPPORTED.

Thanks

etienne-lms commented 13 hours ago

CFG_TA_STATS=y and CFG_WITH_STATS=y are enough to measure memory consumption in TAs. I've just tested on my platform, works fine.

CFG_TEE_TA_MALLOC_DEBUG is rather used internally in embedded code (bget_malloc.c|.h) to assert the heap pool consistency (effective assertion requires NDEBUG is not defined). CFG_TEE_CORE_MALLOC_DEBUG does the same (effective assertion requires CFG_TEE_CORE_DEBUG=y).

ybernsteinoz commented 13 hours ago

@etienne-lms thanks for your reply! I've tried to remove the other flags, so the flags I currently have are: CFG_TEE_TA_LOG_LEVEL ?= 4 CFG_TA_OPTEE_CORE_API_COMPAT_1_1=y CFG_WITH_STATS=y CFG_TA_STATS=y

but the same error still occurs.

etienne-lms commented 12 hours ago

Looking into the implementation, the sole reason I see xtest --stats --ta results in res=0xffff000a err_orig=0x4 is CFG_TA_STATS is disabled (unless I missed something, of corse :-). Check the OP-TEE core you test is really the one you have rebuilt.

xtaens commented 3 hours ago

hi I ran the following error on 4.0.0

# 
# xtest --stats --ta
xtest: TEEC_InvokeCommand: res 0xffff0008 err_orig 0x4
# 
#