Why using C library function `sprintf` in Trusted Application will crash Trusty?

Hi everyone,

I am developing Trusted Applications on Trusty TEE (using Jetson AGX Xavier).
Using C library function sprintf will crash trusty and lead to trusty_panic_notify error. What is the reason of this ?

Thanks !

Please share a patch to either sample so that we can set up and replicate the issue, and then can check with our teams.


Here is the patch file for luks-srv sample that causes trusty crashing.
luks-srv-crashed.patch (1.3 KB)
Bootstrap of Trusty completed, once I executed CA program, the platform would crash and reboot with following error:

Thanks for your help.


Any updates by your side ? I hope my patch helps.

Are you able to call TLOGI for the log? You have got it working in
Where can we find outputs from TLOGI applied in Trusted Application

Or any reason you must call sprintf? We would suggest use existing working solution on current release. For further request, we would need to check and review.


At the end, I could check logs from TLOGI prints by dmesg command.

Actually, I was using sprintf to convert a number in float to a string. Since it doesn’t work, I wrote a self-made function to do the job and it avoids this bug.

But I would like to use C library functions as possible as I could and also avoid this issue in future works, so it would be helpful if you could help me to understand this problem.


Could you try snprintf()? It should be safer than calling sprintf()