MiniTEE—A Lightweight TrustZone-Assisted TEE for Real-Time Systems
Abstract
:1. Introduction
- We comprehensively discussed the obstacle of combing RTOS with current TEE solutions and propose a RTOS-friendly TEE solution with predictable and bounded overhead;
- We present a case study on a 3DOF control system to demonstrate the use case of MiniTEE;
- We conduct comprehensive evaluation on a realistic hardware platform, focusing on the overhead incurred by MiniTEE on the real-time properties to a legacy RTOS.
2. Background
2.1. Overview of TrustZone
2.2. Structure of a TEE
2.3. TEE Augmented Real-Time Task Model
3. Motivation Discussion and Design Principles
3.1. Motivation
- (1)
- Normal World task issues a TA-invoking request by calling the TEE client APIs. Then TEE driver will trap the CPU into monitor mode to communicate with OP-TEE kernel to initialize a private communication channel (i.e., TEE context) for passing messages.
- (2)
- OP-TEE kernel will create a TA execution environment (e.g., session control block, stack space) before invoking that TA function. Note that, if the called TA is busy (i.e., called by other Normal World tasks), OP-TEE kernel will suspend the newly arrived request. Since each TA in OP-TEE has an unique private stack.
- (3)
- The invoked TA starts to execute.
- (4)
- OP-TEE issues a SMC to get the CPU back to Normal World after destroying the TA execution environment and reclaiming the memory space.
- (5)
- After replying the TA’s execution results to the calling task, TEE driver tears down the TEE context.
3.2. Design Principles
- P1. Predictable and Bounded Run-time Overhead: Performance overheads on both the Normal and Secure Worlds incurred by MiniTEE should be Predictable and bounded. Otherwise, it will hurt the real-time properties.
- P2. Security Guarantees: Each communication must not lead to or propagate hazards and faults, And the shared MiniTEE resources should not open any side-channel for malicious tasks.
- P3. Minimize Trusted Computing Base: On the one hand, large software size may potentially open more attack surfaces to adversaries. Relying on the hardware support of TrustZone technology as much as possible, will definitively help us minimize the trusted computing base of the system and, consequently, decreasing the attack surfaces to adversaries. On the other hand large code size may obstacle the usage in resource-constrained devices.
4. Design
4.1. Overview
4.2. Architecture Design
4.2.1. The Monitor
4.2.2. MiniTEE Kernel
- Shared-memory-based Data Channel—MiniTEE uses the shared memory as the data channel, realized as two cache pools—a request pool and a reply pool.
- Channel Maintenance—The first 32 bytes (e.g., the first slot) of each poll is defined as the pool-head, which is used for maintenance of the pool. The head of request pool is partitioned into two fields—request-task corresponds to the message producer (aka, real-time tasks) and msg-bitmap identifies valid slots storing the message data. Note that, at one time, there is at most one real-time task’s message occupying the request pool. Since before a TEE task running, the message will be copied to the TEE task’s private message space and destroy the duplicate message in request pool. The interrupts are disabled during such memory copy to avoid the occurrence another task’s message (due to higher priority task preemption) in the request pool note that, the blocking time of such an atomic execution can be alleviated by using Direct Memory Access (DMA).In this way, the management pool is free from fragmentation and garbage collection, thereby enhancing the predictability of the whole system. Note that, the structure and working principle of the reply pool is similar to the request pool. The difference is that memory copy direction is from reply pool to calling task’s local stack.
- Slot Size and Efficiency—Larger slot size does help for the increment of bandwidth, but it increases the latency of Larger slot size does help for the increment of the bandwidth, but it increases the latency of RPC yet. Note that the operation to read/write memory need considerable CPU cycles. So the slot size is the result of trade-off between bandwidth and latency. In MiniTEE, each pool possesses a 4k bytes page (can be customized to a larger page if needed in future), and contains 128 message slots. The 32-byte message length coincides with the cache line size of the ARMv7 CPU, which makes a high efficiency of the multi-level caches in the CPU. With two distinguishable pools in an RPC channel, it is helpful to decrease the occurrence of page faults, hence increases the speed of RPC message accessing. Similar approach is also adopted in Reference [21].
5. Implementation
6. Evaluation
6.1. Binary Size
6.2. Case Study
6.3. Performance Evaluation
- (1)
- Initialize a MiniTEE context through invoking MiniTEE-Driver: Time since the real-time task calls API TEE_InitializeContext until MiniTEE-Driver issues a world switching using SMC 0;
- (2)
- SMC from Normal world handling: Time since the processor enters in the monitor’s vector table until restore the Secure world context;
- (3)
- Create a new TEE task or resume a previous suspended one: Time since MiniTEE scheduler occupies the CPU until the called TA starts to execute on TEE task’s stack;
- (4)
- Suspend MiniTEE scheduler: Time since TA finishes its execution until MiniTEE scheduler issues a SMC 0 to switch world back to Normal World;
- (5)
- Handle SMC from Secure world in Monitor module: Time since the processor enters in the monitor’s vector table until restore the Normal world context;
- (6)
- Finalize the MiniTEE context: Time since the processor gets back to Normal world until MiniTEE-Driver frees up the shared memory and goes back to the execution of the calling real-time task.
7. Related Work
8. Conclusions
Author Contributions
Funding
Acknowledgments
Conflicts of Interest
References
- Altawy, R.; Youssef, A.M. Security, privacy, and safety aspects of civilian drones: A survey. ACM Trans. Cyber-Phys. Syst. 2017, 1, 7. [Google Scholar] [CrossRef]
- Lesi, V.; Jovanov, I.; Pajic, M. Network scheduling for secure cyber-physical systems. In Proceedings of the IEEE Real-Time Systems Symposium (RTSS), Paris, France, 5–8 December 2017. [Google Scholar]
- Sabt, M.; Achemlal, M.; Bouabdallah, A. Trusted Execution Environment: What It is, and What It is Not. In Proceedings of the 2015 IEEE Trustcom/BigDataSE/ISPA, Helsinki, Finland, 20–22 August 2015; Volume 1, pp. 57–64. [Google Scholar]
- Arm. ARM Security Technology Building a Secure System Using TrustZone Technology. Available online: https://static.docs.arm.com/genc009492/c/PRD29-GENC-009492C_trustzone_security_whitepaper.pdf (accessed on 10 July 2020).
- Rubinov, K.; Rosculete, L.; Mitra, T.; Roychoudhury, A. Automated partitioning of android applications for trusted execution environments. In Proceedings of the 2016 IEEE/ACM ICSE, Austin, TX, USA, 14–22 May 2016; Volume 1, pp. 923–934. [Google Scholar]
- Challener, D.C.; Safford, D.R. Encrypted File System using TCPA. U.S. Patent 7,343,493, 10 July 2008. [Google Scholar]
- Darwish, S.M.; Guirguis, S.K.; Zalat, M.S. Stealthy code obfuscation technique for software security. In Proceedings of the 2010 IEEE ICCES, Cairo, Egypt, 30 November–2 December 2010; Volume 1, pp. 923–930. [Google Scholar]
- ARM. “TrustZone Technology for ARMv8-M Architecture, Version 2.1”. Available online: https://static.docs.arm.com/100690/0201/armv8_m_architecture_trustzone_technology_100690_0201_01_en.pdf (accessed on 1 October 2018).
- Pinto, S.; Santos, N. Demystifying Arm TrustZone: A Comprehensive Survey. ACM Comput. Surv. (CSUR) 2019, 51, 130. [Google Scholar] [CrossRef]
- GlobalPlatform. Available online: https://globalplatform.org/ (accessed on 26 May 2020).
- Technology, G.D.; Globalplatform. TEE Client API Specification. pp. 1–58. Available online: https://globalplatform.org/specs-library/tee-client-api-specification/ (accessed on 10 July 2020).
- Ye, M.; Sherman, J.; Srisa-An, W.; Wei, S. TZSlicer: Security-aware dynamic program slicing for hardware isolation. Procedings of the 2018 IEEE International Symposium on Hardware Oriented Security and Trust (HOST), Washington, DC, USA, 30 April–4 May 2018; pp. 17–24. [Google Scholar]
- Linaro. OP-TEE. Available online: https://wiki.linaro.org/WorkingGroups/Security/OP-TEE (accessed on 26 May 2020).
- Zhao, S.; Zhang, Q.; Qin, Y.; Feng, W.; Feng, D. SecTEE: A Software-based Approach to Secure Enclave Architecture Using TEE. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, London, UK, 11–15 November 2019; pp. 1723–1740. [Google Scholar]
- McGillion, B.; Dettenborn, T.; Nyman, T.; Asokan, N. Open-TEE—An open virtual trusted execution environment.TrustCom. arXiv 2015, arXiv:1506.07367v2. [Google Scholar] [CrossRef] [Green Version]
- Mukherjee, A.; Mishra, T.; Chantem, T.; Fisher, N.; Gerdes, R. Optimized trusted execution for hard real-time applications on COTS processors. Procedings of the 27th International Conference on Real-Time Networks and Systems, Toulouse, France, 6–8 November 2019; pp. 50–60. [Google Scholar]
- Liu, Y.; An, K.; Tilevich, E. RT-Trust: Automated refactoring for different trusted execution environments under real-time constraints. J. Comput. Lang. 2020, 56, 1–49. [Google Scholar] [CrossRef]
- Buttazzo, G.C. Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications; Springer: Berlin, Germany, 2011. [Google Scholar]
- Cho, H.; Zhang, P.; Kim, D.; Park, J.; Lee, C.H.; Zhao, Z.; Doup, A.; Ahn, G.J. Prime+Count: Novel Cross-world Covert Channels on ARM TrustZone. In Proceedings of the 34th Annual Computer Security Applications Conference, San Juan, PR, USA, 3–7 December 2018; pp. 441–452. [Google Scholar]
- Santos, N.; Fonseca, P. SoK: Understanding the Prevailing Security Vulnerabilities in TrustZone-assisted TEE Systems. In Proceedings of the IEEE Symposium on Security and Privacy (S&P), San Francisco, CA, USA, 18–20 May 2020. [Google Scholar]
- Dong, P.; Burns, A.; Jiang, Z.; Liao, X. TZDKS: A new TrustZone-based dual-criticality system with balanced performance. Processing of the 2018 IEEE 24th International Conference on Embedded and Real-Time Computing Systems and Applications (RTCSA), Hakodate, Japan, 28–31 August 2018. [Google Scholar]
- Shen, D. Exploiting TrustZone on android. Black Hat USA 2015, 2, 267–280. [Google Scholar]
- Gai, K.; Qiu, L.; Chen, M.; Zhao, H.; Qiu, M. SA-EAST: Secur.-aware Effic. data Transm. ITS Mob. Heterog. cloud Comput. TECS 2017, 16, 60. [Google Scholar] [CrossRef]
- Corteggiani, N.; Camurati, G.; Francillon, A. Inception: System-wide security testing of real-world embedded systems software. In Proceedings of the 27th USENIX Security Symposium, Baltimore, MD, USA, 15–17 August 2018; pp. 309–326. [Google Scholar]
- Ma, Y.; Jiang, W.; Sang, N.; Zhang, X. Arcsm: A distributed feedback control mechanism for security-critical real-time system. In Proceedings of the 10th IEEE ISPA, Leganes, Madrid, Spain, 10–13 July 2012; pp. 379–386. [Google Scholar]
- Jiang, K.; Lifa, A.; Eles, P.; Peng, Z.; Jiang, W. Energy-aware design of secure multi-mode real-time embedded systemswith FPGA co-processors. In Proceedings of the 21st ACM RTNS, Sophia Antipolis, France, 16–18 October 2013; pp. 109–118. [Google Scholar]
- Mohan, S.; Yoon, M.K.; Pellizzoni, R.; Bobba, R. Real-time systems security through scheduler constraints. In Proceedings of the 26th IEEE ECRTS, Madrid, Spain, 8–11 July 2014; pp. 129–140. [Google Scholar]
- Pellizzoni, R.; Paryab, N.; Yoon, M.K.; Bak, S.; Mohan, S.; Bobba, R.B. A generalized model for preventing information leakage in hard real-time systems. In Proceedings of the 21st IEEE RTAS, Seattle, WA, USA, 13–16 April 2015; pp. 271–282. [Google Scholar]
- Yoon, M.K.; Mohan, S.; Chen, C.Y.; Sha, L. Taskshuffler: A schedule randomization protocol for obfuscation against timing inference attacks in real-time systems. In Proceedings of the 22nd IEEE RTAS, Vienna, Austria, 11–14 April 2016; pp. 1–12. [Google Scholar]
- Hasan, M.; Mohan, S.; Bobba, R.B.; Pellizzoni, R. Exploring opportunistic execution for integrating security into legacy hard real-time systems. In Proceedings of the IEEE RTSS 2016, Porto, Portugal, 29 November–2 December 2016; pp. 123–134. [Google Scholar]
- Hasan, M.; Mohan, S.; Pellizzoni, R.; Bobba, R.B. A design-space exploration for allocating security tasks in multicore real-time systems. In Proceedings of the IEEE DATE, Dresden, Germny, 19–23 March 2018; pp. 225–230. [Google Scholar]
- Yoon, M.K.; Mohan, S.; Choi, J.; Kim, J.E.; Sha, L. SecureCore: A multicore-based intrusion detection architecture for real-time embedded systems. In Proceedings of the 19th IEEE RTAS, Philadelphia, PA, USA, 9–11 April 2013; pp. 21–32. [Google Scholar]
- Kim, C.H.; Kim, T.; Choi, H.; Gu, Z.; Lee, B.; Zhang, X.; Xu, D. Securing Real-Time Microcontroller Systems through Customized Memory View Switching. In Proceedings of the NDSS 2018, San Diego, CA, USA, 18–21 February 2018; pp. 31–42. [Google Scholar]
- Pinto, S.; Pereira, J.; Gomes, T.; Tavares, A.; Cabral, J. LTZVisor: TrustZone is the key. In Proceedings of the 29th IEEE ECRTS, Dubrovnik, Croatia, 27–30 June 2017; pp. 137–158. [Google Scholar]
- Pinto, S.; Araujo, H.; Oliveira, D.; Martins, J.; Tavares, A. Virtualization on TrustZone-Enabled Microcontrollers? Voilà! In Proceedings of the 25th IEEE RTAS, Montreal, QC, Canada, 16–18 April 2019; pp. 293–304. [Google Scholar]
- Pinto, S.; Oliveira, D.; Pereira, J.; Cabral, J.; Tavares, A. FreeTEE: When real-time and security meet. In Proceedings of the 20th IEEE ETFA, Luxembourg, 8–11 September 2015; pp. 1–4. [Google Scholar]
- Liu, R.; Srivastava, M. PROTC: PROTeCting drone’s peripherals through ARM trustzone. In Proceedings of the 3rd Workshop on Micro Aerial Vehicle Networks, Systems, and Applications, Niagara Falls, NY, USA, 23 June 2017; pp. 1–6. [Google Scholar]
- FreeRTOS. “The FreeRTOS Real-Time Operating System”. Available online: https://www.freertos.org (accessed on 10 July 2020).
- NuttX. “NuttX Real-Time Operating System”. Available online: https://nuttx.apache.org/ (accessed on 10 July 2020).
- Liu, Y.; An, K.; Tilevich, E. RT-trust: Automated refactoring for trusted execution under real-time constraints. In Proceedings of the 17th GPCE, Boston, MA, USA, 5–6 November 2018; pp. 175–187. [Google Scholar]
Software | Memory Footprint | |||
---|---|---|---|---|
.text | .data | .bss | Total | |
MiniTEE | 5854 | 10 | 235 | 6099 |
FreeRTOS(v10.0.2) | 20,543 | 20 | 1036 | 21,599 |
OP-TEE | 74,158 | 328 | 43,920 | 11,8406 |
Booting Time | ||
---|---|---|
Worst-Case (ms) | Std | |
Native | 31.14 | 0.13 |
MiniTEE | 83.35 | 0.25 |
Task Name | Pure | Native | MiniTEE | OP-TEE | ||||
---|---|---|---|---|---|---|---|---|
sysTick-dis | sysTick-en | sysTick-dis | sysTick-en | sysTick-dis | sysTick-en | sysTick-dis | sysTick-en | |
wcrt(ms) | wcrt(ms) | wcrt(ms) | wcrt(ms) | wcrt(ms) | wcrt(ms) | wcrt(ms) | wcrt(ms) | |
Control | 1.61 | 1.64 | 2.8 | 2.95 | 2.33 | 2.53 | 20.35 | 20.64 |
Camera | 17.53 | 18.03 | 28.75 | 30.46 | 21.41 | 27.33 | 36.28 | 39.53 |
Network | 0.035 | 0.044 | 0.036 | 0.044 | 0.035 | 0.044 | 0.035 | 0.44 |
World Switch | Operation | Performance (s) | Time Cost (s) | |
---|---|---|---|---|
s | @667 MHz | |||
Switch to S World | (1) Initialize MiniTEE context | 5.5 | 0.1 | 5.7 |
(2) SMC from NS world handling | 5.2 | 0.1 | 5.7 | |
(3) Create/resume TEE task | 52.4 | 2.7 | 63.5 | |
Switch to N World | (4) Suspend MiniTEE OS scheduler | 43.2 | 0.9 | 46.8 |
(5) SMC from S world handling | 3.9 | 0.1 | 4.8 | |
(6) Finalize MiniTEE context | 4.4 | 0.1 | 4.8 |
© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Liu, S.; Guan, N.; Guo, Z.; Yi, W. MiniTEE—A Lightweight TrustZone-Assisted TEE for Real-Time Systems. Electronics 2020, 9, 1130. https://doi.org/10.3390/electronics9071130
Liu S, Guan N, Guo Z, Yi W. MiniTEE—A Lightweight TrustZone-Assisted TEE for Real-Time Systems. Electronics. 2020; 9(7):1130. https://doi.org/10.3390/electronics9071130
Chicago/Turabian StyleLiu, Songran, Nan Guan, Zhishan Guo, and Wang Yi. 2020. "MiniTEE—A Lightweight TrustZone-Assisted TEE for Real-Time Systems" Electronics 9, no. 7: 1130. https://doi.org/10.3390/electronics9071130
APA StyleLiu, S., Guan, N., Guo, Z., & Yi, W. (2020). MiniTEE—A Lightweight TrustZone-Assisted TEE for Real-Time Systems. Electronics, 9(7), 1130. https://doi.org/10.3390/electronics9071130