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

Generic RPC Support #3292

Closed

Conversation

HernanGatta
Copy link

@HernanGatta HernanGatta commented Sep 23, 2019

This PR adds a new PTA, the Generic RPC (GRPC) PTA, that allows user-mode TA's to perform calls out to their corresponding host application running in the REE on a session-by-session basis. The logic behind this feature mirrors that utilized to communicate with the TEE supplicant. In this sense, a TA's host application effectively becomes its own little supplicant.

This mechanism was originally developed for the Open Enclave SDK. This SDK provides developers with an abstraction layer on top of multiple TEE technologies, allowing them to write hosts and enclaves once which can run anywhere. Currently, it supports Intel SGX and work is underway to support OP-TEE, too. The SDK's master branch has preliminary support for OP-TEE and allows one to build and load TA's, to invoke commands (aka. "enclave calls", or "ECALLs") and for TA's to invoke commands on their host (aka. "out calls" or "OCALLs"), for parity with SGX.

In the SDK, a code generator produces stubs that serialize function parameters into known structures (one for input, one for output, and a control structure), then passes that to the enclave or host, depending on the direction of the call. On the other side of the call, the structure is deserialized and the underlying function is invoked automatically. In this sense, the developer merely executes a function call on either side and the complexities of performing an ECALL or an OCALL are completely hidden by the SDK.

The flow for an OCALL is exactly the same as for an RPC to the TEE supplicant; this method just allows for arbitrary parameters and for routing the request to the host application.

To support this functionality, changes were made to the Linux TEE and OP-TEE drivers. These may be viewed here.

Open questions:

  1. API offered to TA's (besides the raw GRPC PTA API);
  2. Is there a way to minimize copies?
  3. How would you like me to submit the changes to Linux?

Associated PR's:

  1. OP-TEE Client
  2. OP-TEE Examples

* CFG_GENERIC_RPC: Enabled by default.
* UUID: ad0fd0ae-09e1-464b-98ed-0607ec9ebd8b
* Request that shared memory be allocated to communicate between the host and the PTA.
* Enable with CFG_GENERIC_RPC.
* When calling the GRPC PTA, the caller passes the GRPC PTA command ID in the upper 4 bits of the cmd_id parameter, and uses the remaining bits for the function ID it wishes the host to execute on its behalf;
* In turn, the same mechanism is used in Linux to determine whether an RPC is a GRPC request, what the command ID is, and which function ID the host is expected to execute.
* The argument attributes are not updated on RPC return.
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed pull request at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant