Thread mode NS-S transition for secure services
Closed, ResolvedPublic

Description

While ARMv8M architecture allows calling a secure function from non-secure code both in thread mode and handler mode, there are benefits to requiring certain types of secure functions to be called exclusively from either one or the other.
In the current trusted-firmware-m implementation handler mode calls are enforced by the framework for all secure service accesses so that the non-secure privileged code that has ownership of the SVC handler can provide access control to secure resources for non-secure threads, associate an identity with each caller thread and/or perform any other administrative tasks associated with a function call.
Similarly, upon entering the secure veneer, tfm_core_sfn_request_function() is run in privileged mode to prepare the execution context for the secure function and potentially perform sanitization of its input parameters.

Task description and rationale:
Creation of the secure context for the execution of the secure service is easier if secure service calls from NS clients are only permitted to be called from NS thread mode, while NS handler mode secure calls are reserved for NS RTOS to TFM Core interactions where elevated privilege of the NS caller is a requirement to get reliable information, e.g. in the case of NS caller thread identification.
Refactor TF-M secure API to restrict NS calls to secure services in thread mode, direct those calls to a secure SVC handler which can take care of input sanitization, access control and other security requirements associated with a non-secure call.
NS client identification will be addressed in a separate task.

wmnt created this task.Aug 6 2018, 8:09 AM
wmnt triaged this task as Normal priority.
wmnt added a comment.Aug 24 2018, 7:22 PM

The same two changes for the feature-ipc branch:
https://review.trustedfirmware.org/#/c/145/
https://review.trustedfirmware.org/#/c/146/

and an additional one to align non-secure to secure IPC interaction with the new thread mode transition requirement:
https://review.trustedfirmware.org/#/c/147/

wmnt closed this task as Resolved.Sep 4 2018, 3:21 PM

The change has been merged on both branches