WO2022077388A1 - 一种处理器的安全度量装置及方法 - Google Patents

一种处理器的安全度量装置及方法 Download PDF

Info

Publication number
WO2022077388A1
WO2022077388A1 PCT/CN2020/121303 CN2020121303W WO2022077388A1 WO 2022077388 A1 WO2022077388 A1 WO 2022077388A1 CN 2020121303 W CN2020121303 W CN 2020121303W WO 2022077388 A1 WO2022077388 A1 WO 2022077388A1
Authority
WO
WIPO (PCT)
Prior art keywords
processor
information
instruction
security
address information
Prior art date
Application number
PCT/CN2020/121303
Other languages
English (en)
French (fr)
Inventor
潘时林
周梓铭
贾民虎
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN202080008627.5A priority Critical patent/CN114641769A/zh
Priority to EP20957167.8A priority patent/EP4209947A4/en
Priority to PCT/CN2020/121303 priority patent/WO2022077388A1/zh
Publication of WO2022077388A1 publication Critical patent/WO2022077388A1/zh
Priority to US18/301,238 priority patent/US20230259636A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1433Vulnerability analysis

Definitions

  • the present application provides a security measuring device and method for a processor, which improves the security of processor operation by measuring the security of executing instructions during the running process of the processor.
  • the present application adopts the following technical solutions.
  • a security measurement device for a processor comprising: a processor for executing instructions in a memory; an access controller for controlling a processor tracker to access a first storage area in the memory, A storage area may be an access area pre-allocated by the access controller to the processor tracker, and the processor cannot access the first storage area; the processor tracker is used to obtain the first instruction in the instructions (the first instruction may be a The first address information of the instruction sequence (that is, including a plurality of ordered instructions) in the memory, and the first address information is stored in the first storage area, for example, the access controller stores the first address information to the processor tracker.
  • the legal address range may be preset, or the processor may send the legal address range to the security protection system during startup, so that the security protection system 104 obtains the legal address range.
  • the methods for determining the security of the first instruction provided by the above two possible implementation manners are simple and effective.
  • the first instruction is the instruction of the current instruction of the processor, so that by measuring the security of the first instruction, the security of the processor can be guaranteed. sex.
  • the first instruction includes an instruction to monitor the thread; the security protection system is further configured to send interrupt information to the processor, where the interrupt information is used to instruct the processor to start the monitor thread, and the interrupt
  • the information can be non-maskable interrupt information, that is, the interrupt information cannot be prohibited, and the processor will immediately execute the task corresponding to the interrupt information when it receives the interrupt information; the processor is also used to start when receiving the interrupt information.
  • the instruction of the monitoring thread is used to trigger the processor tracer through the monitoring thread; the processor tracer is further configured to store the first address information in the first storage area based on the triggering of the monitoring thread.
  • the security protection system can trigger the processor tracker to store the first address information in the first storage area by sending interrupt information to the processor, so that the security protection system can delete the first address information from the first storage area.
  • the first address information is acquired, and the security of the first instruction is measured based on the first address information, thereby improving the accuracy and effectiveness of the security measurement, thereby ensuring the security of the processor operation.
  • the security protection system is further configured to send interrupt information to the processor when it is determined that the preset condition is met.
  • the preset condition may be one of the following: a specified event occurs, and the preset time period for sending the interrupt information is reached.
  • the designated events include but are not limited to: face recognition events, fingerprint recognition events, unlocking events, payment events, data rewriting events, or first login events, etc.
  • the preset duration may be set in advance, for example, the preset duration may be a fixed value, or may be multiple values that vary (for example, each value corresponds to a different time period).
  • the processor is further configured to: perform a security check on the running state information of the processor through the monitoring thread to obtain a check result, and send the check result to the security protection system.
  • the processor in the case of determining that the monitoring thread is safe, can also perform a security check on the running status information of the processor through the monitoring thread, so as to monitor and detect the fine-grained status information of the processor. This further ensures the security of the processor's operation.
  • the memory further includes a second storage area for storing image information of the processor, where the image information includes instructions executed by the processor.
  • the image information may include multiple images on the processor.
  • the corresponding instructions of an application or program, as well as the system files and boot files of the processor, etc.; the security protection system is also used to obtain image information from the second storage area, and measure the integrity of the image information.
  • the security protection system can ensure the security of various software running on the processor by measuring the integrity of the image information of the processor, thereby ensuring the security of the processor's operation.
  • the security protection system is further configured to: after determining that the processor is unsafe (for example, the first instruction is unsafe, the running state information of the processor is unsafe, or the image information is incomplete) , perform a security protection operation on the processor, where the security protection operation may include but is not limited to: triggering an alarm, resetting the processor, rejecting the service requested by the software, instructing the processor to stop running, instructing the processor to stop running the software, prohibiting processing at least part of the functionality of the software running on the server, or prevent the software from accessing data stored in the memory, and the like.
  • the security protection operation may include but is not limited to: triggering an alarm, resetting the processor, rejecting the service requested by the software, instructing the processor to stop running, instructing the processor to stop running the software, prohibiting processing at least part of the functionality of the software running on the server, or prevent the software from accessing data stored in the memory, and the like.
  • a method for measuring security of a processor comprising: the processor executes an instruction in a memory; an access controller controls a processor tracker to access a first storage area in the memory, and the first storage area may be an access The controller pre-allocates the access area of the processor tracker, and the processor cannot access the first storage area; the processor tracker obtains the first instruction in the instructions executed by the processor (the first instruction may be an instruction sequence, that is, it includes multiple Ordered instructions) the first address information in the memory, and store the first address information in the first storage area, for example, the access controller to the processor tracker stores the first address information in the first storage area
  • the step is to perform access authentication, and after the authentication is passed, it is allowed to store the first address information in the first storage area; the security protection system obtains the first address information from the first storage area, and measures the first address information based on the first address information.
  • measuring the security of the first instruction based on the first address information includes: when the first address information is within a legal address range (for example, the legal address range includes multiple address information , when the first address information is consistent with one of the multiple address information), the first instruction is determined to be safe; or, when the first address information is not within the legal address range (for example, the legal address range includes multiple address information) , when the first address information is inconsistent with each of the plurality of address information), it is determined that the first instruction is not safe.
  • measuring the security of the first instruction based on the first address information includes: when the first address information is within the legal address range, and the first instruction and the first instruction within the legal address range When the two instructions are consistent, the first instruction is determined to be safe; or, when the first address information is not within the legal address range, or the first instruction is inconsistent with the second instruction within the legal address range, the first instruction is determined to be unsafe.
  • the instructions in the memory include instructions for monitoring threads
  • the method further includes: the security protection system sends interrupt information to the processor, where the interrupt information is used to instruct the processor to start the monitoring thread, the The interrupt information can be non-maskable interrupt information, that is, the interrupt information cannot be prohibited, and the processor will immediately execute the task corresponding to the interrupt information when it receives the interrupt information; when the processor receives the interrupt information, it will start the monitoring thread. instruction, and triggers the processor tracer through the monitoring thread; the processor tracer stores the first address information in the first storage area based on the triggering of the monitoring thread.
  • the security protection system is further configured to send interrupt information to the processor when it is determined that the preset condition is met.
  • the preset condition may be one of the following: a specified event occurs, and the preset time period for sending the interrupt information is reached.
  • the designated events include but are not limited to: face recognition events, fingerprint recognition events, unlocking events, payment events, data rewriting events, or first login events, etc.
  • the preset duration may be set in advance, for example, the preset duration may be a fixed value, or may be multiple values that vary (for example, each value corresponds to a different time period).
  • the method further includes: the processor performs a security check on the running state information of the processor through a monitoring thread to obtain a check result, and sends the check result to the security protection system. That is, when it is determined that the monitoring thread is safe, the processor can also perform a security check on the running status information of the processor through the monitoring thread, so as to monitor and detect fine-grained status information of the processor.
  • the memory further includes a second storage area for storing image information of the processor, where the image information includes instructions executed by the processor.
  • the image information may include multiple images on the processor.
  • the method further includes: the security protection system obtains mirror information from the second storage area, and measures the integrity of the mirror information.
  • the security protection system measures the integrity of the image information, including: performing a hash operation on the image information to obtain a hash value; comparing the hash value with a preset hash value; When the hash value is consistent with the preset hash value, it is determined that the mirror information is complete; or, when the hash value is inconsistent with the preset hash value, it is determined that the mirror information is incomplete.
  • FIG. 4 is a schematic diagram of software running on a processor provided by an embodiment of the present application.
  • At least one means one or more
  • plural means two or more.
  • And/or which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural.
  • At least one item(s) below or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s).
  • the security measure generally refers to measuring the integrity of the system and/or information, and the integrity of the system at least includes the integrity of the system image.
  • the security metric may include integrity check during system startup and integrity check during system operation, and the embodiments of the present application mainly relate to integrity check during system operation.
  • the integrity check when the server system is running is usually implemented by using a trusted platform module (trust platform module, TPM) or a trusted platform control module (trust platform control module, TPCM).
  • TPM trusted platform module
  • TPCM trusted platform control module
  • TPM mainly performs security measurement by starting the trust chain measurement and remote attestation, that is, TPM measures each level of mirroring level by level according to the system startup process.
  • the image can be stored in the memory
  • the program counter (PC) pointer can indicate the location of the image in the memory, for each level of image, the hash value of the image can be calculated, and the This is achieved by reporting the hash value to a trusted server for verification.
  • the processor is taken as a central processing unit (Central Processing Unit, CPU) as an example for description.
  • CPU Central Processing Unit
  • the security measurement device 100 may be located within an electronic device or may also be the electronic device itself.
  • the electronic devices include, but are not limited to, personal computers, server computers, handheld or laptop devices, mobile devices (such as cell phones, mobile phones, tablet computers, personal digital assistants, media players, etc.), wearable devices, in-vehicle devices, Consumer electronics, minicomputers, mainframe computers, mobile robots, drones, etc.
  • a typical form of the electronic device is a terminal device, such as the mobile phone.
  • the security measurement device 100 may specifically be a chip or a chip set or a circuit board equipped with a chip or a chip set, and the chip or a chip set or a circuit board equipped with a chip or a chip set can work under necessary software driving.
  • the security measurement device 100 includes a processor 101 , a processor tracker 102 , an access controller 103 and a security protection system 104 .
  • the processor 101, the processor tracker 102 and the access controller 103 may be integrated in a system on a chip (System of Chip, SoC); the security protection system 104 may be integrated in the SoC, or may not be integrated in the SoC, In FIG. 3 , the safety protection system 104 is integrated in the SoC as an example for illustration, but it is not intended to be limiting.
  • the security measurement apparatus 100 may further include a memory 105, and the memory 105 may be integrated in the SoC or not. In FIG. 3, the memory 105 is not integrated in the SoC as an example for illustration.
  • the access controller may allocate different access address spaces for the processor 101 and the processor tracker 102 , and the different access address spaces correspond to different storage areas in the memory 105 .
  • the access controller 103 can perform access authentication to it, so as to ensure that the processor 101 and the processor tracker 102 can only access the memory 105 in the corresponding allowed state. Access within the address space.
  • the processor 101 is used to execute the instructions in the memory 105; the processor tracker 102 is used to obtain the first address information of the first instruction in the memory 105, and to store the first address information in the memory 105.
  • the access controller 103 is used to control the processor tracer 102 to access the first storage area in the memory 105, and the first storage area may be pre-allocated by the access controller 103 to the processor tracer If the processor 101 cannot access the first storage area, for example, when the processor tracer 102 writes the first address information into the first storage area, the access controller 103 is used to access the processor tracer 102
  • the access (that is, the operation of writing the first address information in the first storage area) is authenticated, and after authentication, the processor tracker 102 is allowed to store the first address information in the first storage area; security protection system 104 is configured to acquire the first address information from the first storage area, and measure the security of the first instruction based on the first address information.
  • the above-mentioned first instruction may be an instruction, or may be an instruction sequence (ie, including a plurality of ordered instructions).
  • the processor tracker 102 may be provided with an address cache space, and 4KB of address information may be cached in the address cache space, so that the processor tracker 102 can acquire one or more of the instructions in real time, and store the The one or more instructions are stored in the address cache space.
  • the processor tracker 102 is used to track and capture the first address information of the first instruction executed by the processor 101, and the first address information of the first instruction executed by the processor 101 is tracked and captured, and the controller is accessed by accessing the controller.
  • 103 Control the processor tracker 102 to store the first address information in the first storage area in the memory 105. Since the first instruction is the instruction currently executed by the processor 101, and the processor 101 cannot access the first storage area, the hacker The information in the first storage area cannot be tampered with by the processor 101.
  • the process of triggering the processor tracker 102 by the processor 101 through the monitoring thread may include: the processor 101 writes a designated register through the monitoring thread, for example, setting the value of the designated register to 1 through the monitoring thread, and the value of the designated register is set to 1 through the monitoring thread.
  • the initial value can be 0 by default, and the specified register can be configured in advance; the processor tracker 102 determines whether to be triggered by detecting the value of the specified register. For example, if it is detected that the value of the specified register is set to 1, it is determined to be triggered. , if it is detected that the value of the instruction register is not 1, it is determined that it is not triggered.
  • the method further includes: S209 .
  • the security protection system 104 acquires the mirror information from the second storage area, and measures the integrity of the mirror information.
  • the specific process for the security protection system 104 to measure the integrity of the image information may be: perform a hash operation on the image information to obtain a hash value; compare the hash value with a preset hash value; When the value is consistent with the preset hash value, it is determined that the image information is complete, or, when the hash value is inconsistent with the preset hash value, it is determined that the image information is incomplete; further, if it is determined that the image information is incomplete If the information is incomplete, the above security protection operations can be performed.
  • the above-mentioned step S209 may be located after S208 and before S205, and after the measurement result is that the mirror information is complete, the interrupt information is sent to the processor 101 through the above-mentioned S205.

