Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello_world failed after upgrading to optee_os 3.8 for compiling rust TAs #21

Closed
xiangmy opened this issue Dec 2, 2020 · 5 comments
Closed

Comments

@xiangmy
Copy link

xiangmy commented Dec 2, 2020

Hi,

Thanks for the great work! If I understand correctly, the optee used in the skd is 3.4, but we are supposed to test the TAs under optee 3.8 as the instructions specifies. However, after I replaced the optee with optee 3.8 (copied and pasted from optee-qemuv8-3.8.0), I got a translation fault when I test the TA.

We are developing a board adopting optee 3.8. It will be really helpful if you can give us any advice on how to move from optee_os 3.4 to 3.8 so that we can use your scheme.

PS: If I compile TAs with optee_os 3.4 and test TAs with optee 3.8, it works well.

Thanks,
Mingyuan

The error looks like following:

D/TC:? 0 tee_ta_init_pseudo_ta_session:280 Lookup pseudo TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b
D/TC:? 0 load_ldelf:704 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:250 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (Secure Storage TA)
D/TC:? 0 system_open_ta_binary:253 res=0xffff0008
D/TC:? 0 system_open_ta_binary:250 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (REE)
D/TC:? 0 system_open_ta_binary:253 res=0x0
D/LD:  load_main:863 Reloading TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b as legacy TA
D/TC:? 0 system_open_ta_binary:250 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (Secure Storage TA)
D/TC:? 0 system_open_ta_binary:253 res=0xffff0008
D/TC:? 0 system_open_ta_binary:250 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (REE)
D/TC:? 0 system_open_ta_binary:253 res=0x0
D/LD:  ldelf:169 ELF (8aaaf200-2450-11e4-abe2-0002a5d5c51b) at 0x40012000
D/TC:? 0 tee_ta_close_session:499 csess 0xe178320 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session
[+] TA create
[+] TA open session
D/TC:0 0 abort_handler:524 [abort] abort in User mode (TA will panic)
E/TC:? 0 
E/TC:? 0 User TA prefetch-abort at address 0x0 (translation fault)
E/TC:? 0  esr 0x82000005  ttbr0 0x200000e18a000   ttbr1 0x00000000   cidr 0x0
E/TC:? 0  cpu #0          cpsr 0x60000100
E/TC:? 0  x0  0000000000000000 x1  0000000000000000
E/TC:? 0  x2  0000000000000040 x3  0000000000000040
E/TC:? 0  x4  0000000000000010 x5  00000000400282c0
E/TC:? 0  x6  0000000000000000 x7  0000000000000000
E/TC:? 0  x8  0000000000000003 x9  0000000000000003
E/TC:? 0  x10 0000000000000003 x11 0000000000000000
E/TC:? 0  x12 0000000000000000 x13 0000000040039f80
E/TC:? 0  x14 0000000000000000 x15 0000000000000000
E/TC:? 0  x16 000000000e11d8b8 x17 0000000000000000
E/TC:? 0  x18 0000000000000000 x19 0000000000000000
E/TC:? 0  x20 0000000000000000 x21 0000000000000000
E/TC:? 0  x22 0000000000000000 x23 0000000000000000
E/TC:? 0  x24 0000000000000000 x25 0000000000000000
E/TC:? 0  x26 0000000000000000 x27 0000000000000000
E/TC:? 0  x28 0000000000000000 x29 0000000000000000
E/TC:? 0  x30 0000000000000000 elr 0000000000000000
E/TC:? 0  sp_el0 0000000040039f80
E/LD:  Status of TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b
E/LD:   arch: aarch64
E/LD:  region  0: va 0x40004000 pa 0x0e300000 size 0x002000 flags rw-s (ldelf)
E/LD:  region  1: va 0x40006000 pa 0x0e302000 size 0x007000 flags r-xs (ldelf)
E/LD:  region  2: va 0x4000d000 pa 0x0e309000 size 0x001000 flags rw-s (ldelf)
E/LD:  region  3: va 0x4000e000 pa 0x0e30a000 size 0x003000 flags rw-s (ldelf)
E/LD:  region  4: va 0x40011000 pa 0x0e30d000 size 0x001000 flags r--s
E/LD:  region  5: va 0x40012000 pa 0x00010000 size 0x01a000 flags r-xs [0]
E/LD:  region  6: va 0x4002c000 pa 0x0002a000 size 0x00d000 flags rw-s [0]
E/LD:  region  7: va 0x40039000 pa 0x0e335000 size 0x001000 flags rw-s (stack)
E/LD:   [0] 8aaaf200-2450-11e4-abe2-0002a5d5c51b @ 0x40012000
E/LD:  Call stack:
E/LD:   0x0000000000000000
D/TC:? 0 user_ta_enter:168 tee_user_ta_enter: TA panicked with code 0xdeadbeef
D/TC:? 0 tee_ta_close_session:499 csess 0xe178b20 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session
D/TC:? 0 destroy_context:298 Destroy TA ctx (0xe178ac0)
E/TC:? 0 tee_ta_open_session:728 Failed. Return error 0xffff3024
@xiangmy xiangmy changed the title Hello_world failed after upgrading to optee_os 3.8 hello_world failed after upgrading to optee_os 3.8 Dec 2, 2020
@xiangmy xiangmy changed the title hello_world failed after upgrading to optee_os 3.8 hello_world failed after upgrading to optee_os 3.8 when compiling Dec 2, 2020
@xiangmy xiangmy changed the title hello_world failed after upgrading to optee_os 3.8 when compiling hello_world failed after upgrading to optee_os 3.8 for compiling rust TAs Dec 2, 2020
@mssun
Copy link
Member

mssun commented Dec 4, 2020

Thanks for the report. I'm not sure the root cause in your case.

I can see from the log showing that the TA has been crated and the session opened successfully.

[+] TA create
[+] TA open session

To help you debug this issue, the problem should be in invoking command in the secure world. Maybe there're some differences for the invoking command API in the newer version.

@xiangmy
Copy link
Author

xiangmy commented Dec 4, 2020

Hi @mssun ,

Thanks for the reply! I dug in recently, and I think this is because the optee changes the TA entry point since a73b5878c8. They removed the TA entry point from ta_header. So, we have to link the TAs against __utee_entry, or __ta_entry in optee 3.8, as the entry point (though I'm not sure how to do this in rust because I'm new to rust). So before I proceed, I want to ask your options on my thought. Any advice will be helpful.

Thanks,
Mingyuan

@xiangmy
Copy link
Author

xiangmy commented Dec 11, 2020

Hi @mssun ,

I've fixed the entry pointer problem. I have to add a few linking arguments and change the linker script according to optee 3.8. Anyway, the hello_world can compile with optee_os 3.8 and run with optee 3.8 now, though I haven't tried other TAs yet. I can submit a P/R if you like.

Thanks,
Mingyuan

@mssun
Copy link
Member

mssun commented Dec 11, 2020

Sure, I'm happy to take any PR. Thanks.

@mssun
Copy link
Member

mssun commented Feb 23, 2021

I believe this PR can be also closed because of recent PR about OPTEE update.

@mssun mssun closed this as completed Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants