WO2020261365A1 - 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器 - Google Patents

半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器 Download PDF

Info

Publication number
WO2020261365A1
WO2020261365A1 PCT/JP2019/025100 JP2019025100W WO2020261365A1 WO 2020261365 A1 WO2020261365 A1 WO 2020261365A1 JP 2019025100 W JP2019025100 W JP 2019025100W WO 2020261365 A1 WO2020261365 A1 WO 2020261365A1
Authority
WO
WIPO (PCT)
Prior art keywords
avoidance
determination
inspection
control flow
code block
Prior art date
Application number
PCT/JP2019/025100
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 JP2021528686A priority Critical patent/JP7338686B2/ja
Priority to US17/620,804 priority patent/US11868467B2/en
Priority to PCT/JP2019/025100 priority patent/WO2020261365A1/ja
Publication of WO2020261365A1 publication Critical patent/WO2020261365A1/ja

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/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
    • 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/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/54Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by adding security routines or objects to programs
    • 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/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/565Static detection by checking file integrity

Definitions

  • the present disclosure relates to a non-temporary computer-readable medium in which a semiconductor device, a control flow inspection method, and a control flow inspection program are stored.
  • Patent Document 1 discloses a technique relating to a circuit for monitoring the security of a processor.
  • the processor according to Patent Document 1 enhances security by determining one or more signatures from the execution content data of a program to be executed by the processor and comparing the signature with a default signature.
  • CFI Control Flow Integrity
  • This disclosure is made to solve such a problem, and a semiconductor device, a control flow inspection method, and a control flow inspection program for reducing processing overhead while maintaining device security are provided.
  • the purpose is to provide a stored non-temporary computer-readable medium.
  • the semiconductor device is Judgment means for determining whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block to be executed among a plurality of code blocks in a predetermined program.
  • the control flow inspection method according to the second aspect of the present disclosure.
  • the computer Based on the judgment auxiliary information in the target code block that is the execution target among the plurality of code blocks in the predetermined program, it is judged whether or not the avoidance condition of the control flow consistency check is satisfied. When it is determined that the avoidance condition is satisfied, the control flow consistency check in the target code block is avoided.
  • the non-transitory computer-readable medium containing the control flow inspection program according to the third aspect of the present disclosure is A process of determining whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block to be executed among a plurality of code blocks in a predetermined program. A process of avoiding the control flow consistency check in the target code block when it is determined that the avoidance condition is satisfied. Is stored in the control flow inspection program that causes the computer to execute.
  • a non-transitory computer-readable medium containing a semiconductor device, a control flow inspection method, and a control flow inspection program is provided to reduce processing overhead while maintaining device security. be able to.
  • FIG. It is a block diagram which shows the structure of the semiconductor device which concerns on this Embodiment 1. It is a flowchart which shows the flow of the control flow inspection method which concerns on this Embodiment 1. It is a block diagram which shows the structure of the device which concerns on this Embodiment 2. It is a figure for demonstrating the relationship between the control flow graph and inspection instruction which concerns on Embodiment 2.
  • FIG. It is a flowchart which shows the flow of the pre-processing concerning this Embodiment 2. It is a flowchart which shows the flow of the control flow inspection method which concerns on this Embodiment 2. It is a flowchart which shows the flow of the input value determination process which concerns on this Embodiment 2.
  • FIG. 1 is a block diagram showing a configuration of a semiconductor device 100 according to the first embodiment.
  • the semiconductor device 100 is a control device such as a processor or an information processing device that controls the execution of a predetermined program. Further, the semiconductor device 100 may be mounted on a computer, an information processing device, or an electronic device such as an IoT (Internet of Thing) device or an embedded device.
  • the semiconductor device 100 includes a determination unit 110 and an inspection unit 120.
  • the determination unit 110 determines whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block.
  • the target code block is a code block to be executed among a plurality of code blocks in a predetermined program.
  • the determination auxiliary information is information for assisting the determination by the determination unit 110.
  • the determination auxiliary information is an input value for the target code block, a variable value indicating the internal state of the target code block, or the like.
  • the judgment auxiliary information is not limited to these.
  • the avoidance condition is, for example, a condition that the degree of agreement between the data content of the determination auxiliary information and the predetermined value and the data size of the determination auxiliary information are within the predetermined range.
  • the history information of the past input value, the determination result, and the like may be reflected in the predetermined value and the predetermined range of the avoidance condition.
  • the inspection unit 120 determines that the avoidance condition is satisfied, the inspection unit 120 avoids the inspection of the control flow consistency in the target code block.
  • FIG. 2 is a flowchart showing the flow of the control flow inspection method according to the first embodiment.
  • the determination unit 110 determines whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block (S11).
  • the inspection unit 120 avoids the inspection of the control flow consistency in the target code block (S12). That is, the inspection unit 120 does not inspect the control flow consistency in the target code block.
  • the inspection unit 120 executes the control flow consistency inspection in the target code block (S13).
  • the determination auxiliary information in the target code block satisfies a predetermined condition (for example, when the same value as the previous time is input), it is safe even if the target code block is executed. Is considered to be secure. Therefore, when it is determined that the safety can be ensured, the execution of the control flow consistency inspection process in which the processing load cannot be ignored is avoided. That is, the number of executions of the control flow consistency check process (comparison of execution order, hash value comparison process, etc.) of the target code block can be reduced.
  • the judgment auxiliary information does not satisfy the avoidance condition (for example, when a value significantly different from the usual value is input), it is considered that security is a concern. Therefore, the control flow consistency check process can be executed as usual, and security can be maintained. Therefore, according to this embodiment, it is possible to reduce the processing overhead while maintaining the security of the device.
  • the semiconductor device 100 includes a processor, a memory, and other storage devices as a configuration (not shown). Further, the other storage device stores a computer program in which the control flow inspection method (including FIG. 2) according to the present embodiment is implemented. Then, the processor reads the computer program from the storage device into the memory and executes the computer program. As a result, the processor realizes the functions of the determination unit 110 and the inspection unit 120.
  • the determination unit 110 and the inspection unit 120 may each be realized by dedicated hardware.
  • a part or all of each component of each device may be realized by a general-purpose or dedicated circuitry, a processor, or a combination thereof. These may be composed of a single chip or may be composed of a plurality of chips connected via a bus. A part or all of each component of each device may be realized by a combination of the above-mentioned circuit or the like and a program.
  • a processor a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), an FPGA (field-programmable gate array), an ARM (registered trademark) architecture, or the like can be used.
  • FIG. 3 is a block diagram showing the configuration of the device 200 according to the second embodiment.
  • the vise 200 is an example of the above-mentioned semiconductor device 100.
  • the device 200 includes a program execution unit 210, an input value determination unit 220, a control flow consistency inspection unit 230, a control flow graph 241 and a hash value 242, an avoidance level threshold value 243, and a history information storage unit 250. At least prepare.
  • the program execution unit 210 is a control device that executes the target code block 211 in a predetermined program.
  • the program execution unit 210 is, for example, a processor core, but is not limited thereto.
  • the predetermined program is composed of one or more modules, and one or more code blocks are implemented in each module.
  • Each code block is, for example, a set of program code in units such as a function.
  • the control flow consistency check instruction 212 is set in a part of each code block.
  • the inspection command 212 is an instruction for calling the inspection process by the input value determination unit 220 and the control flow consistency inspection unit 230, which will be described later, and is, for example, a function.
  • a plurality of inspection instructions 212 may be set in one code block.
  • the inspection instruction 212 can be set at any position in the code block such as the beginning, the middle, and the end. It is also possible to set the inspection instruction 212 between the code blocks, but in that case, it is equivalent to setting it at the end of the code block immediately before the inspection instruction 212 or at the beginning of the code block immediately after the inspection instruction 212.
  • the check instruction 212 may be implemented on the source code when the program is developed, or may be inserted into the compiled binary.
  • An input value to the target code block 211 may be given as an argument of the inspection instruction 212. Alternatively, the input value to the target code block 211 may be separately acquired from the input value determination unit 220.
  • the input value determination unit 220 is an example of the determination unit 110 described above, and is a software process that determines an input value acquired in response to a call from the inspection command 212 and notifies the control flow consistency inspection unit 230 of the determination result. Or it is a hardware circuit.
  • the input value determination unit 220 makes a determination using the degree of similarity with the input value at the time of past execution in the target code block 211 as an avoidance condition. As a result, the inspection can be avoided when the input value has a proven track record used at the time of execution, the number of inspection processes can be reduced, and the processing overhead can be further reduced while ensuring safety.
  • the judgment auxiliary information shall include the input value to the target code block.
  • the input value determination unit 220 makes a determination using the data content of the input value or the range of the data size as an avoidance condition. As a result, in the case of an attack such as a buffer overflow, the avoidance condition is not satisfied, and the attack can be detected by inspecting as usual. Therefore, security can be maintained.
  • the input value determination unit 220 determines that the avoidance condition is satisfied, the input value determination unit 220 sets the avoidance level according to the degree of the avoidance condition. As a result, the execution of the inspection process can be finely controlled.
  • the input value determination unit 220 acquires the input value as the determination auxiliary information in the target code block. Then, the input value determination unit 220 makes a determination based on the history information described later and the acquired determination auxiliary information. Further, the input value determination unit 220 adds the acquired input value as history information to the history information storage unit 250 according to the avoidance result by the control flow consistency inspection unit 230 described later. As a result, it is possible to accurately determine the avoidance of the inspection process by taking into account the actual results executed and the actual results avoided. For example, it may be determined that the input value satisfies the avoidance condition, and the avoidance determination process described later may result in avoidance of the inspection process.
  • the input value determination unit 220 adds the avoidance result and the input value to the history information storage unit 250 as history information associated with each other. Further, even if it is determined that the input value satisfies the avoidance condition, the avoidance determination process described later may result in an avoidance result that the inspection process is not avoided. In that case, the input value determination unit 220 may add the input value as history information to the history information storage unit 250 together with the avoidance result and the inspection result.
  • the control flow graph (CFG (Control Flow Graph)) 241 is graph information that defines the flow of control between code blocks as the analysis result of the control structure of the program.
  • the control flow graph 241 is stored in a storage device such as a memory in the device 200 and functions as a database.
  • the position and execution order of each code block in the program are defined, and the link from the code block executed first to the code block to be executed next, the link to the branch destination, and the like are defined. Information.
  • FIG. 4 is a diagram for explaining the relationship between the control flow graph and the inspection command according to the second embodiment.
  • Module 31 is a set of code blocks, for example, a program file or the like.
  • the code block 32 is a set of one or more program codes, for example, a function or the like.
  • the hash value inspection process 33 is called by executing the inspection instruction set in the code block, and is executed when the input value determination unit 220 determines that the avoidance condition is not satisfied or the avoidance determination determines that the avoidance cannot be achieved. It is a conceptual indication of that.
  • the hash value 242 is information used for checking the execution order of a plurality of code blocks in a predetermined program.
  • the hash value 242 according to the present embodiment is information for specifying the execution order of a plurality of code blocks in a predetermined program.
  • the hash value 242 is a value calculated in advance by a predetermined hash function from numerical information indicating an execution order in a predetermined program for a plurality of code blocks.
  • the hash value 242 may be a value calculated by a predetermined hash function from a set of control flow paths and execution order numbers of two or more code blocks.
  • the execution order itself or the set of the execution order itself may be used instead of the hash value 242.
  • the avoidance level threshold value 243 is a preset avoidance level threshold value for each of the plurality of code blocks.
  • Each of the hash value 242 and the avoidance level threshold value 243 is stored in a storage device such as a memory in the device 200. It is assumed that the hash value 242 is stored in the storage device in association with the execution order used at the time of calculation.
  • the control flow consistency inspection unit 230 is an example of the inspection unit 120 described above, and is a software process or hardware circuit in which an inspection process of a hash value of a target code block is implemented according to an inspection instruction.
  • the control flow consistency inspection unit 230 inspects the control flow consistency of the target code block 211 currently being executed by the program execution unit 210 or the code block that can be executed immediately after the target code block 211. If the control flow consistency inspection unit 230 determines that there is no problem in the inspection, it returns to the program execution unit 210 that the execution of the subsequent processing of the code block is permitted, and if it is determined that there is a problem in the inspection, the control flow consistency inspection unit 230 returns. , The program execution unit 210 is returned to the effect that the execution of the subsequent processing of the code block is blocked.
  • control flow consistency inspection unit 230 avoids the inspection according to the avoidance level. As a result, it is possible to finely control whether or not inspection is avoided. Then, the control flow consistency inspection unit 230 avoids the inspection when the avoidance level set by the input value determination unit 220 satisfies the avoidance level threshold value 243 defined in the target code block. This makes it possible to accurately determine avoidance.
  • the history information storage unit 250 is a storage device that stores the history information of the determination auxiliary information.
  • the history information storage unit 250 stores the input value 251 and the avoidance result 252 in association with each other. Further, it is assumed that the input value 251 and the avoidance result 252 are also associated with the target code block.
  • the input value 251 is an input value used for the determination in the input value determination unit 220.
  • the avoidance result 252 is information indicating whether or not the inspection has been avoided in the control flow consistency inspection unit 230.
  • the history information storage unit 250 may further store the inspection result by the control flow consistency inspection unit 230 and the execution result of the target code block in association with each other.
  • FIG. 5 is a flowchart showing the flow of preprocessing according to the second embodiment.
  • the pre-processing is a process of generating a hash value or CFG from a program to be executed and saving it. Then, the preprocessing can be realized by the device 200 or any information processing device. In the following description, it is assumed that the information processing device is used.
  • the information processing device analyzes the program to be executed on the device 200 (S21). Then, the information processing apparatus generates a control flow graph (CFG) of the program based on the analysis result (S22). Then, the information processing apparatus inserts an inspection instruction into each code block of the program based on the CFG. For example, it is inserted as shown in FIG. 4 described above. If the inspection command is already implemented in the program to be analyzed, step S23 can be omitted.
  • CFG control flow graph
  • the information processing apparatus calculates the hash value of the execution order of each code block based on the CFG (S24). For example, as described above, the information processing apparatus gives an execution order to a predetermined hash function and calculates a hash value. After that, the information processing apparatus stores the calculated hash value in the memory in the device 200 in association with the execution order (S25). Further, the information processing device stores the generated CFG in a storage device (not shown) in the device 200 as a control flow graph 241.
  • FIG. 6 is a flowchart showing the flow of the control flow inspection method according to the second embodiment.
  • the control flow inspection process is performed when the program for which the CFG and the hash value are created by the above preprocessing is executed on the device 200 will be described.
  • the program execution unit 210 starts executing the program (S301).
  • the processor core in the device 200 reads a program to be executed (input from the outside) into a memory (not shown) and executes it.
  • the program execution unit 210 executes an inspection command while executing the target code block, and calls the input value determination unit 220.
  • the input value determination unit 220 accepts a call by executing the inspection command (S302). Then, the input value determination unit 220 performs the input value determination process (S303).
  • FIG. 7 is a flowchart showing the flow of the input value determination process according to the second embodiment.
  • the input value determination unit 220 acquires the input value to the target code block (S321). For example, when the input value to the target code block is set in the argument of the inspection instruction, the input value determination unit 220 acquires the input value from the argument of the inspection instruction. Further, when the input value is not set in the argument of the inspection instruction, the input value determination unit 220 may inquire of the program execution unit 210 to acquire the input value to the target code block.
  • the input value determination unit 220 determines whether or not the input value satisfies the avoidance condition (S322).
  • the avoidance condition includes, for example, that the data content of the input value completely matches or partially matches the predetermined value, the number of matching characters in the case of partial matching, the ratio of the number of matching characters to the total number of characters, and the like. ..
  • the avoidance condition includes, for example, that the numerical value indicated by the input value is within a predetermined range.
  • the avoidance conditions include, for example, that the data length of the input value matches the predetermined value, that the data length is within the predetermined range, that it is shorter than the predetermined range, that it is longer than the predetermined range, and that it is longer than the predetermined range.
  • the avoidance conditions are not limited to these. Further, it is assumed that the avoidance condition is stored in advance in a storage device such as a memory (not shown) in the device 200. Further, as the predetermined value, among the input values 251 stored in the history information storage unit 250, those corresponding to the target code block may be used.
  • the input value determination unit 220 sets the avoidance level according to the degree of the avoidance condition (S323). For example, when the data content of the input value exactly matches the predetermined value, the input value determination unit 220 sets the avoidance level to a high level (for example, "3"). Further, when the data contents of the input values partially match 80%, the input value determination unit 220 sets the avoidance level to a medium level (for example, "2"). Further, when the data contents of the input values partially match by 50%, the input value determination unit 220 sets the avoidance level to a low level (for example, "1").
  • the avoidance level setting rule is an example, and is not limited to these.
  • the avoidance level setting rule is stored in advance in a storage device such as a memory (not shown) in the device 200. That is, the input value determination unit 220 sets the avoidance level by referring to the avoidance level setting rule. Further, the avoidance level does not have to be three levels, and may be two levels (for example, binary) or more.
  • the input value determination unit 220 sets the avoidance level to "0" (S324). It should be noted that the avoidance level may or may not be set to null.
  • step S323 or S324 the input value determination unit 220 outputs the set avoidance level to the control flow consistency inspection unit 230 (S325).
  • control flow consistency inspection unit 230 performs an avoidance determination process (S304).
  • FIG. 8 is a flowchart showing the flow of the avoidance determination process according to the second embodiment.
  • the control flow consistency inspection unit 230 acquires the avoidance level from the input value determination unit 220 (S331).
  • the control flow consistency inspection unit 230 determines whether or not the acquired avoidance level is other than 0 (S332).
  • the control flow consistency inspection unit 230 determines whether the avoidance level is 1, 2 or 3 (S333).
  • steps S332 and S333 may be carried out together.
  • the control flow consistency inspection unit 230 sets the avoidance flag according to the avoidance frequency of the target code block (S334).
  • the avoidance frequency may be a value or a ratio calculated from the avoidance result 252 associated with the target code block.
  • the avoidance flag is assumed to be a binary value of 0 or 1. For example, when the avoidance frequency of the target code block is equal to or higher than a predetermined value, the control flow consistency inspection unit 230 sets the avoidance flag to 1. On the other hand, when the avoidance frequency of the target code block is less than a predetermined value, the control flow consistency inspection unit 230 sets the avoidance flag to 0.
  • the control flow consistency inspection unit 230 sets the avoidance flag according to the importance of the target code block (S335).
  • the importance is information indicating the security importance of the code block.
  • the control flow consistency inspection unit 230 sets the avoidance flag to 1.
  • the control flow consistency inspection unit 230 sets the avoidance flag to 0. In other words, security can be maintained by avoiding the inspection process of more important code blocks as much as possible.
  • the control flow consistency inspection unit 230 may set an avoidance flag according to the priority. For example, when the priority is equal to or higher than a predetermined value, the control flow consistency inspection unit 230 sets the avoidance flag to 1. On the other hand, when the priority is less than a predetermined value, the control flow consistency inspection unit 230 sets the avoidance flag to 0. That is, higher priority code blocks can try to meet processing time constraints by avoiding inspections.
  • avoidance level threshold value 243 associated with each target code block may be used for the importance or priority of the target code block described above. Further, the avoidance level threshold value 243 may be updated based on the avoidance frequency.
  • the control flow consistency inspection unit 230 sets the avoidance flag to 1 (S336).
  • control flow consistency inspection unit 230 sets the avoidance flag to 0 (S337).
  • the above-mentioned judgment condition of the avoidance level is an example, and is not limited to these. Further, it is assumed that the avoidance level determination condition is stored in advance in a storage device such as a memory (not shown) in the device 200. That is, the control flow consistency inspection unit 230 sets the avoidance flag with reference to the avoidance level determination condition.
  • the control flow consistency inspection unit 230 determines whether or not the avoidance flag is 1 (S305). When the avoidance flag is other than 1, the control flow consistency inspection unit 230 performs the hash value acquisition process (S306). For example, the control flow consistency inspection unit 230 acquires the current execution order of the target code block from the program execution unit 210, and calculates a hash value using the execution order. Here, it is assumed that the method of calculating the hash value, the hash function to be used, and the like are the same as in the pre-processing (step S24). Further, independently of the calculation of the hash value, the control flow consistency inspection unit 230 acquires the hash value 242 associated with the current execution order.
  • control flow consistency inspection unit 230 determines whether or not the calculated hash value and the acquired hash value match (S307). When it is determined that the hash values match, the control flow consistency inspection unit 230 outputs to the program execution unit 210 that the execution of the target code block is permitted. Then, the program execution unit 210 executes the target code block (S308). Then, the input value determination unit 220 stores the acquired input value 251 and the avoidance result 252 in the control flow consistency inspection unit 230 in the history information storage unit 250. That is, the input value determination unit 220 adds the history (S309).
  • the input value determination unit 220 may store the inspection result and the execution result of the target code block in the history information storage unit 250 as history information in association with the input value 251 and the avoidance result 252. Further, the program execution unit 210 or the input value determination unit 220 may store the history information in the history information storage unit 250 instead of the input value determination unit 220. In the control flow consistency check, the execution order itself or the set of execution order itself may be used instead of the hash value 242. Specifically, the current execution order of the target code block is compared with the pattern that enumerates the execution order recorded in advance, and if the current execution order is in that pattern, it is considered normal and the program Allow execution.
  • the program execution unit 210 determines whether or not the next target code block exists (S310). If it exists, the program execution unit 210 calls the input value determination unit 220 again when the inspection command is executed, proceeds to step S302, and repeatedly executes the subsequent steps. If it is determined in step S310 that the next target code block does not exist, the execution of the program ends.
  • control flow consistency inspection unit 230 outputs to the program execution unit 210 that the execution of the target code block is not permitted (error notification) (S311). Then, the execution of the program is finished.
  • the avoidance determination process in step S304 may be omitted by setting the avoidance flag in the input value determination process.
  • FIG. 9 is a diagram for explaining the concept of avoiding the control flow consistency inspection process according to the second embodiment.
  • FIG. 9 conceptually shows that the hash value inspection process was avoided at the avoidance 331, 332, 333, 334, and 335 in response to the call of the inspection instruction in each code block. Needless to say, the locations and numbers to be avoided are not limited to these.
  • processing speed can be improved by avoiding inspection.
  • the avoidance of the inspection can be finely controlled by determining the final avoidance presence / absence (by the avoidance flag) in the avoidance determination process.
  • the third embodiment is a modification of the first embodiment described above.
  • the determination auxiliary information according to the third embodiment further includes the internal state variable value at the time of execution of the target code block.
  • the determination means makes a determination by further considering the range of the internal state variable value as an avoidance condition. As a result, the accuracy of determining whether or not the avoidance condition is satisfied can be further improved.
  • the reason is that when the target code block is repeatedly executed, even if the input values are similar, the internal state variable value changes with the execution, and inspection may be required depending on the internal state variable value. ..
  • FIG. 10 is a block diagram showing the configuration of the device 200a according to the third embodiment.
  • the control flow consistency inspection unit 230 is replaced with the control flow consistency inspection unit 230a, and the internal state variable value determination unit 260 and the internal state variable value 253 are added to the device 200 described above. ..
  • the same reference numerals are given to the other configurations, and the description thereof will be omitted as appropriate.
  • the internal state variable value determination unit 260 is an improvement of a part of the input value determination unit 220 described above, determines the internal state variable value acquired in response to a call from the inspection command 212, and controls the determination result. It is a software process or a hardware circuit that notifies the flow consistency inspection unit 230a. In particular, the internal state variable value determination unit 260 makes a determination in consideration of the range of the internal state variable value as an avoidance condition.
  • the internal state variable value 253 is a variable value for holding the internal state of the target code block, and is included in the history information and stored in the history information storage unit 250.
  • the control flow consistency inspection unit 230a acquires each avoidance level as a determination result in each of the input value determination unit 220 and the internal state variable value determination unit 260.
  • the control flow consistency inspection unit 230a performs an inspection process when either one of the avoidance levels is 0 (or null). When both avoidance levels are other than 0, the control flow consistency inspection unit 230a performs avoidance determination processing according to the lower avoidance level.
  • FIG. 11 is a flowchart showing the flow of the control flow inspection method according to the third embodiment.
  • the description of the configuration equivalent to that of FIG. 6 will be omitted. Further, it is the same as in the second embodiment that the pretreatment of FIG. 5 has been performed.
  • step S302 together with step S303, the internal state variable value determination unit 260 performs the internal state variable value determination process (S312).
  • FIG. 12 is a flowchart showing the flow of the internal state variable value determination process according to the third embodiment.
  • the internal state variable value determination unit 260 acquires the internal state variable value at the time of execution of the target code block (S321a). For example, when the internal state variable value is set in the argument of the inspection command, the internal state variable value determination unit 260 acquires the internal state variable value from the argument of the inspection command. If the internal state variable value is not set in the argument of the inspection command, the internal state variable value determination unit 260 inquires of the program execution unit 210 or acquires the internal state variable value 253 from the history information storage unit 250. You may.
  • the internal state variable value determination unit 260 determines whether or not the internal state variable value satisfies the avoidance condition (S322a).
  • the avoidance condition is the same as in step S322.
  • the avoidance level in the internal state variable value is set by step S323 or S324 according to the determination result of step S322a, and is output to the control flow consistency inspection unit 230a (S325).
  • control flow consistency inspection unit 230a performs an avoidance determination process (S304a).
  • FIG. 13 is a flowchart showing the flow of the avoidance determination process according to the third embodiment.
  • the control flow consistency inspection unit 230a acquires the avoidance level from each of the input value determination unit 220 and the internal state variable value determination unit 260 (S331a).
  • the control flow consistency inspection unit 230a shall acquire the avoidance level A from the input value determination unit 220 and the avoidance level B from the internal state variable value determination unit 260.
  • control flow consistency inspection unit 230a determines whether or not the acquired avoidance levels are both other than 0 (S332a). If the avoidance levels A and B are both 1 to 3, the process proceeds to step S333a. On the other hand, when the avoidance level A is 1 to 3, the avoidance level B is 0, when the avoidance level B is 1 to 3, the avoidance level A is 0, and when both the avoidance levels A and B are 0 , Step S337.
  • the control flow consistency inspection unit 230a determines which of the avoidance levels A and B, whichever is lower, is 1, 2 or 3 ( S333a). If the avoidance levels A and B are the same, either one may be determined. After that, it is the same as FIG.
  • Steps S305 to S308, S310 and S311 are the same as in FIG.
  • the input value determination unit 220 stores the acquired internal state variable value 253 in the history information storage unit 250 in addition to the acquired input value 251 and the avoidance result 252 in the control flow consistency inspection unit 230. To do. That is, the input value determination unit 220 adds the history (S309a). As a result, the internal state variable value determination unit 260 can acquire the internal state variable value 253 from the history information storage unit 250 when determining the avoidance condition for the target block next time, and the processing time can be further shortened.
  • FIG. 14 is a diagram for explaining the concept of avoiding the control flow consistency inspection process according to the third embodiment. It is assumed that the code blocks 321, 322 and 323 have not only the input value but also the internal state variable value in common. In that case, the hash value inspection process 330 is executed in the code block 321 but is avoided in the subsequent code blocks 322 and 323. Also, elsewhere, it indicates that the check is performed because the input value or the internal state variable value does not satisfy the avoidance condition. Needless to say, the locations and numbers to be avoided are not limited to these.
  • FIG. 15 is a block diagram showing a configuration of an embodiment of the device 200a according to the third embodiment.
  • the device 400 is a specific example of the device 200a, and for example, TEE (Trusted Execution Environment) is applied.
  • the device 400 includes a normal world 410 which is a non-secure area and a secure world 420 which is a secure area.
  • the normal world 410 includes a processor core 411 as a program execution unit 210.
  • the processor core 411 shall execute the target code block 211.
  • the cycle world 420 includes the above-mentioned input value determination unit 220, internal state variable value determination unit 260, history information storage unit 250, control flow consistency inspection unit 230a, control flow graph 241 and hash value 242, and avoidance level threshold 243.
  • the cause world 420 may include at least an input value determination unit 220, an internal state variable value determination unit 260, and a control flow consistency inspection unit 230a. Whether or not the input value determination unit 220 and the internal state variable value determination unit 260 satisfy the inspection avoidance condition in response to the execution of the inspection instruction that calls the control flow consistency inspection set in the target code block by the processor core 411. Is determined. secure world420 is, for example, a TrustedZone in an ARM® architecture.
  • FIG. 16 is a block diagram showing a configuration of an embodiment of the information processing apparatus 500 according to the third embodiment.
  • the information processing device 500 includes a storage device 510, a control unit 520, a memory 530, and an IF (InterFace) unit 540.
  • the storage device 510 is a non-volatile storage device such as a hard disk or a flash memory.
  • the storage device 510 stores the control flow inspection program 511, the control flow graph 512, the hash value 513, the avoidance level threshold value 514, the execution target program 515, and the history information 516.
  • the control flow inspection program 511 is a computer program in which the processing of the control flow inspection method according to the present embodiment is implemented.
  • Each of the control flow graph 512, the hash value 513, and the avoidance level threshold value 514 corresponds to the control flow graph 241, the hash value 242, and the avoidance level threshold value 243 described above.
  • the execution target program 515 corresponds to a predetermined program and includes a plurality of code blocks.
  • the history information 516 corresponds to the history information stored in the history information storage unit 250 described above.
  • the memory 530 is a storage area for temporarily holding information when the control unit 520 operates.
  • the IF unit 540 is an interface for inputting / outputting to / from the outside of the information processing device 500. For example, the IF unit 540 outputs the input data from the outside to the control unit 520, and outputs the data received from the control unit 520 to the outside.
  • the control unit 520 is a processor, that is, a control device that controls each configuration of the information processing device 500.
  • the control unit 520 may have one or more processor cores.
  • the control unit 520 reads the control flow inspection program 511 from the storage device 510 into the memory 530 and executes the control flow inspection program 511. Further, the control unit 520 appropriately reads the control flow graph 512, the hash value 513, the avoidance level threshold value 514, and the history information 516 from the storage device 510 into the memory 530. Further, the control unit 520 reads the execution target program 515 from the storage device 510 into the memory 530 and executes it.
  • the control unit 520 includes a program execution unit 210, an input value determination unit 220, a control flow consistency inspection unit 230a, a control flow graph 241, a hash value 242, an avoidance level threshold 243, a history information storage unit 250, and an internal state variable.
  • the function of the value determination unit 260 is realized.
  • the control unit 520 is preferably a CPU provided with TEE (Trusted Execution Environment), and in that case, the control flow inspection program 511 according to the present embodiment is executed on the CPU provided with TEE. It can be said that.
  • the fourth embodiment is a modification of the first to third embodiments described above.
  • the determination model of the avoidance condition is machine-learned using various logs of the device to improve the determination accuracy.
  • FIG. 17 is a block diagram showing the configuration of the device 200b according to the fourth embodiment.
  • the input value determination unit 220 and the internal state variable value determination unit 260 are replaced with the input value determination unit 220b and the internal state variable value determination unit 260b with respect to the device 200a described above, and the learning unit 270 and the determination model 271 and The inspection result 254 and the execution result 255 are added.
  • the device 200b is a modification of the third embodiment, the device 200b may be a modification of the first or second embodiment.
  • the inspection result 254 is an inspection result of the target code block by the control flow consistency inspection unit 230a, and is stored in the history information storage unit 250.
  • the execution result 255 is an execution result of the target code block recognized by the inspection, and is stored in the history information storage unit 250.
  • the determination model 271 is a program module or model expression in which a process of performing a predetermined operation using an input value or an internal state variable value as an input and outputting the operation result as an avoidance level or an avoidance flag is implemented. Is. That is, the determination model 271 may be two models, one for the input value and the other for the internal state variable value. Alternatively, the determination model 271 may take both the input value and the internal state variable value as inputs, perform a predetermined operation using the set parameters, and output the operation result as an avoidance level or an avoidance flag. ..
  • the determination model 271 determines whether or not the avoidance condition is satisfied by using each data of the input value and the internal state variable value as an element of the input data and using a predetermined parameter (weighting coefficient) for each input data to satisfy the determination model 271. Set the avoidance level according to the degree.
  • the determination model 271 may be represented by a neural network, a support vector machine, or the like.
  • the learning unit 270 learns the determination model 271 using at least a part of the history information stored in the history information storage unit 250 as learning data. For example, the learning unit 270 performs machine learning such as avoidance conditions and avoidance level setting rules using the learning data, and updates the parameters of the determination model 271. As a result, the determination model 271 can be updated to the latest state in real time. Therefore, more security can be maintained.
  • the input value determination unit 220b and the internal state variable value determination unit 260b make a determination using the determination model 271 in which the avoidance condition is learned using the history information. Either one of the input value determination unit 220b or the internal state variable value determination unit 260b may use the determination model 271, and the other may use the same model as in the other embodiments. Alternatively, when the determination model 271 inputs both the input value and the internal state variable value, the input value determination unit 220b and the internal state variable value determination unit 260b are used as one determination unit, and one avoidance level is set as the control flow consistency. It may be output to the inspection unit 230a. As a result, it is possible to take into account the results of past inspections, and the accuracy of determining avoidance conditions is further improved.
  • FIG. 18 is a flowchart showing the flow of the control flow inspection method including the learning process according to the fourth embodiment.
  • the determination model 271 is used in step S322 of FIG. 7 and step S322a of FIG.
  • the learning unit 270 reads the history information from the history information storage unit 250, and machine-learns the avoidance condition and the avoidance level setting rule of the determination model 271 as learning data (S313). For example, the learning unit 270 uses at least a part of the input value 251 and the avoidance result 252, the internal state variable value 253, the inspection result 254, and the execution result 255 as the learning data. Then, the process proceeds to step S310. After that, the same applies.
  • the learning unit 270 is not essential.
  • an external information processing device may include a learning unit 270, and the learned determination model 271 may be stored in the storage device in the device 200b.
  • each element described in the drawing as a functional block that performs various processes can be composed of a CPU (Central Processing Unit), a memory, and other circuits in terms of hardware, and is software. Specifically, it is realized by a program or the like that the CPU loads and executes in the memory. Therefore, it is understood by those skilled in the art that these functional blocks can be realized in various forms by hardware only, software only, or a combination thereof, and is not limited to any of them.
  • CPU Central Processing Unit
  • Non-temporary computer-readable media include various types of tangible storage media.
  • Examples of non-temporary computer-readable media include magnetic recording media (eg, flexible disks, magnetic tapes, hard disk drives), magneto-optical recording media (eg, magneto-optical disks), CD-ROMs (Compact Disc-Read Only Memory), CDs. -R (CD-Recordable), CD-R / W (CD-ReWritable), semiconductor memory (for example, mask ROM, PROM (ProgrammableROM), EPROM (ErasablePROM), flash ROM, RAM (RandomAccessMemory)) Including.
  • the program may also be supplied to the computer by various types of temporary computer readable media (transitory computer readable medium).
  • temporary computer-readable media include electrical, optical, and electromagnetic waves.
  • the temporary computer-readable medium can supply the program to the computer via a wired communication path such as an electric wire and an optical fiber, or a wireless communication path.
  • (Appendix A1) A determination means for determining whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block to be executed among a plurality of code blocks in a predetermined program. When it is determined that the avoidance condition is satisfied, an inspection means for avoiding the inspection of the control flow consistency in the target code block and an inspection means.
  • a semiconductor device equipped with. The determination means The semiconductor device according to Appendix A1, wherein the determination is performed using the degree of similarity with the determination auxiliary information at the time of past execution in the target code block as the avoidance condition.
  • the determination auxiliary information includes an input value to the target code block.
  • the determination means The semiconductor device according to Appendix A1 or A2, wherein the determination is made with the data content of the input value or the range of the data size as the avoidance condition.
  • the determination auxiliary information further includes an internal state variable value at the time of execution of the target code block.
  • the determination means The semiconductor device according to Appendix A3, wherein the determination is made by further considering the range of the internal state variable value as the avoidance condition.
  • the determination means When the determination is made that the avoidance condition is satisfied, the avoidance level is set according to the degree of the avoidance condition.
  • the inspection means The semiconductor device according to any one of Supplementary A1 to A4, which avoids the inspection according to the avoidance level.
  • Each of the plurality of code blocks has a predefined threshold for the avoidance level.
  • the inspection means The semiconductor device according to Appendix A5, which avoids the inspection when the avoidance level set by the determination means satisfies the threshold value of the avoidance level defined in the target code block.
  • Appendix A7 Further provided with a storage means for storing the history information of the determination auxiliary information, The determination means Acquire the judgment auxiliary information in the target code block and The determination is made based on the history information and the acquired determination auxiliary information.
  • the semiconductor device according to any one of Supplementary A1 to A6, wherein the acquired determination auxiliary information is added to the storage means as the history information according to the avoidance result by the inspection means.
  • the determination means The semiconductor device according to Appendix A7, which makes the determination using a determination model in which the avoidance condition is learned using the history information.
  • the semiconductor device according to Appendix A9 further comprising a learning means for learning the avoidance condition of the determination model using the history information and updating the parameters.
  • the semiconductor device includes a secure region and a non-secure region.
  • the secure region includes at least the determination means and the inspection means.
  • the non-secure area includes a program execution means.
  • the determination means The semiconductor device according to any one of Supplementary A1 to A9, which makes the determination in response to the execution of an inspection command that calls the control flow consistency inspection set in the target code block by the program execution means.
  • (Appendix B1) The computer Based on the judgment auxiliary information in the target code block to be executed among the plurality of code blocks in the predetermined program, it is judged whether or not the avoidance condition of the control flow consistency check is satisfied.
  • (Appendix C1) A process of determining whether or not the avoidance condition of the control flow consistency check is satisfied based on the determination auxiliary information in the target code block to be executed among a plurality of code blocks in the predetermined program.
  • (Appendix D1) An electronic device including the semiconductor device according to any one of Supplementary A1 to A10.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Debugging And Monitoring (AREA)

Abstract

半導体装置(100)は、所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける少なくとも入力値である判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たす(例えば、過去の入力値との類似度合いが所定範囲である)か否かの判定を行う判定部(110)と、回避条件を満たすと判定した場合に、対象コードブロックにおける制御フロー整合性の検査を回避する検査部(120)と、を備える。

Description

半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器
 本開示は、半導体装置、制御フロー検査方法及び制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体に関する。
 特許文献1には、プロセッサのセキュリティを監視する回路に関する技術が開示されている。特許文献1にかかるプロセッサは、プロセッサによる実行対象のプログラムの実行内容データから1以上の署名を決定し、当該署名と既定の署名とを比較することで、セキュリティを強化するものである。また、プログラム実行時のセキュリティを強化する技術として制御フロー整合性(CFI(Control Flow Integrity))の検査がある。
欧州特許出願公開第3373178号明細書
 ここで、デバイスのセキュリティを維持するために、プログラム実行中にCFI検査を行うと、通常、詳細な処理が必要となり、オーバーヘッド(正味の実行コスト)が大きい。そのため、制御フロー整合性の検査を行う場合、デバイスのセキュリティを維持しつつ、処理のオーバーヘッドを削減することが困難であるという問題点がある。
 本開示は、このような問題点を解決するためになされたものであり、デバイスのセキュリティを維持しつつ、処理のオーバーヘッドを削減するための、半導体装置、制御フロー検査方法及び制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体を提供することを目的とする。
 本開示の第1の態様にかかる半導体装置は、
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う判定手段と、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する検査手段と、
 を備える。
 本開示の第2の態様にかかる制御フロー検査方法は、
 コンピュータが、
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行い、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する。
 本開示の第3の態様にかかる制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体は、
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う処理と、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する処理と、
 をコンピュータに実行させる制御フロー検査プログラムが格納されたものである。
 上述の態様によれば、デバイスのセキュリティを維持しつつ、処理のオーバーヘッドを削減するための、半導体装置、制御フロー検査方法及び制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体を提供することができる。