Abstract

一种处理器的安全度量装置及方法,涉及电子技术领域,用于提供处理器运行时的安全性。该安全度量装置包括:处理器(101),用于运行存储器(105)中的指令;访问控制器(103),用于控制处理器跟踪器(102)访问存储器(105)中的第一存储区域,处理器(101)无法访问第一存储区域;处理器跟踪器(102),用于获取所述指令中第一指令在存储器(105)中的第一地址信息,并将第一地址信息存储在第一存储区域中;安全防护系统(104),用于从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性。

Description

一种处理器的安全度量装置及方法 技术领域
本申请涉及电子技术领域,尤其涉及一种处理器的安全度量装置及方法。
背景技术
随着通信技术的发展和移动终端的普及,以及移动终端本身的开放性和灵活性,其中系统的安全问题逐渐显露出来,因此存在设计具有安全度量功能的移动终端的需求。安全度量通常是指度量系统和/或信息的完整性,系统的完整性至少包括系统镜像(image)的完整性。当前移动终端系统镜像的完整性主要是在启动过程中通过安全启动校验签名来保证,但对于系统运行时镜像的完整性校验尚无措施。
目前,应用于服务器系统运行时的完整性校验通常是采用可信平台模块(trust platform module,TPM)或者可信平台控制模块(trust platform control module,TPCM)来实现。其中,TPM和TPCM采用的度量方法都是使用哈希算法对待度量的程序进行哈希计算,然后将哈希计算结果与设定的哈希值(比如,多个合法的哈希值)进行比较,如果哈希计算结果与设定的哈希值一致,则认为系统运行时的镜像是完整的。TPM和TPCM的区别仅在于,TPM是将哈希计算结果上报至可信服务器,由可信服务器执行校验,而TPCM通常则是基于可信服务器的配置规则在本地执行校验。
但是,上述安全度量方式存在绕过攻击的危险。比如,黑客不修改原始的系统镜像,而是绕过该系统镜像去运行一个假系统镜像,从而破坏系统的完整性,但由于原始的系统镜像并没有发生变动,从而安全度量模块会认为系统镜像是完整的。因此,如何提高系统运行的安全性仍然成为一个问题。
发明内容
本申请提供一种处理器的安全度量装置及方法,通过度量处理器运行过程中执行指令的安全性,从而提高处理器运行的安全性。为达到上述目的,本申请采用如下技术方案。
第一方面,提供一种处理器的安全度量装置,该装置包括:处理器,用于运行存储器中的指令;访问控制器,用于控制处理器跟踪器访问存储器中的第一存储区域,第一存储区域可以是访问控制器预先分配给处理器跟踪器的访问区域,处理器无法访问第一存储区域;处理器跟踪器,用于获取所述指令中第一指令(第一指令可以是一个指令序列,即包括多个有序的指令)在存储器中的第一地址信息,并将第一地址信息存储在第一存储区域中,比如,访问控制器对处理器跟踪器将第一地址信息存储在第一存储区域的步骤进行访问鉴权,并在鉴权通过后允许其将第一地址信息存储在第一存储区域;安全防护系统,用于从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性。
上述技术方案中,通过在处理器的运行过程中,使用处理器跟踪器跟踪抓取处理器执行的第一指令的第一地址信息,并通过访问控制器的访问鉴权后由处理器跟踪器将第一地址信息存储在存储器中的第一存储区域中,由于第一指令是处理器当前执行 的指令,且处理器无法访问第一存储区域,从而黑客无法通过处理器篡改第一存储区域中的信息,这样安全防护系统从第一存储区域中获取的第一地址信息后,可基于第一地址信息度量第一指令的安全性,从而提高了安全度量的准确性和有效性,进而保证处理器运行的安全性。
在第一方面的一种可能的实现方式中,安全防护系统、处理器、处理器跟踪器和访问控制器位于片上系统SoC中。上述可能的实现方式中,通过将该安全度量装置中的各单元集成在SoC中,可以降低端到端的通信时延,减小该安全度量装置的面积,降低成本。
在第一方面的一种可能的实现方式中,安全防护系统还用于:当第一地址信息在合法地址范围以内(比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的一个地址信息一致)时,确定第一指令安全;或者,当第一地址信息不在合法地址范围以内(比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的每个地址信息均不一致)时,确定第一指令不安全。
在第一方面的另一种可能的实现方式中,安全防护系统还用于:当第一地址信息在合法地址范围以内、且第一指令与合法地址范围内的第二指令一致时,确定第一指令安全;或者,当第一地址信息不在合法地址范围以内、或第一指令与合法地址范围内的第二指令不一致时,确定第一指令不安全。
其中,该合法地址范围可以是预先设置的,或者处理器在启动过程中可以将该合法地址范围发送给安全防护系统,以使安全防护系统104获取到该合法地址范围。上述两种可能的实现方式提供的确定第一指令的安全性的方式简单且有效,第一指令是处理器当前指令的指令,从而通过度量第一指令的安全性,可以保证处理器运行的安全性。
在第一方面的一种可能的实现方式中,第一指令包括监控线程的指令;安全防护系统,还用于向处理器发送中断信息,该中断信息用于指示处理器启动监控线程,该中断信息可以是不可屏蔽中断信息,即该中断信息是无法禁止的,处理器在接收到该中断信息时会立即执行该中断信息对应的任务;处理器,还用于在接收到中断信息时,启动监控线程的指令,并通过监控线程触发处理器跟踪器;处理器跟踪器,还用于基于监控线程的触发,将第一地址信息存储在第一存储区域中。上述可能的实现方式中,安全防护系统可以通过向处理器发送中断信息的方式,触发处理器跟踪器将第一地址信息存储在第一存储区域中,从而使得安全防护系统从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性,从而提高了安全度量的准确性和有效性,进而保证处理器运行的安全性。
进一步的,安全防护系统还用于:在确定满足预设条件时,向处理器发送中断信息。其中,该预设条件可以为以下中的一种:发生指定事件,达到发送该中断信息的预设时长。其中,该指定事件包括但不限于:人脸识别事件、指纹识别事件、解锁事件、支付事件、数据改写事件或者首次登录事件等。另外,该预设时长可以事先进行设置,比如,该预设时长可以是一个固定值,也可以是变化的多个值(比如,每个值对应不同的时间段)。
在第一方面的一种可能的实现方式中,处理器还用于:通过监控线程对处理器的 运行状态信息做安全检查,以得到检查结果,并向安全防护系统发送检查结果。上述可能的实现方式中,在确定监控线程安全的情况下,处理器还可以通过监控线程对处理器的运行状态信息做安全检查,从而实现对处理器的细粒度的状态信息的监控和检测,进而进一步保证处理器运行的安全性。
在第一方面的一种可能的实现方式中,存储器还包括用于存储处理器的镜像信息的第二存储区域,镜像信息包括处理器运行的指令,比如,该镜像信息可以包括处理器上多个应用或程序对应指令、以及处理器的系统文件和引导文件等;安全防护系统,还用于从第二存储区域获取镜像信息,并度量镜像信息的完整性。上述可能的实现方式中,安全防护系统通过度量处理器的镜像信息的完整性,可以保证处理器上运行的各种软件的安全性,进而保证处理器运行的安全性。
在第一方面的一种可能的实现方式中,安全防护系统还用于:对镜像信息做哈希运算以得到哈希值;比较哈希值与预设哈希值;当哈希值与预设哈希值一致时,确定镜像信息是完整的;或者,当哈希值与预设哈希值不一致时,确定镜像信息是不完整的。上述可能的实现方式中,安全防护系统通过计算镜像信息的哈希值,并基于该哈希值和预设哈希值是否一致确定镜像信息的完整性,从而降低了确定镜像信息的完整性的难度,提高了完整性检验的速率。
在第一方面的一种可能的实现方式中,安全防护系统还用于:在确定处理器不安全(比如,第一指令不安全、处理器的运行状态信息不安全、或者镜像信息不完整)时,对处理器执行安全保护操作,这里的安全保护操作可以包括但不限于:触发告警、复位处理器、拒绝软件所请求的服务、指示处理器停止运行、指示处理器停止运行软件、禁止处理器运行的软件的至少部分功能、或阻止软件访问存储器内存储的数据等。通过对处理器执行安全保护操作,可以保证处理器的安全性。
第二方面,提供一种处理器的安全度量方法,该方法包括:处理器运行存储器中的指令;访问控制器控制处理器跟踪器访问存储器中的第一存储区域,第一存储区域可以是访问控制器预先分配给处理器跟踪器的访问区域,处理器无法访问第一存储区域;处理器跟踪器获取处理器运行的指令中第一指令(第一指令可以是一个指令序列,即包括多个有序的指令)在存储器中的第一地址信息,并将第一地址信息存储在第一存储区域中,比如,访问控制器对处理器跟踪器将第一地址信息存储在第一存储区域的步骤进行访问鉴权,并在鉴权通过后允许其将第一地址信息存储在第一存储区域;安全防护系统从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性。
在第二方面的一种可能的实现方式中,基于第一地址信息度量第一指令的安全性,包括:当第一地址信息在合法地址范围以内(比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的一个地址信息一致)时,确定第一指令安全;或者,当第一地址信息不在合法地址范围以内(比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的每个地址信息均不一致)时,确定第一指令不安全。
在第二方面的一种可能的实现方式中,基于第一地址信息度量第一指令的安全性,包括:当第一地址信息在合法地址范围以内、且第一指令与合法地址范围内的第二指 令一致时,确定第一指令安全;或者,当第一地址信息不在合法地址范围以内、或第一指令与合法地址范围内的第二指令不一致时,确定第一指令不安全。
在第二方面的一种可能的实现方式中,存储器中的指令包括监控线程的指令,方法还包括:安全防护系统向处理器发送中断信息,该中断信息用于指示处理器启动监控线程,该中断信息可以是不可屏蔽中断信息,即该中断信息是无法禁止的,处理器在接收到该中断信息时会立即执行该中断信息对应的任务;处理器在接收到中断信息时,启动监控线程的指令,并通过监控线程触发处理器跟踪器;处理器跟踪器基于监控线程的触发,将第一地址信息存储在第一存储区域中。进一步的,安全防护系统还用于:在确定满足预设条件时,向处理器发送中断信息。其中,该预设条件可以为以下中的一种:发生指定事件,达到发送该中断信息的预设时长。其中,该指定事件包括但不限于:人脸识别事件、指纹识别事件、解锁事件、支付事件、数据改写事件或者首次登录事件等。另外,该预设时长可以事先进行设置,比如,该预设时长可以是一个固定值,也可以是变化的多个值(比如,每个值对应不同的时间段)。
在第二方面的一种可能的实现方式中,该方法还包括:处理器通过监控线程对处理器的运行状态信息做安全检查,以得到检查结果,向安全防护系统发生检查结果。即在确定监控线程安全的情况下,处理器还可以通过监控线程对处理器的运行状态信息做安全检查,从而实现对处理器的细粒度的状态信息的监控和检测。
在第二方面的一种可能的实现方式中,存储器还包括用于存储处理器的镜像信息的第二存储区域,镜像信息包括处理器运行的指令,比如,该镜像信息可以包括处理器上多个应用或程序对应指令、以及处理器的系统文件和引导文件等,该方法还包括:安全防护系统从第二存储区域获取镜像信息,并度量镜像信息的完整性。
在第二方面的一种可能的实现方式中,安全防护系统度量镜像信息的完整性,包括:对镜像信息做哈希运算以得到哈希值;比较哈希值与预设哈希值;当哈希值与预设哈希值一致时,确定镜像信息是完整的;或者,当哈希值与预设哈希值不一致时,确定镜像信息是不完整的。
在第二方面的一种可能的实现方式中,该方法还包括:安全防护系统在确定处理器不安全(比如,第一指令不安全、处理器的运行状态信息不安全、或者镜像信息不完整)时,对处理器执行安全保护操作,这里的安全保护操作可以包括但不限于:触发告警、复位处理器、拒绝软件所请求的服务、指示处理器停止运行、指示处理器停止运行软件、禁止处理器运行的软件的至少部分功能、或阻止软件访问存储器内存储的数据等。
第三方面,提供了一种电子设备,包括第一方面或其中任一实现方式所提到的安全度量装置以及所述存储器。可选地,所述电子设备是终端设备。
可以理解地,上述提供的任一种安全度量方法均用于执行上文所提供的对应安全度量装置的功能,因此,其所能达到的有益效果可参考上文所提供的对应安全度量装置中的有益效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种系统镜像的完整性校验的示意图;
图2为本申请实施例提供的一种攻击系统镜像的完整性的示意图;
图3为本申请实施例提供的一种安全度量装置的硬件架构示意图;
图4为本申请实施例提供的一种处理器上运行的软件的示意图;
图5为本申请实施例提供的一种安全度量方法的流程示意图;
图6为本申请实施例提供的另一种安全度量方法的流程示意图;
图7为本申请实施例提供的又一种安全度量方法的流程示意图。
具体实施方式
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a、b和c,其中a,b,c可以是单个,也可以是多个。
本申请的实施例采用了“第一”和“第二”等字样对名称或功能或作用类似的对象进行区分,本领域技术人员可以理解“第一”和“第二”等字样并不对数量和执行次序进行限定。另外,本申请中的“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
在本实施例中,安全度量通常是指度量系统和/或信息的完整性,系统的完整性至少包括系统镜像(image)的完整性。其中,安全度量可以包括系统启动过程中的完整性校验和系统运行过程中的完整性校验,本申请实施例主要涉及系统运行过程中的完整性校验。
在一个实施例中,对于服务器系统运行时的完整性校验通常是采用可信平台模块(trust platform module,TPM)或者可信平台控制模块(trust platform control module,TPCM)来实现。以TPM为例,如图1所示在处理器运行过程中,TPM主要是通过启动信任链度量和远程证明的方式来进行安全度量,即TPM按照系统的启动过程逐级度量每一级镜像的安全性,该镜像可以存储在存储器中,通过程序计数器(program counter,PC)指针可以指示该镜像在存储器中的位置,对于每一级的镜像可通过计算该镜像的哈希值,并将该哈希值上报至可信服务器进行校验的方式来实现。图1中以处理器为中央处理单元(Central Processing Unit,CPU)为例进行说明。
其中,TPM和TPCM采用的度量方法都是使用哈希算法对待度量的程序进行哈希计算,然后将哈希计算结果与设定的哈希值(比如,多个合法的哈希值)进行比较,如果哈希计算结果与设定的哈希值一致,则认为系统运行时的镜像是完整的。TPM和TPCM的区别仅在于,TPM是将哈希计算结果上报至可信服务器,由可信服务器执行校验,而TPCM是基于可信服务器的配置在本地执行校验。
但是,上述安全度量方式存在绕过攻击的危险。比如,如图2所示,黑客不修改原始的系统镜像,而是绕过该系统镜像去运行一个假系统镜像,从而破坏系统的完整性,但由于原始的系统镜像并没有发生变动,从而安全度量模块会认为系统镜像是完 整的。基于此,本申请实施例提供一种处理器的安全度量装置及方法,进一步在图1和图2的实施例基础上进行优化,通过在处理器的运行过程中,跟踪抓取处理器当前的执行指令,并度量该执行指令地址的合法性,即确保处理器实际执行指令也是合法的,以此来提高系统运行时的安全性。
请参考图3,其示出了本申请实施例提供的安全度量装置100的一个硬件架构示意图。该安全度量装置100可以位于一个电子设备内或也可能是电子设备本身。该电子设备包括但不限于个人计算机、服务器计算机、手持式或膝上型设备、移动设备(比如手机、移动电话、平板电脑、个人数字助理、媒体播放器等)、可穿戴设备、车载设备、消费型电子设备、小型计算机、大型计算机、移动机器人、无人机等。该电子设备的一个典型形态是个终端设备,如所述移动电话。该安全度量装置100具体可以是芯片或芯片组或搭载有芯片或芯片组的电路板,该芯片或芯片组或搭载有芯片或芯片组的电路板可在必要的软件驱动下工作。
如图3所示,该安全度量装置100包括处理器101、处理器跟踪器102、访问控制器103和安全防护系统104。其中,处理器101、处理器跟踪器102和访问控制器103可以集成在片上系统(System of Chip,SoC)中;安全防护系统104可以集成在该SoC中,也可以不集成在该SoC中,图3中以安全防护系统104集成在该SoC中为例进行说明,但不用于限定。进一步的,该安全度量装置100还可以包括存储器105,存储器105可以集成在该SoC中,也可以不集成在该SoC中,图3中以存储器105不集成在该SoC中为例进行说明。
其中,处理器101可以包括至少一个处理单元,该至少一个处理单元包括但不限于CPU、网络处理单元(Network Processing Unit,NPU)、图形处理器(Graphics Processing Unit,GPU)、应用专用集成电路(application specific integrated circuit,ASIC)或者现场可编程门阵列(Field Programmable Gate Array,FPGA)等。处理器101中可以运行操作系统、以及基于操作系统的至少一个功能所需的应用软件,比如,该操作系统可以包括Linux操作系统、Unix操作系统或者Window操作系统等,该至少一个功能所需的应用软件可以包括内核态软件和用户态软件。其中,该内核态软件可以是指运行在内核层中的软件,该用户态软件可以是指运行在应用程序层中的软件。示例性的,如图4所示,该内核态软件可以包括至少一个线程,比如,该至少一个线程可以包括用于监控处理器101的运行状态信息的监控线程,还可以包括诸如音频驱动或者显示驱动等各种驱动的一个或者多个线程等,图4中统称为内核其他线程;该用户态软件可以包括至少一个进程,比如,该至少一个进程可以包括视频类应用、即时通信类应用或购物类应用等多个应用的一个或者多个进程,图4中以应用进程1至应用进程n为例进行说,n为正整数。
处理器跟踪器102可以是一个用于跟踪处理器101的运行的微处理器或者逻辑功能电路,是一个用于跟踪处理器101状态的硬件单元,比如,处理器跟踪器102可以与处理器101耦合,具体可以耦合至处理器101运行的操作系统的内核,用于获取处理器101运行的指令,具体可用于获取处理器101运行的一个指令或者一个指令序列(即包括多个有序的指令),以及将这一个指令或者指令序列存储在存储器105中。可选的,当处理器101为先进精简指令集机器(Advanced RISC Machine,ARM)体系 时,处理器跟踪器102可以被称为coresight;当处理器101为英特尔(intel)X86CPU时,处理器跟踪器102可以被称为处理器跟踪器(processor trace,PT)。示例性地,处理器跟踪器102可以是一个小型的处理器系统,独立于处理器101,用于实现跟踪处理器101运行的功能。
访问控制器103通常与存储器105(比如,动态随机存取存储器(Dynamic Random Access Memory,DRAM))的存储控制器耦合,可以是一个用于对处理器101和处理器跟踪器102进行访问控制的控制器(比如,对所有向外部DRAM读写的操作进行访问检查鉴权),访问控制器103可以包括逻辑电路,例如是一个包括大量逻辑门电路的、用于实现权限控制的硬件电路结构。
比如,访问控制器可以为处理器101和处理器跟踪器102分配不同的访问地址空间,不同的访问地址空间对应存储器105中不同的存储区域。后续处理器101或处理器跟踪器102在访问存储器105时,访问控制器103可以对其进行访问鉴权,以确保处理器101和处理器跟踪器102只能在各自对应的被允许的所述访问地址空间内访问。比如,处理器101或处理器跟踪器102在需要访问存储器105中的某一存储区域时,可以通过访问控制器103访问存储器105中的该存储区域;访问控制器103可以确定处理器101或处理器跟踪器102需要访问的地址是否在对应的被允许的所述访问地址空间内;若该地址在该访问地址空间内,则可以允许处理器101或处理器跟踪器102访问该存储区域;若该地址不在对应的访问地址空间内,则可以禁止处理器101或处理器跟踪器102访问该存储区域。
安全防护系统104可以是一个安全度量模块,比如,该安全度量模块可以是TPCM,也可以是其他用于安全检测的模块,TPCM可以被服务器中TPM控制或者也可以独立运行。示例性的,安全防护系统104可以包括处理器(比如CPU),也可以选择性包括存储器(比如ROM和RAM)、哈希加速引擎、以及定时器(timer)和看门狗(watchdog)等一个或多个,存储器中可以存储有程序指令,处理器通过运行该程序指令可以使得安全防护系统104执行响应的安全防护功能。因此安全防护系统104可以理解是一个小型的处理器形同,其独立于处理器101,用于安全度量的功能。。其中,安全防护系统104可以在处理器101运行过程中,对处理器101运行的软件进行安全检测,确保处理器101运行的软件正常。例如,对处理器101所加载的指令、所获取的数据等进行安全检测,确保处理器21所加载的指令、获取的数据等未被改写或正常改写,即避免相关数据被篡改。当安全防护系统104检测出处理器101运行的软件被篡改时,可以对处理器101执行安全保护操作。这里的安全保护操作可以包括但不限于:触发告警、复位处理器101、拒绝软件所请求的服务、指示处理器101停止运行、指示处理器101停止运行软件、禁止处理器101运行的软件的至少部分功能、或阻止软件访问存储器105内存储的数据等。示例性地,安全防护系统104可以访问存储器105中的所有存储区域,也可以查询和设定访问控制器103的访问控制配置,比如,安全防护系统104可以查询和修改访问控制器103的寄存器配置等,以为访问控制器103配置访问地址空间的分配规则。
存储器105可以是该安全度量装置的内存,可以包括但不限于:随机存取存储器(Random Access Memory,RAM)和只读存储器(Read Only Memory,ROM)。存 储器105中可以存储有指令和数据。处理器101或者安全防护系统104可以通过加载指令和获取数据,执行该安全度量装置的各种功能应用以及数据处理。具体的,只读存储器可以存储处理器101或者安全防护系统104启动时需要加载的启动密钥数据。随机存取存储器可以存储所述处理器101或者安全防护系统104所要运行的诸如操作系统或应用等指令代码以及运行所需要的数据,还可以包括运行进程产生的各类中间运算结果、数据或配置数据等。其中,RAM可以包括各类易失性存储器,如静态随机存取存储器(Static Random-Access Memory,SRAM)、DRAM或同步动态随机存取存储器(Synchronous Dynamic Random Access Memory,SDRAM)等和非易失性存储器。
在本申请实施例中,处理器101用于运行存储器105中的指令;处理器跟踪器102用于获取所述指令中第一指令在存储器105中的第一地址信息,以及将第一地址信息存储在存储器105中的第一存储区域中;访问控制器103用于控制处理器跟踪器102访问存储器105中的第一存储区域,第一存储区域可以是访问控制器103预先分配给处理器跟踪器102的存储区域,处理器101无法访问第一存储区域,比如,处理器跟踪器102在向第一存储区域中写入第一地址信息时,访问控制器103用于对处理器跟踪器102的访问(即在第一存储区域中写入第一地址信息的操作)进行鉴权,并在鉴权后允许处理器跟踪器102将第一地址信息存储在第一存储区域中;安全防护系统104用于从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性。
其中,上述第一指令可以是一个指令,也可以是一个指令序列(即包括多个有序的指令)。比如,处理器跟踪器102中可以设置有地址缓存空间,该地址缓存空间中可以缓存4KB的地址信息,从而处理器跟踪器102可以实时地获取所述指令中的一个或者多个指令,并将该一个或者多个指令存放在该地址缓存空间中。
示例性地,上述安全防护系统104可以访问存储器105中的所有存储区域,从而安全防护系统104可以通过访问存储器105中的第一存储区域来获取第一地址信息。安全防护系统104在基于第一地址信息度量第一指令的安全性时,可以通过以下两种可能的实现方式来实现,具体如下所述。
在第一种可能的实现方式中,安全防护系统104还用于:当第一地址信息在合法地址范围以内时,确定第一指令安全,比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的一个地址信息一致,则可以理解为第一地址信息在该合法地址范围以内,从而可以确定第一指令安全;或者,当第一地址信息不在该合法地址范围以内时,确定第一指令不安全,比如,该合法地址范围包括多个地址信息,第一地址信息与这多个地址信息中的每个地址信息均不一致,则可以理解为第一地址信息不在该合法地址范围以内,从而可以确定第一指令不安全。
在第二种可能的实现方式中,安全防护系统104还用于:当第一地址信息在该合法地址范围以内、且第一指令与该合法地址范围内的第二指令一致时,确定第一指令安全,比如,该合法地址范围包括多个地址信息,若第一地址信息与该多个地址信息中的一个地址信息(该地址信息中的指令为第二指令)一致,第一地址信息中的指令为第一指令,第一指令与第二指令一致,则可以确定第一指令安全;或者,当第一地 址信息不在该合法地址范围以内、或第一指令与该合法地址范围内的第二指令不一致时,确定第一指令不安全,比如,该合法地址范围包括多个地址信息,第一地址信息中的指令为第一指令,该多个地址信息中的指令为多个第二指令,若第一地址信息与该多个地址信息均不一致、且第一指令与多个第二指令均不一致,则可以确定第一指令不安全。
在上述两种可能的实现方式中,该合法地址范围可以是预先设置的,或者处理器101在启动过程中可以将该合法地址范围发送给安全防护系统104,以使安全防护系统104获取到该合法地址范围,该合法地址范围的发送可以是一次性的,即只在操作系统首次启动过程中发送,后续无需再发送。另外,当安全防护系统104按照上述两种可能的实现方式中的任一种确定第一指令不安全时,安全防护系统104还用于对处理器101执行安全保护操作,这里的安全保护操作可以包括但不限于:触发告警、复位处理器101、拒绝软件所请求的服务、指示处理器101停止运行、指示处理器101停止运行软件、禁止处理器101运行的软件的至少部分功能、或阻止软件访问存储器105内存储的数据等。
进一步的,第一指令包括监控线程的指令。也即是,处理器101可用于运行监控线程的指令;处理器跟踪器102可用于获取该监控线程的指令的地址信息,并将该地址信息存储在第一存储区域中;访问控制器103用于对处理器跟踪器102将该地址信息存储在第一存储区域中的操作进行鉴权,并在鉴权通过后允许处理器跟踪器102将该地址信息存储在第一存储区域中;安全防护系统104可用于从第一存储区域中获取该监控线程的指令的地址信息,并度量其安全性。
在本申请实施例中,处理器跟踪器102将该监控线程的指令的地址信息存储在第一存储区域中的动作可以由安全防护系统104通过中断来触发。具体的,安全防护系统104还用于向处理器101发送中断信息,该中断信息用于指示处理器101启动监控线程(也可以称为调度或运行监控线程);处理器101还用于在接收到该中断信息时,启动该监控线程的指令,并通过该监控线程触发处理器跟踪器102;处理器跟踪器102还用于基于该监控线程的触发,将第一地址信息存储在第一存储区域中,即将该监控线程的指令的地址信息存储在第一存储区域中。
其中,处理器101通过该监控线程触发处理器跟踪器102的过程可以包括:处理器101通过该监控线程写指定寄存器,比如通过该监控线程将指定寄存器的值置为1,该指定寄存器的初始值可以默认为0,该指定寄存器可以事先进行配置;处理器跟踪器102通过检测该指定寄存器的值确定是否被触发,若检测到该指定寄存器的值被置为1则确定被触发,若检测到该指令寄存器的值不为1则确定未被触发。或者,处理器101通过该监控线程向处理器跟踪器102发送触发消息,该触发消息用于指示处理器跟踪器102将获取的地址信息存储在第一存储区域中,从而当处理器跟踪器102接收到该触发消息时,可以确定被触发。或者,处理器101通过该监控线程执行处理器跟踪器102的相关指令,以触发处理器跟踪器102。
另外,安全防护系统104向处理器101发送的中断信息可以是不可屏蔽中断(non maskable interrupt,NMI)信息,即该中断信息是无法禁止的,处理器101在接收到该中断信息时会立即执行该中断信息对应的任务。在实际应用中,该中断信息也可以替 换为其他不可屏蔽的消息,该消息可用于指示处理器101启动监控线程,处理器101在接收到该消息时同样会立即执行该消息对应的任务。
在一种可能的实现方式中,安全防护系统104还可以用于在确定满足预设条件时向处理器101发送中断信息,该预设条件可以为以下中的一种:发生指定事件,达到发送该中断信息的预设时长。其中,该指定事件包括但不限于:人脸识别事件、指纹识别事件、解锁事件、支付事件、数据改写事件或者首次登录事件等。另外,该预设时长可以事先进行设置,比如,该预设时长可以是一个固定值,也可以是变化的多个值(比如,每个值对应不同的时间段),本申请实施例对此不作具体限制。
可选的,上述监控线程可以是处理器101对应的内核中的任意一个线程,也可以是所述内核中用于监控处理器101的运行状态信息的一个线程。当该监控线程为所述内核中用于监控处理器的运行状态信息的一个线程时,处理器101还用于通过该监控线程对处理器101的运行状态信息做安全检查,以得到检查结果,并向安全防护系统104发送该检查结果。
其中,该运行状态信息可以包括处理器101运行过程中相关的粗粒度的状态信息,比如,该粗粒度的状态信息包括内存消耗状态、页表状态和寄存器的读写状态等信息中的一个或者多个。和/或,该运行状态信息还可以包括处理器101运行过程中相关的细粒度的状态信息,比如,细粒度的状态信息可以包括页表范围、各运行栈的健康状态、局部变量、全局变量和关键寄存器等信息中的一个或者多个。
具体的,当处理器101启动该监控线程后,该监控线程可以获取处理器101的一个或者多个运行状态信息,并对每个运行状态信息做安全检查以得到检查结果。比如,该运行状态信息包括关键寄存器,则该监控线程可以判断该关键寄存器的值是否与预设值一致,若一致则可确定该关键寄存器安全,若不一致则可确定该关键寄存器不安全;或者,该运行状态信息还包括全局变量,则该监控线程可以判断该全局变量所访问的地址范围是否在预设访问地址范围内,若在该预设访问地址范围内,则可确定该全局变量安全,若不在该预设访问地址范围内,则可确定该全局变量不安全。之后,当处理器101通过监控线程确定这多个运行状态信息的检查结果时,处理器101还可用于将该检查结果发送给安全防护系统104。进一步的,当安全防护系统104接收到该检查结果时,若该检查结果中存在不安全的检查结果,则安全防护系统104还可用于对处理器101执行安全保护操作,这里的安全保护操作与上文所述的安全保护操作一致,本申请实施例在此不再赘述。在实际应用中,如果该监控线程被恶意程序破坏(比如,修改或删除),则按照上文所描述的方法,安全防护系统104在向处理器101发出中断信息后,若确定第一地址信息对应的第一指令是不合法的(即确定处理器101当前执行的指令是不合法的),则可以确定该监控线程被破坏,从而确定该处理器101受到攻击。
进一步的,如图3所示,存储器105中还可以包括用于存储处理器101的镜像信息的第二存储区域,该镜像信息包括处理器101运行的指令。其中,该镜像信息具体可以包括处理器101上所有的文件信息,比如,该镜像信息可以包括处理器101上所有应用或程序对应指令、以及处理器101的系统文件和引导文件等。
进一步地,安全防护系统104可以访问存储器105中的所有存储区域,从而安全 防护系统104可以通过访问存储器105中的第二存储区域来获取该镜像信息,并度量该镜像信息的完整性。具体的,安全防护系统104度量该镜像信息的完整性的具体过程可以为:对该镜像信息做哈希运算以得到哈希值;比较该哈希值与预设哈希值;当该哈希值与预设哈希值一致时,确定该镜像信息是完整的,或者,当该哈希值与预设哈希值不一致时,确定该镜像信息是不完整的。进一步的,若确定该镜像信息是不完整的,安全防护系统104还可以用于执行上述的安全保护操作。
在本申请实施例提供的安全度量装置中,通过在处理器101的运行过程中,使用处理器跟踪器102跟踪抓取处理器101执行的第一指令的第一地址信息,并通过访问控制器103控制处理器跟踪器102将第一地址信息存储在存储器105中的第一存储区域中,由于第一指令是处理器101当前执行的指令,且处理器101无法访问第一存储区域,从而黑客无法通过处理器101篡改第一存储区域中的信息,即使通过绕过原始的系统镜像而去运行一个假系统镜像的方式来破坏处理器101的完整性,安全防护系统104从第一存储区域中获取的第一地址信息,并仍可以基于第一地址信息度量第一指令的安全性,从而提高了安全度量的准确性和有效性,进而保证处理器101的安全性。
图5为本申请实施例提供的一种处理器的安全度量方法的流程示意图,该方法可应用于图3所示的安全度量装置中,参见图5,该方法包括:S201.处理器101运行存储器105中的指令;S202.处理器跟踪器102获取所述指令中第一指令在存储器105中的第一地址信息;S203.处理器跟踪器102将第一地址信息存储在存储器105中的第一存储区域中,其中,访问控制器103可以对处理器跟踪器102的访问(即在第一存储区域中写入第一地址信息的操作)进行访问进行鉴权,并在鉴权后允许处理器跟踪器102将第一地址信息存储在第一存储区域中,处理器101无法访问第一存储区域;S204.安全防护系统104用于从第一存储区域中获取第一地址信息,并基于第一地址信息度量第一指令的安全性。
其中,第一指令可以是一个指令,也可以是一个指令序列(即包括多个有序的指令)。比如,处理器跟踪器102中可以设置有地址缓存空间,该地址缓存空间中可以缓存4KB的地址信息,从而处理器跟踪器102可以实时地获取所述指令中的一个或者多个指令,并将该一个或者多个指令存放在该地址缓存空间中。另外,第一存储区域可以是访问控制器103预先分配给处理器跟踪器102的存储区域,处理器101无法访问第一存储区域,比如,访问控制器103预先将第一存储区域对应的地址信息发送给处理器跟踪器102。
在一种可能的实现方式中,安全防护系统104基于第一地址信息度量第一指令的安全性的具体过程可以为:当第一地址信息在合法地址范围以内时,确定第一指令安全;或者,当第一地址信息不在该合法地址范围以内时,确定第一指令不安全。在另一种可能的实现方式中,安全防护系统104基于第一地址信息度量第一指令的安全性的具体过程可以为:当第一地址信息在该合法地址范围以内、且第一指令与该合法地址范围内的第二指令一致时,确定第一指令安全;或者,当第一地址信息不在该合法地址范围以内、或第一指令与该合法地址范围内的第二指令不一致时,确定第一指令不安全。
在上述两种可能的实现方式中,该合法地址范围可以是预先设置的,或者处理器 101在启动过程中可以将该合法地址范围发送给安全防护系统104,以使安全防护系统104获取到该合法地址范围。另外,当安全防护系统104按照上述两种可能的实现方式中的任一种确定第一指令不安全时,安全防护系统104还用于对处理器101执行安全保护操作,这里的安全保护操作可以包括但不限于:触发告警、复位处理器101、拒绝软件所请求的服务、指示处理器101停止运行、指示处理器101停止运行软件、禁止处理器101运行的软件的至少部分功能、或阻止软件访问存储器105内存储的数据等。
进一步的,第一指令包括监控线程的指令。也即是,处理器101运行监控线程的指令;处理器跟踪器102获取该监控线程的指令的地址信息;访问控制器103控制处理器跟踪器102将该地址信息存储在第一存储区域中。可选的,处理器跟踪器102将该监控线程的指令的地址信息存储在第一存储区域中的动作可以由安全防护系统104通过中断来触发。
具体的,如图6所示,该方法还包括以下步骤:S205.安全防护系统104向处理器101发送中断信息,该中断信息用于指示处理器101启动监控线程;S206.处理器101在接收到该中断信息时,启动该监控线程的指令,即运行该监控线程;S207.处理器101通过该监控线程触发处理器跟踪器102,从而使得处理器跟踪器102基于该监控线程的触发将第一地址信息存储在第一存储区域中,即通过上述S203将该监控线程的指令的地址信息存储在第一存储区域中,具体可以由访问控制器103控制处理器跟踪器102将该监控线程的指令的地址信息存储在第一存储区域中。
其中,处理器101通过该监控线程触发处理器跟踪器102的过程可以包括:处理器101通过该监控线程写指定寄存器,比如,通过该监控线程将指定寄存器的值置为1,该指定寄存器的初始值可以默认为0,该指定寄存器可以事先进行配置;处理器跟踪器102通过检测该指定寄存器的值确定是否被触发,比如,若检测到该指定寄存器的值被置为1则确定被触发,若检测到该指令寄存器的值不为1则确定未被触发。或者,处理器101通过该监控线程向处理器跟踪器102发送触发消息,该触发消息用于指示处理器跟踪器102将获取的地址信息存储在第一存储区域中,从而当处理器跟踪器102接收到该触发消息时,可以确定被触发。
另外,安全防护系统104向处理器101发送的中断信息可以是不可屏蔽中断(non maskable interrupt,NMI)信息,即该中断信息是无法禁止的,处理器101在接收到该中断信息时会立即执行该中断信息对应的任务。在实际应用中,该中断信息也可以替换为其他不可屏蔽的消息,该消息可用于指示处理器101启动监控线程,处理器101在接收到该消息时同样会立即执行该消息对应的任务。
可选的,如图6所示,该方法还包括以下步骤:S208.安全防护系统104确定满足预设条件,该预设条件可以为以下中的一种:发生指定事件,达到发送该中断信息的预设时长。其中,该指定事件包括但不限于:人脸识别事件、指纹识别事件、解锁事件、支付事件、数据改写事件或者首次登录事件等。另外,该预设时长可以事先进行设置,比如,该预设时长可以是一个固定值,也可以是变化的多个值(比如,每个值对应不同的时间段),本申请实施例对此不作具体限制。
进一步的,上述监控线程可以是处理器101运行的内核中的任意一个线程,也可 以是所述内核中用于监控处理器101的运行状态信息的一个线程。当该监控线程为所述内核中用于监控处理器的运行状态信息的一个线程时,处理器101还用于通过该监控线程对处理器101的运行状态信息做安全检查,以得到检查结果,并向安全防护系统104发送该检查结果。可选的,当安全防护系统104接收到该检查结果时,若该检查结果中存在不安全的检查结果,则安全防护系统104还可以对处理器101执行安全保护操作,这里的安全保护操作与上文所述的安全保护操作一致,本申请实施例在此不再赘述。
其中,该运行状态信息可以包括处理器101运行过程中相关的粗粒度的状态信息,比如,该粗粒度的状态信息包括内存消耗状态、页表状态和寄存器的读写状态等信息中的一个或者多个。和/或,该运行状态信息还可以包括处理器101运行过程中相关的细粒度的状态信息,比如,细粒度的状态信息可以包括页表范围、各运行栈的健康状态、局部变量、全局变量和关键寄存器等信息中的一个或者多个。
具体的,当处理器101启动该监控线程后,该监控线程可以获取处理器101的一个或者多个运行状态信息,并对每个运行状态信息做安全检查以得到检查结果。比如,该运行状态信息包括关键寄存器,则该监控线程可以判断该关键寄存器的值是否与预设值一致,若一致则可确定该关键寄存器安全,若不一致则可确定该关键寄存器不安全;或者,该运行状态信息还包括全局变量,则该监控线程可以判断该全局变量所访问的地址范围是否在预设访问地址范围内,若在该预设访问地址范围内,则可确定该全局变量安全,若不在该预设访问地址范围内,则可确定该全局变量不安全。
进一步的,存储器105中还可以包括用于存储处理器101的镜像信息的第二存储区域,该镜像信息包括处理器101运行的指令。其中,该镜像信息具体可以包括处理器101上所有的文件信息,比如,该镜像信息可以包括处理器101上所有应用或程序对应指令、以及处理器101的系统文件和引导文件等。
相应的,如图7所示,该方法还包括:S209.安全防护系统104从第二存储区域获取该镜像信息,并度量该镜像信息的完整性。具体的,安全防护系统104度量该镜像信息的完整性的具体过程可以为:对该镜像信息做哈希运算以得到哈希值;比较该哈希值与预设哈希值;当该哈希值与预设哈希值一致时,确定该镜像信息是完整的,或者,当该哈希值与预设哈希值不一致时,确定该镜像信息是不完整的;进一步的,若确定该镜像信息是不完整的,则可以执行上述的安全保护操作。上述步骤S209可以位于S208之后且位于S205之前,并在度量结果为该镜像信息是完整的之后,通过上述S205向处理器101发送中断信息。
需要说明的是,上述步骤S201-S209的具体实现过程可以参见图3和图4所述的装置实施例中处理器101、处理器跟踪器102、访问控制器103和安全防护系统104中的相关描述,本申请实施例在此不再赘述。
在本申请实施例提供的安全度量方法中,通过在处理器101的运行过程中,使用处理器跟踪器102跟踪抓取处理器101执行的第一指令的第一地址信息,并通过访问控制器103控制处理器跟踪器102将第一地址信息存储在存储器105中的第一存储区域中,由于第一指令是处理器101当前执行的指令,且处理器101无法访问第一存储区域,从而黑客无法通过处理器101篡改第一存储区域中的信息,从而安全防护系统 104从第一存储区域中获取的第一地址信息后,可基于第一地址信息度量第一指令的安全性,从而提高了安全度量的准确性和有效性,进而保证处理器101的安全性。
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (15)

  1. 一种处理器的安全度量装置,其特征在于,所述装置包括:
    处理器,用于运行存储器中的指令;
    访问控制器,用于控制处理器跟踪器访问所述存储器中的第一存储区域,所述处理器无法访问所述第一存储区域;
    所述处理器跟踪器,用于获取所述指令中第一指令在所述存储器中的第一地址信息,并将所述第一地址信息存储在所述第一存储区域中;
    安全防护系统,用于从所述第一存储区域中获取所述第一地址信息,并基于所述第一地址信息度量所述第一指令的安全性。
  2. 根据权利要求1所述的装置,其特征在于,所述安全防护系统、所述处理器、所述处理器跟踪器和所述访问控制器位于片上系统SoC中。
  3. 根据权利要求1或2所述的装置,其特征在于,所述安全防护系统还用于:
    当所述第一地址信息在合法地址范围以内时,确定所述第一指令安全;或者,
    当所述第一地址信息不在所述合法地址范围以内时,确定所述第一指令不安全。
  4. 根据权利要求1或2所述的装置,其特征在于,所述安全防护系统还用于:
    当所述第一地址信息在合法地址范围以内、且所述第一指令与所述合法地址范围内的第二指令一致时,确定所述第一指令安全;或者,
    当所述第一地址信息不在合法地址范围以内、或所述第一指令与所述合法地址范围内的第二指令不一致时,确定所述第一指令不安全。
  5. 根据权利要求1-4任一项所述的装置,其特征在于,所述第一指令包括监控线程的指令;
    所述安全防护系统,还用于向所述处理器发送中断信息,所述中断信息用于指示所述处理器启动所述监控线程;
    所述处理器,还用于在接收到所述中断信息时,启动所述监控线程的指令,并通过所述监控线程触发所述处理器跟踪器;
    所述处理器跟踪器,还用于基于所述监控线程的触发,将所述第一地址信息存储在所述第一存储区域中。
  6. 根据权利要求5所述的装置,其特征在于,所述处理器,还用于:
    通过所述监控线程对所述处理器的运行状态信息做安全检查,以得到检查结果,并向所述安全防护系统发送所述检查结果。
  7. 根据权利要求1-6任一项所述的装置,其特征在于,所述存储器还包括用于存储所述处理器的镜像信息的第二存储区域,所述镜像信息包括所述指令;
    所述安全防护系统,还用于从所述第二存储区域获取所述镜像信息,并度量所述镜像信息的完整性。
  8. 根据权利要求7所述的装置,其特征在于,所述安全防护系统还用于:
    对所述镜像信息做哈希运算以得到哈希值;
    比较所述哈希值与预设哈希值;
    当所述哈希值与预设哈希值一致时,确定所述镜像信息是完整的;或者,
    当所述哈希值与所述预设哈希值不一致时,确定所述镜像信息是不完整的。
  9. 一种处理器的安全度量方法,其特征在于,所述方法包括:
    处理器运行存储器中的指令;
    访问控制器控制处理器跟踪器访问所述存储器中的第一存储区域,所述处理器无法访问所述第一存储区域;
    所述处理器跟踪器获取所述指令中第一指令在所述存储器中的第一地址信息,并将所述第一地址信息存储在所述第一存储区域中;
    安全防护系统从所述第一存储区域中获取所述第一地址信息,并基于所述第一地址信息度量所述第一指令的安全性。
  10. 根据权利要求9所述的方法,其特征在于,所述基于所述第一地址信息度量所述第一指令的安全性,包括:
    当所述第一地址信息在合法地址范围以内时,确定所述第一指令安全;或者,
    当所述第一地址信息不在所述合法地址范围以内时,确定所述第一指令不安全。
  11. 根据权利要求9所述的方法,其特征在于,所述基于所述第一地址信息度量所述第一指令的安全性,包括:
    当所述第一地址信息在合法地址范围以内、且所述第一指令与所述合法地址范围内的第二指令一致时,确定所述第一指令安全;或者,
    当所述第一地址信息不在合法地址范围以内、或所述第一指令与所述合法地址范围内的第二指令不一致时,确定所述第一指令不安全。
  12. 根据权利要求9-11任一项所述的方法,其特征在于,所述存储器中的指令包括监控线程的指令,所述方法还包括:
    所述安全防护系统向所述处理器发送中断信息,所述中断信息用于指示所述处理器启动所述监控线程;
    所述处理器在接收到所述中断信息时,启动所述监控线程的指令,并通过所述监控线程触发所述处理器跟踪器;
    所述处理器跟踪器基于所述监控线程的触发,将所述第一地址信息存储在所述第一存储区域中。
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:
    所述处理器通过所述监控线程对所述处理器的运行状态信息做安全检查,以得到检查结果,向所述安全防护系统发生所述检查结果。
  14. 根据权利要求9-13任一项所述的方法,其特征在于,所述存储器还包括用于存储所述处理器的镜像信息的第二存储区域,所述镜像信息包括所述指令,所述方法还包括:
    所述安全防护系统从所述第二存储区域获取所述镜像信息,并度量所述镜像信息的完整性。
  15. 根据权利要求14所述的方法,其特征在于,所述安全防护系统度量所述镜像信息的完整性,包括:
    对所述镜像信息做哈希运算以得到哈希值;
    比较所述哈希值与预设哈希值;
    当所述哈希值与预设哈希值一致时,确定所述镜像信息是完整的;或者,
    当所述哈希值与所述预设哈希值不一致时,确定所述镜像信息是不完整的。
