WO2025133751A2 - 一种tee os的启动方法、设备及存储介质 - Google Patents

一种tee os的启动方法、设备及存储介质 Download PDF

Info

Publication number
WO2025133751A2
WO2025133751A2 PCT/IB2024/061559 IB2024061559W WO2025133751A2 WO 2025133751 A2 WO2025133751 A2 WO 2025133751A2 IB 2024061559 W IB2024061559 W IB 2024061559W WO 2025133751 A2 WO2025133751 A2 WO 2025133751A2
Authority
WO
WIPO (PCT)
Prior art keywords
tee
core
runtime component
ree
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/IB2024/061559
Other languages
English (en)
French (fr)
Other versions
WO2025133751A3 (zh
Inventor
梅建强
常琳
黄明
赵哲
郭和益
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloud Intelligence Singapore Holding Pvt Ltd
Original Assignee
Cloud Intelligence Singapore Holding Pvt Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cloud Intelligence Singapore Holding Pvt Ltd filed Critical Cloud Intelligence Singapore Holding Pvt Ltd
Publication of WO2025133751A2 publication Critical patent/WO2025133751A2/zh
Publication of WO2025133751A3 publication Critical patent/WO2025133751A3/zh
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Definitions

  • a TEE OS startup method, device and storage medium TECHNICAL FIELD The present application relates to the field of trusted computing technology, and in particular to a TEE OS startup method, device and storage medium.
  • TEE Trusted Execution Environment
  • TEE OS Trusted Execution Environment-Operating System
  • BIOS Basic Input Output System
  • the embodiment of the present application provides a method for starting a TEE OS, including: in a user state of a conventional execution environment REE, initiating a secure mode call SMC message for instructing to start the TEE OS, to a runtime component in a trusted basic firmware; using the runtime component, loading the image compiled for the TEE OS in the user state of the REE to a specified memory address; using the runtime component, triggering the execution of the image in the specified memory address in a trusted execution environment TEE according to the SMC message to start the TEE OS.
  • the embodiment of the present application also provides a computing device, including a memory and a processor; the memory is configured to store one or more computer instructions; the processor is coupled to the memory and is configured to execute the one or more computer instructions to execute the aforementioned TEE OS startup method.
  • the embodiment of the present application also provides a computer-readable storage medium storing computer instructions, and when the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned TEE OS startup method.
  • a secure mode call SMC message for instructing to start the TEE OS can be initiated in the user state of the conventional execution environment REE to the running program in the trusted basic firmware.
  • the runtime component can load the image compiled for TEE OS in the user state of REE to the specified memory address. Based on this, under the instruction of the SMC message, the runtime component can be used to trigger the operation of the image loaded into the specified memory address in the trusted execution environment TEE, thereby starting TEE OSo. Accordingly, in the embodiment of the present application, the user state of REE and the runtime component in the trusted basic firmware can cooperate with each other to realize the loading of the TEE OS image, and no longer need to rely on the BIOS firmware. Therefore, without restarting the BIOS firmware, the TEE OS can be started online on demand, which can effectively improve the maintainability of the TEE OS.
  • FIG. 1 is a schematic diagram of an exemplary logic of starting an existing TEE OS
  • FIG. 2 is a flowchart of a TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 3 is a logical diagram of a TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 4 is a flowchart of another TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 1 is a schematic diagram of an exemplary logic of starting an existing TEE OS
  • FIG. 2 is a flowchart of a TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 3 is a logical diagram of a TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 4 is a flowchart of another TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 1 is a schematic diagram of an exemplary logic of starting an existing TEE OS
  • FIG. 2 is a flowchart of a TEE OS startup
  • FIG. 5 is a logical diagram of another TEE OS startup method provided by an exemplary embodiment of the present application
  • FIG. 6 is a schematic diagram of an exemplary boot process corresponding to a main core provided by an exemplary embodiment of the present application
  • FIG. 7 is a structural diagram of a computing device provided by another exemplary embodiment of the present application.
  • BIOS Basic Input/Output System
  • BIOS Basic Input/Output System
  • BIOS is a program used by a computer microprocessor to start the computer system after power is applied. It also manages the flow of data between the computer operating system and additional devices such as the hard disk, video adapter, keyboard, mouse, and printer.
  • TEE Trusted Execution Environment. It is a secure area in the processor that helps protect the code and data loaded into it in terms of confidentiality and integrity.
  • TEE OS Trusted Execution Environment-Operating System
  • TEE Transactional Execution Environment-Operating System
  • REE Rich Execution Environment, which includes the conventional operating system and its combination with the rest of the execution environment, does not have sufficient security to meet the tasks required by the device.
  • CA Client Application, a common application. Applications that usually run in a REE environment are referred to as CA.
  • TA Trusted Application. Usually, applications running in a TEE environment are referred to as TA.
  • Hafnium A Secure Partition Manager (SPM) for implementing the Armv8.4-A S-EL2 extension, which allows multiple isolated Secure Partitions (SPs) to run at the S-EL1 level.
  • SPM Secure Partition Manager
  • SMC Secure Monitor Call, secure mode call. Used to enter secure mode and execute the secure monitor (SM) kernel service call. This instruction can only be executed in privileged mode.
  • SM secure monitor
  • ATF Trusted Firmware- A, a trusted foundation firmware. It is the reference implementation of the secure world software for the Arm A-profile architecture (Armv8-A and Armv7-A), including the EL3-level security controller.
  • Runtime the runtime component in ATF, is used to support the interaction between TA in TEE and CA in REE in the runtime state.
  • FF-A Firmware Framework-A profile, a firmware framework.
  • FIG1 is an exemplary schematic diagram of the startup logic of the existing TEE OS.
  • the hot start process can be generally divided into two stages: the first stage is the power-on startup of the master core. At this time, the other slave cores are not powered on.
  • each component can be loaded one by one according to the secure boot link (composed of the SCP ROM, BL2, and BL31 in FIG. 1 , which is an existing solution and will not be described in detail here), so as to complete the startup of the operating system kernel OS kernel in REE based on the BIOS firmware (UEFI in FIG. 1 ), so as to complete the core opening process of the master core; then the second stage can be entered.
  • the secure boot link composed of the SCP ROM, BL2, and BL31 in FIG. 1 , which is an existing solution and will not be described in detail here
  • the OS kernel can follow the relevant configuration information obtained from the BIOS firmware, call the PSCI interface (Power State Coordination Interface, a standard interface set to handle multi-core processors) to enter the runtime component of the trusted basic firmware ATF, power on the slave core, and then enter the boot entry of the slave core, and complete the initialization of Hafnium and TEE OS in FIG. 1 , so as to complete the core opening process of the slave core.
  • the OS kernel will repeatedly execute the above-mentioned core opening action on the slave core, and then complete the core opening work of other slave cores.
  • the size of the BIOS firmware image will continue to increase with the increase in the number of TEE OS, which brings relatively serious storage pressure to the BIOS flash space, and may even exceed the storage limit of the flash space.
  • the startup of the TEE OS will also cause the delay of the computer cold start to become longer. Due to the heavy dependence on the BIOS firmware, the cold start delay of the computer may even reach the hour level when the number of TEE OS continues to increase, resulting in a poor user experience.
  • FIG. 2 is a flowchart of a TEE OS startup method provided by an exemplary embodiment of the present application.
  • Figure 3 is a logical schematic diagram of a TEE OS startup method provided by an exemplary embodiment of the present application.
  • the method may include: Step 100, in the user state of the conventional execution environment REE, initiate a safe mode call SMC message for indicating the startup of TEE OS to the runtime component in the trusted basic firmware; Step 101, using the runtime component, load the image compiled for TEE OS in the user state of REE to the specified memory address; Step 102, using the runtime component, according to the SMC message triggering the running of the image in the specified memory address in the trusted execution environment TEE, to start TEE OS.
  • the TEE OS startup method provided in this embodiment can be applied to various scenarios where TEE OS is needed to support on-demand online startup of TEE OS in the scenario, and this embodiment does not limit the application scenario.
  • the TEE OS startup method provided in this embodiment is implemented after completing the conventional cold start process mentioned in the foregoing.
  • the TEE OS that is expected to be started according to the TEE OS startup method provided in this embodiment it is no longer necessary to package the corresponding image into the BIOS firmware image, and it is no longer necessary to burn its corresponding image into the flash. That is, in the conventional cold start process mentioned in the foregoing, it is no longer necessary to start these TEE OSs that have not been burned with images, but after completing the cold start process, these TEE OSs that have not been burned with images can be started online on demand according to the startup method provided in this embodiment.
  • the TEE OS startup method provided in this embodiment can be independent of the conventional cold start process, no longer depends on the BIOS firmware, and no longer needs to occupy the flash space and working delay in the cold start process, which makes the cold start process more efficient and the flash storage pressure is smaller. It is worth noting that the present embodiment does not prohibit the startup of TEE OS in the cold startup process, that is, some TEE OS that are expected to be started up immediately after startup can still be started up in the traditional cold startup mode, and the present embodiment does not intervene in the cold startup process of this part of TEE OS. However, for this part of TEE OS that is started up immediately after startup, the version upgrade can be achieved through the startup method of TEE OS provided in the present embodiment.
  • the CPU in the computer enters the runtime, and supports the division of the working state into two types during the runtime: secure state and non-secure state.
  • secure state When the CPU is in a secure state, it can only run the code on the TEE side, and has access rights to the address space on the REE side.
  • non-secure state When the CPU is in a non-secure state, it can only run the code on the REE side, and can only obtain specific data and call specific functions on the TEE side through a pre-defined interface.
  • a trusted basic firmware is also introduced to further ensure the credibility of TEE OS startup.
  • custom scripts or other types of custom programs may also be used.
  • This embodiment does not limit the form of the method execution subject deployed in the user state of REE.
  • the custom CA will be used as an example.
  • the custom CA may send an SMC message to the runtime component in the trusted basic firmware.
  • the SMC message initiated in the user state of REE is a message for calling a secure mode.
  • the image can be compiled for a single TEE OS multiple times in the user state of REE, and in the execution of step 101 In the process, the latest image compiled for TEE OS is used. Therefore, in this embodiment, the version of TEE OS can be updated by switching the image version used when TEE OS is started. In actual applications, after a certain TEE OS image is recompiled in the user state of REE, the TEE OS can be restarted according to the TEE OS startup method provided in this embodiment to achieve version upgrade.
  • the image compiled for TEE OS in the user state of REE can be stored in a specified directory in the user state of REE.
  • the image loading link in the aforementioned step 101 can be completed in advance before step 100, that is, the image compilation and loading can be completed in advance before the TEE OS enters the startup process; of course, this link can also be executed after step 100, that is, the TEE OS image is loaded again under the triggering of the SMC message initiated in step 100. Both loading times are possible, and this embodiment does not limit this, and it can be ensured that the image loading of the TEE OS has been correctly completed before step 102.
  • the compilation and loading of the TEE OS image can be completed online on demand without restarting the BIOS firmware. It can provide a maintainable startup basis for the startup of TEE OS.
  • the image in the specified memory address can be run in the trusted execution environment TEE to start the required TEE OS. Since the TEE OS image has been stored at the specified memory address as agreed, the runtime component only needs to guide the startup process as agreed to enter the running entry of the TEE OS image, and then start running the TEE OS image in the trusted execution environment TEE without obstacles to complete the startup of the TEE OS.
  • the boot process for completing step 102 can be defined in the code of the trusted basic firmware.
  • the specific boot process is not limited in this embodiment. In actual applications, the boot process can be defined as needed. In this embodiment, it is sufficient to ensure that the boot process can trigger the running of the image in the specified memory address in the trusted execution environment TEE.
  • An exemplary boot process will be provided later, and will not be described in detail here.
  • a secure mode call SMC message for instructing the startup of TEE OS can be initiated in the user state of the conventional execution environment REE to the runtime component in the trusted basic firmware; and the runtime component can load the image compiled for TEE OS in the user state of REE to the specified memory address.
  • the runtime component can be used to trigger the operation of the image loaded into the specified memory address in the trusted execution environment TEE, thereby starting TEE OS. Accordingly, in the embodiment of the present application, the loading of the TEE OS image can be realized through the cooperation of the user state of REE and the runtime component in the trusted basic firmware, without relying on the BIOS firmware. Therefore, the on-demand online startup of TEE OS can be realized without restarting the BIOS firmware, which can effectively improve the maintainability of TEE OS.
  • FIG4 is a flow chart of another TEE OS startup method provided by an exemplary embodiment of the present application.
  • the method may include: step 400, in the user state of the conventional execution environment REE, initiating a secure mode call SMC message for instructing to start the TEE OS to the runtime component in the trusted basic firmware; step 401, in the user state of the REE, initiating an SMC message for transmitting resource requirements to the runtime component; step 402, using the runtime component, compiling a resource configuration file that matches the resource requirements for the TEE OS, so that the runtime component allocates resources for the TEE OS according to the resource configuration file; step 403, using the runtime component, loading the image compiled for the TEE OS in the user state of the REE to a specified memory address; step 404, using the runtime component, triggering the execution of the specified memory in the trusted execution environment TEE according to the SMC message The image in the address is used to start the TEE OSo.
  • step 400 and step 403-step 404 can refer to the description in the above embodiment.
  • a further improved TEE OS startup method is provided based on step 401 and step 402.
  • the inventor found in the research process that in the traditional cold start process, in the startup process of TEE OS, in addition to relying on the BIOS firmware to load the image of TEE OS, it is also necessary to rely on BIOS support when allocating resources for TEE OS.
  • This resource allocation method that relies on BIOS causes the resource configuration of TEE OS to be too rigid and unable to support resource elasticity, and thus cannot meet the user's flexible and changeable resource occupation requirements for TEE OS.
  • an SMC message for transmitting resource requirements can be initiated in the user state of REE to the runtime component.
  • the SMC message for transmitting resource requirements may include resource configuration parameters for describing the resource specifications required to be occupied.
  • Resource configuration parameters may include but are not limited to memory space size, the number of physical cores or 10 device lists, etc., and no further examples are given here. In this way, by initiating an SMC message for transmitting resource requirements in the user state of REE, the aforementioned resource configuration parameters can be transmitted to the runtime component.
  • the runtime component in response to the SMC message for transmitting resource requirements initiated in the user state of REE, can compile a resource configuration file for the corresponding TEE OS.
  • a runtime component may be responsible for resource configuration for the TEE OS based on the resource configuration file, wherein, as mentioned above, the runtime component runs at the EL3 level, therefore, the runtime component has access rights to the entire hardware resources in the computer, and can be used to schedule hardware resources.
  • the resource configuration process can be implemented by the SPMD deployed in the runtime component, and this embodiment is not limited to this.
  • resource configuration parameters can be adjusted on demand for TEE OS in the user state of REE, and the runtime component can be driven to compile resource configuration files for TEE OS online by initiating SMC messages to the runtime component. Therefore, in this embodiment, elastic resource configuration of TEE OS can be supported.
  • resource configuration parameters can be adjusted for TEE OS in the user state of REE, and the adjusted resource configuration parameters can be passed to the runtime component through SMC messages, and the runtime component can update the corresponding resource configuration file for TEE OS.
  • TEE OS can be restarted to make the updated resource configuration file effective, thereby allocating fewer resources to TEE OS to solve the problem of resource waste.
  • the present embodiment can support multiple compilations of the resource configuration parameters of TEE OS, for this reason, in the present embodiment, for the runtime component, if there is already a resource configuration file corresponding to TEE OS, the resource configuration file corresponding to TEE OS can be modified according to the SMC message received this time for transmitting resource requirements, thereby realizing the update of the resource configuration file.
  • the user state of REE supports on-demand online compilation of resource configuration parameters and images for TEE OS.
  • FIG. 5 is a logical schematic diagram of another TEE OS startup method provided by an exemplary embodiment of the present application. Referring to FIG. 5 , the present embodiment still follows the TEE OS startup process shown in FIG. 1 , and provides an exemplary implementation for the processing concept in the user state of REE and the processing concept in the runtime component.
  • a trigger thread can be created in the user state of REE for the processing cores required to be occupied by TEE OS.
  • TEE OS needs to occupy multiple processing cores
  • trigger threads are created for multiple processing cores in the user state of REE respectively.
  • resource configuration parameters can be compiled for TEE OS in the user state of REE. Therefore, the user state of REE is known to the processing cores required to be occupied by TEE OS.
  • trigger threads can be created for the processing cores required to be occupied by TEE OS in the user state of REE respectively.
  • interface functions such as pthread_create and pthread_setaffinity_np in glibc can be called to create trigger threads for processing cores in the user state of REE.
  • the trigger thread is used to initiate an SMC message.
  • the SMC message initiated by a single trigger thread is used to indicate that the corresponding processing core is started for TEE OS. It is worth noting that here, starting the processing core is no longer the core opening action in the cold start process, but can be understood as performing relevant initialization work for TEE OS on the corresponding processing core.
  • a trigger thread consistent with the number of processing cores that TEE OS needs to occupy can be created in the user state of REE; and the processing core affinity can be configured for each created trigger thread, so as to form a binding relationship between the trigger thread and the processing core through the processing core affinity.
  • the affinity of the processing cores between the mutually bound processing cores and the triggering threads is high enough to support the unique determination of the bound processing cores for the triggering threads according to the affinity of the processing cores.
  • other methods can also be used to implement the binding relationship between the processing cores and the triggering threads, and are not limited to this, and no further examples are given here.
  • the triggering threads corresponding to the multiple processing cores can be run in sequence to initiate SMC messages for the multiple processing cores respectively.
  • each triggering thread can be enabled to run in the startup sequence by adding a mutex lock.
  • the inventors in the research process It is found that when TEE OS needs to occupy multiple processing cores, the master core and the slave core are usually set, and the master core is usually started first, and then the slave cores are started in sequence. For this reason, in this implementation, the startup order between multiple processing cores can be set in the user state of REE in the order of master first and slave later. It is emphasized again here that the startup here is not a core opening action.
  • the SMC messages initiated for multiple processing cores can be the same, mainly used to drive the runtime component to enter the subsequent processing logic. Let's look at the runtime component.
  • the runtime component After receiving the SMC message initiated in the user state of REE, the runtime component can first determine whether the current 'SMC message corresponds to the master core or the slave core, so as to enter the corresponding boot process.
  • the core identifiers of the master core and the slave core in multiple processing cores can be configured respectively; the core identifiers belonging to the master core and the core identifiers belonging to the slave core are recorded in the first register respectively.
  • the runtime component can access the first register, and if it is identified that the core identifier of the processing core corresponding to the target SMC message is the core identifier belonging to the master core, it is determined that the processing core corresponding to the target SMC message is the master core.
  • the first register can use the mpidr register to characterize the master-slave relationship between the processing cores by recording the topological relationship between each processing core.
  • this is only exemplary, and the first register is not limited here. The following will take the runtime component receiving the target SMC message as an example to describe in detail the boot process defined for the master core and the slave core in the runtime component.
  • the target SMC message can be any one of the SMC messages initiated for the multiple processing cores required to be occupied by the TEE OS.
  • the runtime component after receiving the target SMC message, it can be determined whether the target SMC message corresponds to the main core; if so, the boot process corresponding to the main core can be executed; if not, the boot process corresponding to the slave core can be executed.
  • FIG6 is a schematic diagram of an exemplary boot process corresponding to the main core provided by an exemplary embodiment of the present application.
  • the runtime component determines that the target SMC message corresponds to the main core
  • the aforementioned operation of loading the image compiled for the TEE OS in the user state of the REE to the specified memory address can be performed under the triggering of the target SMC message; after completing the image loading, the initialization logic corresponding to the main core is triggered to run in the trusted execution environment TEE. That is, step 101 in FIG2 can be placed in the boot process corresponding to the main core for execution. Accordingly, the signature verification link for the TEEOS image mentioned above can also be placed in the boot process corresponding to the main core for execution.
  • the runtime component can trigger the initialization logic corresponding to the main core in the trusted execution environment TEE after completing the image loading operation. It should be understood that in this embodiment, for the SMC message corresponding to the main core, after the runtime component performs the aforementioned image signature verification and image loading operations, it can guide the relevant components in the TEE to start running the initialization logic corresponding to the main core. The runtime component can only undertake the boot work, and the specific initialization logic can be implemented by the relevant components in the TEE.
  • a secure partition manager can be introduced in the TEE, such as the above-mentioned And Hafnium, etc., are used to manage multiple TEE OSo runtime components can send a first trigger notification to the secure partition manager in the TEE, and the control of the main core has been transferred to the secure partition manager; the secure partition manager can perform initialization configuration operations for the TEE OS on the main core according to the first trigger notification, and after completing the initialization configuration operation, call the preset instruction to trigger the entry into the image corresponding to the main core.
  • the initialization configuration operation for the TEE OS performed on the main core may include but is not limited to memory initialization, page table initialization, and VCPU initialization, etc., which are not exhaustive here.
  • the secure partition manager can trigger the running of the TEE OS image by calling the start function (the entry function of the TEE OS image), and then the start function can continue to call the reset function, and the reset function can continue to call the reset_primary function, so as to run the image code corresponding to the main core in the TEE OS.
  • the running process of the image can be carried out in the aforementioned ELI.
  • the initialization logic executed in the TEE above is only an exemplary partial logic.
  • the secure partition manager can update the number of TEE OS managed by it, and after monitoring the completion of the execution of the relevant image code in the TEEOS image, it can take over the control of the main core again, and start the VCPU required for TEE OS on the main core, etc., and the initialization logic is not exhaustively enumerated here. At this point, the work related to the startup of TEE OS on the main core can be completed.
  • the runtime component executes the boot process corresponding to the slave core according to the target SMC message to trigger the initialization logic corresponding to the slave core in the trusted execution environment TEE.
  • the runtime component no longer needs to perform the signature verification and loading operation of the image, which is different from the boot process corresponding to the master core.
  • the boot process corresponding to the master core refers to the boot process corresponding to the master core.
  • the runtime component sends a second trigger notification to the secure partition manager for managing the TEE OS in the TEE according to the target SMC message; the secure partition manager performs the initialization configuration operation for the TEE OS on the slave core according to the second trigger notification, and after completing the initialization configuration operation, calls the preset instruction to trigger the entry into the running entry corresponding to the slave core in the image.
  • the process of running the initialization logic corresponding to the slave core in the TEE is basically the same as the aforementioned process of running the initialization logic corresponding to the slave core in the TEE, and will not be repeated here to save space.
  • the user state of REE can cooperate with the runtime component to complete the relevant startup work on the master core and the slave core for TEE OS, and the whole process does not need to rely on BIOS firmware.
  • the runtime component detects that the SMC message initiated for the current processing core has completed the processing flow, it can return a process end notification to the user state of REE; after receiving the process end notification, the user state of REE will initiate an SMC message for the next processing core.
  • the runtime component detects that the processing flow for the current SMC message has been completed, it can restore the EL3 level context, and then call the eret instruction to return to the OS kernel in REE.
  • the custom CA in REE can end the startup process for the current SMC message by calling the TEEC_FinalizeContext interface function, and can initiate an SMC message for the next processing core.
  • the relevant startup work can be completed for TEE OS on each processing core that it needs to occupy.
  • the boot processes corresponding to the master core and the slave core can be defined respectively, and the runtime component can execute the corresponding boot processes for the master core and the slave core required to be occupied by the TEE OS, so as to cooperate with other components in the TEE, and complete the work related to the startup of the TEE OS on the master core and the slave core required to be occupied by the TEE OS, so as to complete the startup of the TEE OS.
  • FIG. 7 is a schematic diagram of the structure of a computing device provided by another exemplary embodiment of the present application. As shown in FIG. 7, the computing device includes: a memory 70 and a processor 71.
  • the processor 71 is coupled to the memory 70 and is configured to execute a computer program in the memory 70, so as to: initiate a secure mode call SMC message for instructing the startup of the TEE OS in the user state of the conventional execution environment REE to a runtime component in the trusted basic firmware; use the runtime component to load the image compiled for the TEE OS in the user state of the REE to a specified memory address; use the runtime component to trigger the execution of the image in the specified memory address in the trusted execution environment TEE according to the SMC message to start the TEE OS.
  • the processor may include multiple processing cores, and one or more of the processing cores may execute the above-mentioned computer program in the memory 70.
  • the processor 71 may also be configured to: before loading the image to the specified memory address, in the user state of the REE, initiate an SMC message for transmitting resource requirements to the runtime component; using the runtime component, compile a resource configuration file adapted to the resource requirements for the TEE OS, so that the runtime component allocates resources for the TEE OS according to the resource configuration file.
  • the processor 71 when the processor 71 uses the runtime component to compile a resource configuration file adapted to the resource requirements for the TEE OS, it may be specifically configured to: if there is already a resource configuration file corresponding to the TEE OS, modify the resource configuration file according to the SMC message for transmitting resource requirements received this time; wherein the modified resource configuration file is consistent with the resource requirements described in the image compiled for the TEE OS.
  • the processor 71 when the processor 71 initiates a secure mode call SMC message for instructing the startup of the TEE OS, it may be specifically configured to: if the TEE OS needs to occupy multiple processing cores, create Create a trigger thread; run the trigger threads corresponding to the multiple processing cores in turn in the user state of the REE according to the startup order set for the multiple processing cores, so as to initiate the SMC messages for the multiple processing cores respectively.
  • the multiple processing cores include a master core and a slave core
  • the processor 71 uses the runtime component to trigger the execution of the image in the specified memory address in the trusted execution environment TEE according to the SMC message, it can be specifically set as follows: after receiving the target SMC message in the multiple SMC messages, the runtime component determines whether the target SMC message corresponds to the master core; if the target SMC message corresponds to the master core, use the runtime component to execute the boot process corresponding to the master core according to the target SMC message to trigger the execution of the initialization logic corresponding to the master core in the trusted execution environment TEE; wherein, the target SMC message is any one of the multiple SMC messages.
  • the processor 71 when the processor 71 uses the runtime component to execute the boot process corresponding to the main core according to the target SMC message to trigger the initialization logic corresponding to the main core to run in the trusted execution environment TEE, it can be specifically set to: under the trigger of the target SMC message, use the runtime component to execute the operation of loading the image compiled for the TEE OS in the user state of the REE to the specified memory address; after completing the image loading, use the runtime component to trigger the initialization logic corresponding to the main core to run in the trusted execution environment TEE.
  • the processor 71 may also be used for: if the target SMC message corresponds to the slave core, using the runtime component to execute the boot process corresponding to the slave core according to the target SMC message to trigger the initialization logic corresponding to the slave core to run in the trusted execution environment TEE.
  • These computer program instructions may also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, and the instruction device implements the functions specified in one or more processes of the flowchart and/or one or more blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes of the flowchart and/or one or more blocks of the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

本申请实施例提供一种TEE OS的启动方法、设备及存储介质。在基于BIOS固件完成冷启动之后,可在REE的用户态下,发起用于指示进行TEE OS启动的SMC消息,至可信基础固件中的运行时组件;而且,可由运行时组件将在REE的用户态下为TEE OS编译完成的镜像加载至指定内存地址,基于此,可在SMC消息的指示下,借助运行时组件触发在TEE中运行已加载至指定内存地址中的所述镜像,从而启动TEE OS。据此,可通过REE的用户态与可信基础固件中的运行时组件相互配合实现TEE OS镜像的加载,而不再需要依赖BIOS固件,因此可有效改善TEE OS的可维护。

Description

一种 TEE OS 的启 动方 法、 设备及 存储 介质 技术领域 本 申请涉及可信计算技术领域, 尤其涉及一种 TEE OS的启动方法、 设备及存储介质。 背景技术
TEE, 全名为可信执行环境 (Trusted Execution Environment) , 是指在计算平台上使用软 硬件方法构建的一个安全隔离区域, 进而保证在这个安全隔离的区域内拥有的数据和代码的 生命周期在机密性和完整性方面得到保护。 TEE OS (Trusted Execution Environment- Operating System) 则是指运行在可信执行环境中的操作系统。 目前, TEE OS启动过程中所需的 TEE OS镜像需要打包至 BIOS (Basic Input Output System, 基本输入输出系统) 的固件镜像中, 并随 BIOS固件镜像一同预烧录到闪存 Flash空 间中, 因此, TEE OS的启动依赖于 BIOS固件。 而这种依赖于 BIOS固件的 TEE OS启动方 式导致 TEE OS的可维护性不佳, 无法满足用户对 TEE OS灵活多变的使用需求。 发明内容 本 申请的多个方面提供一种 TEE OS的启动方法、 设备及存储介质, 用以改善 TEE OS 的可维护性。 本 申请实施例提供一种 TEE OS的启动方法, 包括: 在 常规执行环境 REE的用户态下,发起用于指示进行 TEE OS启动的安全模式调用 SMC 消息, 至可信基础固件中的运行时组件; 利 用所述运行时组件, 将在所述 REE的用户态下为所述 TEE OS编译完成的镜像加载至 指定内存地址; 利 用所述运行时组件, 按照所述 SMC消息触发在可信执行环境 TEE中运行所述指定内 存地址中的所述镜像, 以启动所述 TEE OSo 本 申请实施例还提供一种计算设备, 包括存储器和处理器; 所述存储器被设置 为存储一条或多条计算机指令; 所述处理 器与所述存储器耦合, 被设置为执行所述一条或多条计算机指令, 以执行前述 的 TEE OS的启动方法。 本 申请实施例还提供一种存储计算机指令的计算机可读存储介质, 当所述计算机指令被 一个或多个处理器执行时, 致使所述一个或多个处理器执行前述的 TEE OS的启动方法。 在本 申请实施例中, 在基于 BIOS固件完成冷启动之后, 可在常规执行环境 REE的用户 态下, 发起用于指示进行 TEE OS启动的安全模式调用 SMC消息, 至可信基础固件中的运行 时组件; 而且, 可由运行时组件将在 REE的用户态下为 TEE OS编译完成的镜像加载至指定 内存地址, 基于此, 可在 SMC消息的指示下, 借助运行时组件触发在可信执行环境 TEE中 运行已加载至指定内存地址中的所述镜像, 从而启动 TEE OSo 据此, 本申请实施例中, 可通 过 REE的用户态与可信基础固件中的运行时组件相互配合实现 TEE OS镜像的加载, 而不再 需要依赖 BIOS固件,因此,在无需重启 BIOS固件的情况,即可实现按需在线启动 TEE OS, 这可有效改善 TEE OS的可维护性。 附图说明 此 处所说明的附图用来提供对本申请的进一步理解, 构成本申请的一部分, 本申请的示 意性实施例及其说明用于解释本申请, 并不构成对本申请的不当限定。 在附图中: 图 1为一种示例性的现有 TEE OS的启动逻辑示意图; 图 2为本申请一示例性实施例提供的一种 TEE OS的启动方法的流程示意图; 图 3为本申请一示例性实施例提供的一种 TEE OS的启动方法的逻辑示意图; 图 4为本申请一示例性实施例提供的另一种 TEE OS的启动方法的流程示意图; 图 5为本申请一示例性实施例提供的又一种 TEE OS的启动方法的逻辑示意图; 图 6为本申请一示例性实施例提供的一种与主核对应的示例性引导流程的示意图; 图 7为本申请另一示例性实施例提供的一种计算设备的结构示意图。 具体实施方式 为使本申请的目的、 技术方案和优点更加清楚, 下面将结合本申请具体实施例及相应的 附图对本申请技术方案进行清楚、 完整地描述。 显然, 所描述的实施例仅是本申请一部分实 施例, 而不是全部的实施例。 基于本申请中的实施例, 本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例, 都属于本申请保护的范围。 在 开始描述本申请各实施例提供的技术方案之前, 先对本申请中涉及到的几个技术概念 进行简单说明如下:
BIOS : Basic Input/Output System,是计算机微处理器上电后用来启动计算机系统的程序。 它还管理计算机操作 系统和附加设备 (如硬盘、 视频适配器、 键盘、 鼠标和打印机)之间的数 据流。
TEE: Trusted Execution Environment, 可信执行环境。 是处理器中的一个安全区域, 它有 助于在保密性和完整性方面保护其中加载的代码和数据。
TEE OS (Trusted Execution Environment-Operating System) 则是指运行在可信执行环境 TEE 中的操作系统。
REE: Rich Execution Environment, 常规执行环境。 包含常规操作系统及其与该执行环境 其余部分的组合, 不具备足够的安全性来满足设备所需的任务。
CA: Client Application, 常规应用。 通常运行在 REE 环境下的应用简称为 CA 。
TA: Trusted Application, 可信应用。 通常运行在 TEE 环境下的应用简称为 TA。 Hafnium: 用于实现 Armv8.4-A S-EL2扩展的一种安全分区管理器 (SPM), 它允许多个隔 离的安全分区 (SP)在 S-EL1层级上运行。
SMC : Secure Monitor Call,安全模式调用。用于进入安全模式并执行安全管控器 (Secure Monitor, SM) 内核服务调用, 此指令只能在特权模式下执行。
ATF : Trusted Firmware- A,一种可信基础固件。是 Arm A-profile架构 (Armv8-A和 Armv7-A) 的安全世界软件的参考实现, 包括 EL3层级的安全管控器。
Runtime, ATF中的运行时组件, 用于在运行时状态下, 支持 TEE中的 TA和 REE中的 CA 之间进行交互。
FF-A : Firmware Framework-A profile , 一种固件框架。
SPMD: FF-A规范下, 在 ATF的运行时组件中部署的用于对安全分区管理器 (SPM)进行 调度的调度器。 正如 背景技术中介绍的那样, 目前 TEE OS的启动需要依赖于 BIOS固件, 也即是, 在基 于 BIOS固件进行冷启动的过程中, TEE OS的启动是冷启动过程中的其中一个环节。 图 1为 一种示例性的现有 TEE OS的启动逻辑示意图。 现有的启动方案中, CPU中包含多个处理核 core 的情况下, 通常会指定主核和从核。 参考图 1, 冷启动流程整体上可分为两个阶段: 第 一个阶段是主核上电启动, 此时, 其它从核并未上电, 针对主核可按照安全启动链路 (由图 1 中的 SCP ROM及 BL2及 BL31等环节构成, 为现有方案, 在此不做过多说明)逐一加载各 个组件, 从而基于 BIOS固件 (图 1中示为 UEFI) 完成 REE中操作系统内核 OS kernel的启 动, 以完成主核的开核过程; 之后可进入第二个阶段, 主核完成 OS kernel主要模块的初始化 流程之后 , 0S kernel可遵循从 BIOS固件中获得的相关配置信息,调用 PSCI接口 (Power State Coordination Interface, 电源管理接口, 是一种被设置为处理多核处理器的标准接口) 进入可 信基础固件 ATF 的运行时组件, 为从核上电, 随后进入从核的启动入口, 并完成图 1 中的 Hafnium及 TEE OS的初始化等环节, 以完成从核的开核过程。 另外, 在从核为多个的情况 下, OS kernel将重复执行上述关于从核的开核动作, 进而完成其它从核的开核工作。 基 于图 1示出的冷启动流程可知, TEE OS的启动穿插在冷启动的流程中,且正如背景技 术中介绍的, TEE OS的镜像需要烧录在 BIOS的固件镜像中, 因此, 现有的 TEE OS启动方 案对 BIOS固件有强依赖性。 显 然, 这会导致 TEE OS的可维护性不佳, 这里的可维护性不佳可理解为 TEE OS的启 动时机不灵活或启动后无法进行镜像再编译等, 因此, 现有的 TEE OS启动方案无法满足用 户对 TEE OS灵活多变的使用需求。除此之外, 由于 TEE OS的镜像需要打包在 BIOS固件镜 像中, 而 BIOS固件镜像又被烧录在闪存 flash空间中, 因此, 在处理器中需要部署多个 TEE OS 的情况下, BIOS固件镜像的大小将随着 TEE OS数量的增加而不断增加,这给 BIOS flash 空间带来比较严重的存储压力, 甚至可能超过 flash空间的存储上限。 而且, TEE OS的启动 还将导致计算机冷启动的时延变长, 由于对 BIOS固件的依赖性较大, 因此, 在 TEE OS数量 不断增多的情况下, 计算机的冷启动时延甚至可能达到小时级, 导致用户体验不佳。 为此, 本申请实施例提出了一种新的 TEE OS启动方案, 支持 TEE OS按需在线启动, 而不再依赖于 BIOS固件。 以下结合附图, 详细说明本申请各实施例提供的技术方案。 图 2为本申请一示例性实施例提供的一种 TEE OS的启动方法的流程示意图。 图 3为本 申请一示例性实施例提供的一种 TEE OS的启动方法的逻辑示意图。参考图 2,该方法可包括: 步骤 100、 在常规执行环境 REE的用户态下, 发起用于指示进行 TEE OS启动的安全模 式调用 SMC 消息, 至可信基础固件中的运行时组件; 步骤 101、 利用运行时组件, 将在 REE的用户态下为 TEE OS编译完成的镜像加载至指 定内存地址; 步骤 102、 利用运行时组件, 按照 SMC消息触发在可信执行环境 TEE中运行指定内存 地址中的镜像, 以启动 TEE OSo 本实施例提供的 TEE OS的启动方法可应用于各种需要使用到 TEE OS的场景中, 以在 场景中支持按需在线启动 TEE OS, 本实施例对应用场景不做限定。 应 当理解的是, 本实施例提供的 TEE OS的启动方法是在完成前文中提及的常规的冷启 动流程之后实施的。其中,对于期望按照本实施例提供的 TEE OS的启动方法进行启动的 TEE OS,不再需要将对应的镜像打包至 BIOS固件镜像中,也不再需要将其对应的镜像烧录中 flash 中。 也即是, 在前文中提及的常规的冷启动流程中, 不再需要对这些未烧录镜像的 TEE OS 进行启动, 而是可在完成冷启动流程之后, 按照本实施例提供的启动方法对这些未烧录镜像 的 TEE OS进行按需在线启动。 因此, 本实施例提供的 TEE OS的启动方法可独立在常规的 冷启动流程之后, 不再依赖于 BIOS固件, 也不再需要占用冷启动流程中的 flash空间及工作 时延, 这使得冷启动流程的效率更高且 flash存储压力更小。 值得说 明的是, 本实施例并不禁止在冷启动流程中进行 TEE OS的启动, 也即是, 部分 期望开机即启动完成的 TEE OS仍可按照传统的冷启动方式完成启动,本实施例对这部分 TEE OS 的冷启动过程不做干预。 但是, 针对这部分开机即启动完成的 TEE OS, 可通过本实施例 提供的 TEE OS的启动方法来实现版本升级, 换句话说, 本实施例提供的 TEE OS的启动方 法可支持对已启动的 TEE OS进行在线重启, 进而支持 TEE OS的在线升级。 参考 图 3, 本实施例中, 计算机中提供了两种执行环境: TEE和 REE。 应当理解的是, 这两种执行环境在前述的冷启动流程中已经构建完成。 实际应用中, 可采用 Trustzone等技术 来支持这两种执行环境的构建。 以 TrustZone为例, 其可提供 Secure空间和 Non- Secure空间 两种空间, 分别对应于 TEE和 REE两种执行环境, 并在两种执行环境之间进行硬件强制隔 离,且可支持计算机的 CPU进行工作模式的切换,以按需在两种执行环境中工作。示例性地, 可通过切换安全配置 Secure Configuration Register 系统寄存器来使能工作模式的切换, 该寄 存器最后 Ibit为 0, 表示当前 CPU处于安全模式 secure mode。 并且 Trustzone技术还支持将 系统资源配置成安全 secure状态, 通过操作相关寄存器可以将系统总线、 内存、 DMA、 cache 等资源配置成安全 secure状态, 配置成安全 secure状态之后, REE中运行的程序 CA无法访 问这些硬件资源, 从而实现两种执行环境之间的硬件强制隔离。 针对两种执行环境的构建过 程在此不作更详细的说明。 这样 , 本实施例中, 在完成冷启动流程后, 计算机中的 CPU进入运行时 (runtime), 且 在运行时支持将工作状态划分为两种: 安全状态和非安全状态。 当 CPU处于安全状态时只能 运行 TEE侧的代码, 且具有 REE侧地址空间的访问权限。 当 CPU处于非安全状态时只能运 行 REE侧的代码, 且只能通过事先定义好的接口来获取 TEE侧中特定的数据和调用特定的 功能。 另外, 参考图 3, 在构建出上述 TEE和 REE两种执行环境的基础上, 本实施例中, 还引 入了可信基础固件来进一步保证 TEE OS启动的可信性。 示例性地, 本实施例中的可信基础 固件可采用 ATF (ARM Trusted Firmware) o 基于 ATF可在保有 Trustzone提供的 Secure空间 和 Non-Secure空间的同时, 划分出 EL0(异常等级 Exception level 0)到 EL3四个异常等级, 以进一步保证启动和运行时阶段中的安全性。 其中, 前述的 CA和 TA可运行在 EL0, 前述的 OS kernel和本实施例中启动后的 TEE OS则可运行在 ELI , BISO则可运行在 EL2。 参考 图 3,本实施例中提出,采用可信基础固件中的运行时组件来支持本实施例中的 TEE OS 的启动方法。 其中, 该运行时组件运行在前述的 EL3, 且一直位于 Secure空间中, 这可 有效保证本实施例中 TEE OS的启动方法的安全性和可信性。 在此基础上 , 参考图 2, 在步骤 100中, 可在常规执行环境 REE的用户态下, 发起用于 指示进行 TEE OS加载的安全模式调用 SMC消息, 至可信基础固件中的运行时组件。 本实施例中, 可在 REE的用户态中部署一自定义 CA(常规应用), 并由该自定义 CA实 施需要在 REE的用户态下进行的处理逻辑。 当然, 本实施例中还可采用其它类型的逻辑载体 作为在 REE的用户态下的方法执行主体, 例如, 除了前述的自定义 CA之外, 也可采用自定 义脚本或者其它类型的自定义程序等, 本实施例对在 REE的用户态中部署的方法执行主体的 形态不做限定。 后文中在需要提及 REE的用户态中方法执行主体的情况下, 将以自定义 CA 作为示例。这里,在步骤 100中,可由该自定义 CA向可信基础固件中的运行时组件发送 SMC 消息。 其 中, 正如前文提供的 SMC的定义, REE的用户态中发起的 SMC消息是一种用于安全 模式调用的消息。 这里可理解为, REE的用户态通过发出 SMC信息至可信基础固件中的运 行时组件, 将 CPU的控制权从 REE的用户态转移至可信基础固件中的运行时组件。 另外, 本实施例中, REE的用户态中发起的 SMC消息是用于指示进行 TEE OS启动。 实 际应用中, REE的用户态中发起的 SMC消息可用于指示进行单个 TEE OS的启动, 也可用于 指示多个 TEE OS —同启动, 对于后一种情况下, 可触发运行时组件自动重复执行针对单个 TEE OS的启动逻辑。 为便于理解, 后文中, 将从单个 TEE OS的视角进行启动逻辑的描述。 继 续参考图 2和图 3, 在步骤 101中, 可利用运行时组件, 将在 REE的用户态下为 TEE OS 编译完成的镜像加载至指定内存地址。 这里存在两个方面的处理逻辑: 一 方面, 本实施例中, 可在 REE的用户态下为 TEE OS编译镜像。 实际应用中, 可由前 述的自定义 CA完成镜像编译工作。基于此,本实施例中,可支持按照用户灵活多变的 TEE OS 使用需求, 为 TEE OS按需编译镜像, 而且, 可支持对 TEE OS进行镜像再编译。 也即是, 本实施例中, 可在 REE的用户态下为单个 TEE OS多次进行镜像编译, 而在执行步骤 101的 过程中, 使用的是为 TEE OS最新编译出的镜像, 因此, 本实施例中, 可通过切换 TEE OS 启动时使用的镜像版本, 来实现对 TEE OS进行版本更新。 实际应用中, 当 REE的用户态下 对某个 TEE OS的镜像进行重新编译后, 可按照本实施例提供的 TEE OS的启动方法, 对该 TEE OS进行重新启动, 以实现版本升级。 本实施例中,在 REE的用户态下为 TEE OS编译完成的镜像, 可存储至 REE的用户态下 的指定目录中。 在此基础上, 本实施例中, 在 REE的用户态下, 前述的自定义 CA还可调用 TEE驱动提供的 自定义接口,以利用该自定义接口从 REE的用户态下指定目录获取为 TEE OS 编译完成的镜像, 并将镜像存储至指定的缓冲区域中; 之后, 将缓冲区域的地址配置至第二 寄存器中;其中,第二寄存器为 TEE驱动与运行时组件之间约定的缓冲区域的地址传递媒介。 实际应用中, 可在 TEE驱动中添加自定义接口函数 ffa_tos_load, 在 REE的用户态下, 可调 用该自定义接口函数, 而该自定义接口函数的函数功能可定义为: 调用 Linux 固件子系统接 口函数 request_firmware , 来获取 OS文件系统指定目录下新编译得到的 TEE OS镜像, 并 申请缓冲区域 buffer暂存该镜像,最后,将 buffer地址连同 Function ID等写入第二寄存器。 另一方面, 运行时组件可获取到在 REE的用户态下为 TEE OS编译完成的镜像, 并将镜 像加载至指定内存地址中。 其 中, 可在可信基础固件中为 TEE OS镜像预先配置指定内存地址, 这样, 在步骤 101 中, 运行时组件可按照可信基础固件中的指定, 将 TEE OS的镜像存储至指定内存地址。 后 续的处理逻辑中, 也将继续遵循可信基础固件中的该指定, 从而保证在 TEE中能够准确地查 找到镜像, 进而运行镜像。 承接前 文中的第二寄存器, 实际应用中, 运行时组件可从第二寄存器中查询到 TEE OS 镜像所处的缓冲区域的地址, 从而可从该缓冲区域中读取到 TEE OS镜像, 进而可将读取到 的 TEE OS镜像转移至指定内存地址。 值得说 明的是, 前述的步骤 101中的镜像加载环节, 可在步骤 100之前即预先完成, 也 即可在 TEE OS进入启动流程之前预先完成镜像编译及加载; 当然, 该环节也可在步骤 100 之后再执行, 也即是在步骤 100中发起的 SMC消息的触发下, 再进行 TEE OS镜像的加载。 两种加载时机均可, 本实施例对此不做限定, 能够保证在步骤 102之前已经正确完成 TEE OS 的镜像加载即可。 另外, 本实施例中, 运行时组件在读取到 REE的用户态为 TEE OS所编译的镜像之后, 还可对读取到的镜像进行签名校验; 在确定镜像通过签名校验的情况下, 再执行将镜像加载 至指定内存地址的操作。 本实施例中, 不限定签名校验的实现方式, 在一种示例性的解决方 案中, 可将 TEE的公钥存储在硬件可信根中, 而在 REE的用户态可通过 TEE私钥对 TEE OS 镜像进行加密, 这样, 由于运行时组件可通过 TEE公钥对读取到的 TEE OS进行签名校验。 由于 TEE公钥仅可能在 TEE中被获知, 因此可保证 TEE公钥的安全性, 进而保证签名校验 的可信性。 本实施例中, 在镜像加载之前增加对 TEE OS镜像的签名校验环节, 可有效保障 TEE OS镜像的安全性和可信性, 避免因 REE的用户态参与 TEE OS的启动过程而引入安全 性问题。 可知 , 本实施例中, 在 REE的用户态和可信基础固件中运行时组件的相互配合下, 可支 持在 REE的用户态下为 TEE OS按需编译镜像, 且将编译完成的镜像顺利加载至 TEE OS启 动时默认的镜像读取地址 (也即前文的指定内存地址) 中。 整个镜像加载的过程完全无需依 赖 BIOS固件, 完全脱离了前述的冷启动流程。 因此, 本实施例中, 在无需重启 BIOS 固件的情况下, 即可实现按需在线完成 TEE OS 镜像的编译及加载。 可为 TEE OS的启动提供了可维护的启动基础。 继续参考 图 2和图 3, 基于加载好的 TEE OS镜像, 在步骤 102中, 可在运行时组件的引 导下, 在可信执行环境 TEE中运行指定内存地址中的镜像, 以启动所需的 TEE OSo 由于 TEE OS的镜像已经按约定存储到了指定内存地址, 因此, 运行时组件只需按约定 进行启动流程的引导, 即可进入到 TEE OS镜像的运行入口, 进而无障碍地开始在可信执行 环境 TEE中运行 TEE OS的镜像, 以完成 TEE OS的启动。 本实施例中, 可在可信基础固件 的代码中定义用于完成步骤 102的引导流程, 本实施例中不限定具体的引导流程, 实际应用 中, 可按需进行引导流程的定义, 本实施例中保证该引导流程能够触发在可信执行环境 TEE 中运行指定内存地址中的镜像即可, 后文中将提供示例性的引导流程, 在此不做展开说明。 综上 , 本实施例中, 在基于 BIOS固件完成冷启动之后, 可在常规执行环境 REE的用户 态下, 发起用于指示进行 TEE OS启动的安全模式调用 SMC消息, 至可信基础固件中的运行 时组件; 而且, 可由运行时组件将在 REE的用户态下为 TEE OS编译完成的镜像加载至指定 内存地址, 基于此, 可在 SMC消息的指示下, 借助运行时组件触发在可信执行环境 TEE中 运行已加载至指定内存地址中的所述镜像, 从而启动 TEE OSo 据此, 本申请实施例中, 可通 过 REE的用户态与可信基础固件中的运行时组件相互配合实现 TEE OS镜像的加载, 而不再 需要依赖 BIOS固件,因此,在无需重启 BIOS固件的情况,即可实现按需在线启动 TEE OS, 这可有效改善 TEE OS的可维护性。 除 了改善 TEE OS的可维护性之外, 本实施例提供的按需在线启动 TEE OS的方案, TEE OS 的启动时延可达到秒级, 相较于传统启动方案中小时级的启动时延, 本实施例中可有效改 善 TEE OS的启动效率。 而且, 本实施例中, 在线启动的 TEE OS不再需要占用 BIOS的 flash 空间, 因此, 可有效减轻 flash空间的存储压力。 图 4为本申请一示例性实施例提供的另一种 TEE OS的启动方法的流程示意图。参考图 4, 该方法可包括: 步骤 400、 在常规执行环境 REE的用户态下, 发起用于指示进行 TEE OS启动的安全模 式调用 SMC 消息, 至可信基础固件中的运行时组件; 步骤 401、 在 REE的用户态下, 发起用于传递资源需求的 SMC消息, 至运行时组件; 步骤 402、利用运行时组件, 为 TEE OS编译与资源需求相适配的资源配置文件, 以供运 行时组件按照资源配置文件为 TEE OS分配资源; 步骤 403、 利用运行时组件, 将在 REE的用户态下为 TEE OS编译完成的镜像加载至指 定内存地址; 步骤 404、 利用运行时组件, 按照 SMC消息触发在可信执行环境 TEE中运行指定内存 地址中的镜像, 以启动 TEE OSo 其 中, 步骤 400和步骤 403 -步骤 404可参考前述实施例中的描述, 本实施例中, 基于步 骤 401和步骤 402提供了一种进一步改进的 TEE OS的启动方法。 发明人在研究过程中发现, 传统冷启动流程中, TEE OS 的启动过程中, 除了需要依赖 BIOS固件进行 TEE OS的镜像加载之外,为 TEE OS进行资源分配时也需要依赖 BIOS支持。 这种依赖 BIOS进行的资源分配方式, 导致 TEE OS的资源配置过于死板, 无法支持资源弹性 伸缩, 进而也就无法满足用户针对 TEE OS的灵活多变的资源占用需求。 为此, 本实施例中提出了一种按需在线进行资源配置的技术构思, 以进一步改善 TEE OS 的可维护性。 参考 图 4,在步骤 401中, 可在 REE的用户态下, 发起用于传递资源需求的 SMC消息, 至运行时组件。 其中, 用于传递资源需求的 SMC消息中可包含对资源配置参数, 用于对所需 占用的资源规格进行描述。 资源配置参数可包括但不限于内存空间大小、 物理核的个数或 10 设备列表等, 在此不做更多示例。 这样, 通过在 REE的用户态下, 发起用于传递资源需求的 SMC 消息, 可将前述的资源配置参数传递至运行时组件。 继 续参考图 4,在步骤 402中,响应于 REE的用户态中所发起的用于传递资源需求的 SMC 消息, 运行时组件可为相应的 TEE OS编译资源配置文件。 而本实施例中提出, 可有运行时 组件负责基于资源配置文件为 TEE OS进行资源配置, 其中, 正如前文提及的, 运行时组件 运行在 EL3级别, 因此, 运行时组件具备对计算机中整个硬件资源的访问权限, 且可用于进 行硬件资源的调度。实际应用中,可由运行时组件中部署的 SPMD,来实施该资源配置过程, 本实施例并不限于此。 这样 , 本实施例中, 可在 REE的用户态为 TEE OS按需调整资源配置参数, 并通过向运 行时组件发起 SMC消息的方式,来驱使运行时组件在线为 TEE OS编译资源配置文件。因此, 本实施例中, 可支持 TEE OS的资源弹性配置。 在 TEE OS所分配到的资源过多的情况下, 可在 REE的用户态为 TEE OS调整资源配置参数, 并将调整后的资源配置参数通过 SMC消 息传递至运行时组件, 而运行时组件可为 TEE OS更新对应的资源配置文件, 在此基础上, 可对 TEE OS进行重新启动, 即可使更新后的资源配置文件生效, 从而为 TEE OS分配更少 的资源, 以解决资源浪费问题。 在 TEE OS所分配到的资源不足的情况下, 也可通过本实施 例提供的按需在线进行资源配置的技术构思, 来为 TEE OS分配更多的资源, 以提高 TEE OS 的性能。 由于本实施例中可支持对 TEE OS的资源配置参数进行多次编译, 为此, 本实施例中, 对于运行时组件来说, 若已经存在与 TEE OS对应的资源配置文件, 则可按照本次接收到的 用于传递资源需求的 SMC消息, 修改 TEE OS对应的资源配置文件, 从而实现资源配置文件 的更新。 另外, 值得强调的是, 本实施例中, 在 REE的用户态支持为 TEE OS进行资源配置参数 及镜像的按需在线编译, 发明人在研究过程中发现, TEE OS的镜像中可包含了一部分与资源 配置相关的配置内容, 因此, 本实施例中, 若在 REE的用户态为 TEE OS进行了资源配置参 数的调整, 则应同步调整 TEE OS镜像中相关的配置内容。 也即是, 运行时组件中的资源配 置文件与为 TEE OS编译完成的镜像中所描述的资源需求保持一致。 综上 , 本实施例中, 可支持在 REE的用户态下为 TEE OS在线编译资源配置参数, 并可 在将 TEE OS的镜像加载至指定内存地址之前, 将编译后的资源配置参数传递至运行时组件 中, 以供运行时组件为 TEE OS编译资源配置文件, 这样, 运行时组件可按照资源配置文件 为 TEE OS动态分配资源, 从而支持 TEE OS的资源弹性伸缩, 这可进一步改善 TEE OS的可 维护性, 更好地满足用户对 TEE OS所占用资源的灵活多变的规格要求。 通过 TEE OS的创 建及删除等动作, 可对系统资源进行按需申请和释放, 提高系统资源利用率。 图 5为本申请一示例性实施例提供的又一种 TEE OS的启动方法的逻辑示意图。参考图 5, 本实施例中仍遵照图 1所示的 TEE OS的启动流程, 本实施例中为在 REE的用户态下的处理 构思和运行时组件中的处理构思提供了示例性的实现方式。 先 来看 REE的用户态。 本实施例中提出了一种发起用于指示进行 TEE OS启动的安全模式调用 SMC消息的示例 性实现方式。 参考 图 5, 在该实现方式中, 可在 REE的用户态为 TEE OS所需占用的处理核创建触发 线程。 其中, 若 TEE OS需占用多个处理核, 则在 REE的用户态下为多个处理核 core分别创 建触发线程。 正如前文提及的, 可在 REE的用户态下为 TEE OS编译资源配置参数, 因此, REE 的用户态对 TEE OS所需占用的处理核是已知的, 基于此, 可在 REE的用户态下, 为 TEE OS所需占用的处理核分别创建触发线程。 实际应用中, 可调用 glibc中的 p thread_create 及 pthread_setaffinity_np等接口函数, 以在 REE的用户态中为处理核创建触发线程。 在该 实现方式中,触发线程是用于发起 SMC消息的,具体地,单个触发线程发起的 SMC 消息用于指示为 TEE OS启动相应的处理核。 值得说明的是, 这里, 启动处理核不再是冷启 动流程中的开核动作, 而是可理解为在相应的处理核为 TEE OS进行相关的初始化工作。 包 括但不限于内存初始化、 页表初始化、 VCPU 初始化、 镜像文件中相关代码的执行以及其它 需在该处理核上为 TEE OS运行做出的准备工作。 值得强调的是, 在该实现方式中, 用于指 示进行 TEE OS启动的 SMC消息并不会导致处理核的断电,也不会影响处理核上其它负载的 运行。 在该 实现方式中, 在创建触发线程的过程中: 可在 REE的用户态下创建与 TEE OS需占 用的处理核数量一致的触发线程; 并可为创建的各个触发线程分别配置处理核亲和度, 以通 过处理核亲和度形成触发线程与处理核之间的绑定关系。 实际应用中, 相互绑定的处理核和 触发线程之间的处理核亲和度足够高, 以支持按照处理核亲和度即可为触发线程唯一确定出 去所绑定的处理核。 当然, 还可采用其它方式来实现处理核与触发线程之间的绑定关系, 而 并不限于此, 在此不做更多示例。 这样 , 可在 REE的用户态下, 按照为 TEE OS所需占用的多个处理核设定的启动顺序, 依次运行多个处理核各自对应的触发线程, 以针对多个处理核分别发起 SMC消息。实际应用 中, 可通过添加互斥锁使得各个触发线程能够按照启动顺序运行。 其中, 发明人在研究过程 中发现, 在 TEE OS需要占用多个处理核的情况下, 通常会设定主核和从核, 且通常是先启 动主核, 再依次启动各个从核。 为此, 在该实现方式中, 可在 REE的用户态下, 按照先主后 从的顺序, 设定多个处理核之间的启动顺序。 这里再次强调的是, 这里的启动并不是开核动 作。 另外, 实际应用中, 在 REE的用户态下, 针对多个处理核分别发起的 SMC消息可以是 相同的, 主要是用于驱动运行时组件进入后续处理逻辑。 再来看运行时组件。 参考 图 5, 在该实现方式中, 在可信基础固件中针对主核和从核分别为运行时组件定义 了不同的引导流程。 运行时组件在接收到 REE的用户态下所发起的 SMC消息后, 可先判断 当前' SMC消息对应的是主核还是从核, 以便进入对应的引导流程。 为了支持运行时组件准确判断出接收到的 SMC消息对应的是主核还是从核,在一种示例 性的支持方案中: 可在 REE的用户态下, 为多个处理核中主核和从核分别配置核标识; 在第 一寄存器中分别记录属于主核的核标识和属于从核的核标识。 基于此, 运行时组件可访问第 一寄存器, 若识别到目标 SMC消息对应的处理核的核标识为属于主核的核标识, 则确定目标 SMC 消息对应的处理核为主核。 实际应用中, 第一寄存器可采用 mpidr寄存器, 通过记录各 个处理核之间的拓扑关系来表征处理核之间的主从关系。 当然, 这仅是示例性的, 在此对第 一寄存器不做限定。 以下将以运行时组件接收到目标 SMC消息为例,对运行时组件中为主核和从核分别定义 的引导流程进行详细说明。其中, 目标 SMC消息可以是针对 TEE OS所需占用的多个处理核 所分别发起的 SMC 消息中的任意一个。 参考 图 5, 对于运行时组件来说, 可在接收到目标 SMC消息后, 判断目标 SMC消息是 否对应于主核; 若是 , 则可执行与主核对应的引导流程; 若否 , 则可执行与从核对应的引导流程。 图 6为本申请一示例性实施例提供的一种与主核对应的示例性引导流程的示意图。 参考 图 6, 继续以目标 SMC消息为例, 若运行时组件确定目标 SMC消息对应于主核, 则可在目 标 SMC 消息的触发下, 执行前述的将在 REE的用户态下为 TEE OS编译完成的镜像加载至 指定内存地址的操作; 在完成镜像加载之后, 触发在可信执行环境 TEE中运行与主核对应的 初始化逻辑。也即是,可将图 2中的步骤 101放在主核对应的引导流程中进行执行。相应地, 前文提及的针对 TEEOS镜像进行的签名验签环节也可放在主核对应的引导流程中进行执行。 参考图 6, 按照主核的引导流程中, 运行时组件可在完成镜像加载操作之后, 触发在可信执 行环境 TEE中运行与主核对应的初始化逻辑。 应 当理解的是, 本实施例中, 针对与主核对应的 SMC消息, 运行时组件执行完前述的镜 像验签以及镜像加载操作之后, 引导 TEE中的相关组件开始运行与主核对应的初始化逻辑即 可, 运行时组件可只承担引导工作, 具体的初始化逻辑可由 TEE中的相关组件来实施。 在一种示例性的解决 方案中: 参考图 6, 可在 TEE中引入安全分区管理器, 例如前文提 及的 Hafnium等, 用以管理多个 TEE OSo 运行时组件可向 TEE中的安全分区管理器发送第 一触发通知, 已将主核的控制权转移至安全分区管理器; 安全分区管理器则可根据第一触发 通知对主核执行针对 TEE OS的初始化配置操作, 且在完成初始化配置操作后调用预设指令 以触发进入镜像中与主核对应的运行入口。 这里, 对主核执行针对 TEE OS的初始化配置操 作, 可包括但不限于内存初始化、 页表初始化及 VCPU初始化等, 在此不做穷举。 另外, 由 于多处理核的原因, TEE OS镜像中通常针对主核和从核提供不同的运行入口, 例如, 主核对 应的运行入口通常为 reset_primary函数, 而从核的运行入口则通常为 reset_secondary函数, 当然, 这仅是示例性的, 本实施例对此不做限定。 基于此, 实际应用中, 安全分区管理器可 通过调用 start函数 (TEE OS镜像的入口函数) 来触发 TEE OS的镜像运行, 之后, start函 数又可继续调用 reset函数,而 reset函数又可继续调用 reset_primary函数,从而得以运行 TEE OS 中与主核对应的镜像代码。 其中, 镜像的运行过程可位于前述的 ELI中进行。 当然, 以上在 TEE中执行的初始化逻辑仅是示例性的部分逻辑, 本实施例中, 还支持定 义其它初始化逻辑,例如,安全分区管理器在接收到第一触发通知后,可更新其管理的 TEE OS 的数量, 在监测到 TEEOS镜像中的相关镜像代码执行完成后, 重新接管对主核的控制权, 并 在主核上为 TEE OS启动所需的 VCPU等, 在此不做初始化逻辑的穷举。 至此可 完成在主核上与 TEE OS启动相关的工作。 还是 以目标 SMC消息为例, 若目标 SMC消息对应于从核, 运行时组件按照目标 SMC 消息执行与从核对应的引导流程, 以触发在可信执行环境 TEE中运行与从核对应的初始化逻 辑。 在 与从核对应的引导流程中, 运行时组件不再需要进行镜像的验签及加载操作, 这一点 区别于与主核对应的引导流程。 其它的则可参考与主核对应的引导流程。 同样, 在 TEE中存 在多个 TEE OS的情况下, 运行时组件按照目标 SMC消息, 向 TEE中用于管理 TEE OS的 安全分区管理器发送第二触发通知; 安全分区管理器根据第二触发通知对从核执行针对 TEE OS 的初始化配置操作,且在完成初始化配置操作后调用预设指令以触发进入镜像中与从核对 应的运行入口。 关于在 TEE 中运行与从核对应的初始化逻辑的过程, 与前述在 TEE 中运行与从核对应 的初始化逻辑的过程基本一致, 为节省篇幅, 在此不再重复赘述。 可知 , 本实施例中, REE的用户态可与运行时组件相互配合, 为 TEE OS完成在主核和 从核上的相关启动工作, 整个过程中并无需依赖 BIOS固件。 进一 步优选地,参考图 5,本实施例中,运行时组件在监测到针对当前处理核发起的 SMC 消息已完成处理流程后, 可向 REE的用户态返回流程结束通知; REE的用户态在接收到流程 结束通知后, 再针对下一个处理核发起 SMC消息。 实际应用中, 运行时组件在监测到针对当 前 SMC 消息的处理流程已经完成后, 可恢复 EL3层级上下文, 再调用 eret指令返回 REE中 的 OS kernel, 最终 REE中的自定义 CA可通过调用 TEEC_FinalizeContext接口函数, 结束 针对当前 SMC 消息的启动流程, 并可针对下一个处理核发起 SMC消息。 如此往复循环, 可 为 TEE OS在其所需占用的各个处理核上完成相关启动工作。 综上 ,本实施例中,可分别定义与主核和从核对应的引导流程,运行时组件可针对 TEE OS 所需占用的主核和从核分别执行相应的引导流程, 以与 TEE中的其它组件相互配合, 在 TEE OS 所需占用的主核和从核上分别完成与 TEE OS启动相关的工作, 以完成 TEE OS的启动。 整个过程无需依赖 BIOS固件, 而且, 相关组件各司其职, 配合流畅, 使得 TEE OS的启动效 率、 安全性、 准确性及可信性得以保障。 需要说明的是, 在上述实施例及附图中的描述的一些流程中, 包含了按照特定顺序出现 的多个操作, 但是应该清楚了解, 这些操作可以不按照其在本文中出现的顺序来执行或并行 执行, 操作的序号如 801、 802等, 仅仅是用于区分开各个不同的操作, 序号本身不代表任何 的执行顺序。 另外, 这些流程可以包括更多或更少的操作, 并且这些操作可以按顺序执行或 并行执行。 需要说明的是, 本文中的 “第一 " 、 "第二 "等描述, 是用于区分不同的触发通 知或寄存器等, 不代表先后顺序, 也不限定 “第一 "和 “第二 "是不同的类型。 图 7为本申请另一示例性实施例提供的一种计算设备的结构示意图。 如图 7所示, 该计 算设备包括: 存储器 70及处理器 71 o 处理器 71 , 与存储器 70耦合, 被设置为执行存储器 70中的计算机程序, 以用于: 在 常规执行环境 REE的用户态下,发起用于指示进行 TEE OS启动的安全模式调用 SMC 消息, 至可信基础固件中的运行时组件; 利 用所述运行时组件, 将在所述 REE的用户态下为所述 TEE OS编译完成的镜像加载至 指定内存地址; 利 用所述运行时组件, 按照所述 SMC消息触发在可信执行环境 TEE中运行所述指定内 存地址中的所述镜像, 以启动所述 TEE OSo 本实施例 中, 处理器中可包含多个处理核, 可由其中的一个或多个处理核执行存储器 70 中的上述计算机程序。 在一可选实施例 中, 处理器 71还可被设置为: 在将所述镜像加载至指定 内存地址之前, 在所述 REE的用户态下, 发起用于传递资源需 求的 SMC 消息, 至所述运行时组件; 利 用所述运行时组件, 为所述 TEE OS编译与所述资源需求相适配的资源配置文件, 以 供所述运行时组件按照所述资源配置文件为所述 TEE OS分配资源。 在一可选实施例 中, 处理器 71在利用所述运行时组件, 为所述 TEE OS编译与所述资源 需求相适配的资源配置文件时, 具体可被设置为: 若 已经存在与 TEE OS对应的资源配置文件, 则按照本次接收到的用于传递资源需求的 SMC 消息, 修改所述资源配置文件; 其 中, 修改后的所述资源配置文件与为所述 TEE OS编译完成的镜像中所描述的资源需 求保持一致。 在一可选实施例 中, 处理器 71在发起用于指示进行 TEE OS启动的安全模式调用 SMC 消息时, 具体可被设置为: 若所述 TEE OS需占用多个处理核, 则在所述 REE的用户态下为所述多个处理核分别创 建触发线程; 按照 为所述多个处理核设定的启动顺序,在所述 REE的用户态下依次运行所述多个处理 核各自对应的触发线程, 以针对所述多个处理核分别发起所述 SMC消息。 在一可选实施例 中,所述多个处理核包括主核和从核,处理器 71在利用所述运行时组件, 按照所述 SMC消息触发在可信执行环境 TEE中运行所述指定内存地址中的所述镜像时, 具 体可被设置为: 所述运行时组件在接收到 多条所述 SMC消息中的目标 SMC消息后,判断所述目标 SMC 消息是否对应于主核; 若所述 目标 SMC消息对应于主核, 利用所述运行时组件按照所述目标 SMC消息执行与 主核对应的引导流程, 以触发在可信执行环境 TEE中运行与主核对应的初始化逻辑; 其 中, 所述目标 SMC消息为所述多条 SMC消息中的任意一条。 在一可选实施例 中, 处理器 71在利用所述运行时组件按照所述目标 SMC消息执行与主 核对应的引导流程, 以触发在可信执行环境 TEE中运行与主核对应的初始化逻辑时, 具体可 被设置为: 在所述 目标 SMC消息的触发下, 利用运行时组件执行所述将在所述 REE的用户态下为 所述 TEE OS编译完成的镜像加载至指定内存地址的操作; 在 完成镜像加载之后, 利用运行时组件触发在可信执行环境 TEE中运行与主核对应的初 始化逻辑。 在一可选实施例 中, 所述处理器 71在利用运行时组件触发在可信执行环境 TEE中运行 与主核对应的初始化逻辑时, 具体可被设置为: 在所述 TEE中存在多个 TEE OS的情况下, 利用所述运行时组件按照所述目标 SMC消 息, 向 TEE中用于管理 TEE OS的安全分区管理器发送第一触发通知; 利 用所述安全分区管理器根据所述第一触发通知对所述主核执行针对所述 TEE OS的初 始化配置操作, 且在完成所述初始化配置操作后调用预设指令以触发进入所述镜像中与主核 对应的运行入口。 在一可选实施例 中, 处理器 71还可用于: 若所述 目标 SMC消息对应于从核, 利用所述运行时组件按照所述目标 SMC消息执行与 从核对应的引导流程, 以触发在可信执行环境 TEE中运行与从核对应的初始化逻辑。 在一可选实施例 中, 处理器 71在利用所述运行时组件按照所述目标 SMC消息执行与从 核对应的引导流程,以触发在可信执行环境 TEE中运行与从核对应的初始化逻辑时,可用于: 在所述 TEE中存在多个 TEE OS的情况下, 利用所述运行时组件按照所述目标 SMC消 息, 向 TEE中被设置为管理 TEE OS的安全分区管理器发送第二触发通知; 利 用所述安全分区管理器根据所述第二触发通知对所述从核执行针对所述 TEE OS的初 始化配置操作, 且在完成所述初始化配置操作后调用预设指令以触发进入所述镜像中与从核 对应的运行入口。 在一可选实施例 中, 处理器 71, 还可被设置为: 在所述 REE的用户态下, 为所述多个处理核中主核和从核分别配置核标识; 在 第一寄存器中分别记录属于主核的核标识和属于从核的核标识; 处理器 71在利用运行时组件判断所述目标 SMC消息对应的处理核是否为主核, 包括: 利 用所述运行时组件访问所述第一寄存器,若识别到所述目标 SMC消息对应的处理核的 核标识为属于主核的核标识, 则确定所述目标 SMC消息对应的处理核为主核。 在一可选实施例 中, 处理器 71在所述 REE的用户态下为所述多个处理核分别创建触发 线程时, 具体可被设置为: 在所述 REE的用户态下创建与所述 TEE OS需占用的处理核数量一致的触发线程; 为创建的各个触发线程分别配置处理核亲和度, 以通过处理核亲和度形成触发线程与处 理核之间的绑定关系。 在一可选实施例 中, 处理器 71还可被设置为: 利 用所述运行时组件在监测到针对当前处理核发起的 SMC消息已完成处理流程后,向所 述 REE的用户态返回流程结束通知; 所述 REE的用户态在接收到所述流程结束通知后,再针对下一个处理核发起 SMC消息。 在一可选实施例 中, 处理器 71还可被设置为: 利 用所述运行时组件从指定的寄存器中读取所述 REE的用户态为所述 TEE OS所编译的 镜像的存储地址; 对所述存储地址 中的镜像进行签名校验; 在确定所述镜像通过签名校验的情况下,再执行将所述镜像加载至指定内存地址的操作。 在一可选实施例 中, 处理器 71还可被设置为: 在所述 REE的用户态下, 调用 TEE驱动提供的自定义接口, 以利用所述自定义接口从 所述 REE的用户态下指定目录获取为所述 TEE OS编译完成的所述镜像, 并将所述镜像存储 至指定的缓冲区域中; 将所述缓冲 区域的地址配置至第二寄存器中; 其 中, 所述第二寄存器为所述 TEE驱动与所述运行时组件之间约定的缓冲区域的地址传 递媒介。 进一 步, 如图 7所示, 该计算设备还包括: 通信组件 72、 电源组件 73等其它组件。 图 7 中仅示意性给出部分组件, 并不意味着计算设备只包括图 7所示组件。 值得说 明的是, 上述关于计算设备各实施例中的技术细节, 可参考前述的方法实施例中 的相关描述, 为节省篇幅, 在此不再赘述, 但这不应造成本申请保护范围的损失。 相应地 , 本申请实施例还提供一种存储有计算机程序的计算机可读存储介质, 计算机程 序被执行时能够实现上述方法实施例中执行的各步骤。 上述 图 7中的存储器, 被设置为存储计算机程序, 并可被配置为存储其它各种数据以支 持在计算平台上的操作。 这些数据的示例包括用于在计算平台上操作的任何应用程序或方法 的指令, 联系人数据, 电话簿数据, 消息, 图片, 视频等。 存储器可以由任何类型的易失性 或非易失性存储设备或者它们的组合实现, 如静态随机存取存储器 (SRAM), 电可擦除可编 程只读存储器(EEPROM) ,可擦除可编程只读存储器(EPROM) ,可编程只读存储器(PROM) , 只读存储器 (ROM), 磁存储器, 快闪存储器, 磁盘或光盘。 上述 图 7中的通信组件, 被配置为便于通信组件所在设备和其他设备之间有线或无线方 式的通信。通信组件所在设备可以接入基于通信标准的无线网络,如 WiFi, 2G、 3G、 4G/LTE、 5G 等移动通信网络, 或它们的组合。 在一个示例性实施例中, 通信组件经由广播信道接收来 自外部广播管理系统的广播信号或广播相关信息。 在一个示例性实施例中, 所述通信组件还 包括近场通信 (NFC)模块, 以促进短程通信。 例如, 在 NFC模块可基于射频识别 (RFID) 技术, 红外数据协会 (IrDA) 技术, 超宽带 (UWB) 技术, 蓝牙 (BT) 技术和其他技术来 实现。 上述 图 7中的电源组件, 为电源组件所在设备的各种组件提供电力。 电源组件可以包括 电源管理系统, 一个或多个电源, 及其他与为电源组件所在设备生成、 管理和分配电力相关 联的组件。 本领域 内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。 因此, 本申请可采用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实施例的 形式。 而且, 本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储 介质 (包括但不限于磁盘存储器、 CD-ROM, 光学存储器等) 上实施的计算机程序产品的形 式。 本 申请是参照根据本申请实施例的方法、 设备(系统)、 和计算机程序产品的流程图和/ 或方框图来描述的。 应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/ 或方框、 以及流程图和 /或方框图中的流程和/或方框的结合。 可提供这些计算机程序指令 到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个 机器, 使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程 图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的装置。 这 些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工 作的计算机可读存储器中, 使得存储在该计算机可读存储器中的指令产生包括指令装置的制 造品, 该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指 定的功能。 这 些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机或 其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从而在计算机或其他可编 程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/ 或方框图一个方框或多 个方框中指定的功能的步骤。 还 需要说明的是, 术语 “包括” 、 “包含”或者其任何其他变体意在涵盖非排他性的包 含, 从而使得包括一系列要素的过程、 方法、 商品或者设备不仅包括那些要素, 而且还包括 没有明确列出的其他要素, 或者是还包括为这种过程、 方法、 商品或者设备所固有的要素。 在没有更多限制的情况下, 由语句 “包括一个 …… ” 限定的要素, 并不排除在包括所述要素 的过程、 方法、 商品或者设备中还存在另外的相同要素。 需要说 明的是, 本申请所涉及的用户信息 (包括但不限于用户设备信息、 用户个人信息 等) 和数据 (包括但不限于用于分析的数据、 存储的数据、 展示的数据等), 均为经用户授权 或者经过各方充分授权的信息和数据, 并且相关数据的收集、 使用和处理需要遵守相关国家 和地区的相关法律法规和标准, 并提供有相应的操作入口, 供用户选择授权或者拒绝。 以上所述仅为本申请的实施例而已, 并不用于限制本申请。 对于本领域技术人员来说, 本申请可以有各种更改和变化。 凡在本申请的精神和原理之内所作的任何修改、 等同替换、 改进等, 均应包含在本申请的保护范围之内。

Claims

权利 要 求 书
1、 一种 TEE OS的启动方法,, 包括: 在 常规执行环境 REE的用户态下,发起用于指示进行 TEE OS启动的安全模式调用 SMC 消息, 至可信基础固件中的运行时组件; 利 用所述运行时组件, 将在所述 REE的用户态下为所述 TEE OS编译完成的镜像加载至 指定内存地址; 利 用所述运行时组件, 按照所述 SMC消息触发在可信执行环境 TEE中运行所述指定内 存地址中的所述镜像, 以启动所述 TEE OSo
2、 根据权利要求 1所述的方法, 其中, 还包括: 在将所述镜像加载至指定 内存地址之前, 在所述 REE的用户态下, 发起用于传递资源需 求的 SMC 消息, 至所述运行时组件; 利 用所述运行时组件, 为所述 TEE OS编译与所述资源需求相适配的资源配置文件, 以 供所述运行时组件按照所述资源配置文件为所述 TEE OS分配资源。
3、 根据权利要求 2所述的方法, 其中, 利用所述运行时组件, 为所述 TEE OS编译与所 述资源需求相适配的资源配置文件, 包括: 若 已经存在与 TEE OS对应的资源配置文件, 则按照本次接收到的用于传递资源需求的 SMC 消息, 修改所述资源配置文件; 其 中, 修改后的所述资源配置文件与为所述 TEE OS编译完成的镜像中所描述的资源需 求保持一致。
4、 根据权利要求 1所述的方法, 其中, 发起用于指示进行 TEE OS启动的安全模式调用 SMC 消息, 包括: 若所述 TEE OS需占用多个处理核, 则在所述 REE的用户态下为所述多个处理核分别创 建触发线程; 按照 为所述多个处理核设定的启动顺序,在所述 REE的用户态下依次运行所述多个处理 核各自对应的触发线程, 以针对所述多个处理核分别发起所述 SMC消息。
5、 根据权利要求 4所述的方法, 其中, 所述多个处理核包括主核和从核, 利用所述运行 时组件, 按照所述 SMC消息触发在可信执行环境 TEE中运行所述指定内存地址中的所述镜 像, 包括: 所述运行时组件在接收到 多条所述 SMC消息中的目标 SMC消息后,判断所述目标 SMC 消息是否对应于主核; 若所述 目标 SMC消息对应于主核, 所述运行时组件按照所述目标 SMC消息执行与主核 对应的引导流程, 以触发在可信执行环境 TEE中运行与主核对应的初始化逻辑; 其 中, 所述目标 SMC消息为所述多条 SMC消息中的任意一条。
6、 根据权利要求 5所述的方法, 其中, 所述运行时组件按照所述目标 SMC消息执行与 主核对应的引导流程, 以触发在可信执行环境 TEE中运行与主核对应的初始化逻辑, 包括: 在所述 目标 SMC消息的触发下, 执行所述将在所述 REE的用户态下为所述 TEE OS编 译完成的镜像加载至指定内存地址的操作; 在 完成镜像加载之后, 触发在可信执行环境 TEE中运行与主核对应的初始化逻辑。
7、 根据权利要求 6所述的方法, 其中, 所述运行时组件触发在可信执行环境 TEE中运 行与主核对应的初始化逻辑, 包括: 在所述 TEE中存在多个 TEE OS的情况下, 所述运行时组件按照所述目标 SMC消息, 向 TEE中被设置为管理 TEE OS的安全分区管理器发送第一触发通知; 所述安 全分区管理器根据所述第一触发通知对所述主核执行针对所述 TEE OS的初始化 配置操作, 且在完成所述初始化配置操作后调用预设指令以触发进入所述镜像中与主核对应 的运行入口。
8、 根据权利要求 5所述的方法, 其中, 还包括: 若所述 目标 SMC消息对应于从核, 所述运行时组件按照所述目标 SMC消息执行与从核 对应的引导流程, 以触发在可信执行环境 TEE中运行与从核对应的初始化逻辑。
9、 根据权利要求 8所述的方法, 其中, 所述运行时组件按照所述目标 SMC消息执行与 从核对应的引导流程, 以触发在可信执行环境 TEE中运行与从核对应的初始化逻辑, 包括: 在所述 TEE中存在多个 TEE OS的情况下, 所述运行时组件按照所述目标 SMC消息, 向 TEE中被设置为管理 TEE OS的安全分区管理器发送第二触发通知; 所述安 全分区管理器根据所述第二触发通知对所述从核执行针对所述 TEE OS的初始化 配置操作, 且在完成所述初始化配置操作后调用预设指令以触发进入所述镜像中与从核对应 的运行入口。
10、 根据权利要求 5所述的方法, 其中, 在所述 REE的用户态下, 为所述多个处理核中主核和从核分别配置核标识; 在 第一寄存器中分别记录属于主核的核标识和属于从核的核标识; 判 断所述目标 SMC消息对应的处理核是否为主核, 包括: 所述运行 时组件访问所述第一寄存器,若识别到所述目标 SMC消息对应的处理核的核标 识为属于主核的核标识, 则确定所述目标 SMC消息对应的处理核为主核。
11、 根据权利要求 4所述的方法, 其中, 在所述 REE的用户态下为所述多个处理核分别 创建触发线程, 包括: 在所述 REE的用户态下创建与所述 TEE OS需占用的处理核数量一致的触发线程; 为创建的各个触发线程分别配置处理核亲和度, 以通过处理核亲和度形成触发线程与处 理核之间的绑定关系。
12、 根据权利要求 4所述的方法, 其中, 还包括: 所述运行 时组件在监测到针对当前处理核发起的 SMC 消息已完成处理流程后, 向所述 REE 的用户态返回流程结束通知; 所述 REE的用户态在接收到所述流程结束通知后,再针对下一个处理核发起 SMC消息。 19
13、 根据权利要求 1所述的方法, 其中, 还包括: 利 用所述运行时组件从指定的寄存器中读取所述 REE的用户态为所述 TEE OS所编译的 镜像的存储地址; 对所述存储地址 中的镜像进行签名校验; 在确定所述镜像通过签名校验的情况下,再执行将所述镜像加载至指定内存地址的操作。
14、 根据权利要求 1所述的方法, 其中, 还包括: 在所述 REE的用户态下, 调用 TEE驱动提供的自定义接口, 以利用所述自定义接口从 所述 REE的用户态下指定目录获取为所述 TEE OS编译完成的所述镜像, 并将所述镜像存储 至指定的缓冲区域中; 将所述缓冲 区域的地址配置至第二寄存器中; 其 中, 所述第二寄存器为所述 TEE驱动与所述运行时组件之间约定的缓冲区域的地址传 递媒介。
15、 一种计算设备,, 包括存储器和处理器; 所述存储器被设置 为存储一条或多条计算机指令; 所述处理 器与所述存储器耦合, 被设置为执行所述一条或多条计算机指令, 以执行权利 要求 1-14任一项所述的 TEE OS的启动方法。
16、一种存储计算机指令的计算机可读存储介质,, 当所述计算机指令被一个或多个处理 器执行时,致使所述一个或多个处理器执行权利要求 1-14任一项所述的 TEE OS的启动方法。
PCT/IB2024/061559 2023-12-20 2024-11-19 一种tee os的启动方法、设备及存储介质 Pending WO2025133751A2 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311766515.8A CN120179339A (zh) 2023-12-20 2023-12-20 一种tee os的启动方法、设备及存储介质
CN202311766515.8 2023-12-20

Publications (2)

Publication Number Publication Date
WO2025133751A2 true WO2025133751A2 (zh) 2025-06-26
WO2025133751A3 WO2025133751A3 (zh) 2025-07-17

Family

ID=96036359

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/IB2024/061559 Pending WO2025133751A2 (zh) 2023-12-20 2024-11-19 一种tee os的启动方法、设备及存储介质

Country Status (2)

Country Link
CN (1) CN120179339A (zh)
WO (1) WO2025133751A2 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120803668A (zh) * 2025-09-08 2025-10-17 武汉启云方科技有限公司 资源调度方法、装置及设备

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20160127478A (ko) * 2015-04-27 2016-11-04 삼성전자주식회사 소프트웨어 업데이트 방법 및 시스템
US10740496B2 (en) * 2017-02-13 2020-08-11 Samsung Electronics Co., Ltd. Method and apparatus for operating multi-processor system in electronic device
CN113239329B (zh) * 2021-04-19 2024-03-19 南京大学 一种用于移动端应用程序的可信执行环境的实现系统
CN116881901A (zh) * 2021-11-11 2023-10-13 荣耀终端有限公司 业务处理的方法和相关装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120803668A (zh) * 2025-09-08 2025-10-17 武汉启云方科技有限公司 资源调度方法、装置及设备

Also Published As

Publication number Publication date
CN120179339A (zh) 2025-06-20
WO2025133751A3 (zh) 2025-07-17

Similar Documents

Publication Publication Date Title
JP6892729B2 (ja) コード実行要請ルーティング
EP3073373B1 (en) Method for interruption affinity binding of virtual network interface card, and computer device
US10884787B1 (en) Execution guarantees in an on-demand network code execution system
CN100580628C (zh) 操作系统友好引导加载器
US11875174B2 (en) Method and apparatus for virtual machine emulator upgrading virtualization emulator
US20200053022A1 (en) Network-accessible data volume modification
CN108064377B (zh) 一种多系统共享内存的管理方法及装置
WO2012100535A1 (zh) 超级内核组件的升级方法和计算机系统
US10037298B2 (en) Network-accessible data volume modification
JP2017534107A (ja) 動的コードデプロイメント及びバージョニング
CN116521209B (zh) 操作系统的升级方法及装置、存储介质及电子设备
CN113360893B (zh) 基于容器的智能合约执行方法、装置及存储介质
KR20110080448A (ko) 애플리케이션 구축 시스템 및 그 방법
CN120179339A (zh) 一种tee os的启动方法、设备及存储介质
CN116627644A (zh) 计算资源调度方法、装置、设备及存储介质
US20210392091A1 (en) User-mode protocol stack-based network isolation method and device
WO2015165057A1 (zh) 一种硬盘执行应用代码的方法及装置
CN112559190A (zh) 异构系统间的资源分配方法、系统、装置、设备及介质
AU2017290693B2 (en) Network-accessible data volume modification
CN113239347B (zh) 一种适用于tee安全应用实例的启动方法及装置
WO2023125482A1 (zh) 集群管理方法、设备及计算系统
KR102268796B1 (ko) 하이퍼바이저 기반 plc 서비스 처리 장치
CN120011001B (zh) 一种轻量化的虚拟化实现方法及装置
CN119759485A (zh) 云平台上的嵌入式实时操作系统虚拟机创建方法及装置
JP7327057B2 (ja) コンテナ制御装置、コンテナ制御方法、およびコンテナ制御プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24906706

Country of ref document: EP

Kind code of ref document: A2