本実施形態1にかかる半導体装置の構成を示すブロック図である。 本実施形態1にかかる制御フロー検査方法の流れを示すフローチャートである。 本実施形態2にかかるデバイスの構成を示すブロック図である。 本実施形態2にかかる制御フローグラフと検査命令の関係を説明するための図である。 本実施形態2にかかる事前処理の流れを示すフローチャートである。 本実施形態2にかかる制御フロー検査方法の流れを示すフローチャートである。 本実施形態2にかかる入力値判定処理の流れを示すフローチャートである。 本実施形態2にかかる回避判定処理の流れを示すフローチャートである。 本実施形態2にかかる制御フロー整合性の検査処理の回避の概念を説明するための図である。 本実施形態3にかかるデバイスの構成を示すブロック図である。 本実施形態3にかかる制御フロー検査方法の流れを示すフローチャートである。 本実施形態3にかかる内部状態変数値判定処理の流れを示すフローチャートである。 本実施形態3にかかる回避判定処理の流れを示すフローチャートである。 本実施形態3にかかる制御フロー整合性の検査処理の回避の概念を説明するための図である。 本実施形態3にかかるデバイスの実施例の構成を示すブロック図である。 本実施形態3にかかる情報処理装置の実施例の構成を示すブロック図である。 本実施形態4にかかるデバイスの構成を示すブロック図である。 本実施形態4にかかる学習処理を含む制御フロー検査方法の流れを示すフローチャートである。
 以下では、本開示の実施形態について、図面を参照しながら詳細に説明する。各図面において、同一又は対応する要素には同一の符号が付されており、説明の明確化のため、必要に応じて重複説明は省略される。
<実施形態1>
 図1は、本実施形態1にかかる半導体装置100の構成を示すブロック図である。半導体装置100は、所定のプログラムの実行を制御するプロセッサ等の制御装置や情報処理装置である。また、半導体装置100は、コンピュータもしくは情報処理装置、又は、IoT(Internet of Thing)機器もしくは組み込み機器等の電子機器に搭載されたものであってもよい。半導体装置100は、判定部110と、検査部120とを備える。
 判定部110は、対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う。ここで、対象コードブロックとは、所定のプログラム内の複数のコードブロックのうち実行対象であるコードブロックである。また、判定補助情報とは、判定部110による判定を補助するための情報である。例えば、判定補助情報は、対象コードブロックに対する入力値や対象コードブロックの内部状態を示す変数値等である。但し、判定補助情報はこれらに限定されない。また、回避条件とは、例えば、判定補助情報のデータ内容と所定値との一致度合いや、判定補助情報のデータサイズが所定の範囲内であることといった条件である。また、回避条件の所定値や所定の範囲には、過去の入力値の履歴情報、判定結果等を反映しても良い。検査部120は、回避条件を満たすと判定した場合に、対象コードブロックにおける制御フロー整合性の検査を回避する。
 図2は、本実施形態1にかかる制御フロー検査方法の流れを示すフローチャートである。まず、判定部110は、対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う(S11)。回避条件を満たすと判定した場合、検査部120は、対象コードブロックにおける制御フロー整合性の検査を回避する(S12)。つまり、検査部120は、対象コードブロックにおける制御フロー整合性の検査を行わない。一方、回避条件を満たさないと判定した場合、検査部120は、対象コードブロックにおける制御フロー整合性の検査を実行する(S13)。
 このように、本実施形態では、対象コードブロックにおける判定補助情報が所定の条件を満たす場合(例えば、前回と同じ値が入力された場合等)には、対象コードブロックを実行したとしても安全性が確保できるとみなす。そのため、安全性が確保できると判定した場合には、処理負荷の無視できない制御フロー整合性の検査処理の実行を回避するものである。つまり、対象コードブロックの制御フロー整合性の検査処理(実行順序の比較やハッシュ値の比較処理等)の実行回数を減少できる。一方、判定補助情報が回避条件を満たさない場合(例えば、通常とは著しく異なる値が入力された場合等)には、セキュリティが懸念されるとみなす。そのため、制御フロー整合性の検査処理を通常通り実行し、セキュリティを維持できる。よって、本実施形態により、デバイスのセキュリティを維持しつつ、処理のオーバーヘッドを削減することができる。
 尚、半導体装置100は、図示しない構成としてプロセッサ、メモリ及び他の記憶装置を備えるものである。また、当該他の記憶装置には、本実施形態にかかる(図2を含む)制御フロー検査方法が実装されたコンピュータプログラムが記憶されている。そして、当該プロセッサは、記憶装置からコンピュータプログラムを前記メモリへ読み込み、当該コンピュータプログラムを実行する。これにより、前記プロセッサは、判定部110及び検査部120の機能を実現する。
 または、判定部110及び検査部120は、それぞれが専用のハードウェアで実現されていてもよい。また、各装置の各構成要素の一部又は全部は、汎用または専用の回路(circuitry)、プロセッサ等やこれらの組合せによって実現されもよい。これらは、単一のチップによって構成されてもよいし、バスを介して接続される複数のチップによって構成されてもよい。各装置の各構成要素の一部又は全部は、上述した回路等とプログラムとの組合せによって実現されてもよい。また、プロセッサとして、CPU(Central Processing Unit)、GPU(Graphics Processing Unit)、FPGA(field-programmable gate array)、ARM(登録商標)アーキテクチャ等を用いることができる。
<実施形態2>
 本実施形態2は、上述した実施形態1の具体例である。
 図3は、本実施形態2にかかるデバイス200の構成を示すブロック図である。バイス200は、上述した半導体装置100の一例である。デバイス200は、プログラム実行部210と、入力値判定部220と、制御フロー整合性検査部230と、制御フローグラフ241と、ハッシュ値242と、回避レベル閾値243と、履歴情報記憶部250とを少なくとも備える。
 プログラム実行部210は、所定のプログラム内の対象コードブロック211を実行する制御装置である。プログラム実行部210は、例えば、プロセッサコアであるがこれに限定されない。ここで、所定のプログラムは、1以上のモジュールで構成され、各モジュールには1以上のコードブロックが実装されているものとする。そして、各コードブロックは、例えば、関数等の単位のプログラムコードの集合である。また、各コードブロックの一部には、制御フロー整合性の検査命令212が設定されているものとする。検査命令212は、後述する入力値判定部220及び制御フロー整合性検査部230による検査処理を呼び出す命令であり、例えば、関数である。検査命令212は、1のコードブロック内に複数設定されていてもよい。検査命令212は、コードブロック内の冒頭、中盤、末尾等の任意の位置に設定可能であるものとする。また、コードブロック間に検査命令212を設定することも可能であるが、その場合、検査命令212の直前のコードブロックの末尾か、検査命令212の直後のコードブロックの冒頭に設定した場合と同等であるものとする。検査命令212は、プログラムの開発時にソースコード上に実装されても良く、コンパイル後のバイナリに対して挿入されてもよい。尚、検査命令212の引数として対象コードブロック211への入力値が与えられていてもよい。または、対象コードブロック211への入力値は、別途、入力値判定部220から取得されても良い。
 入力値判定部220は、上述した判定部110の一例であり、検査命令212からの呼び出しに応じて取得される入力値を判定し、判定結果を制御フロー整合性検査部230へ通知するソフトウェアプロセス又はハードウェア回路である。入力値判定部220は、対象コードブロック211における過去の実行時の入力値との類似度合いを回避条件として判定を行う。これにより、実行時に用いられた実績のある入力値である場合に検査を回避でき、安全性を確保しつつ、検査処理の回数を減少させ、処理のオーバーヘッドをより削減することができる。
 ここで、判定補助情報は、対象コードブロックへの入力値を含むものとする。この場合、入力値判定部220は、入力値のデータ内容又はデータサイズの範囲を回避条件として判定を行う。これにより、バッファオーバーフロー等の攻撃の場合には回避条件を満たさず、通常通り検査させることで、当該攻撃を検出し得る。よって、セキュリティを維持し得る。
 また、入力値判定部220は、回避条件を満たすと判定した場合、当該回避条件を満たす度合いに応じて回避レベルを設定する。これにより、検査処理の実行をきめ細かく制御できる。
 また、入力値判定部220は、対象コードブロックにおける判定補助情報として入力値を取得する。そして、入力値判定部220は、後述する履歴情報と取得した判定補助情報とに基づいて、判定を行う。さらに、入力値判定部220は、後述する制御フロー整合性検査部230による回避結果に応じて、取得した入力値を履歴情報として履歴情報記憶部250に追加する。これにより、実行された実績や回避された実績を加味して精度よく、検査処理の回避の判定を行わせることができる。例えば、入力値が回避条件を満たすと判定され、後述する回避判定処理によって検査処理が回避されるという回避結果になった場合がある。その場合、入力値判定部220は、回避結果と入力値を対応付けた履歴情報として履歴情報記憶部250に追加する。また、入力値が回避条件を満たすと判定されたとしても、後述する回避判定処理により検査処理が回避されないという回避結果となる場合もある。その場合には、入力値判定部220は、回避結果及び検査結果と共に入力値を履歴情報として履歴情報記憶部250に追加するとよい。
 制御フローグラフ(CFG(Control Flow Graph))241は、プログラムの制御構造の解析結果をコードブロック間の制御の流れを定義したグラフ情報である。制御フローグラフ241は、デバイス200内のメモリ等の記憶装置に格納され、データベースとして機能するものである。制御フローグラフ241は、各コードブロックのプログラム内の位置及び実行順序が定義され、先に実行されたコードブロックから次に実行されるコードブロックへのリンク、分岐先へのリンク等が定義された情報である。
 図4は、本実施形態2にかかる制御フローグラフと検査命令の関係を説明するための図である。モジュール31は、コードブロックの集合であり、例えば、プログラムファイル等である。コードブロック32は、1以上のプログラムコードの集合であり、例えば、関数等である。ハッシュ値検査処理33は、コードブロック内に設定された検査命令の実行により呼び出され、入力値判定部220により回避条件を満たさない、又は、回避判定により回避できないと判定された場合に、実行されることを概念的に示したものである。
 図3に戻り説明を続ける。ハッシュ値242は、所定のプログラム内の複数のコードブロックの実行順序の検査に用いる情報である。言い換えると、本実施形態にかかるハッシュ値242は、所定のプログラム内の複数のコードブロックの実行順序を特定するための情報である。例えば、ハッシュ値242は、複数のコードブロックについての所定のプログラム内での実行順序を示す数値情報から所定のハッシュ関数により事前に算出された値である。また、ハッシュ値242は、2以上のコードブロックの制御フローのパスや実行順序の番号の組から、所定のハッシュ関数により算出された値であってもよい。尚、実行順序の検査には、ハッシュ値242の代わりに、実行順序そのものや実行順序の組そのものを用いても良い。
 回避レベル閾値243は、複数のコードブロックのそれぞれに予め定義された回避レベルの閾値である。尚、ハッシュ値242及び回避レベル閾値243のそれぞれは、デバイス200内のメモリ等の記憶装置に格納されている。尚、ハッシュ値242は、算出時に用いた実行順序と対応付けられて記憶装置に格納されているものとする。
 制御フロー整合性検査部230は、上述した検査部120の一例であり、検査命令に応じた、対象コードブロックのハッシュ値の検査処理が実装されたソフトウェアプロセス又はハードウェア回路である。制御フロー整合性検査部230は、プログラム実行部210で現在実行中の対象コードブロック211又は直後に実行され得るコードブロックについての制御フロー整合性の検査を行う。制御フロー整合性検査部230は、検査で問題なしと判定されれば、当該コードブロックの後続の処理の実行を許可する旨をプログラム実行部210へ返信し、検査で問題ありと判定されれば、当該コードブロックの後続の処理の実行をブロックする旨をプログラム実行部210へ返信する。
 ここで、本実施形態にかかる制御フロー整合性検査部230は、回避レベルに応じて検査を回避する。これにより、検査の回避の有無をきめ細かく制御できる。そして、制御フロー整合性検査部230は、入力値判定部220により設定された回避レベルが、対象コードブロックに定義された回避レベル閾値243を満たす場合、検査を回避する。これにより正確に回避の判定を行うことができる。
 履歴情報記憶部250は、判定補助情報の履歴情報を記憶する記憶装置である。ここでは、履歴情報記憶部250は、入力値251と、回避結果252とを対応付けて記憶する。また、入力値251及び回避結果252は、対象コードブロックとも対応付けられているものとする。入力値251は、入力値判定部220における判定に用いられた入力値である。回避結果252は、制御フロー整合性検査部230において検査が回避されたか否かを示す情報である。尚、履歴情報記憶部250は、入力値251及び回避結果252に加えて、制御フロー整合性検査部230による検査結果及び対象コードブロックの実行結果をさらに対応付けて記憶してもよい。
 図5は、本実施形態2にかかる事前処理の流れを示すフローチャートである。事前処理は、実行予定のプログラムからハッシュ値やCFGを生成し、保存する処理である。そして、事前処理は、デバイス200又は任意の情報処理装置で実現可能である。以下の説明では、任意の情報処理装置で実行するものとする。
 まず、情報処理装置は、デバイス200において実行予定のプログラムを解析する(S21)。そして、情報処理装置は、解析結果に基づき当該プログラムの制御フローグラフ(CFG)を生成する(S22)。そして、情報処理装置は、CFGに基づきプログラムの各コードブロックに検査命令を挿入する。例えば、上述した図4のように挿入される。尚、検査命令が解析対象のプログラムに予め実装済みである場合、ステップS23を省略することができる。
 続いて、情報処理装置は、CFGに基づき各コードブロックの実行順序のハッシュ値を算出する(S24)。例えば上述したように、情報処理装置は、所定のハッシュ関数に実行順序を与えて、ハッシュ値を算出する。その後、情報処理装置は、算出したハッシュ値を実行順序と対応付けてデバイス200内のメモリに保存する(S25)。また、情報処理装置は、生成したCFGをデバイス200内の記憶装置(不図示)に制御フローグラフ241として保存する。
 図6は、本実施形態2にかかる制御フロー検査方法の流れを示すフローチャートである。ここでは、上記事前処理でCFG及びハッシュ値を作成したプログラムを、デバイス200で実行する際に、制御フロー検査処理を行う場合について説明する。
 まず、プログラム実行部210は、プログラムの実行を開始する(S301)。例えば、デバイス200内のプロセッサコアが(外部から入力された)実行対象のプログラムをメモリ(不図示)に読み込み、実行する。
 次に、プログラム実行部210は、対象コードブロックを実行中に検査命令を実行し、入力値判定部220を呼び出す。入力値判定部220は、検査命令実行による呼び出しを受け付ける(S302)。そして、入力値判定部220は、入力値判定処理を行う(S303)。
 図7は、本実施形態2にかかる入力値判定処理の流れを示すフローチャートである。まず、入力値判定部220は、対象コードブロックへの入力値を取得する(S321)。例えば、検査命令の引数に対象コードブロックへの入力値が設定されている場合、入力値判定部220は、検査命令の引数から入力値を取得する。また、検査命令の引数に入力値が設定されていない場合、入力値判定部220は、プログラム実行部210へ問い合わせて、対象コードブロックへの入力値を取得してもよい。
 次に、入力値判定部220は、入力値が回避条件を満たすか否かを判定する(S322)。ここで、回避条件には、例えば、入力値のデータ内容が所定値と完全一致することや部分一致すること、部分一致する場合の一致する文字数や一致する文字数の全文字数における割合等が挙げられる。または、回避条件には、例えば、入力値が示す数値が所定範囲内であること等が挙げられる。または、回避条件には、例えば、入力値のデータ長が所定値と一致すること、データ長が所定範囲以内であること、所定範囲より短いこと、所定範囲以上であること、所定範囲より長いこと等が挙げられる。但し、回避条件は、これらに限定されない。また、回避条件は、デバイス200内のメモリ(不図示)等の記憶装置に予め保存されているものとする。また、所定値は、履歴情報記憶部250に記憶された入力値251のうち、対象コードブロックに対応するものを用いても良い。
 ステップS322において回避条件を満たすと判定した場合、入力値判定部220は、回避条件を満たす度合いに応じた回避レベルを設定する(S323)。例えば、入力値のデータ内容が所定値と完全一致する場合には、入力値判定部220は、回避レベルを高レベル(例えば「3」)に設定する。また、入力値のデータ内容が80%部分一致する場合には、入力値判定部220は、回避レベルを中レベル(例えば「2」)に設定する。また、入力値のデータ内容が50%部分一致する場合には、入力値判定部220は、回避レベルを低レベル(例えば「1」)に設定する。尚、回避レベルの設定ルールは一例であり、これらに限定されない。また、回避レベルの設定ルールは、デバイス200内のメモリ(不図示)等の記憶装置に予め保存されているものとする。つまり、入力値判定部220は、回避レベルの設定ルールを参照して回避レベルを設定する。また、回避レベルは、3段階である必要はなく、2段階(例えば、二値)以上であればよい。
 ステップS322において回避条件を満たすと判定した場合、入力値判定部220は、回避レベルを「0」に設定する(S324)。尚、回避レベルにnullを設定するか、設定しなくてもよい。
 ステップS323又はS324の後、入力値判定部220は、設定した回避レベルを制御フロー整合性検査部230へ出力する(S325)。
 図6に戻り説明を続ける。ステップS303の入力値判定処理の後、制御フロー整合性検査部230は、回避判定処理を行う(S304)。
 図8は、本実施形態2にかかる回避判定処理の流れを示すフローチャートである。まず、制御フロー整合性検査部230は、入力値判定部220から回避レベルを取得する(S331)。次に、制御フロー整合性検査部230は、取得した回避レベルが0以外か否かを判定する(S332)。取得した回避レベルが0以外である場合、制御フロー整合性検査部230は、回避レベルが1、2又は3のいずれかを判定する(S333)。尚、ステップS332及びS333はまとめて実施しても構わない。
 回避レベルが1の場合、制御フロー整合性検査部230は、対象コードブロックの回避頻度に応じた回避フラグを設定する(S334)。ここで、回避頻度とは、対象コードブロックに対応付けられた回避結果252から算出された値、比率であるとよい。また、回避フラグは0又は1の二値であるものとする。例えば、対象コードブロックの回避頻度が所定値以上の場合、制御フロー整合性検査部230は、回避フラグを1に設定する。一方、対象コードブロックの回避頻度が所定値未満の場合、制御フロー整合性検査部230は、回避フラグを0に設定する。
 回避レベルが2の場合、制御フロー整合性検査部230は、対象コードブロックの重要度に応じた回避フラグを設定する(S335)。ここで、重要度は、コードブロックのセキュリティ上の重要性を示す情報である。対象コードブロックの重要度が所定値未満の場合、制御フロー整合性検査部230は、回避フラグを1に設定する。一方、対象コードブロックの重要度が所定値以上の場合、制御フロー整合性検査部230は、回避フラグを0に設定する。つまり、より重要なコードブロックの検査処理は極力回避しないことで、セキュリティを維持できる。
 または、コードブロックの実行順序の優先度(処理時間の制約が高い等)が予め設定されている場合、制御フロー整合性検査部230は、優先度に応じた回避フラグを設定してもよい。例えば、優先度が所定値以上の場合、制御フロー整合性検査部230は、回避フラグを1に設定する。一方、優先度が所定値未満の場合、制御フロー整合性検査部230は、回避フラグを0に設定する。つまり、優先度がより高いコードブロックは、検査を回避することで、処理時間の制約を満たすように努めることができる。
 尚、上述した対象コードブロックの重要度又は優先度には、対象コードブロックごとに対応付けられた回避レベル閾値243を用いてもよい。また、回避頻度に基づいて回避レベル閾値243を更新してもよい。
 回避レベルが3の場合、制御フロー整合性検査部230は、回避フラグを1に設定する(S336)。
 ステップS332において取得した回避レベルが0である場合、制御フロー整合性検査部230は、回避フラグを0に設定する(S337)。
 尚、回避レベルの上述した判定条件は一例であり、これらに限定されない。また、回避レベルの判定条件は、デバイス200内のメモリ(不図示)等の記憶装置に予め保存されているものとする。つまり、制御フロー整合性検査部230は、回避レベルの判定条件を参照して回避フラグを設定する。
 図6に戻り説明を続ける。制御フロー整合性検査部230は、回避フラグが1であるか否かを判定する(S305)。回避フラグが1以外の場合、制御フロー整合性検査部230は、ハッシュ値取得処理を行う(S306)。例えば、制御フロー整合性検査部230は、プログラム実行部210から対象コードブロックの現在の実行順序を取得し、実行順序を用いてハッシュ値を算出する。ここで、ハッシュ値の算出の仕方、用いるハッシュ関数等は、事前処理(ステップS24)と同様であるものとする。また、ハッシュ値の算出と独立して、制御フロー整合性検査部230は、現在の実行順序に対応付けられたハッシュ値242を取得する。
 そして、制御フロー整合性検査部230は、算出したハッシュ値と取得したハッシュ値とが一致するか否かを判定する(S307)。ハッシュ値が一致すると判定した場合、制御フロー整合性検査部230は、対象コードブロックの実行を許可する旨をプログラム実行部210へ出力する。そして、プログラム実行部210は、対象コードブロックを実行する(S308)。そして、入力値判定部220は、取得した入力値251及び制御フロー整合性検査部230における回避結果252を履歴情報記憶部250へ格納する。つまり、入力値判定部220は、履歴を追加する(S309)。さらに、入力値判定部220は、入力値251及び回避結果252と共に、検査結果及び対象コードブロックの実行結果を対応付けて履歴情報として履歴情報記憶部250へ格納してもよい。さらに、入力値判定部220の代わりにプログラム実行部210又は入力値判定部220が、履歴情報を履歴情報記憶部250へ格納してもよい。
 尚、制御フロー整合性の検査には、ハッシュ値242の代わりに、実行順序そのものや実行順序の組そのものを用いても良い。具体的には、対象コードブロックの現在の実行順序と、あらかじめ記録しておいた実行順序を列挙したパターンと比較し、現在の実行順序がそのパターンの中にあれば、正常とみなしてプログラムの実行を許可する。
 その後、プログラム実行部210は、次の対象コードブロックが存在するか否かを判定する(S310)。存在する場合、プログラム実行部210は、検査命令を実行した際に、再び、入力値判定部220を呼び出し、ステップS302へ進み、以降を繰り返し実行する。ステップS310で、次の対象コードブロックが存在しないと判定した場合、プログラムの実行を終了する。
 一方、ステップS307でハッシュ値が一致しないと判定した場合、制御フロー整合性検査部230は、対象コードブロックの実行を許可しない旨(エラー通知)をプログラム実行部210へ出力する(S311)。そして、プログラムの実行を終了する。
 尚、本実施形態では、入力値判定処理にて回避フラグを設定することで、ステップS304の回避判定処理を省略してもよい。
 図9は、本実施形態2にかかる制御フロー整合性の検査処理の回避の概念を説明するための図である。図9では、各コードブロックにおける検査命令の呼び出しに対して、回避331、332、333、334及び335の箇所でハッシュ値の検査処理が回避されたことを概念的に示すものである。尚、回避される箇所や数がこれらに限定されないことはもちろんである。
 このように、本実施形態により対象コードブロックへの入力値を判定することで、例えば、バッファオーバーフローなどの場合の検査を漏らさず、一方で、過去の入力値との類似度合いが高い場合には、検査を回避することで処理速度を向上できる。特に、各コードブロックにおける入力値とそれに関連する情報を含む履歴情報を用いることで、回避条件を満たすか否かの判定精度を向上できる。さらに、入力値判定処理で回避レベルを設定した後に、回避判定処理で(回避フラグにより)最終的な回避有無を判定することで、きめ細かく検査の回避を制御できる。これらによっても、デバイスのセキュリティを維持しつつ、処理のオーバーヘッドを削減することができる。
<実施形態3>
 本実施形態3は、上述した実施形態1の変形例である。本実施形態3にかかる判定補助情報は、対象コードブロックの実行時の内部状態変数値をさらに含む。そして、判定手段は、内部状態変数値の範囲を回避条件としてさらに加味して判定を行うものである。これにより、回避条件を満たすか否かの判定精度をより向上できる。その理由は、対象コードブロックが繰り返し実行される場合に、入力値が類似したとしても、実行に伴い内部状態変数値が変化し、内部状態変数値によっては検査を要する場合があり得るためである。
 図10は、本実施形態3にかかるデバイス200aの構成を示すブロック図である。デバイス200aは、上述したデバイス200に対して、制御フロー整合性検査部230が制御フロー整合性検査部230aに置き換わり、内部状態変数値判定部260及び内部状態変数値253が追加されたものである。それ以外の構成には同一の符号を付し、適宜説明を省略する。
 内部状態変数値判定部260は、上述した入力値判定部220の一部を改良したものであり、検査命令212からの呼び出しに応じて取得される内部状態変数値を判定し、判定結果を制御フロー整合性検査部230aへ通知するソフトウェアプロセス又はハードウェア回路である。特に、内部状態変数値判定部260は、内部状態変数値の範囲を回避条件として加味して判定を行う。
 内部状態変数値253は、対象コードブロックの内部状態を保持するための変数値であり、履歴情報に含めて履歴情報記憶部250に記憶される。
 制御フロー整合性検査部230aは、入力値判定部220及び内部状態変数値判定部260のそれぞれにおける判定結果として、各回避レベルを取得する。制御フロー整合性検査部230aは、双方の回避レベルのいずれか一方が0(又はnull)である場合、検査処理を行う。制御フロー整合性検査部230aは、両方の回避レベルが共に0以外の場合、より低い回避レベルに応じた回避判定処理を行う。
 図11は、本実施形態3にかかる制御フロー検査方法の流れを示すフローチャートである。以下では、図6と同等の構成については説明を省略する。また、図5の事前処理が実施済みであることも実施形態2と同様である。
 ステップS302の後、ステップS303と共に、内部状態変数値判定部260は、内部状態変数値判定処理を行う(S312)。
 図12は、本実施形態3にかかる内部状態変数値判定処理の流れを示すフローチャートである。まず、内部状態変数値判定部260は、対象コードブロックの実行時の内部状態変数値を取得する(S321a)。例えば、検査命令の引数に内部状態変数値が設定されている場合、内部状態変数値判定部260は、検査命令の引数から内部状態変数値を取得する。また、検査命令の引数に内部状態変数値が設定されていない場合、内部状態変数値判定部260は、プログラム実行部210へ問い合わせて、又は、履歴情報記憶部250から内部状態変数値253を取得してもよい。
 次に、内部状態変数値判定部260は、内部状態変数値が回避条件を満たすか否かを判定する(S322a)。ここで、回避条件については、ステップS322と同等である。
 ステップS322aの判定結果に応じてステップS323又はS324により内部状態変数値における回避レベルが設定され、制御フロー整合性検査部230aへ出力される(S325)。
 図11に戻り説明を続ける。ステップS303及びS312の後、制御フロー整合性検査部230aは、回避判定処理を行う(S304a)。
 図13は、本実施形態3にかかる回避判定処理の流れを示すフローチャートである。まず、制御フロー整合性検査部230aは、入力値判定部220及び内部状態変数値判定部260のそれぞれから回避レベルを取得する(S331a)。例えば、制御フロー整合性検査部230aは、入力値判定部220から回避レベルAを、内部状態変数値判定部260から回避レベルBを取得するものとする。
 次に、制御フロー整合性検査部230aは、取得した回避レベルが共に0以外か否かを判定する(S332a)。回避レベルA及びBが共に1~3であれば、ステップS333aへ進む。一方、回避レベルAが1~3であっても回避レベルBが0の場合、回避レベルBが1~3であっても回避レベルAが0の場合、回避レベルA及びBが共に0の場合、ステップS337へ進む。
 回避レベルA及びBが共に1~3の場合、制御フロー整合性検査部230aは、回避レベルA及びBのうちレベルがより低い方の回避レベルが1、2又は3のいずれかを判定する(S333a)。もし、回避レベルA及びBが同じであれば、いずれか一方を判定すればよい。以降は、図8と同様である。
 図11に戻り説明を続ける。ステップS305からS308、S310及びS311は、図8と同様である。ステップS308の後、そして、入力値判定部220は、取得した入力値251及び制御フロー整合性検査部230における回避結果252に加えて、取得した内部状態変数値253を履歴情報記憶部250へ格納する。つまり、入力値判定部220は、履歴を追加する(S309a)。これにより、当該対象ブロックを次回、回避条件を判定する際に、内部状態変数値判定部260は、履歴情報記憶部250から内部状態変数値253を取得でき、処理時間をより短縮できる。
 その他、本実施形態3では、上述した実施形態2と同様の変形が可能である。
 図14は、本実施形態3にかかる制御フロー整合性の検査処理の回避の概念を説明するための図である。コードブロック321、322及び323は、それぞれ入力値だけでなく、内部状態変数値が共通するものとする。その場合、コードブロック321においてはハッシュ値検査処理330が実行されるが、後続のコードブロック322及び323においては、回避されることを示す。また、他の箇所では、入力値又は内部状態変数値が回避条件を満たさないため、検査が実行されることを示す。尚、回避される箇所や数がこれらに限定されないことはもちろんである。
 図15は、本実施形態3にかかるデバイス200aの実施例の構成を示すブロック図である。デバイス400は、デバイス200aの具体例であり、例えば、TEE(Trusted Execution Environment)を適用したものである。デバイス400は、非セキュア領域であるnormal world410と、セキュア領域であるsecure world420と、を備える。normal world410は、プログラム実行部210としてプロセッサコア411を備える。プロセッサコア411は、対象コードブロック211を実行するものとする。
 secure world420は、上述した入力値判定部220、内部状態変数値判定部260、履歴情報記憶部250、制御フロー整合性検査部230a、制御フローグラフ241、ハッシュ値242及び回避レベル閾値243を備える。但し、secure world420は、少なくとも入力値判定部220、内部状態変数値判定部260及び制御フロー整合性検査部230aを備えるものであればよい。入力値判定部220及び内部状態変数値判定部260は、プロセッサコア411により対象コードブロックに設定された制御フロー整合性の検査を呼び出す検査命令の実行に応じて、検査の回避条件を満たすか否かの判定を行う。secure world420は、例えば、ARM(登録商標)アーキテクチャにおけるTrustedZoneである。
 図16は、本実施形態3にかかる情報処理装置500の実施例の構成を示すブロック図である。情報処理装置500は、記憶装置510と、制御部520と、メモリ530と、IF(InterFace)部540とを備える。記憶装置510は、ハードディスク、フラッシュメモリ等の不揮発性記憶装置である。記憶装置510は、制御フロー検査プログラム511と、制御フローグラフ512と、ハッシュ値513と、回避レベル閾値514と、実行対象プログラム515と、履歴情報516とを記憶する。制御フロー検査プログラム511は、本実施形態にかかる制御フロー検査方法の処理が実装されたコンピュータプログラムである。制御フローグラフ512、ハッシュ値513及び回避レベル閾値514のそれぞれは、上述した制御フローグラフ241、ハッシュ値242及び回避レベル閾値243に対応する。実行対象プログラム515は、所定のプログラムに対応し、複数のコードブロックが含まれる。履歴情報516は、上述した履歴情報記憶部250に記憶された履歴情報に対応する。
 メモリ530は、制御部520の動作時に一時的に情報を保持するための記憶領域である。IF部540は、情報処理装置500の外部との入出力を行うインタフェースである。例えば、IF部540は、外部からの入力データを制御部520へ出力し、制御部520から受け付けたデータを外部へ出力する。
 制御部520は、情報処理装置500の各構成を制御するプロセッサつまり制御装置である。例えば、制御部520は、1以上のプロセッサコアであってもよい。制御部520は、記憶装置510から制御フロー検査プログラム511をメモリ530へ読み込み、制御フロー検査プログラム511を実行する。また、制御部520は、記憶装置510から制御フローグラフ512、ハッシュ値513、回避レベル閾値514及び履歴情報516を適宜、メモリ530へ読み込む。また、制御部520は、記憶装置510から実行対象プログラム515をメモリ530へ読み込み、実行する。これらにより、制御部520は、プログラム実行部210、入力値判定部220、制御フロー整合性検査部230a、制御フローグラフ241、ハッシュ値242、回避レベル閾値243、履歴情報記憶部250、内部状態変数値判定部260の機能を実現する。尚、制御部520は、好適には、TEE(Trusted Execution Environment)を備えたCPUであり、その場合、本実施形態にかかる制御フロー検査プログラム511は、TEEを備えたCPU上で実行されるものといえる。
<実施形態4>
 本実施形態4は、上述した実施形態1から3の変形例である。実施形態4では、デバイスの各種ログを用いて回避条件の判定モデルを機械学習し、判定精度を向上させるものである。
 図17は、本実施形態4にかかるデバイス200bの構成を示すブロック図である。デバイス200bは、上述したデバイス200aに対して、入力値判定部220及び内部状態変数値判定部260が入力値判定部220b及び内部状態変数値判定部260bに置き換わり、学習部270及び判定モデル271並びに検査結果254及び実行結果255が追加されたものである。尚、デバイス200bは、実施形態3の変形例であるが、実施形態1又は2を変形しても構わない。
 検査結果254は、制御フロー整合性検査部230aによる対象コードブロックの検査結果であり、履歴情報記憶部250に記憶されている。実行結果255は、検査で認められた対象コードブロックの実行結果であり、履歴情報記憶部250に記憶されている。
 判定モデル271は、入力値又は内部状態変数値を入力として、設定されたパラメータを用いて所定の演算を行い、演算結果を回避レベル又は回避フラグとして出力する処理が実装されたプログラムモジュールやモデル式である。つまり、判定モデル271は、入力値用と内部状態変数値用の2つのモデルであってもよい。または、判定モデル271は、入力値及び内部状態変数値の両方を入力として、設定されたパラメータを用いて所定の演算を行い、演算結果を回避レベル又は回避フラグとして出力するものであってもよい。例えば、判定モデル271は、入力値及び内部状態変数値の各データを入力データの要素とし、各入力データに所定のパラメータ(重み付け係数)を用いて回避条件を満たすか否かを判定し、満たす度合いに応じて回避レベルを設定する。尚、判定モデル271は、ニューラルネットワーク、サポートベクターマシン等で表現されたものであればよい。
 学習部270は、履歴情報記憶部250に記憶された履歴情報の少なくとも一部を学習用データとして判定モデル271を学習する。例えば、学習部270は学習用データを用いて回避条件や回避レベルの設定ルール等の機械学習を行い、判定モデル271のパラメータを更新する。これにより、判定モデル271をリアルタイムに最新状態に更新できる。よって、よりセキュリティを維持できる。
 入力値判定部220b及び内部状態変数値判定部260bは、履歴情報を用いて回避条件が学習された判定モデル271を用いて、判定を行う。尚、入力値判定部220b又は内部状態変数値判定部260bのいずれか一方が判定モデル271を用い、他方は、他の実施形態と同様のものを用いても良い。または、判定モデル271が入力値及び内部状態変数値の両方を入力とする場合、入力値判定部220b及び内部状態変数値判定部260bを一つの判定部とし、1つの回避レベルを制御フロー整合性検査部230aへ出力してもよい。これらにより、過去の検査の実績を踏まえることができ、回避条件の判定精度がより向上する。
 図18は、本実施形態4にかかる学習処理を含む制御フロー検査方法の流れを示すフローチャートである。以下では、図11と同等の構成については説明を省略する。また、図5の事前処理が実施済みであることも実施形態3と同様である。尚、図7のステップS322及び図12のステップS322aは、判定モデル271を用いるものとする。
 そして、ステップS309の後、学習部270は、履歴情報記憶部250から履歴情報を読み出し、学習用データとして判定モデル271の回避条件、回避レベルの設定ルールを機械学習する(S313)。例えば、学習部270は、学習用データとして入力値251、回避結果252、内部状態変数値253、検査結果254及び実行結果255の少なくとも一部を用いる。その後ステップS310へ進む。以降は、同様である。
 尚、本実施形態では、学習部270が必須ではない。別途、外部の情報処理装置が学習部270を備え、学習済みの判定モデル271をデバイス200b内の記憶装置に保存してもよい。