PCT/CN2020/121303 2020-10-15 2020-10-15 一种处理器的安全度量装置及方法 WO2022077388A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202080008627.5A CN114641769A (zh) 2020-10-15 2020-10-15 一种处理器的安全度量装置及方法
EP20957167.8A EP4209947A4 (en) 2020-10-15 2020-10-15 PROCESSOR SECURITY MEASUREMENT DEVICE AND METHOD
PCT/CN2020/121303 WO2022077388A1 (zh) 2020-10-15 2020-10-15 一种处理器的安全度量装置及方法
US18/301,238 US20230259636A1 (en) 2020-10-15 2023-04-16 Security assessment apparatus and method for processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/121303 WO2022077388A1 (zh) 2020-10-15 2020-10-15 一种处理器的安全度量装置及方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/301,238 Continuation US20230259636A1 (en) 2020-10-15 2023-04-16 Security assessment apparatus and method for processor

Publications (1)

Publication Number Publication Date
WO2022077388A1 true WO2022077388A1 (zh) 2022-04-21

Family

ID=81208736

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/121303 WO2022077388A1 (zh) 2020-10-15 2020-10-15 一种处理器的安全度量装置及方法

Country Status (4)

Country Link
US (1) US20230259636A1 (zh)
EP (1) EP4209947A4 (zh)
CN (1) CN114641769A (zh)
WO (1) WO2022077388A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312228A (zh) * 2022-06-21 2023-12-29 华为技术有限公司 一种计算设备及数据保护方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4677546A (en) * 1984-08-17 1987-06-30 Signetics Guarded regions for controlling memory access
US20090089626A1 (en) * 2007-09-28 2009-04-02 Arm Limited Techniques for generating a trace stream for a data processing apparatus
US20190050566A1 (en) * 2015-03-27 2019-02-14 Intel Corporation Technologies for control flow exploit mitigation using processor trace
CN109670312A (zh) * 2017-10-13 2019-04-23 华为技术有限公司 安全控制方法及计算机系统
CN111651778A (zh) * 2020-05-26 2020-09-11 上海交通大学 基于risc-v指令架构的物理内存隔离方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1843250B1 (en) * 2006-04-05 2015-06-10 Texas Instruments France System and method for checking the integrity of computer program code
US9395993B2 (en) * 2013-07-29 2016-07-19 Intel Corporation Execution-aware memory protection

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4677546A (en) * 1984-08-17 1987-06-30 Signetics Guarded regions for controlling memory access
US20090089626A1 (en) * 2007-09-28 2009-04-02 Arm Limited Techniques for generating a trace stream for a data processing apparatus
US20190050566A1 (en) * 2015-03-27 2019-02-14 Intel Corporation Technologies for control flow exploit mitigation using processor trace
CN109670312A (zh) * 2017-10-13 2019-04-23 华为技术有限公司 安全控制方法及计算机系统
CN111651778A (zh) * 2020-05-26 2020-09-11 上海交通大学 基于risc-v指令架构的物理内存隔离方法

