Operating system kernel design method and device based on trust domain extension
By introducing the Rust-TPM library and Rust-IMA library built in the Rust language into the Linux operating system and combining them with Intel Trust Domain Extensions, the security vulnerability problems caused by the C language are resolved, achieving higher system security and reliability.
Patent Information
- Application Number
- CN202510455245.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-09-05
AI Technical Summary
Existing Linux operating systems may crash or be attacked maliciously due to security vulnerabilities in the C language and lack memory management and type safety issues.
The Rust-TPM library and Rust-IMA library are built using the Rust language to implement the Trusted Platform Module and Integrity Measurement Architecture, and combined with Intel Trust Domain Extensions to enhance system security.
Through the memory safety of the Rust language and the hardware isolation of Intel Trust Domain Extension, security vulnerabilities are reduced, system reliability and security are improved, and the protection capabilities of the integrity measurement architecture are enhanced.
Smart Images

Figure CN120597277A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for designing an operating system kernel based on trust domain extension. Background Art
[0002] Linux is an open-source computer operating system kernel. It's a Unix-like operating system primarily written in C and compliant with the POSIX standard. Due to its open-source and modular nature, Linux is widely used in a variety of fields, including servers, embedded systems, and desktop computing. Despite significant efforts to improve Linux security, the C language itself has inherent security issues, such as memory management errors, a lack of type safety, and manual memory management. For example, developers needing to manually manage memory allocation and deallocation can lead to memory leaks and other memory-related vulnerabilities, potentially causing system crashes or exploitation by malicious attackers.
[0003] Therefore, the existing technology still needs to be improved and developed. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an operating system kernel design method and device based on trust domain extension in response to the above-mentioned defects of the prior art, aiming to solve the problem in the prior art that the Linux system may crash due to its own security vulnerabilities or be exploited by malicious attackers.
[0005] The technical solutions adopted by the present invention to solve the technical problems are as follows:
[0006] In a first aspect, the present invention provides a method for designing an operating system kernel based on trust domain extension, wherein the method comprises:
[0007] Obtain the Rust-TPM library and the Rust-IMA library, both built in Rust, where the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel, and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel.
[0008] Based on the Rust-TPM library and the Rust-IMA library, obtain the Asterinas-IMA kernel;
[0009] The Asterinas-IMA kernel is deployed on Intel Trust Domain Extension to obtain an Asterinas-IMA kernel based on the Trust Domain Extension.
[0010] In one implementation, the Rust-TPM library built based on the Rust language includes:
[0011] The Trusted Platform Module component and hardware interface driver of the Asterinas kernel built on the Rust language, where the Trusted Platform Module component is used for key generation, hardware encryption, hardware decryption, secure boot, and remote authentication.
[0012] In one implementation, the Rust-IMA library built based on the Rust language includes:
[0013] The Asterinas kernel is built based on the Rust language and includes a system call interceptor component, a measurement unit component, an integrity anchor component, and a hardware-assisted verification component. The measurement unit component is used to process measurement requests, store measurement results, and verify measurement data.
[0014] In one implementation, the system call interceptor component is used to:
[0015] When a calling instruction of a system call handler is obtained, a measurement request is sent to the measurement unit component through a system call interceptor, wherein the calling instruction is used to call a system file;
[0016] measuring the called system file according to the measurement request to obtain a hash value of the system file;
[0017] Comparing the hash value of the system file with a measurement reference value to obtain a comparison result;
[0018] If the comparison result is that the hash value of the system file is consistent with the preset measurement reference value, calling the system file according to the calling instruction;
[0019] If the comparison result is that the hash value of the system file is inconsistent with the preset measurement reference value, the calling instruction is not executed.
[0020] In one implementation, the integrity anchor component is used to:
[0021] Obtain measurement records of the measurement unit and compare the measurement records with historical measurement results in a measurement list to verify the integrity of the content in the measurement list, where the measurement list is deployed in the integrity measurement architecture to store historical measurement results, and the historical measurement results are stored via the security.ima extended attribute.
[0022] In one implementation, the hardware-assisted verification component is used to:
[0023] Run a trust domain extension driver on the Asterinas kernel, and trigger the measurement unit to send a TDCALL request to the trust domain extension through the trust domain extension driver;
[0024] Recording runtime measurement data according to the TDCALL request;
[0025] Calculating the runtime measurement data using a SHA384 algorithm to obtain a local runtime measurement register extension value, and storing the local runtime measurement register extension value in a runtime measurement register extended by the trust domain;
[0026] The local runtime measurement register extension value is read through the trust domain extension authentication report, and the local runtime measurement register extension value is compared with the historical measurement results in the measurement list. If the local runtime measurement register extension value is consistent with the historical measurement results in the measurement list, the verification is passed.
[0027] In one implementation, obtaining the Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library includes:
[0028] The Rust-TPM library interacts with the trusted platform module through the Rust-TPM library, interacts with the integrity measurement architecture through the Rust-TPM library, integrates the Rust-TPM library and the Rust-TPM library into the integrity measurement architecture, and replaces the platform configuration registers of the trusted platform module with the runtime measurement registers of the trust domain extension to obtain the Asterinas-IMA kernel.
[0029] In a second aspect, an embodiment of the present invention further provides an operating system kernel design device based on trust domain extension, wherein the device includes:
[0030] A first Rust library writing module is used to obtain the Rust-TPM library and the Rust-IMA library built based on the Rust language, wherein the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel;
[0031] A first system kernel acquisition module, configured to obtain an Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library;
[0032] The second system kernel acquisition module is used to deploy the Asterinas-IMA kernel on Intel Trust Domain Extension to obtain the Asterinas-IMA kernel based on the Trust Domain Extension.
[0033] In a third aspect, an embodiment of the present invention further provides an intelligent terminal, wherein the intelligent terminal includes a memory, a processor, and an operating system kernel design program based on trust domain extension stored in the memory and runnable on the processor. When the processor executes the operating system kernel design program based on trust domain extension, the steps of the operating system kernel design method based on trust domain extension as described in any one of the above items are implemented.
[0034] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein an operating system kernel design program based on trust domain extension is stored on the computer-readable storage medium. When the operating system kernel design program based on trust domain extension is executed by a processor, the steps of the operating system kernel design method based on trust domain extension as described in any one of the above items are implemented.
[0035] Beneficial Effects: Compared with the prior art, the present invention provides an operating system kernel design method based on trust domain extensions, the method comprising: obtaining the Rust-TPM library and the Rust-IMA library built based on the Rust language, and utilizing Rust's inherent security properties to reduce security vulnerabilities and improve code reliability; obtaining the Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library, and the system kernel implemented by Rust will be able to effectively reduce security vulnerabilities; deploying the Asterinas-IMA kernel on Intel Trust Domain Extensions to obtain an Asterinas-IMA kernel based on the Trust Domain Extensions, and enhancing system security by leveraging the isolation effect of Intel Trust Domain Extensions. The present invention utilizes the memory safety characteristics of Rust and Trust Domain Extensions to re-implement the integrity measurement architecture function, thereby significantly improving the security of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 The present invention provides a flow chart of an operating system kernel design method based on trust domain extension.
[0038] Figure 2 This is a diagram of the Asterinas-IMA core architecture provided by an embodiment of the present invention.
[0039] Figure 3This is a principle block diagram of an operating system kernel design device based on trust domain extension provided by an embodiment of the present invention.
[0040] Figure 4 This is a block diagram of the internal structure of the smart terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0042] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the description of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0043] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with their meanings in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0044] Linux is a C-based operating system. Since its release in 1991, it has become one of the most widely used operating systems worldwide. Due to its open source and modular nature, Linux is widely used in a variety of fields, including servers, embedded systems, and desktop computing. In terms of security, Linux implements features such as TPM (Trusted Platform Module) and IMA (Integrity Measurement Architecture), which greatly enhance system security. However, due to inherent security issues in the C language itself, Linux suffers from security flaws such as memory management errors and a lack of type safety. To overcome the security flaws of the C language, developers chose to implement the new operating system in the more security-focused Rust language.
[0045] Asterinas (Starblossom Operating System) uses Rust as its sole programming language and is a secure, fast, and versatile operating system kernel. It provides the same interfaces as Linux, allowing it to seamlessly run Linux applications, but with greater memory safety and developer-friendliness. This invention uses Asterinas as the system kernel. To enhance Asterinas' security, the invention has developed a TDX (Trust Domain Extensions)-compatible version of Asterinas, while also incorporating IMA (Integrity Measurement Architecture) and TPM (Trusted Platform Module) functionality implemented in Rust.
[0046] Exemplary Methods
[0047] This embodiment provides an operating system kernel design method based on trust domain extension, and this embodiment can be applied to the operating system kernel. Figure 1 As shown, the method includes the following steps:
[0048] Step S100: Obtain a Rust-TPM library and a Rust-IMA library built based on the Rust language, wherein the Rust-TPM library is used to implement a trusted platform module on the Asterinas kernel, and the Rust-IMA library is used to implement an integrity measurement architecture on the Asterinas kernel;
[0049] Specifically, in Linux systems, the Trusted Platform Module (TPM) provides a range of hardware-level security features, including the generation and management of encryption keys. Leveraging hardware-based encryption technology, the TPM provides enhanced protection for stored information against external software attacks. TPM-enabled applications enhance security measures, particularly in scenarios where unauthorized access to sensitive data is required, such as device theft. By ensuring that the platform configuration has not been tampered with, the TPM enables applications to deny access to data and confidential information, thereby strengthening security protocols.
[0050] Asterinas is a secure, fast, and universal operating system kernel. It provides the same interfaces as Linux and can run Linux applications seamlessly. Asterinas enhances its memory safety by using Rust as its sole programming language. By restricting the use of unsafe Rust to a well-defined and minimal trusted computing foundation, Asterinas becomes a safer and more reliable kernel choice. All memory accesses in Rust are strictly checked by the compiler, and no null pointer exceptions or data race conditions will occur at runtime. This means that Rust code has higher reliability and security, avoiding common security vulnerabilities.
[0051] In this embodiment, the Rust-TPM library is written in Rust language to implement TPM on the Asterinas kernel, making the kernel operation more secure and reliable.
[0052] IMA (Integrity Measurement Architecture) is an operating system security framework that calculates and compares hash values of files to ensure that the system has not been tampered with during operation. IMA measurements can be stored in the TPM for enhanced security and can be used for remote authentication. However, a system that uses only IMA relies on the security and configuration of the kernel. Vulnerabilities or improper configuration of the kernel or configuration may affect the protection provided by IMA. For example, certain critical files may not be monitored, or incorrect IMA configuration may lead to insufficient protection.
[0053] In this embodiment, IMA is implemented in Rust. Leveraging Rust's security, the Rust-IMA library is developed to calculate and verify hash values for system components, ensuring system integrity. This library implements runtime integrity checks, continuously monitors the integrity of critical files and processes, and integrates auditing and logging capabilities to provide comprehensive security auditing capabilities. It supports policy-based integrity measurement and verification, allowing administrators to define and manage security policies. In other words, by implementing IMA in Rust within Asterinas, security vulnerabilities caused by programming language memory management and type safety issues are effectively avoided, reducing the burden on developers when writing and maintaining secure code.
[0054] In one implementation, the Rust-TPM library described in this embodiment includes the following:
[0055] The Trusted Platform Module component and hardware interface driver of the Asterinas kernel built on the Rust language, where the Trusted Platform Module component is used for key generation, hardware encryption, hardware decryption, secure boot, and remote authentication.
[0056] In this embodiment, the TPM is implemented in Rust, and a Rust library is developed to interact with the TPM, including key generation, hardware encryption / decryption, secure boot, and remote authentication. Furthermore, the TPM hardware interface and driver are implemented to ensure seamless integration of the TPM with the Asterinas operating system. This implements the Trusted Platform Module within the Asterinas kernel, enhancing system security.
[0057] In one implementation, the Rust-IMA library described in this embodiment includes:
[0058] The Asterinas kernel is built based on the Rust language and includes a system call interceptor component, a measurement unit component, an integrity anchor component, and a hardware-assisted verification component. The measurement unit component is used to process measurement requests, store measurement results, and verify measurement data.
[0059] Specifically, if Figure 2 As shown in the detailed architecture of Asterinas-IMA, the implementation of IMA is divided into several main components, including system call interceptor component, measurement unit component, integrity anchor component and hardware-assisted verification component. These components work together to ensure the integrity of files and systems.
[0060] In one implementation, the system call interceptor group described in this embodiment is used in the following steps:
[0061] Step S1001: When a calling instruction of a system call processing program is obtained, a measurement request is sent to the measurement unit component through a system call interceptor, wherein the calling instruction is used to call a system file;
[0062] Step S1002: Measure the called system file according to the measurement request to obtain a hash value of the system file;
[0063] Step S1003: Compare the hash value of the system file with the measurement reference value to obtain a comparison result;
[0064] Step S1004: If the comparison result is that the hash value of the system file is consistent with the preset measurement reference value, calling the system file according to the calling instruction;
[0065] Step S1005: If the comparison result is that the hash value of the system file is inconsistent with the preset measurement reference value, the calling instruction is not executed.
[0066] Specifically, Asterinas defines various system call interfaces and their handlers. These parse system call requests and their parameters and pass them to specific processing functions. The system call interceptor is responsible for intercepting system call requests from the operating system. Whenever the operating system handles a system call request, it triggers an interrupt, enters the trap frame handler, and then routes it to a specific processing function.
[0067] In this embodiment, to implement runtime measurement, Asterinas adds a system call interceptor to the system call handler. This interceptor binds to the registered system call handler and allows for the insertion of measurement code before and after the system call processing task. Specifically, when a file-sensitive system call such as mmap() is executed, the system call interceptor sends a measurement request to the measurement unit. The measurement unit measures the accessed file and compares the current system file hash value with a preset measurement reference value. This process ensures file integrity at runtime and monitors file operations.
[0068] In one implementation, the integrity anchor component of this embodiment is used in the following steps:
[0069] Step S1006: Obtain the measurement record of the measurement unit and compare the measurement record with the historical measurement results in the measurement list to verify the integrity of the content in the measurement list, where the measurement list is deployed in the integrity measurement architecture to store historical measurement results, and the historical measurement results are stored through the security.ima extended attribute.
[0070] Specifically, the measurement unit is responsible for processing measurement requests, storing results, and validating measurement data. The Measurement List (ML) is a key data structure for implementing IMA functionality, storing the complete current measurement history. The ML is maintained by the kernel security module, and when a new measurement record is generated, a new measurement entry is added to the list. Because the Measurement List maintains the system's measurement log, historical entries cannot be deleted, and therefore it is read-only to the outside world.
[0071] In this embodiment, in order to save the measurement reference value, the Asterinas file system designs an extended file attribute (ExtendedFileAttribute, Xattr) mechanism. An extended attribute is a key-value pair permanently associated with a specific file, which is usually used to provide additional functions of the file system, such as permission control and logging, and is integrated into the access control list (ACL). In the IMA implementation, the security.ima attribute is used to specify the reference measurement value of the current file. The kernel can use the XattrAPI to set, obtain and list the extended attributes of the file. During system initialization, the file system traverses the file system to initialize the measurement reference value and writes the extended attribute as the original reference value. When the system performs integrity measurement subsequently, it can compare with the reference value to determine whether the file is complete. At the same time, the corresponding reference value needs to be updated synchronously after the file is modified.
[0072] The integrity anchor (MeasurementAnchor, MA) is an important node in the IMA trust chain, used to ensure the integrity of the content in the measurement list. Whenever a new measurement record is submitted to the measurement list, the measurement unit will synchronize the changes to the measurement anchor to maintain the consistency of the record. In order to make the integrity anchor trustworthy, it relies on secure hardware, such as a TPM chip or a measurement anchor in a TDX environment. In this embodiment, an Intel TDX-based measurement anchor is selected as the secure firmware platform. Specifically, the driver module of the TDX firmware, namely tdx_guest, is mounted to the / dev / tdx_guest directory when the kernel starts.
[0073] In one implementation, the hardware-assisted verification component described in this embodiment is used in the following steps:
[0074] Step S1007: Run a trust domain extension driver on the Asterinas kernel, and trigger the measurement unit to send a TDCALL request to the trust domain extension through the trust domain extension driver;
[0075] Step S1008: Recording runtime measurement data according to the TDCALL request;
[0076] Simply put, the kernel can call functions in this module to manipulate TDX-related registers. This module acts as the Trust Domain (TD) within the TDX. TDCALL is the command used by the Trust Domain to request services from the TDX module. Asterinas can use TDCALL to submit measurement data and obtain certification reports, thereby reading data.
[0077] Step S1009: Calculate the runtime measurement data using the SHA384 algorithm to obtain a local runtime measurement register extension value, and store the local runtime measurement register extension value in the runtime measurement register of the trust domain extension;
[0078] Step S1040: Read the local runtime measurement register extension value through the trust domain extension authentication report, and compare the local runtime measurement register extension value with the historical measurement results in the measurement list. If the local runtime measurement register extension value is consistent with the historical measurement results in the measurement list, verification is passed.
[0079] Specifically, the hardware-assisted verification mechanism is based on the Runtime Measurement Register (RTMR) extension of Intel Trust Domain Extension. In the Intel Trust Domain Extension standard, the Runtime Measurement Register is used to record runtime data, where RTMR[2] and RTMR[3] allow the operating system and user programs to record runtime measurement data. First, we implemented a simple TDX driver in the kernel. This driver is based on the Intel TDX GuestAPI and allows the measurement unit to send TDCALL to extend the Runtime Measurement Register. After receiving the request, TDX will perform an extension operation on the submitted value together with the old value, and calculate and overwrite the old value through the SHA384 (new value + old value) algorithm.
[0080] It's important to note that the Trust Domain Extension standard doesn't provide a direct way to read the Runtime Measurement Registers. Instead, these are obtained by decoding the Trust Domain Extension Certification Report. The Trust Domain Extension Guest can use TDCALL[TDG.MR.REPORT] to obtain the TDREPORT (TDREPORT_STRUCT) from the Trust Domain Extension module. In the Trust Domain Extension Certification Report, the Runtime Measurement Register values are encoded within specific fields. The RTMR value, representing the historical measurement result in the measurement list, is obtained by reading the corresponding location in TDREPORT_BUFFER and comparing it with the local Runtime Measurement Register Extension value. If they match, this proves the integrity of the measurement records stored in the measurement list, and verification is passed.
[0081] Step S200: Obtain an Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library;
[0082] Specifically, systems using only IMA rely on kernel security and configuration. Vulnerabilities or improper configurations in the kernel or configuration can compromise IMA's protection. For example, critical files might not be monitored, or IMA misconfiguration could lead to insufficient protection. TDX, on the other hand, provides hardware-level isolation, separating the operating environments of virtual machines and the host system. This prevents potential threats within both the host and virtual machines from compromising data integrity. In Asterinas, IMA provides integrity protection while benefiting from the isolation provided by TDX, enhancing system security.
[0083] In one implementation, step S200 in this embodiment includes the following steps:
[0084] Step S201: interact with the trusted platform module through the Rust-TPM library, interact with the integrity measurement architecture through the Rust-TPM library, integrate the Rust-TPM library and the Rust-TPM library into the integrity measurement architecture, and replace the platform configuration registers of the trusted platform module with the runtime measurement registers of the trust domain extension to obtain the Asterinas-IMA kernel.
[0085] Specifically, Asterinas introduces a new approach to measurement data recording and verification by implementing a runtime measurement register extension verification mechanism based on a trust domain extension. In this embodiment, the runtime measurement register extension mechanism replaces the platform configuration registers of the traditional Trusted Platform Module (TPM) to record runtime data, enhancing the reliability and security of measurement data. Furthermore, the system utilizes the TDX standard authentication report to obtain extended values. Compared to traditional TPM, this enables the collaborative operation of TPM and IMA, enhancing the overall security of the system.
[0086] Step S300: deploy the Asterinas-IMA kernel onto Intel Trust Domain Extension to obtain an Asterinas-IMA kernel based on the Trust Domain Extension.
[0087] Specifically, systems using only IMA rely on kernel security and configuration. Vulnerabilities or improper configuration of the kernel or configuration can compromise IMA's protection. For example, certain critical files may not be monitored, or IMA configuration errors may result in insufficient protection. Intel Trust Domain Extensions (TDDEs) provide a hardware-level isolation mechanism that isolates the virtual machine's execution environment from the host operating system, preventing potential threats within both the host and virtual machines from affecting data integrity.
[0088] In this embodiment, by deploying the Asterinas-IMA kernel on Intel Trust Domain Extension, the data and code in the virtual machine are isolated and protected from the influence of the host system or other virtual machines, thereby reducing the attack surface. For example, even if the host operating system is compromised, the attacker cannot directly access or tamper with the data of the virtual machine running inside the trust domain. RTMRs (Runtime Measurement Registers) are used to record the measurement data of the virtual machine at runtime and use secure hardware to protect and verify this data. This mechanism ensures the integrity and immutability of the measurement data, enabling the system to detect and respond to potential security issues in real time, such as file tampering or system configuration anomalies. Maintaining the runtime measurement registers within the system can make good use of the trust domain extension hardware features to improve the measurement credibility and integrity of the IMA system.
[0089] Exemplary devices
[0090] like Figure 3 As shown in , this embodiment further provides an operating system kernel design device based on trust domain extension, the device comprising:
[0091] A first Rust library writing module is used to obtain the Rust-TPM library and the Rust-IMA library built based on the Rust language, wherein the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel;
[0092] A first system kernel acquisition module, configured to obtain an Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library;
[0093] The second system kernel acquisition module is used to deploy the Asterinas-IMA kernel on Intel Trust Domain Extension to obtain the Asterinas-IMA kernel based on the Trust Domain Extension.
[0094] In one implementation, the first Rust library writing module includes:
[0095] The Rust-TPM library unit includes the trusted platform module component and hardware interface driver of the Asterinas kernel built based on the Rust language, where the trusted platform module component is used for key generation, hardware encryption, hardware decryption, secure boot, and remote authentication.
[0096] In one implementation, the first Rust library writing module further includes:
[0097] The Rust-IMA library unit includes a system call interceptor component of the Asterinas kernel built based on the Rust language, a measurement unit component, an integrity anchor component, and a hardware-assisted verification component. The measurement unit component is used to process measurement requests, store measurement results, and verify measurement data.
[0098] In one implementation, the Rust-IMA library unit described in this embodiment includes:
[0099] a measurement request sending unit, configured to send a measurement request to the measurement unit component via a system call interceptor when obtaining a call instruction of a system call handler, wherein the call instruction is used to call a system file;
[0100] A hash value obtaining unit, configured to measure the called system file according to the measurement request and obtain a hash value of the system file;
[0101] a first comparing unit, configured to compare the hash value of the system file with a measurement reference value to obtain a comparison result;
[0102] a system file calling unit, configured to call the system file according to the calling instruction if the comparison result shows that the hash value of the system file is consistent with a preset measurement reference value;
[0103] The interception unit is configured to not execute the calling instruction if the comparison result is that the hash value of the system file is inconsistent with a preset measurement reference value.
[0104] a second comparing unit configured to obtain a measurement record of the measurement unit and compare the measurement record with a historical measurement result in a measurement list to verify the integrity of the content in the measurement list, wherein the measurement list is deployed in an integrity measurement architecture to store historical measurement results, and the historical measurement results are stored via a security.ima extended attribute.
[0105] a request sending unit, configured to run a trust domain extension driver on the Asterinas kernel, and trigger the measurement unit to send a TDCALL request to the trust domain extension through the trust domain extension driver;
[0106] a measurement data recording unit, configured to record runtime measurement data according to the TDCALL request;
[0107] a runtime measurement register extension value acquiring unit, configured to calculate the runtime measurement data using a SHA384 algorithm to obtain a local runtime measurement register extension value, and store the local runtime measurement register extension value in a runtime measurement register extended by the trust domain;
[0108] The third comparing unit is configured to read the local runtime measurement register extended value through the trust domain extended authentication report, and compare the local runtime measurement register extended value with the historical measurement results in the measurement list; if the local runtime measurement register extended value is consistent with the historical measurement results in the measurement list, verification is passed.
[0109] In one implementation, the first system kernel acquisition module includes:
[0110] An Asterinas-IMA kernel acquisition unit is configured to interact with a trusted platform module through the Rust-TPM library, interact with an integrity measurement architecture through the Rust-TPM library, integrate the Rust-TPM library and the Rust-TPM library into the integrity measurement architecture, and replace the platform configuration registers of the trusted platform module with the runtime measurement registers of the trust domain extension to obtain an Asterinas-IMA kernel.
[0111] Based on the above embodiment, the present invention also provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 4 As shown. The intelligent terminal includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected via a system bus. The processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for designing an operating system kernel based on trust domain extension is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the intelligent terminal is pre-set inside the intelligent terminal to detect the operating temperature of the internal device.
[0112] Those skilled in the art will understand that Figure 4 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the solution of the present invention and does not constitute a limitation on the smart terminal to which the solution of the present invention is applied. The specific smart terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0113] In one embodiment, a smart terminal is provided. The smart terminal includes a memory, a processor, and a trust domain extension-based operating system kernel design program stored in the memory and executable on the processor. When the processor executes the trust domain extension-based operating system kernel design program, the processor implements the following operating instructions:
[0114] Obtain the Rust-TPM library and the Rust-IMA library, both built in Rust, where the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel, and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel.
[0115] Based on the Rust-TPM library and the Rust-IMA library, obtain the Asterinas-IMA kernel;
[0116] The Asterinas-IMA kernel is deployed on Intel Trust Domain Extension to obtain an Asterinas-IMA kernel based on the Trust Domain Extension.
[0117] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, operating database or other media used in the embodiments provided by the present invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0118] In summary, the present invention discloses a method for designing an operating system kernel based on trust domain extensions. The method comprises: obtaining a Rust-TPM library and a Rust-IMA library built in the Rust language, wherein the Rust-TPM library is used to implement a trusted platform module on the Asterinas kernel, and the Rust-IMA library is used to implement an integrity measurement architecture on the Asterinas kernel; obtaining an Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library; and deploying the Asterinas-IMA kernel on Intel Trust Domain Extensions to obtain an Asterinas-IMA kernel based on the Trust Domain Extensions. The present invention utilizes the memory safety characteristics of Rust and the Trust Domain Extensions to reimplement the integrity measurement architecture functionality, thereby significantly improving the security of the operating system.
[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for designing an operating system kernel based on trust domain extension, characterized in that: The method comprises: Obtain the Rust-TPM library and the Rust-IMA library, both built in Rust, where the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel, and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel. Based on the Rust-TPM library and the Rust-IMA library, obtain the Asterinas-IMA kernel; The Asterinas-IMA kernel is deployed on Intel Trust Domain Extension to obtain an Asterinas-IMA kernel based on the Trust Domain Extension.
2. The operating system kernel design method based on trust domain extension according to claim 1, characterized in that: The Rust-TPM library built on the Rust language includes: The Trusted Platform Module component and hardware interface driver of the Asterinas kernel built on the Rust language, where the Trusted Platform Module component is used for key generation, hardware encryption, hardware decryption, secure boot, and remote authentication.
3. The operating system kernel design method based on trust domain extension according to claim 1, characterized in that: The Rust-IMA library built on the Rust language includes: The Asterinas kernel is built based on the Rust language and includes a system call interceptor component, a measurement unit component, an integrity anchor component, and a hardware-assisted verification component. The measurement unit component is used to process measurement requests, store measurement results, and verify measurement data.
4. The operating system kernel design method based on trust domain extension according to claim 3, characterized in that: The system call interceptor component is used to: When a calling instruction of a system call handler is obtained, a measurement request is sent to the measurement unit component through a system call interceptor, wherein the calling instruction is used to call a system file; measuring the called system file according to the measurement request to obtain a hash value of the system file; Comparing the hash value of the system file with a measurement reference value to obtain a comparison result; If the comparison result is that the hash value of the system file is consistent with the preset measurement reference value, calling the system file according to the calling instruction; If the comparison result is that the hash value of the system file is inconsistent with the preset measurement reference value, the calling instruction is not executed.
5. The operating system kernel design method based on trust domain extension according to claim 3, characterized in that: The integrity anchor component is used to: Obtain measurement records of the measurement unit and compare the measurement records with historical measurement results in a measurement list to verify the integrity of the content in the measurement list, where the measurement list is deployed in the integrity measurement architecture to store historical measurement results, and the historical measurement results are stored via the security.ima extended attribute.
6. The operating system kernel design method based on trust domain extension according to claim 5, characterized in that: The hardware-assisted verification component is used to: Run a trust domain extension driver on the Asterinas kernel, and trigger the measurement unit to send a TDCALL request to the trust domain extension through the trust domain extension driver; Recording runtime measurement data according to the TDCALL request; Calculating the runtime measurement data using a SHA384 algorithm to obtain a local runtime measurement register extension value, and storing the local runtime measurement register extension value in a runtime measurement register extended by the trust domain; The local runtime measurement register extension value is read through the trust domain extension authentication report, and the local runtime measurement register extension value is compared with the historical measurement results in the measurement list. If the local runtime measurement register extension value is consistent with the historical measurement results in the measurement list, the verification is passed.
7. The operating system kernel design method based on trust domain extension according to claim 6, characterized in that: The Asterinas-IMA kernel is obtained based on the Rust-TPM library and the Rust-IMA library, including: The Rust-TPM library interacts with the trusted platform module through the Rust-TPM library, interacts with the integrity measurement architecture through the Rust-TPM library, integrates the Rust-TPM library and the Rust-TPM library into the integrity measurement architecture, and replaces the platform configuration registers of the trusted platform module with the runtime measurement registers of the trust domain extension to obtain the Asterinas-IMA kernel.
8. An operating system kernel design device based on trust domain extension, characterized in that: The device comprises: A first Rust library writing module obtains the Rust-TPM library and the Rust-IMA library built based on the Rust language, wherein the Rust-TPM library is used to implement the Trusted Platform Module on the Asterinas kernel, and the Rust-IMA library is used to implement the Integrity Measurement Architecture on the Asterinas kernel; A first system kernel acquisition module, configured to obtain an Asterinas-IMA kernel based on the Rust-TPM library and the Rust-IMA library; The second system kernel acquisition module is used to deploy the Asterinas-IMA kernel on Intel Trust Domain Extension to obtain the Asterinas-IMA kernel based on the Trust Domain Extension.
9. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and an operating system kernel design program based on trust domain extension stored in the memory and runnable on the processor. When the processor executes the operating system kernel design program based on trust domain extension, the steps of the operating system kernel design method based on trust domain extension as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an operating system kernel design program based on trust domain extension. When the operating system kernel design program based on trust domain extension is executed by the processor, the steps of the operating system kernel design method based on trust domain extension as described in any one of claims 1 to 7 are implemented.