<その他の実施形態>
 尚、上記実施形態において、様々な処理を行う機能ブロックとして図面に記載される各要素は、ハードウェア的には、CPU(Central Processing Unit)、メモリ、その他の回路で構成することができ、ソフトウェア的には、CPUがメモリにロードして実行するプログラム等によって実現される。したがって、これらの機能ブロックがハードウェアのみ、ソフトウェアのみ、又はそれらの組合せによっていろいろな形で実現できることは当業者には理解されるところであり、いずれかに限定されるものではない。
 また、上記のプログラムは、様々なタイプの非一時的なコンピュータ可読媒体(non-transitory computer readable medium)を用いて格納され、コンピュータに供給することができる。非一時的なコンピュータ可読媒体は、様々なタイプの実体のある記録媒体(tangible storage medium)を含む。非一時的なコンピュータ可読媒体の例は、磁気記録媒体(例えばフレキシブルディスク、磁気テープ、ハードディスクドライブ)、光磁気記録媒体(例えば光磁気ディスク)、CD-ROM(Compact Disc-Read Only Memory)、CD-R(CD-Recordable)、CD-R/W(CD-ReWritable)、半導体メモリ(例えば、マスクROM、PROM(Programmable ROM)、EPROM(Erasable PROM)、フラッシュROM、RAM(Random Access Memory))を含む。また、プログラムは、様々なタイプの一時的なコンピュータ可読媒体(transitory computer readable medium)によってコンピュータに供給されても良い。一時的なコンピュータ可読媒体の例は、電気信号、光信号、及び電磁波を含む。一時的なコンピュータ可読媒体は、電線及び光ファイバ等の有線通信路、又は無線通信路を介して、プログラムをコンピュータに供給できる。
 なお、本開示は上記実施形態に限られたものではなく、趣旨を逸脱しない範囲で適宜変更することが可能である。また、本開示は、それぞれの実施形態を適宜組み合わせて実施されてもよい。
 上記の実施形態の一部又は全部は、以下の付記のようにも記載され得るが、以下には限られない。
 (付記A1)
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う判定手段と、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する検査手段と、
 を備える半導体装置。
 (付記A2)
 前記判定手段は、
 前記対象コードブロックにおける過去の実行時の判定補助情報との類似度合いを前記回避条件として前記判定を行う
 付記A1に記載の半導体装置。
 (付記A3)
 前記判定補助情報は、前記対象コードブロックへの入力値を含み、
 前記判定手段は、
 前記入力値のデータ内容又はデータサイズの範囲を前記回避条件として前記判定を行う
 付記A1又はA2に記載の半導体装置。
 (付記A4)
 前記判定補助情報は、前記対象コードブロックの実行時の内部状態変数値をさらに含み、
 前記判定手段は、
 前記内部状態変数値の範囲を前記回避条件としてさらに加味して前記判定を行う
 付記A3に記載の半導体装置。
 (付記A5)
 前記判定手段は、
 前記回避条件を満たすと前記判定を行った場合、当該回避条件を満たす度合いに応じて回避レベルを設定し、
 前記検査手段は、
 前記回避レベルに応じて前記検査を回避する
 付記A1乃至A4のいずれか1項に記載の半導体装置。
 (付記A6)
 前記複数のコードブロックのそれぞれは、前記回避レベルの閾値が予め定義されており、
 前記検査手段は、
 前記判定手段により設定された回避レベルが、前記対象コードブロックに定義された回避レベルの閾値を満たす場合、前記検査を回避する
 付記A5に記載の半導体装置。
 (付記A7)
 前記判定補助情報の履歴情報を記憶する記憶手段をさらに備え、
 前記判定手段は、
 前記対象コードブロックにおける判定補助情報を取得し、
 前記履歴情報と前記取得した判定補助情報とに基づいて、前記判定を行い、
 前記検査手段による回避結果に応じて、前記取得した判定補助情報を前記履歴情報として前記記憶手段に追加する
 付記A1乃至A6のいずれか1項に記載の半導体装置。
 (付記A8)
 前記判定手段は、
 前記履歴情報を用いて前記回避条件が学習された判定モデルを用いて、前記判定を行う
 付記A7に記載の半導体装置。
 (付記A9)
 前記履歴情報を用いて前記判定モデルの前記回避条件を学習してパラメータを更新する学習手段をさらに備える
 付記A8に記載の半導体装置。
 (付記A10)
 前記半導体装置は、セキュア領域と非セキュア領域とを備え、
 前記セキュア領域は、前記判定手段及び前記検査手段を少なくとも含み、
 前記非セキュア領域は、プログラム実行手段を含み、
 前記判定手段は、
 前記プログラム実行手段により前記対象コードブロックに設定された前記制御フロー整合性の検査を呼び出す検査命令の実行に応じて、前記判定を行う
 付記A1乃至A9のいずれか1項に記載の半導体装置。
 (付記B1)
 コンピュータが、
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行い、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する
 制御フロー検査方法。
 (付記C1)
 所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う処理と、
 前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する処理と、
 をコンピュータに実行させる制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体。
 (付記D1)
 付記A1乃至A10のいずれか1項に記載の半導体装置を備える電子機器。
 以上、実施形態(及び実施例)を参照して本願発明を説明したが、本願発明は上記実施形態(及び実施例)に限定されものではない。本願発明の構成や詳細には、本願発明のスコープ内で当業者が理解し得る様々な変更をすることができる。
 100 半導体装置
 110 判定部
 120 検査部
 200 デバイス
 200a デバイス
 200b デバイス
 210 プログラム実行部
 211 対象コードブロック
 212 検査命令
 220 入力値判定部
 220b 入力値判定部
 230 制御フロー整合性検査部
 230a 制御フロー整合性検査部
 241 制御フローグラフ
 242 ハッシュ値
 243 回避レベル閾値
 250 履歴情報記憶部
 251 入力値
 252 回避結果
 253 内部状態変数値
 254 検査結果
 255 実行結果
 260 内部状態変数値判定部
 260b 内部状態変数値判定部
 270 学習部
 271 判定モデル
 31 モジュール
 32 コードブロック
 321 コードブロック
 322 コードブロック
 323 コードブロック
 33 ハッシュ値検査処理
 331 回避
 332 回避
 333 回避
 334 回避
 335 回避
 336 回避
 400 デバイス
 410 normal world
 411 プロセッサコア
 420 secure world
 500 情報処理装置
 510 記憶装置
 511 制御フロー検査プログラム
 512 制御フローグラフ
 513 ハッシュ値
 514 回避レベル閾値
 515 実行対象プログラム
 516 履歴情報
 520 制御部
 530 メモリ
 540 IF部

Claims (13)

  1.  所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う判定手段と、
     前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する検査手段と、
     を備える半導体装置。
  2.  前記判定手段は、
     前記対象コードブロックにおける過去の実行時の判定補助情報との類似度合いを前記回避条件として前記判定を行う
     請求項1に記載の半導体装置。
  3.  前記判定補助情報は、前記対象コードブロックへの入力値を含み、
     前記判定手段は、
     前記入力値のデータ内容又はデータサイズの範囲を前記回避条件として前記判定を行う
     請求項1又は2に記載の半導体装置。
  4.  前記判定補助情報は、前記対象コードブロックの実行時の内部状態変数値をさらに含み、
     前記判定手段は、
     前記内部状態変数値の範囲を前記回避条件としてさらに加味して前記判定を行う
     請求項3に記載の半導体装置。
  5.  前記判定手段は、
     前記回避条件を満たすと前記判定を行った場合、当該回避条件を満たす度合いに応じて回避レベルを設定し、
     前記検査手段は、
     前記回避レベルに応じて前記検査を回避する
     請求項1乃至4のいずれか1項に記載の半導体装置。
  6.  前記複数のコードブロックのそれぞれは、前記回避レベルの閾値が予め定義されており、
     前記検査手段は、
     前記判定手段により設定された回避レベルが、前記対象コードブロックに定義された回避レベルの閾値を満たす場合、前記検査を回避する
     請求項5に記載の半導体装置。
  7.  前記判定補助情報の履歴情報を記憶する記憶手段をさらに備え、
     前記判定手段は、
     前記対象コードブロックにおける判定補助情報を取得し、
     前記履歴情報と前記取得した判定補助情報とに基づいて、前記判定を行い、
     前記検査手段による回避結果に応じて、前記取得した判定補助情報を前記履歴情報として前記記憶手段に追加する
     請求項1乃至6のいずれか1項に記載の半導体装置。
  8.  前記判定手段は、
     前記履歴情報を用いて前記回避条件が学習された判定モデルを用いて、前記判定を行う
     請求項7に記載の半導体装置。
  9.  前記履歴情報を用いて前記判定モデルの前記回避条件を学習してパラメータを更新する学習手段をさらに備える
     請求項8に記載の半導体装置。
  10.  前記半導体装置は、セキュア領域と非セキュア領域とを備え、
     前記セキュア領域は、前記判定手段及び前記検査手段を少なくとも含み、
     前記非セキュア領域は、プログラム実行手段を含み、
     前記判定手段は、
     前記プログラム実行手段により前記対象コードブロックに設定された前記制御フロー整合性の検査を呼び出す検査命令の実行に応じて、前記判定を行う
     請求項1乃至9のいずれか1項に記載の半導体装置。
  11.  コンピュータが、
     所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行い、
     前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する
     制御フロー検査方法。
  12.  所定のプログラム内の複数のコードブロックのうち実行対象である対象コードブロックにおける判定補助情報に基づき、制御フロー整合性の検査の回避条件を満たすか否かの判定を行う処理と、
     前記回避条件を満たすと判定した場合に、前記対象コードブロックにおける前記制御フロー整合性の検査を回避する処理と、
     をコンピュータに実行させる制御フロー検査プログラムが格納された非一時的なコンピュータ可読媒体。
  13.  請求項1乃至10のいずれか1項に記載の半導体装置を備える電子機器。
PCT/JP2019/025100 2019-06-25 2019-06-25 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器 WO2020261365A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2021528686A JP7338686B2 (ja) 2019-06-25 2019-06-25 半導体装置、制御フロー検査方法、制御フロー検査プログラム及び電子機器
US17/620,804 US11868467B2 (en) 2019-06-25 2019-06-25 Semiconductor device, control flow inspection method, non-transitory computer readable medium, and electronic device
PCT/JP2019/025100 WO2020261365A1 (ja) 2019-06-25 2019-06-25 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2019/025100 WO2020261365A1 (ja) 2019-06-25 2019-06-25 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器

Publications (1)

Publication Number Publication Date
WO2020261365A1 true WO2020261365A1 (ja) 2020-12-30

Family

ID=74060831

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/025100 WO2020261365A1 (ja) 2019-06-25 2019-06-25 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器

Country Status (3)

Country Link
US (1) US11868467B2 (ja)
JP (1) JP7338686B2 (ja)
WO (1) WO2020261365A1 (ja)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4004784B1 (en) * 2020-09-30 2024-03-13 Google LLC Determining expected hash-values in functions with control flow

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180225446A1 (en) * 2017-02-06 2018-08-09 Huawei Technologies Co., Ltd. Processor trace-based enforcement of control flow integrity of a computer system
JP2019012498A (ja) * 2017-07-03 2019-01-24 株式会社デンソー 電子制御装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3373178A1 (en) 2017-03-08 2018-09-12 Secure-IC SAS Comparison of execution context data signatures with references
US11496506B2 (en) * 2017-07-03 2022-11-08 Denso Corporation Program generation method and electronic control unit for changing importance of functions based on detected operation state in a vehicle

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180225446A1 (en) * 2017-02-06 2018-08-09 Huawei Technologies Co., Ltd. Processor trace-based enforcement of control flow integrity of a computer system
JP2019012498A (ja) * 2017-07-03 2019-01-24 株式会社デンソー 電子制御装置

Also Published As

Publication number Publication date
US20220358211A1 (en) 2022-11-10
JP7338686B2 (ja) 2023-09-05
US11868467B2 (en) 2024-01-09
JPWO2020261365A1 (ja) 2020-12-30

Similar Documents

Publication Publication Date Title
JP2021535477A (ja) フォールトツリー分析を使用して機能安全のため制御フローグラフを最適化するシステム及び方法
US9720793B2 (en) Implementing processor functional verification by generating and running constrained random irritator tests for multiple processor system and processor core with multiple threads
CN105975269B (zh) 一种基于流程模型的需求验证方法
KR102118236B1 (ko) 컨트랙트에 대한 운영 체제 지원 기법
WO2020261365A1 (ja) 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器
US8438000B2 (en) Dynamic generation of tests
US20190146893A1 (en) Simulation device, simulation system, simulation method, and simulation program
JP2020057385A (ja) ソースコード作成のためのモデルの変更方法
US10929584B1 (en) Environmental modification testing for design correctness with formal verification
US11113140B2 (en) Detecting error in executing computation graph on heterogeneous computing devices
US9117023B2 (en) Dynamic generation of test segments
CN115562931A (zh) 处理器调试模块验证方法、装置、电子设备和存储介质
CN115328772A (zh) 激励组合与模块相关性的学习方法与测试脚本产生方法
WO2020261377A1 (ja) 半導体装置、制御フロー検査方法、非一時的なコンピュータ可読媒体及び電子機器
WO2019142266A1 (ja) テストケース生成装置、テストケース生成方法およびテストケース生成プログラム
JP2008090699A (ja) トレースロギング方法、装置及びプログラム
KR20210147354A (ko) 소스 코드 자동 머지 방법 및 그 장치
Bohlender et al. Symbolic Verification of PLC Safety-Applications based on PLCopen Automata.
JP4569284B2 (ja) 集積回路のデバッグ方法、デバッグプログラム
CN114780444B (zh) 代码优化方法、装置、电子设备和存储介质
US20230237010A1 (en) Power efficient memory value updates for arm architectures
US20150135149A1 (en) Monitoring coverage for static modelling of an electronic device
US20220147617A1 (en) Information processing apparatus, information processing method, and storage medium
CN113688032A (zh) 基于进程间通信机制的故障注入验证方法、系统及终端
CN115658958A (zh) 基于大数据的语音数据挖掘方法及系统

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

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021528686

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19935021

Country of ref document: EP

Kind code of ref document: A1