Contact Us Search Paper

A Code-Refactoring-Based Migration Scheme for Trusted Applications across Heterogeneous TEEs

Di Lu1,*, Qingwen Zhang1, Yujia Liu1, Xiangkun Yang2, Li Yang1, and Yulong Shen1

Corresponding Author:

Di Lu

Affiliation(s):

1School of Computer Science and Technology, Xidian University, Xi’an 710126, China

2Huawei Technologies Co., Ltd., Shenzhen 518129, China

*Corresponding author

Abstract:

Trusted execution environments (TEEs) have become a key building block for privacy-preserving and confidential computing because they protect sensitive code and data through hardware-assisted isolation. However, the current TEE ecosystem remains highly fragmented. Different platforms expose different execution abstractions, programming interfaces, build procedures, and deployment models, making trusted applications difficult to migrate and costly to adapt. This paper presents CRTAMS, a code-refactoring-based migration scheme for trusted applications across heterogeneous TEEs. CRTAMS introduces an integrated programming model that uses Clang Attributes to express TEE boundary annotations, named CATBA, so that developers can describe trusted and untrusted code boundaries in a platform-neutral form. Based on the annotated source code, CRTAMS converts the program into LLVM intermediate representation, extracts annotation metadata, refactors the code according to the selected target platform, and automatically generates a target-platform-compliant trusted-application project structure and auxiliary build files. We implement a prototype and evaluate it on three categories of heterogeneous TEE hardware, including ARM TrustZone, Intel SGX/TDX, and AMD SEV. Experimental results show that CRTAMS enables trusted-application migration across heterogeneous TEEs with low refactoring cost and moderate execution overhead in the evaluated workloads, while reducing the amount of platform-specific code that developers must write manually.

Keywords:

Trusted execution environment, LLVM IR, control-flow graph, application migration, code refactoring

Downloads: 7 Views: 36
Cite This Paper:

Di Lu, Qingwen Zhang, Yujia Liu, Xiangkun Yang, Li Yang, and Yulong Shen (2026). A Code-Refactoring-Based Migration Scheme for Trusted Applications across Heterogeneous TEEs. Journal of Networking and Network Applications, Volume 6, Issue 3, pp. 97–110. https://doi.org/10.33969/J-NaNA.2026.060301.

References:

[1] M. Sabt, M. Achemlal, and A. Bouabdallah, “Trusted execution en-vironment: What it is, and what it is not,” in Proc. IEEE Trust-com/BigDataSE/ISPA, 2015, pp. 57–64.

[2] S. Pinto and N. Santos, “Demystifying ARM TrustZone: A comprehen-sive survey,” ACM Computing Surveys, vol. 51, no. 6, pp. 1–36, 2019.

[3] V. Costan and S. Devadas, “Intel SGX explained,” IACR Cryptology ePrint Archive, report 2016/086, 2016.

[4] P. C. Cheng, W. Ozga, E. Valdez, et al., “Intel TDX demystified: A top-down approach,” ACM Computing Surveys, vol. 56, no. 9, pp. 1–33, 2024.

[5] AMD, “AMD SEV-SNP: Strengthening VM isolation with integrity protection and more,” White Paper, Jan. 2020.

[6] C.-C. Tsai, D. E. Porter, and M. Vij, “Graphene-SGX: A practical library OS for unmodified applications on SGX,” in Proc. USENIX ATC, 2017, pp. 645–658.

[7] D. R. Engler, M. F. Kaashoek, and J. O’Toole, Jr., “Exokernel: An op-erating system architecture for application-level resource management,” ACM SIGOPS Operating Systems Review, vol. 29, no. 5, pp. 251–266, 1995.

[8] Y. Shen, H. Tian, Y. Chen, et al., “Occlum: Secure and efficient multitasking inside a single enclave of Intel SGX,” in Proc. ASPLOS, 2020, pp. 955–970.

[9] V. Velciu, F. Stancu, and M. Chiroiu, “HiddenApp–securing Linux applications using ARM TrustZone,” in Proc. International Conference on Security for Information Technology and Communications, 2018, pp. 41–52.

[10] L. Guan, P. Liu, X. Xing, et al., “TrustShadow: Secure execution of unmodified applications with ARM TrustZone,” in Proc. MobiSys, 2017, pp. 488–501.

[11] D. Quarta, M. Ianni, A. Machiry, et al., “Tarnhelm: Isolated, transparent and confidential execution of arbitrary code in ARM’s TrustZone,” in Proc. CheckMATE, 2021, pp. 43–57.

[12] H. Yan, Z. Ling, X. Chen, et al., “UIEE: Secure and efficient user-space isolated execution environment for embedded TEE systems,” in Proc. NDSS, 2026.

[13] J. Menetrey, M. Pasin, P. Felber, and V. Schiavoni, “Twine: An embedded trusted runtime for WebAssembly,” in Proc. IEEE ICDE, 2021, pp. 205–216.

[14] J. Menetrey, M. Pasin, P. Felber, et al., “A comprehensive trusted runtime for WebAssembly with Intel SGX,” IEEE Transactions on Dependable and Secure Computing, vol. 21, no. 4, pp. 3562–3579, 2023.

[15] J. Menetrey, M. Pasin, P. Felber, et al., “WATZ: A trusted WebAssembly runtime environment with remote attestation for TrustZone,” in Proc. IEEE ICDCS, 2022, pp. 1177–1189.

[16] X. Li, X. Li, C. Dall, et al., “Design and verification of the Arm Confidential Compute Architecture,” in Proc. USENIX OSDI, 2022, pp. 465–484.

[17] J. Y. Gu, H. Li, Y. B. Xia, et al., “Unified enclave abstraction and secure enclave migration on heterogeneous security architectures,” Journal of Computer Science and Technology, vol. 37, no. 2, pp. 468–486, 2022.

[18] openEuler, “secGear,” 2025. [Online]. Available: https://www.openeuler. org/en/other/projects/secgear

[19] openEuler, “openEuler,” 2025. [Online]. Available: https://www. openeuler.org/en

[20] E. Feng, X. Lu, D. Du, et al., “Scalable memory protection in the Penglai enclave,” in Proc. USENIX OSDI, 2021, pp. 275–294.

[21] Confidential Containers, “Confidential Containers,” 2025. [Online]. Available: https://confidentialcontainers.org

[22] Alibaba Cloud, “Cloud-native secure container solution,” 2025. [Online]. Available: https://www.aliyun.com/solution/cloudnative/securecontainer

[23] Y. Liu, K. An, and E. Tilevich, “RT-Trust: Automated refactoring for trusted execution under real-time constraints,” in Proc. GPCE, 2018, pp. 175–187.

[24] Y. Liu, K. An, and E. Tilevich, “RT-Trust: Automated refactoring for different trusted execution environments under real-time constraints,” Journal of Computer Languages, vol. 56, p. 100939, 2020.

[25] F. Dreissig, J. Roeckl, and T. Mueller, “Compiler-aided development of trusted enclaves with Rust,” in Proc. ARES, 2022, pp. 1–10, doi: 10.1145/3538969.3538972.

[26] P. Yuhala, J. Menetrey, P. Felber, et al., “Montsalvat: Intel SGX shielding for GraalVM native images,” in Proc. Middleware, 2021, pp. 352–364, doi: 10.1145/3464298.3493406.

[27] S. Tanigassalame, Y. Pipereau, A. Chader, J. Toljaga, and G. Thomas, “Privagic: Automatic code partitioning with explicit secure typing,” in Proc. Middleware, 2024, pp. 199–210, doi: 10.1145/3652892.3700759.

[28] OP-TEE, “Open Portable Trusted Execution Environment,” 2025. [On-line]. Available: https://www.op-tee.org

[29] S. Mofrad, F. Zhang, S. Lu, et al., “A comparison study of Intel SGX and AMD memory encryption technology,” in Proc. HASP, 2018, pp. 1–8.

[30] C. Lattner and V. Adve, “LLVM: A compilation framework for lifelong program analysis and transformation,” in Proc. CGO, 2004, pp. 75–86.

[31] LLVM, “LLVM Language Reference Manual,” 2025. [Online]. Avail-able: https://llvm.org/docs/LangRef.html

[32] Clang, “Attribute Reference,” 2025. [Online]. Available: https://clang. llvm.org/docs/AttributeReference.html

[33] F. E. Allen, “Control flow analysis,” ACM SIGPLAN Notices, vol. 5, no. 7, pp. 1–19, 1970.

[34] J. Ferrante, K. J. Ottenstein, and J. D. Warren, “The program dependence graph and its use in optimization,” ACM Transactions on Programming Languages and Systems, vol. 9, no. 3, pp. 319–349, 1987.

[35] R. C. Read and D. G. Corneil, “The graph isomorphism disease,” Journal of Graph Theory, vol. 1, no. 4, pp. 339–363, 1977.