Closed ShaleXIONG closed 3 years ago
Do you see and trace print to the console? Like: [+] TA create [+] TA open session
No I did not get those info. This is the full console output:
D/TC:? 0 tee_ta_init_pseudo_ta_session:284 Lookup pseudo TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b
D/TC:? 0 load_ldelf:703 ldelf load address 0x40006000
D/LD: ldelf:134 Loading TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b
D/TC:? 0 tee_ta_init_session_with_context:573 Re-open TA 3a2f8978-5dc0-11e8-9c2d-fa7ae01bbebc
D/TC:? 0 system_open_ta_binary:257 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (Secure Storage TA)
D/TC:? 0 system_open_ta_binary:260 res=0xffff0008
D/TC:? 0 system_open_ta_binary:257 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (REE)
D/TC:? 0 system_open_ta_binary:260 res=0x0
D/LD: load_main:974 Reloading TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b as legacy TA
D/TC:? 0 system_open_ta_binary:257 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (Secure Storage TA)
D/TC:? 0 system_open_ta_binary:260 res=0xffff0008
D/TC:? 0 system_open_ta_binary:257 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (REE)
D/TC:? 0 system_open_ta_binary:260 res=0x0
D/TC:3 0 abort_handler:524 [abort] abort in User mode (TA will panic)
E/TC:? 0
E/TC:? 0 User TA data-abort at address 0x481b8dfc (translation fault)
E/TC:? 0 esr 0x92000006 ttbr0 0x200001018f060 ttbr1 0x00000000 cidr 0x0
E/TC:? 0 cpu #3 cpsr 0x40000100
E/TC:? 0 x0 0000000002060fcf x1 0000000000000003
E/TC:? 0 x2 0000000040034ec0 x3 0000000000000000
E/TC:? 0 x4 0000000000000000 x5 000000004000ca4f
E/TC:? 0 x6 0000000000021eb0 x7 0000000040034ecc
E/TC:? 0 x8 0000000000000007 x9 0000000040005e94
E/TC:? 0 x10 0000000000000000 x11 0000000000000000
E/TC:? 0 x12 0000000000000000 x13 0000000040005c68
E/TC:? 0 x14 0000000000000000 x15 0000000000000001
E/TC:? 0 x16 000000001011e4f4 x17 0000000000000000
E/TC:? 0 x18 8cff8c41aded7b9f x19 0000000002060fcf
E/TC:? 0 x20 0000000040011ef0 x21 0000000000000003
E/TC:? 0 x22 000000004000ca3f x23 0000000040005ef8
E/TC:? 0 x24 0000000040034ec0 x25 0000000040034e68
E/TC:? 0 x26 0000000000000000 x27 0000000000000000
E/TC:? 0 x28 0000000000000000 x29 0000000040005e00
E/TC:? 0 x30 00000000400094e8 elr 000000004000930c
E/TC:? 0 sp_el0 0000000040005e00
E/TC:? 0 region 0: va 0x0000000040000000 pa 0x0000000010102000 size 0x002000 flags ---R-X
E/TC:? 0 region 1: va 0x0000000040002000 pa 0x000000001017b000 size 0x001000 flags ---RW-
E/TC:? 0 region 2: va 0x0000000040004000 pa 0x0000000010800000 size 0x002000 flags rw-RW-
E/TC:? 0 region 3: va 0x0000000040006000 pa 0x0000000010802000 size 0x008000 flags r-x---
E/TC:? 0 region 4: va 0x000000004000e000 pa 0x000000001080a000 size 0x001000 flags rw-RW-
E/TC:? 0 region 5: va 0x000000004000f000 pa 0x000000001080b000 size 0x003000 flags rw-RW-
E/TC:? 0 region 6: va 0x0000000040012000 pa 0x000000001080e000 size 0x001000 flags r--R--
E/TC:? 0 region 7: va 0x0000000040013000 pa 0x000000001080f000 size 0x02f000 flags rwxRW-
E/TC:? 0 region 8: va 0x0000000040042000 pa 0x000000001083e000 size 0x001000 flags rw-RW-
E/TC:? 0 init_with_ldelf:228 ldelf panicked
D/TC:? 0 tee_ta_close_session:499 csess 0x10177ee0 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session
D/TC:? 0 destroy_context:298 Destroy TA ctx (0x10177e80)
D/TC:? 0 tee_ta_close_session:499 csess 0x101776e0 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session
E/TC:? 0 tee_ta_open_session:728 Failed. Return error 0xffff0000
call teec_post_process_operationraw::TEEC_OpenSession return error: 4294901760
Error: Non-specific cause. (error code 0xffff0000)
Actually, I didn't test this on 3.7.0. We do have tutorial to run it in 3.4.0 on QEMU: https://github.com/mesalock-linux/rust-optee-trustzone-sdk/wiki/Getting-started-with-OPTEE-for-QEMU-ARMv8
If 3.7 still follow the GlobalPlatform API, the library should be okay. Another thing you may try is to increase the TEE RAM size since Rust's code is later than C and we didn't do any optimization.
I see cool ! I will try on 3.4.0. The hello_world TA from rust is around 100K, while the same TA from C is around 80K. I doubt it is the problem off TEE RAM but I will try that too.
Hi, any update on this issue?
I was busy with other things. I have tested the 3.7 on QEMU, which works, but did not find a time to try further, e.g. 3.4 on Rpi or increase the TEE RAM size. I will post here if I get any update.
I'm closing this issue. Feel free to reopen it if you have any update. Thanks.
Hi,
I compile the
hello_world
example, targeting rpi3, and it pops:For comparison, there is no problem when I compile the TA in the
hello_world
example (in C) in optee_example, and then use the host program in thehello_example
here (in Rust).Specifically, by instrumenting the source code, I believe:
raw::TEEC_OpenSession
in thenew
method inSession
fail, returning 0xffff0000ioctl
inTEEC_OpenSession
in the source codetee_client_api.c
contained in theoptee_client/libteec
dir.I configure the rpi3, following the guide in optee; specifically, I use version 3.7.0.
Do you have any insight into this problem?