Also Published As

Publication number Publication date
EP4209947A1 (en) 2023-07-12
EP4209947A4 (en) 2023-09-27
US20230259636A1 (en) 2023-08-17
CN114641769A (zh) 2022-06-17

Similar Documents

Publication Publication Date Title
CN108573144B (zh) 安全的执行上下文数据
US10516533B2 (en) Password triggered trusted encryption key deletion
KR101122517B1 (ko) 런타임 보안 보장을 위한 자율 메모리 검사기 및 이의 방법
TWI607376B (zh) 用於處理改變依照統一可延伸韌體介面計算裝置中之系統安全資料庫及韌體儲存區請求的系統及方法
US8028174B2 (en) Controlling update of content of a programmable read-only memory
CN110334521B (zh) 可信计算系统构建方法、装置、可信计算系统及处理器
US8122514B2 (en) Software enhanced trusted platform module
US20070276969A1 (en) Method and device for controlling an access to peripherals
GB2436046A (en) Method for establishing a trusted running environment in the computer
US11556651B2 (en) Method for secure booting using route switchover function for boot memory bus and apparatus using the same
US8843742B2 (en) Hypervisor security using SMM
CN112818327A (zh) 基于TrustZone的用户级代码和数据安全可信保护方法及装置
US11775649B2 (en) Perform verification check in response to change in page table base register
CN113254949A (zh) 对存储器区域的访问权限
US20230259636A1 (en) Security assessment apparatus and method for processor
US11645390B2 (en) Cloud-based method to increase integrity of a next generation antivirus (NGAV) security solution in a virtualized computing environment
Frazelle Securing the boot process
US20210224386A1 (en) Electronic system and method for preventing malicious actions on a processing system of the electronic system
WO2017131679A1 (en) System management mode test operations
CN114462041A (zh) 基于双体系架构的动态可信访问控制方法及系统
CN116157795A (zh) 分层保护域中的安全性增强
WO2021174512A1 (zh) 电子装置和安全防护方法
EP4273722A1 (en) Terminal chip and measurement method therefor
EP3940565A1 (en) System management states
US20220342984A1 (en) Integrity monitor

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: 20957167

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020957167

Country of ref document: EP

Effective date: 20230404

NENP Non-entry into the national phase

Ref country code: DE