apache / incubator-teaclave-trustzone-sdk

Teaclave TrustZone SDK enables safe, functional, and ergonomic development of trustlets.
https://teaclave.apache.org
Apache License 2.0
204 stars 58 forks source link

The third-party lib questions #58

Closed suntong30 closed 2 years ago

suntong30 commented 2 years ago

Hello team, I am new to Rust OP-TEE. I use C/C++, and I haven't learned Rust. I know that TA can execute a third-party lib(crate), and the third-party lib must be a static link lib, right? So if there are some codes in crate that have to invoke system calls (such as read()/open()/write() in Linux), can Rust TA executes this code in secure world?

thanks, Steph

mssun commented 2 years ago

I know that TA can execute a third-party lib(crate), and the third-party lib must be a static link lib, right?

I believe OP-TEE supports TA dynamic linking. But if you are using Rust, all crates are statically linked.

So if there are some codes in crate that have to invoke system calls (such as read()/open()/write() in Linux), can Rust TA executes this code in secure world?

OP-TEE OS is not like Linux. Its syscalls are different. Here is a list: https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/master/optee-utee/optee-utee-sys/src/utee_syscalls.rs.

suntong30 commented 2 years ago

@mssun Many thanks for your quick reply. https://github.com/OP-TEE/optee_os/issues/1909#issuecomment-341024444 This issue said that there is no dynamic linking for TAs.

OP-TEE OS is not like Linux. Its syscalls are different. Here is a list: https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/master/optee-utee/optee-utee-sys/src/utee_syscalls.rs.

What I mean is that, if a crate has Linux system calls, can Rust OP-TEE execute this crate successfully?

thanks, Steph

mssun commented 2 years ago

What I mean is that, if a crate has Linux system calls, can Rust OP-TEE execute this crate successfully?

No.

suntong30 commented 2 years ago

OK, thanks for your reply.