WO2017112315A1 - Non-tracked control transfers within control transfer enforcement - Google Patents
Non-tracked control transfers within control transfer enforcement Download PDFInfo
- Publication number
- WO2017112315A1 WO2017112315A1 PCT/US2016/063665 US2016063665W WO2017112315A1 WO 2017112315 A1 WO2017112315 A1 WO 2017112315A1 US 2016063665 W US2016063665 W US 2016063665W WO 2017112315 A1 WO2017112315 A1 WO 2017112315A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- instruction
- execution
- control transfer
- micro
- processor
- Prior art date
Links
- 238000012546 transfer Methods 0.000 title claims abstract description 143
- 238000012545 processing Methods 0.000 claims abstract description 75
- 230000007704 transition Effects 0.000 claims abstract description 13
- 230000015654 memory Effects 0.000 claims description 78
- 238000000034 method Methods 0.000 claims description 73
- 230000009471 action Effects 0.000 claims description 9
- 230000004044 response Effects 0.000 claims description 4
- 238000007667 floating Methods 0.000 description 33
- 230000006870 function Effects 0.000 description 31
- 238000010586 diagram Methods 0.000 description 28
- 238000003860 storage Methods 0.000 description 26
- 239000000872 buffer Substances 0.000 description 14
- 230000003287 optical effect Effects 0.000 description 13
- 238000013461 design Methods 0.000 description 12
- 238000004891 communication Methods 0.000 description 11
- 238000005516 engineering process Methods 0.000 description 9
- 230000002093 peripheral effect Effects 0.000 description 9
- 230000007246 mechanism Effects 0.000 description 8
- 230000001629 suppression Effects 0.000 description 8
- 230000005291 magnetic effect Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 101710092886 Integrator complex subunit 3 Proteins 0.000 description 5
- 102100025254 Neurogenic locus notch homolog protein 4 Human genes 0.000 description 5
- 238000007792 addition Methods 0.000 description 5
- 230000006835 compression Effects 0.000 description 5
- 238000007906 compression Methods 0.000 description 5
- 230000001419 dependent effect Effects 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000004519 manufacturing process Methods 0.000 description 4
- 238000005457 optimization Methods 0.000 description 4
- 230000003068 static effect Effects 0.000 description 4
- 230000006399 behavior Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 230000006837 decompression Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000000644 propagated effect Effects 0.000 description 3
- 239000003826 tablet Substances 0.000 description 3
- 241000287231 Serinus Species 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 2
- 210000004027 cell Anatomy 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 229910052754 neon Inorganic materials 0.000 description 2
- GKAOGPIIYCISHV-UHFFFAOYSA-N neon atom Chemical compound [Ne] GKAOGPIIYCISHV-UHFFFAOYSA-N 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- LHMQDVIHBXWNII-UHFFFAOYSA-N 3-amino-4-methoxy-n-phenylbenzamide Chemical compound C1=C(N)C(OC)=CC=C1C(=O)NC1=CC=CC=C1 LHMQDVIHBXWNII-UHFFFAOYSA-N 0.000 description 1
- 101150034459 Parpbp gene Proteins 0.000 description 1
- 241000932075 Priacanthus hamrur Species 0.000 description 1
- 101100285899 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) SSE2 gene Proteins 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000004134 energy conservation Methods 0.000 description 1
- 230000007274 generation of a signal involved in cell-cell signaling Effects 0.000 description 1
- 239000007943 implant Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000011012 sanitization Methods 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 210000000352 storage cell Anatomy 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3861—Recovery, e.g. branch miss-prediction, exception handling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
- G06F21/121—Restricting unauthorised execution of programs
- G06F21/123—Restricting unauthorised execution of programs by using dedicated hardware, e.g. dongles, smart cards, cryptographic processors, global positioning systems [GPS] devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
- G06F21/121—Restricting unauthorised execution of programs
- G06F21/125—Restricting unauthorised execution of programs by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3005—Arrangements for executing specific machine instructions to perform operations for flow control
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3005—Arrangements for executing specific machine instructions to perform operations for flow control
- G06F9/30054—Unconditional branch instructions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30076—Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
Definitions
- Return-oriented programming is a computer security exploit technique in which an attacker uses software control of a stack to execute an attacker-chosen sequence of machine instructions.
- These clusters of instructions typically end with a programmer- intended or unintended return (RET) instruction within existing program code.
- RET unintended return
- the intended or unintended RET instruction transfers execution to the attacker-chosen return address on the stack and allows the attacker to retain execution control through the program code, and direct execution to the next set of chosen sequence of instructions to achieve the attacker's intent.
- the clusters of attacker-chosen instruction sequences are referred to as gadgets.
- the executed gadget includes only several assembler instructions fol lowed by a RET instruction that can already perform a well-defined attack operation.
- a RET instruction that can already perform a well-defined attack operation.
- the ROP technique involves delivering a payload having a set of chained list of pointers to gadgets and parameters to a data memory of a program using vulnerabilities like stack buffer overflows.
- the exploit also overwrites the return address of the vulnerable function thai was used to perform the stack buffer overflow to point to the first gadget in the sequence.
- this vulnerable function executes a RET instruction
- This gadget can then consume one or more data elements from the stack payload.
- the maiware writer is able to change the control flow of the program by causing a control transfer to a non-programmer intended location in the program (e.g., to the middle of an instruction).
- a ROP attack technique can use various characteristics of an x86 instruction set architecture (ISA): variable length and unaligned instruction encoding; large and dense ISA encoding; a stack holding control and data information; and a single byte opcode RET instruction.
- ISA x86 instruction set architecture
- Current techniques to defend against such attacks can be ineffective and have various shortcomings.
- Figure 1 is a block diagram of a portion of a processor in accordance with an embodiment of the present disclosure.
- Figure 2 is a block diagram of a state machine in accordance with an embodiment of the present disclosure.
- Figure 3A is a flow chart of a method of a compiler deciding whether to add a predefined subcode to control transfer instructions of a high-level programming language.
- Figure 3B is a flow chart of a method for non-tracked control transfers and mode- specific control flow termination according to an embodiment of the present disclosure.
- Figure 4 is a flow chart of another method for mode-specific control flow termination according to another embodiment of the present disclosure.
- Figure 5 A is a flow d agram of a method of control transfer management in accordance with an embodiment of the present disclosure.
- Figure 5B is a flow diagram of another method of control transfer management in accordance with an embodiment of the present disclosure.
- Figure 6 is a block diagram of a configuration register in accordance wit an embodiment of the present disclosure.
- Figure 7A is a block diagram of a call stack frame for code execution in accordance with an embodiment of the present disclosure.
- Figure 7B is a block diagram of control transfer termination logic with legacy interworking in accordance with an embodiment of the present disclosure.
- Figure 8 is a block diagram of a processor core in accordance with one embodiment of the present disclosure.
- Figure 9A is a block diagram illustrating a micro-architecture for a processor core that can be incorporated into the processor of Figure 1.
- Figure 9B is a block diagram illustrating an in-order pipeline and a register renaming stage, out-of-order issue/execution pipeline implemented by the processor core of Figure 9A according to some embodiments of the disclosure.
- Figure 10 illustrates a block diagram of the micro-architecture for a processor that, in one embodiment, can represent portions of the processor of Figure 1.
- Figure 11 is a block diagram of a multi-processor system according to one
- Figure 12 is a block diagram of a multi-processor system according to another implementation.
- Figure 13 is a block diagram of a system-on-a-chip according to one implementation.
- Figure 14 illustrates another implementation of a block diagram for a computing system.
- Figure 15 illustrates another implementation of a block diagram for a computing system.
- Embodiments provide a set of instruction set architecture (ISA) instructions that enable a processor to determine whether a control transfer instruction is directed to an appropriate target, and if not to take action to prevent instructions beyond the control transfer instruction from being committed to the architectural state of the processor. In this way, at least certain unintended control transfers within a program can be eliminated, constraining the number of gadgets that a malware writer can use.
- ISA instruction set architecture
- embodiments provide a set of control transfer termination (CTT) instructions to allow software to specify valid control transfer terminating points in a program such that hardware can enforce control transfers to occur to only programmer- intended locations.
- CTT instructions can be opcodes of fixed length that are handled differently than ISA instructions in that the CTT instructions perform no operation other than to signal to the processor that a proper control transfer termination is occurring.
- the CTT instructions are mode-specific (e.g., 32-bit or 64-bit), multi-byte opcodes executable as a no operation. Accordingly, CTT instructions perform this enforcement with minimal performance and energy impacts to the program.
- the CTT ISA extensions can thus mitigate the execution of unintended gadgets in programs.
- An indirec call or jump refers to an indirect operand.
- this indirect operand can be an indirect destination address that provides an address of the instruction to which the call or jump is to be performed.
- this indirect operand can be a processor register that provides an address of the instruction to which the call or jump is to be performed.
- a compiler need not add (or emit) CTT instructions at control transfer terminating points when the compiler generates indirect jumps and calls (and returns from same) and already has code generated to ensure that the targets of that indirect call or jump (or return) are restricted to a small subset of targets known at compile time.
- the compiler knows the number of possible targets and computes the address of the code for the possible targets. This optimization by the compiler to not emit a CTT instruction at the control transfer terminating points is generally safe when the indirect jump or call is of the type where the indirect operand is a register. If the indirect operand is a memory location, then the contents of those memory locations can be modified between when the compiler checks the contents and when the indirect call or jump instruction uses the content of that memory location to perform the indirec call or jump.
- a subcode such as a prefix or suffix can be added to a control transfer instruction (such as an indirect call or jump) indicating that the indirect call or jump need not be tracked by a tracker state machine, which can remain idle for such instructions,
- the tracker state machine tracks states for control transfer instructions such that a CTT instruction is required after a control transfer instruction, except where the subcode is detected, to avoid issuing an execution exception.
- the subcode can be added to all control transfer instructions except for those that need not be tracked.
- the lack of a subcode can signal to CTT processing logic that those control transfer instructions are not tracked by the tracker state machine, in the alternative embodiment.
- a new indirect control transfer instruction may be defined that need not be tracked.
- an instruction set can be associated with one or more computer architectures, including data types, instructions, register architecture, addressing modes, memory architecture, interrupt and exception handling, and external input and output (I/O).
- the ISA can be implemented by one or more micro-architectures, which include processor logic and circuits used to implement one or more instruction sets. Accordingly, processors with different micro-architectures can share at least a portion of a common instruction set.
- an instruction can include one or more instruction formats.
- Such instruction format can indicate various fields (number of bits, location of bits, etc) to specify, among other things, the operation to be performed and the operand(s) on which that operation is to be performed.
- Some instruction formats can be further broken defined by instruction templates (or sub formats). For example, the instruction templates of a given instruction format can be defined to have different subsets of the instruction format ' s fields and/or defined to have a given field interpreted differently.
- an instruction is expressed using an instruction format (and, if defined, in a given one of the instruction templates of that instruction format) and specifies or indicates the operation and the operands upon which the operation will operate.
- a first CTT instruction referred to herein as an ENDBRANCH instruction
- ENDBRANCH an indirect CALL or an indirect jump (JMP) instruction
- JMP indirect CALL
- ENDRET an indirect jump
- the disclosed processor employs mode-specific opcodes as CTT instructions to block maiware attempts to jump to 32-bit programs without switching to compatibility mode or to jump to 64-bit programs before switching to 64-bit mode.
- the ENDB RANCH instructions can be further broken into two mode- specific CTT instructions, e.g., ENDBRANCH32 and ENDBRANCH64 instructions, to avoid situations where maiware can attempt to jump between processing modes to generate gadgets.
- the ENDRET instruction can be further broken into two mode-specific CTT instructions, namely ENDRET32 and ENDRET64 to prevent similar maiware behavior when a control transfer instruction accesses memory to determine an address of a target ENDRET instruction.
- This extension to different modes can be applied to different modes outside of 32-bit and 64-bit modes as would be apparent to one of ordinary skill.
- these CTT instructions can be 4-byte opcodes chosen such that they are handled differently than ISA instructions when decoded, e.g., the CTT instructions can be defined as no operation (NOP) in the x86 ISA to allow programs compiled with
- these CTT instructions can have a general form that includes a multi-byte opcode.
- these CTT instructions can be represented by a four-byte opcode that corresponds to an opcode value not presently existing in the current x86 ISA. Beyond this opcode, there can be no additional encoding for the instruction, since the instruction executes as a no operation within execution logic. As such, there may be no identification of a source operand, destination operand or immediate value to be associated with the instruction.
- Figure 1 is a block diagram of a portion 100 of a processor in accordance with an embodiment of the present disclosure.
- the portion 100 of the processor includes various portions of a pipelined processor such as an in-order or out-of-order processor.
- a compiler 108 can compile instructions into machine-readable code also referred to herein as macro-instructions of one or more programs of a given ISA.
- instructions from the compiler 108 are provided to a decode unit 110 that decodes the instructions, e.g., into one or more smaller instruction such as micro-operations ( ⁇ ).
- the decode unit 110 can include a CTT logic 115 (also simply referred to herein as processing logic) in accordance with an embodiment of the present disclosure.
- the CTT logic 115 can analyze incoming instructions and determine whether any given instruction is associated with a control transfer. If so, the CTT logic 115 can determine whether the control transfer instruction includes a specific subcode (such as a pre-defined prefix or suffix opcode) indicating that there is no threat of gadget creation.
- the CTT logic can associate certain state information with one or more ⁇ . This state information indicates a state of a state
- control transfer machine 116 (implemented by the CTT logic 115) that is modified by decoding of at least certain control transfer and control transfer termination instructions. If instead the instruction is not associated with a control transfer, a different state can be associated with the one or more ⁇ .
- the CTT logic 115 can transition the state machine 116 from the IDLE state to a given WAIT state. Furthermore, to reflect this WAFT state, a given encoding can be associated with the one or more ⁇ decoded from the incoming control transfer instruction.
- a next incoming instruction is a control transfer termination (CTT) instruction that immediately follows the control transfer termination.
- CTT control transfer termination
- state machine 116 can return to the IDLE state and associate a given encoding with the decoded one or more _uops.
- CTT control transfer termination
- the CTT logic 115 can raise an execution exception or insert a fault ⁇ into the processor pipeline (and the state machine can remain in a wait state).
- the CTT logic 115 can place or retain the state machine 116 in an IDLE state. Furthermore, due to the lack of an ENDB RANCH instruction (because of the subcode), there is no CTT instruction to be tracked. Furthermore, when the state machine 116 is in an IDLE state and an incoming instruction does not relate to a control transfer (or termination), an encoding of IDLE state information can be associated with the one or more ⁇ to indicate that state machine 116 remains in the IDLE state.
- the decode unit 110 outputs a stream of ⁇ and associated state information to indicate a state of the state machine 116 within the CTT logic 115.
- ⁇ and state information can be provided to an execution unit 120, which can include various types of units including arithmetic logic units (ALUs), floating point units and so forth that execute operations indicated by the stream of ⁇ .
- the CTT instructions can only control the state transitions in the state machine 200, and in execution logic of the processor, these instructions execute as NOP and do not cause a change in the program semantics.
- results of executing the ⁇ are provided to a retirement unit 130 configured to determine whether given operations were successfully performed and to retire the ⁇ 8 when successfully performed. If a ⁇ is not successfully performed, the retirement unit 130 can raise a fault or exception if an undesired condition occurs as a result of the execution. In an out-of-order processor, the retirement unit 130 can further operate to reorder instructions which can be executed in any order, back into program order. When ⁇ properly retire, the ⁇ can be provided to further portions of a processor such as a memory subsystem.
- the retirement unit 130 includes a CTT exception logic 135 that can be configured to determine whether appropriate behavior occurs with regard to control transfer instructions. More specifically, the CTT exception logic 135 can operate to raise an execution exception when a given ⁇ decoded from a control transfer instruction to be retired is not directly followed by an appropriate CTT ⁇ , as described herein. In an
- this determination can be based at least in pari on an inserted fault ⁇ and the state information communicated with the ⁇ exiting from decode unit 110. If a CTT fault ⁇ is detected, an execution exception is raised and is communicated to a fault handler 140, which can take various actions in accordance with a given handler to resolve the faulting behavior. Thus, in an embodiment, when a next ⁇ presented to retire after a control transfer ⁇ is not an appropriate CTT ⁇ , the retirement unit 130 can deliver an fault-class execution exception (e.g., a general protection fault) responsive to this CTT fault ⁇ such that the ⁇ does not retire.
- an fault-class execution exception e.g., a general protection fault
- the retirement unit 130 can communicate via a feedback path 138 with decode unit 1 10 to thus provide an indication of a proper branch or other code flow to be taken. Still further, a state machine recovery signal can be communicated via this feedback path 138 such that the state machine 1 16 of CTT logic 115 can be placed into an appropriate state to reflect this change in program flow.
- the state machine recovery signal can cause the state machine 116 to pass from a WAIT state back to an IDLE state (or to remain in a WAIT state), and to also indicate the last successful instruction to retire, so that the decode unit 110 can decode instructions of the correct branch.
- FIG. 2 is a block diagram of a state machine 200 in accordance with an embodiment of the present disclosure.
- the state machine 200 can correspond to the CTT state
- the state machine 200 begins operation in an IDLE state 210 into which the state machine is placed by the CTT logic 115 after reset of a processor.
- the state machine can remain in the IDLE state 210.
- the subcode can be included as a prefix, a suffix or somewhere within the CALL or JMP instruction (e.g., in a header) that signals to the decode unit 110 that the state machine 200 is not to track the CALL or JMP instruction and carries no risk of aiding to the generation of a gadget.
- Table 1, below, is an example of the subcode functioning in this way so that the CALL or JMP instruction is not tracked.
- the C code at the top of Table 1 is translated by a compiler 108 into the sequence of instructions that is shown below the C program.
- the code at address 400a8f is the no-track (subcode) jump emitted by the compiler.
- the compiler 108 can safely emit the no- track indirect jump here because the compiler has sanitized the jump locations at address 400a82 and 400a85 to ensure that the jump target is within bounds and the offset used for the targets of the jump are known at compile time. In this way, the compiler 108 can avoid emitting the
- ENDBRANCH64 (endbr64) instruction at the targets of, for example, addresses 400aaa and 400ab6 that follow this CALL or JMP instruction.
- the state machine enters a WAIT_FOR_ENDBRANCH state 220.
- the next instruction that is decoded is not an ENDBRANCH instruction of the proper operation mode (e.g., ENDBRANCH32 for 32-bit or compatibility modes and ENDBRANCH64 for 64-bit mode)
- the state machine 200 performs a DELIVER_EXECUTION ..
- EXCEPTION operation 230 which can also cause generation of a fault ⁇ (and the state machine 200 can remain in the WAIT_FOR_ENDBRANCH state 220),
- the state machine 200 transitions back to the IDLE state 210.
- the INT3 shown as circling within the WAIT_FOR_ENDBRANCH state 220 is an instruction that is used to invoke a debugger for the state machine 200.
- an INT3 instruction is encountered at the target of an indirect CALL or JMP, the state machine 200 is maintained in the WAIT_FOR_ENDBRANCH state 220.
- This is to support breakpoint generation by debuggers.
- the way a debugger sets up breakpoints in a program is by replacing the code byte at the address where the debugger wants to break with an INT3 instruction. This gives control to the debugger.
- the debugger can then examine the program state and then return the original code bytes that were replaced by the INT3 and restart program execution at that address.
- the hardware verifies whether the debugger has put back the code bytes for ENDBRANCH (that it had originally replaced with INT3).
- the state machine 200 can determine whether the RET instruction includes the subcode indicating that a target of the RET instruction is valid and safe. (Note that in some instruction architectures, the check for the subcode can be unnecessary if the RET instructions do not access memory to determine a target address, e.g., there is no threat of gadget generation.) When the RET instruction includes the subcode, the state machine 200 can remain in the IDLE state. Otherwise, when the RET instruction lacks the subcode, the state machine can enter the WAIT_FOR_ENDRET state 240.
- the state machine 200 When the next instruction that is decoded is not an ENDRET instruction of the proper mode (e.g., ENDRET32 for 32-bit or compatibility modes and ENDRET64 for 64-bit mode), the state machine 200 performs the DELIVER ... EXECUTION ... EXCEPTION operation 230. When the next instruction that is decoded is an ENDRET instruction of the proper mode, the state machine 200 transitions back to the IDLE state 210.
- the next instruction that is decoded is not an ENDRET instruction of the proper mode (e.g., ENDRET32 for 32-bit or compatibility modes and ENDRET64 for 64-bit mode)
- the state machine 200 When the next instruction that is decoded is an ENDRET instruction of the proper mode, the state machine 200 transitions back to the IDLE state 210.
- the state machine 200 thus enforces the following rules: the instruction at the target of a RET instruction must be an ENDRET instruction of the proper mode and the instruction at the target of an indirect CALL or indirect JMP instruction must be an ENDBRANCH instruction of the proper mode. When these rules are violated, then the violating instruction (the instruction at the target of a RET or CALL/JMP instruction) faults and is prevented from retiring by the retirement unit 130.
- the C code at the top of Table 2 is translated by a compiler into the sequence of instructions that is shown below the C program.
- the compiler 108 places an
- ENDBRANCH64 instruction as the first instruction in the subroutine foo and in the main program
- an ENDRET64 instruction is placed after the CALL instruction to subroutine foo.
- 3 three valid control transfer points in this program.
- a call instruction (call *%rdx) is executed, causing a control transfer to the subroutine foo.
- the first instruction in this subroutine is an ENDBRANCH64 instruction, such that a valid control transfer occurs and the CTT state machine thus proceeds from an IDLE state, to a W A rr_FOR_E ND B ANCH state and back to the IDLE state, without raising a fault.
- a return instruction is executed, thus causing control to transfer to the first instruction after the calling instruction in the main program.
- this instruction is an ENDRET64 instruction and as such, a valid control transfer occurs.
- the CTT state machine proceeds from the IDLE state, to the
- a constraint is introduced that a ROP gadget be preceded with an ENDRET32 (or ENDRET64) to be usable, effectively eliminating the possibility for a sequence of instructions to be used as a ROP gadget.
- ENDRET32 or ENDRET64
- a significant reduction in the number of gadgets that can be harvested from a library is realized, and the quality of such gadgets is significantly lower in terms of functionality that these remaining gadgets expose, making ROP attacks harder to execute.
- Figure 3A is a flow chart of a method 300 of a compiler deciding whether to add a predefined subcode to control transfer instructions of a high-level programming language.
- the method can begin by receiving, by a processing device executing a high-level programming language compiler, a list of keywords identifying a programming language statement to be translated into control transfer commands for execution in a non-tracked mode (301).
- the keywords can include a switch-case statement or a table lookup, for example, where the destination address is known at compile time.
- the method 300 can continue by determining whether the programming language statement includes a keyword from the list of keywords (302).
- the method can continue by translating the programming language statement into a control transfer instruction having a pre-defined subcode, the pre-defined subcode to instruct a processor not to track the control transfer instruction (304). Responsive to determining that the programming language statement does not include a keyword from the list of keywords, the method can continue by translating the programming language statement into a trackable control transfer instruction (306) and emitting an ENDBRANCH instruction to follow the trackable control transfer instruction (308).
- FIG. 3B is a flow chart of a method 310 for non-tracked control transfers and mode- specific control flow termination according to an embodiment of the present disclosure.
- the method 310 can be performed by a compiler and by a processor that includes a control transfer termination (CTT) state machine (e.g., processing logic of a decode unit).
- CTT control transfer termination
- the method 300 can determine whether a control transfer instruction needs to access memory to determine an address of a target instruction of an indirect call, jump or return (control transfer) instruction (312).
- the method 310 can also determine whether a target instruction of the control transfer instruction is computed at compile time by the compiler (330).
- the compiler can add a subcode (such as a prefix or suffix) to the control transfer instruction (315).
- the state machine can then be placed or retained in an IDLE state (320) for that control transfer instruction, after decoded, in response to detecting the subcode in the control transfer instruction.
- the compiler can compile program instructions as before, adding CTT instructions following control transfer instructions as directed (335).
- the method 310 can then continue, during decoding, by determining whether the control transfer instruction is followed by a CTT instruction (340). When no, then the processing logic raises an execution exception or generates a fault micro-operation as in step 230 of Figure 2 (360). If the answer is yes to block 340, then the method continues with determining whether the CTT instruction is of the same mode as the processing logic following the execution of the control transfer instruction (whether 32-bit mode or 64-bit mode, for example) (345).
- the processing logic can place or retain the state machine in an IDLE state (350), corresponding to state 210 in Figure 2.
- the processing logic raises an execution exception or generates a fault micro- operation as discussed with respect to as in step 230 of Figure 2 (360).
- the processor can then take appropriate action in response to the execution exception or the fault.
- the retirement unit 130 can send an execution exception to the fault handler 140 upon receipt of the fault micro-operation through the pipeline of the portion 100 of the processor.
- FIG. 4 is a flow chart of another method 400 for mode- specific control flow termination according to another embodiment of the present disclosure.
- the method 400 can be performed by logic of a retirement unit to handle CTT -based retirement operations.
- the method 400 can begin by determining whether a control transfer micro-instruction ( ⁇ ) associated with a WAIT state (from a CTT state machine) is followed by a CTT ⁇ (410). When the answer is no, then the method generates a fault and sends the fault to a fault handier (450). When the answer is yes, then the method 400 can further determine whether the CTT ⁇ is of the same mode as the current mode of the machine (420), whether of a 32-bit or a 64-bit mode, for example.
- ⁇ control transfer micro-instruction
- the logic can retire the CTT ⁇ (430), signal to the state machine to move the state to IDLE (435), and perform further retirement operations (440).
- the logic can generate and send an execution exception to the fault handler (450).
- the logic can also retain the target ⁇ in active execution, e.g., not retire the target ⁇ (which could belong to a gadget) contingent on the fault handler resolving the execution exception (460).
- FIG. 5A is a flow diagram of a method 500 of control transfer management in accordance with an embodiment of the present disclosure.
- the method 500 can be performed by a processor including a control transfer termination (CTT) state machine as described herein.
- CTT control transfer termination
- the operations shown in Figure 5A relate to state machine operations for control transfer-related instructions. For other instructions, if the state machine is currently in the IDLE state, the state machine remains in the IDLE state.
- the method 500 can begin by determining whether a feedback signal is received to update the CTT state machine (510).
- this feedback signal can be received from a retirement unit or fault handler to cause the state of the state machine to transition to a given state, e.g., due to a misprediction (as from a retirement unit) or responsive to resolving a fault (as from a fault handler). If such feedback signal was received, control passes to block 515 where the state machine is updated with the state communicated through this feedback signal.
- method 500 can further determine whether an indication of a control transfer termination instruction of the correct mode is received (530). If so, control passes to block 535 where the IDLE state of the state machine is entered, as pursuant to this proper CTT instruction following the control transfer instruction, a valid control transfer occurs.
- a control transfer termination fault instruction can be inserted into the processor pipeline.
- this fault instruction is a ⁇ that travels through the processor pipeline and if it is selected for retirement, the retirement unit causes a fault to enable an OS-based fault handler to execute to determine the cause of the fault and take appropriate action.
- FIG. 5B is a flow diagram of another method 550 of control transfer management in accordance with an embodiment of the present disclosure.
- the method 550 can be performed at least in part by logic of a retirement unit to handle CTT-based retirement operations.
- the method 550 begins by retiring a given micro-instruction (a ⁇ ) and storing a CTT state associated with the ⁇ (555).
- this information can be stored in a given storage of the retirement unit such as reorder buffer entry. As will be discussed further below, this state can be used in case a misprediction occurs.
- the method 500 determines whether a misprediction has occurred.
- a call can be issued to a fault handler.
- an OS-based fault handler can be executed.
- a supervisor-based CTT state machine can be enabled and used to access the state of the user mode CTT state machine to determine the reason for the fault and to act accordingly.
- a target ⁇ namely a non-CTT target ⁇
- the fault handler can take any other action.
- the fault handler can cause the user mode CTT state machine to be set to the appropriate state.
- retirement operations can be resumed responsive to control of the fault handler (590).
- CTT instructions enforcing valid control transfer locations
- software checks can be placed after these instructions to further check for valid control transfers using techniques like stack canaries.
- Stack canaries are used to detect stack buffer overflow. This is done by placing a random number on the stack before the return address on entering a function and checking this random number before return from the function.
- the CTT logic 115 provides strong positions in the program to add additional checks for detecting buffer overflows. Without CTT logic, these checks could be bypassed. CTT logic, therefore, ensures that these checks cannot be bypassed since the function must be called at the Endbranch and not past the Endbranch to skip the checks.
- the execution of a program using CTT instructions can be performed by a compiler.
- a just-in-time (JIT) compiler or a regular (cc) compiler can perform the instrumentation of the CTT instructions.
- instrumentation can be performed by rewriting the program binary to insert the CTT instructions using a binary rewriting tool that reconstructs the control flow graph from the application binary.
- the binary rewriting technique can be used in cases where the source of the binary is not available for recompilation. Such binary rewriting can also be done by anti-malware software using such tools.
- applications and libraries compiled with CTT instrumentation can be merged with libraries that are not compiled with CTT instrumentation, such as non-CTT instrumented libraries referred to herein as "legacy libraries.”
- a suppression instruction referred to herein as a DISCTT instruction, can be used to suppress the CTT state machine such that it stays in the IDLE state instead of transitioning to the WAIT ... FOR .. ENDB RANCH or
- WAIT_FOR_ENDRET states on an indirect CALL/JMP or RET, respectively. Additionally this instruction returns, in a general purpose register, the state of the CTT suppression at the time the instruction was issued.
- An enable instruction referred to herein as an ENCTT instruction, is used to remove the suppression of the CTT state machine put in place by the DISCTT instruction such that the state machine enforces the CTT rules. Additionally, this instruction returns the state of the CTT suppression at the time the instruction was issued.
- DISCTT and ENCTT instructions can be enabled for a process by an operating system. If the operating system does not allow a program to disable CTT, then the DISCTT instruction executes as a NOP and does not suppress CTT.
- temp_variable DISCTT
- the DISCTT instruction returns the current state of CTT functionality as NOTJSUPPRESS ED and then suppresses the CTT functionality.
- the legacy_functionl calls the CTT___function2.
- the CTT___function2 calls legacy .. functioii2
- the DISCTT instruction now returns the current state of the CTT functionality as SUPPRESSED since it has been suppressed by CTT .. function 1.
- the control returns from legacy_function2 to CTT_function2 to CTT_function2, it does not un-suppress the CTT functionality since it was already suppressed when it was invoked.
- the control returns to CTT_functionl, it tin- suppresses the CTT functionality using the ENCTT instruction since it was suppressed by that function. [0079] Returning the previous state of CTT responsive to the ENCTT instruction allows for a
- CTT-enabled library function to be called by a non-CTT enabled library/application to un- suppress CTT before it starts executing and suppress CTT functionality before returning to the caller, if it was suppressed when the function was called.
- FIG. 6 is a block diagram of a configuration register in accordance with an embodiment of the present disclosure.
- configuration register 600 can include various fields to store state values used in performing CTT functionality.
- two such configuration registers can be provided, with each register associated with a particular mode of operation. Stated another way, one configuration register can be used to control CTT operation in a user mode (e.g., ring 3) while a second configuration register can be used to control CTT functionality in a supervisor mode (e.g., rings less than 3).
- configuration register 600 includes an enable field 605 to store an enable indicator to indicate whether CTT is enabled for the current privilege level.
- a legacy enable field 610 can be used to store an indicator to indicate whether legacy interworking is enabled.
- a suppression field 615 can be used to store a suppression indicator to indicate whether CTT faults and tracking are to be suppressed.
- a tracker field 620 can be used to store a value of the CTT state machine. In an embodiment, this tracker field can be three bits where a value of zero ("0") can indicate the IDLE state, a value of one ("1") can indicate a
- WAIT . FOR . ENDRET32 state a value of two (“2") can indicate a WAIT .
- FOR ENDRET64 state a value of three (“3") can indicate a WAIT_ FORJENDBRANCH32 state, and a value of four (“4") can indicate a WAIT ... FOR ... ENDBRANCH64 state.
- a reserved field 425 can be used for various extensions. Other fields can be present in other embodiments than those specifically sho wn in Figure 4.
- a code segment 750 includes a first CTT call stack frame 760 and a second CTT call stack frame 762 that in turn calls a legacy call stack frame 765.
- the CTT functionality is disabled responsive to a DISCTT instruction.
- execution begins with CTT functionality disabled for a first legacy call stack frame 765 and a second legacy call stack frame 766. Note that as the called functions return back, at the point of returning to call stack frame 762, execution with CTT functionality is re-enabled by an ENCTT instruction.
- Figure 7A shows an example where a first transfer to legacy code suppresses CTT, which is done using indirect CALL/JMP instructions (not RET) for security reasons.
- CTT is suppressed by a DISCTT instruction
- subsequent CALL/JMP/RET instructions can land on instructions other than ENDBRANCH/ENDRET without causing faults.
- CTT operation is unsuppressed when control returns to the point where suppression was done, via an ENCTT instruction.
- FIG. 7B is a block diagram of control transfer termination logic with legacy interworking in accordance with an embodiment of the present disclosure.
- an implementation is present with a CTT-enabled application image 770 that issues a call to a CTT enabled library 775 (Call_l) that in turn initiates a call to a legacy library 785 (Call_2).
- legacy library 785 issues a call to a second CTT-enabled library 790 (Call_3).
- a heap/stack 780 Also present is a heap/stack 780.
- control passes back to legacy library 785 (RET_1), and from there control returns back to first CTT-enabled library 775 (RET_2), and finally control returns back to application image 770 (RET_3).
- RET_1 legacy library 785
- RET_2 first CTT-enabled library 775
- RET_3 application image 770
- the DISCTT and ENCTT instructions can be placed in the program by the programmer if she is aware of the interworking, and/or these DISCTT and ENCTT instructions can be placed in the program by the compiler/linker when it is linking statically to legacy libraries.
- a loader or anti-malware software can insert trampoline functions between the application and the library, where the trampoline functions use DISCTT and ENCTT instructions.
- trampoline functions use DISCTT and ENCTT instructions.
- calls to functions in a legacy library that are dynamically linked to a CTT enabled application go through a trampoline function, which suppresses CTT and then calls the legacy library function.
- the legacy library function returns to the trampoline function that un-suppresses CTT and returns to the CTT-enabled application.
- Embodiments can be used by anti-malware software to wrap non-CTT binaries such that they can be used with CTT-enabled binaries.
- anti-malware software can restrict the use of the gadgets that can be found in the program even with CTT in use.
- Embodiments can be particularly applicable to mobile and other portable low power systems, in that software only- techniques to mitigate against ROP (like rewriting binaries to remove all instances of RET by use of functionally equivalent, but larger, more complex sequences), generally lead to much larger binaries and increase the execution time of the program and thereby are not suited for mobi le applications where power efficiency is a primary concern.
- FIG. 8 is a block diagram of a processor core 800 in accordance with one
- the processor core 800 can be a multi-stage pipelined out-of-order processor.
- the core 800 can support one or more instructions sets (e.g., the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of MIPS Technologies of Sunnyvale, Calif.; the ARM instruction set (with optional additional extensions such as NEON) of ARM Holdings of Sunnyvale, Calif.). It should be understood that the core 800 can support multithreading
- time-sliced multithreading executing two or more parallel sets of operations or threads
- simultaneous multithreading where a single physical core provides a logical core for each of the threads that physical core is simultaneously multithreading
- time sliced fetching and decoding and simultaneous multithreading thereafter such as in the Intel® Hyperthreading technology
- a processor including the core 800 can be a general-purpose processor, such as a CoreTM 13, 15, 17, 2 Duo and Quad, XeonTM, ItaniumTM, XScaleTM or StrongARMTM processor, which are available from Intel Corporation.
- the processor can be from another company, such as a design from ARM Holdings, Ltd, MIPS, etc.
- the processor can be a special- purpose processor, such as, for example, a network or communication processor, compression engine, graphics processor, co-processor, embedded processor, or the like.
- the processor can be implemented on one or more chips, and can be a part of and/or can be implemented on one or more substrates using any of a number of process technologies, such as, for example, BiCMOS, CMOS. or NMOS,
- core 800 can operate at various voltages and frequencies as a result of integrated voltage regulator 809.
- core 800 includes front end units 810, which can be used to fetch instructions to be executed and prepare them for use later in the processor.
- the front end units 810 can include a fetch unit 801, an instruction cache 803, and an instruction decoder 805.
- Instruction decoder 805 can include CTT logic 806 in accordance with an embodimeni of the present disclosure, with an associated CTT state machine to perform CTT operations as described herein.
- the front end units 810 can further include a trace cache, along with microcode storage as well as a micro- operation storage.
- Fetch unit 801 can fetch macro-instructions, e.g., from memory or instruction cache 803, and feed them to instruction decoder 805 to decode the macro-instructions into primitives, e.g., micro-operations for execution by the processor.
- an out-of-order (OOO) engine 815 that can be used to receive the micro-instructions and prepare them for execution. More specifically, the OOO engine 815 can include various buffers to re-order flow of microinstructions and allocate various resources needed for execution, as well as to provide renaming of logical registers onto storage locations within various register files such as a register file 830 and an extended register file 835.
- the register file 830 can include separate register files for integer and floating point operations.
- the extended register file 835 can provide storage for vector-sized units, e.g., 256 or 512 bits per register.
- Various resources can be present in execution units 820, including, for example, various integer, floating point, and single instruction multiple data (SIMD) logic units, among other specialized hardware.
- execution units can include one or more arithmetic logic units (ALUs) 822, among other such execution units.
- ALUs arithmetic logic units
- Results from the execution units can be provided to a retirement unit 840 including a reorder buffer (ROB).
- This ROB can include various arrays and logic to receive information associated with instructions that are executed. This information is then examined by retirement unit 840 to determine whether the instructions can be validly retired and result data committed to the architectural state of the processor, or whether one or more exceptions occurred that prevent a proper retirement of the instructions.
- retirement unit 840 can handle other operations associated with retirement.
- CTT logic 845 of the retirement unit 840 can store CTT state machine state received with incoming instructions, and feed this information back to the CTT state machine responsive to a misprediction.
- Figure 9A is a block diagram illustrating a micro-architecture for a processor core 900 that can be incorporated into the processor of Figure 1 or execute the state machine 200 (or CTT processing logic) of Figure 2.
- processor core 900 depicts an in-order architecture core and a register renaming logic, out-of-order issue/execution logic to be included in a processor according to at least one embodiment of the disclosure.
- the embodiments of the error correcting code that carry additional bits can be implemented by processor core 900.
- the processor core 900 includes a front end unit 930 coupled to an execution engine unit 950, and both are coupled to a memory unit 970.
- the processor core 900 can include a reduced instruction set computing (RISC) core, a complex instruction set computing (CISC) core, a very long instruction word (VLIW) core, or a hybrid or alternative core type.
- processor core 900 can include a special-purpose core, such as, for example, a network or communication core, compression engine, graphics core, or the like.
- processor core 900 can be a multi-core processor or can be part of a multiprocessor system.
- the front end unit 930 includes a branch prediction unit 932 coupled to an instruction cache unit 934, which is coupled to an instruction translation lookaside buffer (TLB) 936, which is coupled to an instruction fetch unit 938, which is coupled to a decode unit 940.
- the decode unit 940 (also known as a decoder) can decode instructions, and generate as an output one or more micro-operations, micro-code entry points, microinstructions, other instructions, or other control signals, which are decoded from, or which otherwise reflect, or are derived from, the primary instructions.
- the decoder 940 can be implemented using various different mechanisms.
- the instruction cache unit 934 is further coupled to the memory unit 970.
- the decode unit 940 is coupled to a rename/allocator unit 952 in the execution engine unit 950.
- the execution engine unit 950 includes the rename/allocator unit 952 coupled to a retirement unit 954 and a set of one or more scheduler unit(s) 956.
- the scheduler unit(s) 956 represents any number of different schedulers, including reservations stations (RS), central instruction window, etc.
- the scheduler unit(s) 956 can be coupled to the physical register file unit(s) 958.
- Each of the physical register file unit(s) 958 represents one or more physical register files, different ones of which store one or more different data types, such as scalar integer, scalar floating point, packed integer, packed floating point, vector integer, vector floating point, etc., status (e.g., an instruction pointer that is the address of the next instruction to be executed), etc.
- the physical register file(s) unit(s) 958 can be overlapped by the retirement unit 954 to illustrate various ways in which register renaming and out-of-order execution can be implemented (e.g., using a reorder buffer(s) and a retirement register file(s), using a future file(s), a history buffer(s), and a retirement register file(s); using a register maps and a pool of registers; etc.).
- the architectural registers are visible from the outside of the processor or from a programmer's perspective.
- the registers are not limited to any known particular type of circuit.
- Various different types of registers are suitable as long as they are capable of storing and providing data as described herein. Examples of suitable registers include, but are not limited to, dedicated physical registers, dynamically allocated physical registers using register renaming, combinations of dedicated and dynamically allocated physical registers, etc.
- the execution cluster(s) 960 includes a set of one or more execution units 962 and a set of one or more memory access units 964.
- the execution units 962 can perform various operations (e.g., shifts, addition, subtraction, multiplication) and operate on various types of data (e.g., scalar floating point, packed integer, packed floating point, vector integer, vector floating point).
- scheduler unit(s) 956, physical register file(s) unit(s) 958, and execution cluster(s) 960 are shown as being possibly plural because certain embodiments create separate pipelines for certain types of data/operations (e.g., a scalar integer pipeline, a scalar floating point/packed integer/packed floating point/vector integer/vector floating point pipeline, and/or a memory access pipeline that each have their own scheduler unit, physical register file(s) unit, and/or execution cluster - and in the case of a separate memory access pipeline, certain embodiments are implemented in which only the execution cluster of this pipeline has the memory access unit(s) 964).
- the set of memory access units 964 can be coupled to the memory unit 970, which can include a data prefetcher 980, a data TLB unit 972, a data cache unit (DCU) 974, and a level 2
- L2 cache unit 976 to name a few examples.
- DCU 974 is also known as a first level data cache (LI cache). The DCU 974 can handle multiple outstanding cache misses and continue to service incoming stores and loads. It also supports maintaining cache coherency.
- LI cache first level data cache
- the data TLB unit 972 is a cache used to improve virtual address translation speed by mapping virtual and physical address spaces.
- the memory access units 964 can include a load unit, a store address unit, and a store data unit, each of which is coupled to the data TLB unit 972 in the memory unit 970.
- the L2 cache unit 976 can be coupled to one or more other levels of cache and eventually to a main memory.
- the data prefetcher 980 speculatively loads/prefetches data to the DCU 974 by automatically predicting which data a program is about to consume.
- Prefetching can refer to transferring data stored in one memory location (e.g., position) of a memory hierarchy (e.g., lower level caches or memory) to a higher-level memory location that is closer (e.g., yields lower access latency) to the processor before the data is actually demanded by the processor. More specifically, prefetching can refer to the early retrieval of data from one of the lower level caches/memory to a data cache and/or to prefetch buffer before the processor issues a demand for the specific data being returned.
- a memory hierarchy e.g., lower level caches or memory
- the processor core 900 can support one or more instructions sets (e.g., the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of Imagination Technologies of Kings Langley, Hertfordshire, UK; the ARM instruction set (with optional additional extensions such as NEON) of ARM Holdings of Sunnyvale, CA).
- the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of Imagination Technologies of Kings Langley, Hertfordshire, UK; the ARM instruction set (with optional additional extensions such as NEON) of ARM Holdings of Sunnyvale, CA).
- the core can support multithreading (executing two or more parallel sets of operations or threads), and can do so in a variety of ways including time sliced multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that physical core is simultaneously multithreading), or a combination thereof (e.g., time sliced fetching and decoding and simultaneous multithreading thereafter such as in the Intel® Hyperthreading technology).
- register renaming is described in the context of out-of-order execution, it should be understood that register renaming can be used in an in-order architecture.
- the illustrated embodiment of the processor also includes a separate instruction and data cache units and a shared L2 cache unit, alternative embodiments can have a single internal cache for both instructions and data, such as, for example, a Level 1 (LI) internal cache, or multiple levels of internal cache.
- the system can include a combination of an internal cache and an external cache that is external to the core and/or the processor. Alternatively, all of the cache can be external to the core and/or the processor.
- Figure 9B is a block diagram illustrating an in-order pipeline and a register renaming stage, out-of-order issue/execution pipeline implemented by processor core 900 of Figure 9A according to some embodiments of the disclosure.
- the solid lined boxes in Figure 9B illustrate an in-order pipeline, while the dashed lined boxes illustrates a register renaming, out-of-order issue/execution pipeline.
- a processor pipeline 990 includes a fetch stage 902, a length decode stage 904, a decode stage 906, an allocation stage 908, a renaming stage 910, a scheduling (also known as a dispatch or issue) stage 912, a register read/memory read stage 914, an execute stage 916, a write back/memory write stage 918, an exception handling stage 922, and a commit stage 924.
- the ordering of stages 902-924 can be different than illustrated and are not limited to the specific ordering shown in Figure 9B.
- Figure 10 illustrates a block diagram of the micro- architecture for a processor 1000 (which can represent the processor of Figure 1 in one embodiment) that includes logic circuits.
- an instruction in accordance with one embodiment can be implemented to operate on data elements having sizes of byte, word, doubleword, quadword, etc., as well as datatypes, such as single and double precision integer and floating point datatypes.
- the in-order front end 1001 is the part of the processor 1000 that fetches instructions to be executed and prepares them to be used later in the processor pipeline.
- the front end 1001 can include several units.
- the instruction pref etcher 1016 fetches instructions from memory and feeds them to an instruction decoder 1018 which in turn decodes or interprets them.
- the decoder decodes a received instruction into one or more operations called "micro-instructions" or “micro- operations” (also called micro-op or ⁇ 8) that the machine can execute.
- the decoder parses the instruction into an opcode and corresponding data and control fields that are used by the micro-architecture to perform operations in accordance with one embodiment.
- the trace cache 1030 takes decoded ⁇ 8 and assembles them into program ordered sequences or traces in the ⁇ queue 1034 for execution.
- the microcode ROM (or RAM) 1032 can provide the ⁇ 8 needed to complete the operation.
- Some instructions are converted into a single micro-op, whereas others need several micro-ops to complete the full operation.
- the decoder 1018 accesses the microcode ROM 1032 to do the instruction.
- an instruction can be decoded into a small number of micro ops for processing at the instruction decoder 1018.
- an instruction can be stored within the microcode ROM 1032 should a number of micro-ops be needed to accomplish the operation.
- the trace cache 1030 refers to an entry point programmable logic array (PLA) to determine a correct micro-instruction pointer for reading the micro-code sequences to complete one or more instructions in accordance with one embodiment from the micro-code ROM 1032. After the microcode ROM 1032 finishes sequencing micro-ops for an instruction, the front end 1001 of the machine resumes fetching micro-ops from the trace cache 1030.
- PLA programmable logic array
- the out-of-order execution engine 1003 is where the instructions are prepared for execution.
- the out-of-order execution logic has a number of buffers to smooth out and re-order the flow of instructions to optimize performance as they go down the pipeline and get scheduled for execution.
- the allocator logic allocates the machine buffers and resources that each uop needs in order to execute.
- the register renaming logic renames logic registers onto entries in a register file.
- the allocator also allocates an entry for each uop in one of the two uop queues, one for memory operations and one for non-memory operations, in front of the instruction
- schedulers memory scheduler, fast scheduler 1002, slow/general floating point scheduler 1004, and simple floating point scheduler 1006.
- the ⁇ schedulers 1002, 1004, 1006, determine when a uop is ready to execute based on the readiness of their dependent input register operand sources and the availability of the execution resources the ⁇ 8 need to complete their operation.
- the fast scheduler 1002 of one embodiment can schedule on each half of the main clock cycle while the other schedulers can only schedule once per main processor clock cycle.
- the schedulers arbitrate for the dispatch ports to schedule ⁇ 8 for execution.
- Register files 1008, 1010 sit between the schedulers 1002, 1004, 1006, and the execution units 1012, 1014, 1016, 1018, 1020, 1022, 1024 in the execution block 1011.
- Each register file 1008, 1010, of one embodiment also includes a bypass network that can bypass or forward just completed results that have not yet been written into the register file to new dependent ⁇ 8.
- the integer register file 1008 and the floating point register file 1010 are also capable of communicating data with the other.
- the integer register file 1008 is split into two separate register files, one register file for the low order 32 bits of data and a second register file for the high order 32 bits of data.
- the floating point register file 1010 of one embodiment has 128 bit wide entries because floating point instructions typically have operands from 64 to 128 bits in width.
- the execution block 1011 contains the execution units 1012, 1014, 1016, 1018, 1020, 1022, 1024, where the instructions are actually executed.
- This section includes the register files 1008, 1010, that store the integer and floating point data operand values that the microinstructions need to execute.
- the processor 1000 of one embodiment is comprised of a number of execution units: address generation unit (AGU) 1012, AGU 1014, fast ALU 1016, fast ALU
- floating point execution blocks 1022, 1024, execute floating point, MMX, SIMD, and SSE, or other operations.
- the floating point ALU 1022 of one embodiment includes a 64-bit-by-64-bit floating point divider to execute divide, square root, and remainder micro-ops.
- instructions involving a floating point value can be handled with the floating point hardware.
- the ALU operations go to the high-speed ALU execution units 1016, 1018.
- the fast ALUs 1016, 1018, of one embodiment can execute fast operations with an effective latency of half a clock cycle.
- most complex integer operations go to the slow ALU 1020 as the slow ALU 1020 includes integer execution hardware for long latency type of operations, such as a multiplier, shifts, flag logic, and branch processing.
- Memory load/store operations are executed by the AGUs 1012, 1014.
- the integer ALUs 1016, 1018, 1020 are described in the context of performing integer operations on 64 bit data operands.
- the ALUs 1016, 1018, 1020 can be implemented to support a variety of data bits including 16, 32, 128, 256, etc.
- the floating point units 1022, 1024 can be implemented to support a range of operands having bits of various widths.
- the floating point units 1022, 1024 can operate on 128 bits wide packed data operands in conjunction with SIMD and multimedia instructions.
- the ⁇ 8 schedulers 1002, 1004, 1006, dispatch dependent operations before the parent load has finished executing.
- the processor 1000 also includes logic to handle memory misses. If a data load misses in the data cache, there can be dependent operations in flight in the pipeline that have left the scheduler with temporarily incorrect data.
- a replay mechanism tracks and re-executes instructions that use incorrect data. Only the dependent operations need to be replayed and the independent ones are allowed to complete.
- the schedulers and replay mechanism of one embodiment of a processor are also designed to catch instruction sequences for text string comparison operations.
- the processor 1000 also includes logic to implement compression/decompression optimization in solid-state memory devices according to one embodiment.
- the execution block 1011 of processor 1000 can include MCU 115, to perform
- registers can refer to the on-board processor storage locations that are used as part of instructions to identify operands. In other words, registers can be those that are usable from the outside of the processor (from a programmer's perspective). However, the registers of an embodiment should not be limited in meaning to a particular type of circuit. Rather, a register of an embodiment is capable of storing and providing data, and performing the functions described herein.
- the registers described herein can be implemented by circuitry within a processor using any number of different techniques, such as dedicated physical registers, dynamically allocated physical registers using register renaming, combinations of dedicated and dynamically allocated physical registers, etc.
- integer registers store thirty- two bit integer data.
- a register file of one embodiment also contains eight multimedia SEVID registers for packed data.
- the registers are understood to be data registers designed to hold packed data, such as 64 bits wide MMXTM registers (also referred to as 'mm' registers in some instances) in microprocessors enabled with MMX technology from Intel Corporation of Santa Clara, California. These MMX registers, available in both integer and floating point forms, can operate with packed data elements that accompany SIMD and SSE instructions. Similarly, 128-bit wide XMM registers relating to SSE2, SSE3, SSE4, or beyond (referred to generically as "SSEx”) technology can also be used to hold such packed data operands.
- SSEx 128-bit wide XMM registers relating to SSE2, SSE3, SSE4, or beyond
- the registers do not need to differentiate between the two data types.
- integer and floating point are either contained in the same register file or different register files.
- floating point and integer data can be stored in different registers or the same registers.
- multiprocessor system 1100 is a point-to-point interconnect system, and includes a first processor 1170 and a second processor 1180 coupled via a point-to-point interconnect 1150.
- processors 1170 and 1180 can be multicore processors, including first and second processor cores (i.e., processor cores 1174a and 1174b and processor cores 1184a and 1184b), although potentially many more cores can be present in the processors.
- the processors each can include hybrid write mode logics in accordance with an embodiment of the present.
- the embodiments of the page additions and content copying can be implemented in the processor 1170, processor 1180, or both.
- processors 1170, 1180 While shown with two processors 1170, 1180, it is to be understood that the scope of the present disclosure is not so limited. In other implementations, one or more additional processors can be present in a given processor.
- Processors 1170 and 1180 are shown including integrated memory controller units 1172 and 1182, respectively.
- Processor 1170 also includes as part of its bus controller units point-to-point (P-P) interfaces 1176 and 1188; similarly, second processor 1180 includes P-P interfaces 1186 and 1188.
- Processors 1170, 1180 can exchange information via a point-to-point (P-P) interface 1150 using P-P interface circuits 1178, 1188.
- IMCs 1172 and 1182 couple the processors to respective memories, namely a memory 1132 and a memory 1134, which can be portions of main memory locally attached to the respective processors.
- Processors 1170, 1180 can each exchange information with a chipset 1190 via individual P-P interfaces 1152, 1154 using point to point interface circuits 1176, 1194, 1186, 1198.
- Chipset 1190 can also exchange information with a high-performance graphics circuit 1138 via a high-performance graphics interface 1139.
- a shared cache (not shown) can be included in either processor or outside of both processors, yet connected with the processors via P-P interconnect, such that either or both processors' local cache information can be stored in the shared cache if a processor is placed into a low power mode.
- first bus 1116 can be a Peripheral Component Interconnect (PCI) bus, or a bus such as a PCI Express bus or another third generation I/O interconnect bus, although the scope of the present disclosure is not so limited.
- PCI Peripheral Component Interconnect
- first bus 1116 can be a Peripheral Component Interconnect (PCI) bus, or a bus such as a PCI Express bus or another third generation I/O interconnect bus, although the scope of the present disclosure is not so limited.
- PCI Peripheral Component Interconnect
- various I/O devices 1114 can be coupled to first bus 1116, along with a bus bridge 1118 which couples first bus 1116 to a second bus 1120.
- second bus 1120 can be a low pin count (LPC) bus.
- LPC low pin count
- Various devices can be coupled to second bus 1120 including, for example, a keyboard and/or mouse 1122,
- an audio I/O 1124 can be coupled to second bus 1120.
- a system can implement a multidrop bus or other such architecture.
- FIG. 12 shown is a block diagram of a third system 1200 in accordance with an embodiment of the present disclosure. Like elements in Figures 11 and 12 bear like reference numerals, and certain aspects of Figure 11 have been omitted from Figure 11 in order to avoid obscuring other aspects of Figure 12.
- FIG 12 illustrates that the processors 1270, 1280 can include integrated memory and I/O control logic ("CL") 1272 and 1282, respectively.
- CL 1272, 1282 can include integrated memory controller units such as described herein.
- CL 1272, 1282 can also include I/O control logic.
- Figure 12 illustrates that the memories 1232, 1234 are coupled to the CL 1272, 1282, and that I/O devices 1214 are also coupled to the control logic 1272, 1282.
- Legacy I/O devices 1215 are coupled to the chipset 1290.
- the embodiments of the page additions and content copying can be implemented in processor 1270, processor 1280, or both.
- Figure 13 is an exemplary system on a chip (SoC) 1300 that can include one or more of the cores 1302.
- SoC system on a chip
- Other system designs and configurations known in the arts for laptops, desktops, handheld PCs, personal digital assistants, engineering workstations, servers, network devices, network hubs, switches, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, micro controllers, cell phones, portable media players, hand held devices, and various other electronic devices, are also suitable.
- DSPs digital signal processors
- graphics devices video game devices, set-top boxes, micro controllers, cell phones, portable media players, hand held devices, and various other electronic devices, are also suitable.
- DSPs digital signal processors
- a huge variety of systems or electronic devices capable of incorporating a processor and/or other execution logic as disclosed herein are generally suitable.
- an interconnect unit(s) 1302 is coupled to: an application processor 1317 which includes a set of one or more cores 1302A-N and shared cache unit(s) 1306; a system agent unit 1310; a bus controller unit(s) 1316; an integrated memory controller unit(s) 1314; a set of one or more media processors 1320 which can include integrated graphics logic 1308, an image processor 1324 for providing still and/or video camera functionality, an audio processor 1326 for providing hardware audio acceleration, and a video processor 1328 for providing video encode/decode acceleration; a static random access memory (SRAM) unit 1330; a direct memory access (DMA) unit 1332; and a display unit 1340 for coupling to one or more external displays.
- the embodiments of the pages additions and content copying can be implemented in SoC 1300.
- SoC 1400 is included in user equipment (UE).
- UE refers to any device to be used by an end-user to communicate, such as a hand-held phone, smartphone, tablet, ultra-thin notebook, notebook with broadband adapter, or any other similar communication device.
- a UE can connect to a base station or node, which can correspond in nature to a mobile station (MS) in a GSM network.
- MS mobile station
- the embodiments of the page additions and content copying can be
- SoC 1400 includes 2 cores— 1406 and 1407. Similar to the discussion above, cores 1406 and 1407 can conform to an Instruction Set Architecture, such as a processor having the Intel® Architecture CoreTM, an Advanced Micro Devices, Inc. (AMD) processor, a MIPS- based processor, an ARM-based processor design, or a customer thereof, as well as their licensees or adopters. Cores 1406 and 1407 are coupled to cache control 1408 that is associated with bus interface unit 1409 and L2 cache 1410 to communicate with other parts of SOC 1400.
- AMD Advanced Micro Devices, Inc.
- Interconnect 1411 includes an on-chip interconnect, such as an IOSF, AMBA, or other interconnects discussed above, which can implement one or more aspects of the described disclosure.
- Interconnect 1411 provides communication channels to the other components, such as a Subscriber Identity Module (SIM) 1430 to interface with a SIM card, a boot ROM 1435 to hold boot code for execution by cores 1406 and 1407 to initialize and boot SoC 1400, a SDRAM controller 1440 to interface with external memory (e.g., DRAM 1460), a flash controller 1445 to interface with non-volatile memory (e.g., Flash 1465), a peripheral control 1450 (e.g. Serial Peripheral Interface) to interface with peripherals, video codecs 1420 and Video interface 1425 to display and receive input (e.g. touch enabled input), GPU 1415 to perform graphics related computations, etc. Any of these interfaces can incorporate aspects of the embodiments described herein.
- SIM Subscriber Identity Module
- boot ROM 1435 to hold boot code for execution by cores 1406 and 1407 to initialize and boot SoC 1400
- SDRAM controller 1440 to interface with external memory (e.g., DRAM 1460)
- the system illustrates peripherals for communication, such as a Bluetooth module 1470, 3G modem 1475, GPS 1480, and Wi-Fi 1485.
- a UE includes a radio for communication.
- these peripheral communication modules can not all be included.
- some form of a radio for external communication should be included.
- Figure 15 illustrates a diagrammatic representation of a machine in the example form of a computing system 1500 within which a set of instructions, for causing the machine to perform any one or more of the methodologies discussed herein, can be executed.
- the machine can be connected (e.g., networked) to other machines in a LAN, an intranet, an extranet, or the Internet.
- the machine can operate in the capacity of a server or a client device in a client- server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment.
- the machine can be a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine.
- PC personal computer
- PDA Personal Digital Assistant
- STB set-top box
- WPA Personal Digital Assistant
- a cellular telephone a web appliance
- server a server
- network router switch or bridge
- any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine.
- the term "machine” shall also be taken to include any collection of machines that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein.
- the embodiments that execute the processor of Figure 1 can be implemented in or as a part of the computing system 1500.
- the computing system 1500 includes a processing device 1502, main memory 1504 (e.g., flash memory, dynamic random access memory (DRAM) (such as synchronous DRAM (SDRAM) or DRAM (RDRAM), etc.), a static memory 1506 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 1516, which communicate with each other via a bus 1508.
- main memory 1504 e.g., flash memory, dynamic random access memory (DRAM) (such as synchronous DRAM (SDRAM) or DRAM (RDRAM), etc.
- static memory 1506 e.g., flash memory, static random access memory (SRAM), etc.
- SRAM static random access memory
- Processing device 1502 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processing device can be complex instruction set computing (CISC) microprocessor, reduced instruction set computer (RISC) microprocessor, very long instruction word (VLIW) microprocessor, or processor implementing other instruction sets, or processors implementing a combination of instruction sets. Processing device 1502 can also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. In one embodiment, processing device 1502 can include one or processor cores. The processing device 1502 is configured to execute the processing logic or instructions 1526 for performing the operations discussed herein.
- CISC complex instruction set computing
- RISC reduced instruction set computer
- VLIW very long instruction word
- processing device 1502 can also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA
- processing device 1502 can be the processor of Figure 1.
- the computing system 1500 can include other components as described herein.
- the core can support multithreading (executing two or more parallel sets of operations or threads), and can do so in a variety of ways including time sliced multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that physical core is simultaneously multithreading), or a
- the computing system 1500 can further include a network interface device 1518 communicably coupled to a network 1519.
- the computing system 1500 also can include a video display device 1510 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 1512 (e.g., a keyboard), a cursor control device 1514 (e.g., a mouse), a signal generation device 1520 (e.g., a speaker), or other peripheral devices.
- video display device 1510 e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)
- an alphanumeric input device 1512 e.g., a keyboard
- a cursor control device 1514 e.g., a mouse
- signal generation device 1520 e.g., a speaker
- computing system 1500 can include a graphics processing unit 1522, a video processing unit 1528 and an audio processing unit 1532.
- the computing system 1500 can include a chipset (not illustrated), which refers to a group of integrated circuits, or chips, that are designed to work with the processing device 1502 and controls communications between the processing device 1502 and external devices.
- the chipset can be a set of chips on a motherboard that links the processing device 1502 to very high-speed devices, such as main memory 1504 and graphic controllers, as well as linking the processing device 1502 to lower- speed peripheral buses of peripherals, such as USB, PCI or ISA buses.
- the data storage device 1516 can include a computer-readable storage medium 1524 on which is stored software 1526 embodying any one or more of the methodologies of functions described herein.
- the software 1526 can also reside, completely or at least partially, within the main memory 1504 as instructions 1526 and/or within the processing device 1502 as processing logic during execution thereof by the computing system 1500; the main memory 1504 and the processing device 1502 also constituting computer-readable storage media.
- the computer-readable storage medium 1524 can also be used to store instructions 1526 utilizing the processing device 1502, such as described with respect to Figures 1-4, and/or a software library containing methods that call the above applications. While the computer- readable storage medium 1524 is shown in an example embodiment to be a single medium, the term "computer-readable storage medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions. The term “computer-readable storage medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instruction for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present embodiments. The term “computer-readable storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories, and optical and magnetic media.
- Example 1 is a processor comprising: 1) an execution unit; and 2) a processing logic operatively coupled to the execution unit, the processing logic to: a) enter a first execution state; b) remain in the first execution state responsive to executing a control transfer instruction having a pre-defined subcode; c) transition into a second execution state responsive to executing a control transfer instruction not having the pre-defined subcode; and d) raise an execution exception responsive to determining, while in the second execution state, that a next instruction to be executed differs from an ENDBRANCH instruction.
- Example 2 the processor of Example 1, wherein the first execution state comprises an IDLE state and wherein the second execution state comprises a WAIT state.
- Example 3 the processor of Example 1, wherein the pre-defined subcode comprises a pre-defined opcode prefix.
- Example 4 the processor of Example 1, wherein the processing logic is further to, responsive to executing a control transfer instruction that is a far call or jump instruction, transition into the second execution state.
- Example 5 the processor of Example 1, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
- Example 6 the processor of Example 1, wherein the processing logic is further to, responsive to determining that the next instruction to be executed is the ENDBRANCH instruction, transition to the first execution state.
- Example 7 the processor of Example 1, wherein the processing logic includes a state machine to track an execution state of control transfer instructions.
- Example 8 is a processor comprising: 1) a decode unit to decode a first control transfer instruction, which generates a first micro-operation, wherein the first control transfer instruction includes a pre-defined subcode indicating to a processing logic of the decode unit to not track execution of the first micro-operation; and 2) wherein the processing logic is to raise an execution exception responsive to determining that a target instruction of a second control transfer instruction is not an ENDBRANCH instruction and the second control transfer instruction does not include the pre-defined subcode, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
- Example 9 the processor of Example 8, wherein the processing logic is further to associate a first state with the first micro-operation to indicate that the processing logic is in an IDLE state.
- Example 10 the processor of Example 8, wherein the processing logic is further to associate a second state with a second micro-operation decoded from the second control transfer instruction to indicate that the processing logic is in a WAIT state.
- Example 11 the processor of Example 8, further comprising: 1) an execution unit operatively coupled to the decode unit, the execution unit to execute micro-operations; and 2) a retirement unit operatively coupled to the execution unit, the retirement unit to raise the execution exception after processing a target micro-operation decoded from the target instruction.
- Example 12 the processor of Example 8, wherein the decode unit is further to decode the second control transfer instruction into a second micro -operation and to decode the target instruction into a target micro-operation, further comprising an execution pipeline, wherein the decode unit is further to: a) generate a fault micro-operation in response to determining that the target instruction of the second control transfer instruction is not an
- ENDBRANCH instruction and the second control transfer instruction does not include the subcode; and b) feed the second micro-operation, the target micro-operation and the fault micro- operation to the execution pipeline.
- Example 13 the processor of Example 12, further comprising: 1) an execution unit operatively coupled to the decode unit, the execution unit to execute micro-operations; and 2) a retirement unit operatively coupled to the execution unit, the retirement unit to communicate the execution exception to a fault handler responsive to receipt of the fault micro-operation.
- Example 14 is a method comprising: 1) receiving, by a processing device executing a high-level programming language compiler, a list of keywords identifying a programming language statement to be translated into control transfer commands for execution in a non- tracked mode; 2) determining, by the processing device, whether the programming language statement comprises a keyword from the list of keywords; and 3) responsive to determining that the programming language statement comprises a keyword from the list of keywords, translating the programming language statement into a control transfer instruction having a pre-defined subcode, the pre-defined subcode to instruct a processor not to track the control transfer instruction.
- Example 15 the method of claim 14, wherein the determining comprises determining whether the keyword identifies a switch-case statement or a table lookup.
- Example 16 the method of claim 14, wherein the determining further comprises determining whether a control transfer command corresponding to the programming language statement, when executed, needs to access memory to retrieve a destination address, wherein the method further comprises, responsive to determining that the control transfer command does not need to access memory, translating the programming language statement into a control transfer instruction having the pre-defined subcode.
- Example 17 the method of claim 14, wherein translating comprises appending the subcode to the control transfer instruction as a pre-defined prefix opcode.
- Example 18 the method of claim 14, further comprising, responsive to determining that the programming language statement does not comprise a keyword from the list of keywords: a) translating the programming language statement into a trackable control transfer instruction; and b) emitting an ENDBRANCH instruction to follow the trackable control transfer instruction.
- Various embodiments can have different combinations of the structural features described above. For instance, all optional features of the computing system described above can also be implemented with respect to the method or process described herein and specifics in the examples can be used anywhere in one or more embodiments.
- Example 19 is a processor comprising: 1) a fetch unit to fetch instructions, wherein the instructions include a first control transfer instruction having a pre-defined subcode and a second control transfer instruction that is missing the pre-defined subcode; 2) a decode unit to decode the instructions and including a processing logic to: a) decode the first control transfer instruction into a first micro-operation; b) remain in a first execution state responsive to detecting the pre-defined subcode of the first control transfer instruction; c) decode the second control transfer instruction into a second micro-operation; and d) enter into a second execution state responsive to detecting an absence of the pre-defined subcode of the second control transfer instruction; 3) an execution unit operatively coupled to the decode unit and to execute the first micro-operation and the second micro-operation; and 4) a retirement unit to retire the first micro- operation and to raise an execution exception responsive to a next micro-operation to be retired after the second micro-operation being other than an ENDBRANCH micro-operation, wherein the END
- Example 20 the processor of claim 19, wherein the retirement unit is further to: a) retain the next micro-operation in active execution; and b) send the execution exception to a fault handler for corrective action before deciding whether to retire the next micro-operation.
- Example 21 the processor of claim 19, wherein the first execution state is an IDLE state and the processing logic is further to associate the IDLE state with the first micro-operation.
- Example 22 the processor of claim 19, wherein the second execution state is a WAIT state and the processing logic is further to associate the WAIT state with the second micro-operation.
- the embodiments are described with reference to compression/decompression optimization in solid-state memory devices in specific integrated circuits, such as in computing platforms or microprocessors.
- the embodiments can also be applicable to other types of integrated circuits and programmable logic devices.
- the disclosed embodiments are not limited to desktop computer systems or portable computers, such as the Intel® UltrabooksTM computers, and can be also used in other devices, such as handheld devices, tablets, other thin notebooks, systems on a chip (SoC) devices, and embedded applications.
- Some examples of handheld devices include cellular phones, Internet protocol devices, digital cameras, personal digital assistants (PDAs), and handheld PCs.
- Embedded applications typically include a microcontroller, a digital signal processor (DSP), a system on a chip, network computers (NetPC), set-top boxes, network hubs, wide area network (WAN) switches, or any other system that can perform the functions and operations taught below. It is described that the system can be any kind of computer or embedded system.
- the disclosed embodiments can especially be used for low-end devices, like wearable devices (e.g., watches), electronic implants, sensory and control infrastructure devices, controllers, supervisory control and data acquisition (SCAD A) systems, or the like.
- the apparatuses, methods, and systems described herein are not limited to physical computing devices, but can also relate to software optimizations for energy conservation and efficiency.
- the embodiments of methods, apparatuses, and systems described herein are vital to a 'green technology' future balanced with performance considerations.
- Embodiments of the present disclosure can be provided as a computer program product or software which can include a machine or computer-readable medium having stored thereon instructions which can be used to program a computer (or other electronic devices) to perform one or more operations according to embodiments of the present disclosure.
- operations of embodiments of the present disclosure might be performed by specific hardware components that contain fixed- function logic for performing the operations, or by any combination of programmed computer components and fixed-function hardware components.
- Instructions used to program logic to perform embodiments of the disclosure can be stored within a memory in the system, such as DRAM, cache, flash memory, or other storage. Furthermore, the instructions can be distributed via a network or by way of other computer readable media.
- a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), but is not limited to, floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto- optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable
- the computer-readable medium includes any type of tangible machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
- a design can go through various stages, from creation to simulation to fabrication.
- Data representing a design can represent the design in a number of manners.
- the hardware can be represented using a hardware description language or another functional description language.
- a circuit level model with logic and/or transistor gates can be produced at some stages of the design process.
- most designs, at some stage reach a level of data representing the physical placement of various devices in the hardware model.
- the data representing the hardware model can be the data specifying the presence or absence of various features on different mask layers for masks used to produce the integrated circuit.
- the data can be stored in any form of a machine readable medium.
- a memory or a magnetic or optical storage such as a disc can be the machine readable medium to store information transmitted via optical or electrical wave modulated or otherwise generated to transmit such information.
- an electrical carrier wave indicating or carrying the code or design is transmitted, to the extent that copying, buffering, or re-transmission of the electrical signal is performed, a new copy is made.
- a communication provider or a network provider can store on a tangible, machine-readable medium, at least temporarily, an article, such as information encoded into a carrier wave, embodying techniques of embodiments of the present disclosure.
- a module as used herein refers to any combination of hardware, software, and/or firmware.
- a module includes hardware, such as a micro-controller, associated with a non-transitory medium to store code adapted to be executed by the micro-controller. Therefore, reference to a module, in one embodiment, refers to the hardware, which is specifically configured to recognize and/or execute the code to be held on a non-transitory medium. Furthermore, in another embodiment, use of a module refers to the non-transitory medium including the code, which is specifically adapted to be executed by the microcontroller to perform predetermined operations.
- module in this example, can refer to the combination of the microcontroller and the non- transitory medium. Often module boundaries that are illustrated as separate commonly vary and potentially overlap. For example, a first and a second module can share hardware, software, firmware, or a combination thereof, while potentially retaining some independent hardware, software, or firmware.
- use of the term logic includes hardware, such as transistors, registers, or other hardware, such as programmable logic devices. [00175] Use of the phrase 'configured to,' in one embodiment, refers to arranging, putting together, manufacturing, offering to sell, importing and/or designing an apparatus, hardware, logic, or element to perform a designated or determined task.
- an apparatus or element thereof that is not operating is still 'configured to' perform a designated task if it is designed, coupled, and/or interconnected to perform said designated task.
- a logic gate can provide a 0 or a 1 during operation. But a logic gate 'configured to' provide an enable signal to a clock does not include every potential logic gate that can provide a
- the logic gate is one coupled in some manner that during operation the 1 or 0 output is to enable the clock.
- use of the term 'configured to' does not require operation, but instead focus on the latent state of an apparatus, hardware, and/or element, where in the latent state the apparatus, hardware, and/or element is designed to perform a particular task when the apparatus, hardware, and/or element is operating.
- use of the phrases 'to,' 'capable of/to,' and or 'operable to,' in one embodiment refers to some apparatus, logic, hardware, and/or element designed in such a way to enable use of the apparatus, logic, hardware, and/or element in a specified manner.
- use of to, capable to, or operable to, in one embodiment refers to the latent state of an apparatus, logic, hardware, and/or element, where the apparatus, logic, hardware, and/or element is not operating but is designed in such a manner to enable use of an apparatus in a specified manner.
- a value includes any known representation of a number, a state, a logical state, or a binary logical state. Often, the use of logic levels, logic values, or logical values is also referred to as l's and 0's, which simply represents binary logic states. For example, a 1 refers to a high logic level and 0 refers to a low logic level.
- a storage cell such as a transistor or flash cell, can be capable of holding a single logical value or multiple logical values.
- the decimal number ten can also be represented as a binary value of 1010 and a hexadecimal letter A. Therefore, a value includes any representation of information capable of being held in a computer system.
- states can be represented by values or portions of values.
- a first value such as a logical one
- a second value such as a logical zero
- reset and set in one embodiment, refer to a default and an updated value or state, respectively.
- a default value potentially includes a high logical value, i.e. reset
- an updated value potentially includes a low logical value, i.e. set.
- any combination of values can be utilized to represent any number of states.
- a non-transitory machine-accessible/readable medium includes any mechanism that provides (i.e., stores and/or transmits) information in a form readable by a machine, such as a computer or electronic system.
- a non-transitory machine-accessible medium includes random-access memory (RAM), such as static RAM (SRAM) or dynamic RAM
- DRAM dynamic random access memory
- ROM read-only memory
- magnetic or optical storage medium flash memory devices
- electrical storage devices optical storage devices
- acoustical storage devices other form of storage devices for holding information received from transitory (propagated) signals (e.g., carrier waves, infrared signals, digital signals); etc., which are to be distinguished from the non-transitory mediums that can receive information there from.
- transitory (propagated) signals e.g., carrier waves, infrared signals, digital signals
- Instructions used to program logic to perform embodiments of the disclosure can be stored within a memory in the system, such as DRAM, cache, flash memory, or other storage. Furthermore, the instructions can be distributed via a network or by way of other computer readable media.
- a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), but is not limited to, floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto- optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable
- the computer-readable medium includes any type of tangible machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer)
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Multimedia (AREA)
- Technology Law (AREA)
- Remote Sensing (AREA)
- Radar, Positioning & Navigation (AREA)
- Executing Machine-Instructions (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
Abstract
A processor includes an execution unit and a processing logic operatively coupled to the execution unit, the processing logic to: enter a first execution state; responsive to executing a control transfer instruction having a pre-defined subcode, remain in the first execution state; responsive to executing a control transfer instruction not having the pre-defined subcode, transition into a second execution state; and responsive to determining, in the second execution state, that a next instruction to be executed differs from an ENDBRANCH instruction, raise an execution exception.
Description
NON-TRACKED CONTROL TRANSFERS WITHIN
CONTROL TRANSFER ENFORCEMENT Background
[0001] Return-oriented programming (ROP) is a computer security exploit technique in which an attacker uses software control of a stack to execute an attacker-chosen sequence of machine instructions. These clusters of instructions typically end with a programmer- intended or unintended return (RET) instruction within existing program code. The intended or unintended RET instruction transfers execution to the attacker-chosen return address on the stack and allows the attacker to retain execution control through the program code, and direct execution to the next set of chosen sequence of instructions to achieve the attacker's intent. The clusters of attacker-chosen instruction sequences are referred to as gadgets.
[0002] Often the executed gadget includes only several assembler instructions fol lowed by a RET instruction that can already perform a well-defined attack operation. By chaining together a set of these gadgets such that the RET instructions from one gadget lands into the next gadget and so on, the maiware writer is able to execute a complex algorithm without injecting any code into the program. Some of these instruction sequences ending in a RET can be found in functions compiled into the program or libraries.
[0003] Thus the ROP technique involves delivering a payload having a set of chained list of pointers to gadgets and parameters to a data memory of a program using vulnerabilities like stack buffer overflows. The exploit also overwrites the return address of the vulnerable function thai was used to perform the stack buffer overflow to point to the first gadget in the sequence. When this vulnerable function executes a RET instruction, control transfers to the first gadget instead of the function caller. This gadget can then consume one or more data elements from the stack payload. Using this exploit type, the maiware writer is able to change the control flow of the program by causing a control transfer to a non-programmer intended location in the program (e.g., to the middle of an instruction).
[0004] A ROP attack technique can use various characteristics of an x86 instruction set architecture (ISA): variable length and unaligned instruction encoding; large and dense ISA encoding; a stack holding control and data information; and a single byte opcode RET instruction. Current techniques to defend against such attacks can be ineffective and have various shortcomings.
Brief Description of the Drawings
[0005] Figure 1 is a block diagram of a portion of a processor in accordance with an embodiment of the present disclosure.
[0006] Figure 2 is a block diagram of a state machine in accordance with an embodiment of the present disclosure.
[0007] Figure 3A is a flow chart of a method of a compiler deciding whether to add a predefined subcode to control transfer instructions of a high-level programming language.
[0008] Figure 3B is a flow chart of a method for non-tracked control transfers and mode- specific control flow termination according to an embodiment of the present disclosure.
[0009] Figure 4 is a flow chart of another method for mode-specific control flow termination according to another embodiment of the present disclosure.
[0010] Figure 5 A is a flow d agram of a method of control transfer management in accordance with an embodiment of the present disclosure.
[0011] Figure 5B is a flow diagram of another method of control transfer management in accordance with an embodiment of the present disclosure.
[0012] Figure 6 is a block diagram of a configuration register in accordance wit an embodiment of the present disclosure.
[0013] Figure 7A is a block diagram of a call stack frame for code execution in accordance with an embodiment of the present disclosure.
[0014] Figure 7B is a block diagram of control transfer termination logic with legacy interworking in accordance with an embodiment of the present disclosure.
[0015] Figure 8 is a block diagram of a processor core in accordance with one embodiment of the present disclosure.
[0016] Figure 9A is a block diagram illustrating a micro-architecture for a processor core that can be incorporated into the processor of Figure 1.
[0017] Figure 9B is a block diagram illustrating an in-order pipeline and a register renaming stage, out-of-order issue/execution pipeline implemented by the processor core of Figure 9A according to some embodiments of the disclosure.
[0018] Figure 10 illustrates a block diagram of the micro-architecture for a processor that, in one embodiment, can represent portions of the processor of Figure 1.
[0019] Figure 11 is a block diagram of a multi-processor system according to one
implementation.
[0020] Figure 12 is a block diagram of a multi-processor system according to another implementation.
[0021] Figure 13 is a block diagram of a system-on-a-chip according to one implementation.
[0022] Figure 14 illustrates another implementation of a block diagram for a computing system.
[0023] Figure 15 illustrates another implementation of a block diagram for a computing system.
Description of Embodiments
[0024] Embodiments provide a set of instruction set architecture (ISA) instructions that enable a processor to determine whether a control transfer instruction is directed to an appropriate target, and if not to take action to prevent instructions beyond the control transfer instruction from being committed to the architectural state of the processor. In this way, at least certain unintended control transfers within a program can be eliminated, constraining the number of gadgets that a malware writer can use.
[0025] More specifically, embodiments provide a set of control transfer termination (CTT) instructions to allow software to specify valid control transfer terminating points in a program such that hardware can enforce control transfers to occur to only programmer- intended locations. These CTT instructions can be opcodes of fixed length that are handled differently than ISA instructions in that the CTT instructions perform no operation other than to signal to the processor that a proper control transfer termination is occurring. In one embodiment, the CTT instructions are mode-specific (e.g., 32-bit or 64-bit), multi-byte opcodes executable as a no operation. Accordingly, CTT instructions perform this enforcement with minimal performance and energy impacts to the program. The CTT ISA extensions can thus mitigate the execution of unintended gadgets in programs.
[0026] An indirec call or jump refers to an indirect operand. In one type of indirect call or jump, this indirect operand can be an indirect destination address that provides an address of the instruction to which the call or jump is to be performed. In another type of indirect call or jump, this indirect operand can be a processor register that provides an address of the instruction to which the call or jump is to be performed. In some cases, a compiler need not add (or emit) CTT instructions at control transfer terminating points when the compiler generates indirect jumps and calls (and returns from same) and already has code generated to ensure that the targets of that indirect call or jump (or return) are restricted to a small subset of targets known at compile time. For example, for a lookup or a switch-case statement, the compiler knows the number of possible targets and computes the address of the code for the possible targets. This optimization by the compiler to not emit a CTT instruction at the control transfer terminating points is generally safe when the indirect jump or call is of the type where the indirect operand is a register. If the indirect operand is a memory location, then the contents of those memory locations can be modified between when the compiler checks the contents and when the indirect call or jump instruction uses the content of that memory location to perform the indirec call or jump.
[0027] In either of these cases, not requiring a CTT instruction following a control transfer instruction reduces the size of the binary generated by a program (due to eliminated CTT instructions); and, jump or call targets become not-valid targets for indirect jumps or calls from other locations due to lacking the CTT instruction following the control transfer instruction, thus increasing security of the program. In one embodiment, a subcode such as a prefix or suffix can be added to a control transfer instruction (such as an indirect call or jump) indicating that the indirect call or jump need not be tracked by a tracker state machine, which can remain idle for such instructions, As will be further explained, the tracker state machine tracks states for control transfer instructions such that a CTT instruction is required after a control transfer instruction, except where the subcode is detected, to avoid issuing an execution exception.
[0028] In an alternative embodiment, the subcode can be added to all control transfer instructions except for those that need not be tracked. In other words, the lack of a subcode can signal to CTT processing logic that those control transfer instructions are not tracked by the tracker state machine, in the alternative embodiment.
[0029] hi another embodiment, a new indirect control transfer instruction may be defined that need not be tracked.
[0030] As more computer systems are used in Internet, text, and multimedia applications, additional processor support has been introduced over time to execute these applications. In one embodiment, an instruction set can be associated with one or more computer architectures, including data types, instructions, register architecture, addressing modes, memory architecture, interrupt and exception handling, and external input and output (I/O). In one embodiment, the ISA can be implemented by one or more micro-architectures, which include processor logic and circuits used to implement one or more instruction sets. Accordingly, processors with different micro-architectures can share at least a portion of a common instruction set.
[0031] In one embodiment, an instruction can include one or more instruction formats. Such instruction format can indicate various fields (number of bits, location of bits, etc) to specify, among other things, the operation to be performed and the operand(s) on which that operation is to be performed. Some instruction formats can be further broken defined by instruction templates (or sub formats). For example, the instruction templates of a given instruction format can be defined to have different subsets of the instruction format's fields and/or defined to have a given field interpreted differently. In one embodiment, an instruction is expressed using an instruction format (and, if defined, in a given one of the instruction templates of that instruction format) and specifies or indicates the operation and the operands upon which the operation will operate.
[0032] A first CTT instruction, referred to herein as an ENDBRANCH instruction, is used to identify valid locations in a program to which a control transfer can be validly performed using
an indirect CALL or an indirect jump (JMP) instruction. A second CTT instruction, referred to herein as an ENDRET instruction, is used to identify valid locations in a program where a control transfer can be validly performed using a RET instruction.
[0033] Within instruction set architecture, a program compiled with 64-bit mode instructions when decoded in 32-bit mode could decode to a different set of instructions than when decoded in 64-bit mode. This attribute has been exploited by maiware designed to jump into 32-bit binaries from 64-bit mode and vice versa. For example, consider the following byte string in the program: 4c 8b dl b8 50 00 00 00 Of 05 c3 Of If 44 00 00. This byte string, when decoded in 32- bit mode, decodes to following instruction sequence:
4c dec esp
8b dl mov edx, ecx
B 850000000 mov eax, 50h
0f 05 syscail
C3 ret
[0034] However, this same byte string when decoded in 64-bit mode decodes to following instruction sequence:
4c 8b dl mov rlO, rex
B 850000000 mov eax, 50h
Of 05 syscail
C3 ret
[0035] Thus, if the above byte string were in a 32-bit binary and then jumps to a 64-bit binary without switching to compatibility mode, the program would lead to execution of an unintended set of instructions. Likewise, if the above byte string were in a 64-bit binary and then jumps to a 32-bit binary without switching to 64-bit mode, the program would lead to execution of an unintended set of instructions. According to an embodiment, therefore, the disclosed processor employs mode-specific opcodes as CTT instructions to block maiware attempts to jump to 32-bit programs without switching to compatibility mode or to jump to 64-bit programs before switching to 64-bit mode.
[0036] Accordingly, the ENDB RANCH instructions can be further broken into two mode- specific CTT instructions, e.g., ENDBRANCH32 and ENDBRANCH64 instructions, to avoid situations where maiware can attempt to jump between processing modes to generate gadgets. Similarly, the ENDRET instruction can be further broken into two mode-specific CTT instructions, namely ENDRET32 and ENDRET64 to prevent similar maiware behavior when a control transfer instruction accesses memory to determine an address of a target ENDRET
instruction. This extension to different modes can be applied to different modes outside of 32-bit and 64-bit modes as would be apparent to one of ordinary skill.
[0037] In an embodiment, these CTT instructions can be 4-byte opcodes chosen such that they are handled differently than ISA instructions when decoded, e.g., the CTT instructions can be defined as no operation (NOP) in the x86 ISA to allow programs compiled with
ENDBRANCH/ENDRET instructions to execute on earlier generation processors.
[0038] Although the scope of the present disclosure is not limited in this regard in an embodiment, these CTT instructions can have a general form that includes a multi-byte opcode. In one such implementation, these CTT instructions can be represented by a four-byte opcode that corresponds to an opcode value not presently existing in the current x86 ISA. Beyond this opcode, there can be no additional encoding for the instruction, since the instruction executes as a no operation within execution logic. As such, there may be no identification of a source operand, destination operand or immediate value to be associated with the instruction.
[0039] Figure 1 is a block diagram of a portion 100 of a processor in accordance with an embodiment of the present disclosure. As shown in Figure 1, the portion 100 of the processor includes various portions of a pipelined processor such as an in-order or out-of-order processor. A compiler 108 can compile instructions into machine-readable code also referred to herein as macro-instructions of one or more programs of a given ISA. As seen, instructions from the compiler 108 are provided to a decode unit 110 that decodes the instructions, e.g., into one or more smaller instruction such as micro-operations (μορβ).
[0040] The decode unit 110 can include a CTT logic 115 (also simply referred to herein as processing logic) in accordance with an embodiment of the present disclosure. The CTT logic 115 can analyze incoming instructions and determine whether any given instruction is associated with a control transfer. If so, the CTT logic 115 can determine whether the control transfer instruction includes a specific subcode (such as a pre-defined prefix or suffix opcode) indicating that there is no threat of gadget creation. The CTT logic can associate certain state information with one or more μορβ. This state information indicates a state of a state
machine 116 (implemented by the CTT logic 115) that is modified by decoding of at least certain control transfer and control transfer termination instructions. If instead the instruction is not associated with a control transfer, a different state can be associated with the one or more μορβ.
[0041] When the incoming control transfer instruction lacks the subcode, the CTT logic 115 can transition the state machine 116 from the IDLE state to a given WAIT state. Furthermore, to reflect this WAFT state, a given encoding can be associated with the one or more μορβ decoded from the incoming control transfer instruction. When a next incoming instruction is a control transfer termination (CTT) instruction that immediately follows the control transfer termination.
then state machine 116 can return to the IDLE state and associate a given encoding with the decoded one or more _uops. As will be discussed, when a control transfer instruction is not immediately followed by a CTT instruction of the proper mode, the CTT logic 115 can raise an execution exception or insert a fault μορ into the processor pipeline (and the state machine can remain in a wait state).
[0042] When the incoming control transfer instruction contains the subcode, the CTT logic 115 can place or retain the state machine 116 in an IDLE state. Furthermore, due to the lack of an ENDB RANCH instruction (because of the subcode), there is no CTT instruction to be tracked. Furthermore, when the state machine 116 is in an IDLE state and an incoming instruction does not relate to a control transfer (or termination), an encoding of IDLE state information can be associated with the one or more μορδ to indicate that state machine 116 remains in the IDLE state.
[0043] Accordingly, the decode unit 110 outputs a stream of μορβ and associated state information to indicate a state of the state machine 116 within the CTT logic 115. These μορβ and state information can be provided to an execution unit 120, which can include various types of units including arithmetic logic units (ALUs), floating point units and so forth that execute operations indicated by the stream of μορβ. In an embodiment, the CTT instructions can only control the state transitions in the state machine 200, and in execution logic of the processor, these instructions execute as NOP and do not cause a change in the program semantics.
[0044] In turn, results of executing the μορβ are provided to a retirement unit 130 configured to determine whether given operations were successfully performed and to retire the μορ8 when successfully performed. If a μορ is not successfully performed, the retirement unit 130 can raise a fault or exception if an undesired condition occurs as a result of the execution. In an out-of-order processor, the retirement unit 130 can further operate to reorder instructions which can be executed in any order, back into program order. When μορβ properly retire, the μορβ can be provided to further portions of a processor such as a memory subsystem.
[0045] With further reference to Figure 1 , the retirement unit 130 includes a CTT exception logic 135 that can be configured to determine whether appropriate behavior occurs with regard to control transfer instructions. More specifically, the CTT exception logic 135 can operate to raise an execution exception when a given μορ decoded from a control transfer instruction to be retired is not directly followed by an appropriate CTT μορ, as described herein. In an
embodiment, this determination can be based at least in pari on an inserted fault μορ and the state information communicated with the μορς exiting from decode unit 110. If a CTT fault μορ is detected, an execution exception is raised and is communicated to a fault handler 140, which can take various actions in accordance with a given handler to resolve the faulting behavior. Thus, in an embodiment, when a next μορ presented to retire after a control transfer μορ is not an
appropriate CTT μορ, the retirement unit 130 can deliver an fault-class execution exception (e.g., a general protection fault) responsive to this CTT fault μορ such that the μορ does not retire.
[0046] Still referring to Figure 1 , in the case where a misprediction occurs and μο β are to be re-executed according to a correct branch, the retirement unit 130 can communicate via a feedback path 138 with decode unit 1 10 to thus provide an indication of a proper branch or other code flow to be taken. Still further, a state machine recovery signal can be communicated via this feedback path 138 such that the state machine 1 16 of CTT logic 115 can be placed into an appropriate state to reflect this change in program flow. Stated another way, when a fault μορ is present in a mispredicted path, an execution exception is not raised due to this m sprediction, and accordingly, the state machine recovery signal can cause the state machine 116 to pass from a WAIT state back to an IDLE state (or to remain in a WAIT state), and to also indicate the last successful instruction to retire, so that the decode unit 110 can decode instructions of the correct branch.
[0047] Figure 2 is a block diagram of a state machine 200 in accordance with an embodiment of the present disclosure. The state machine 200 can correspond to the CTT state
machine 116 of Figure 1 or to other processing logic of the portion 100 of the processor. The state machine 200 begins operation in an IDLE state 210 into which the state machine is placed by the CTT logic 115 after reset of a processor.
[0048] When some other instructions or an indirect CALL or JMP instruction that includes a certain subcode (such as 3EH or other opcode, for example) is decoded, the state machine can remain in the IDLE state 210. The subcode can be included as a prefix, a suffix or somewhere within the CALL or JMP instruction (e.g., in a header) that signals to the decode unit 110 that the state machine 200 is not to track the CALL or JMP instruction and carries no risk of aiding to the generation of a gadget. Table 1, below, is an example of the subcode functioning in this way so that the CALL or JMP instruction is not tracked.
TABLE 1
int main(int argc, char **argv)
{
int i;
i = foo();
switch(i)
{
case 1:
printffCase l\n");
break;
case 2:
printffCase 2\n");
break;
case 3:
printffCase 3\n");
break;
case 4:
printffCase 4\n");
break;
case 5:
printffCase 5\n");
break;
default:
printf("Nothing\n");
break;
}
return 0;
}
0000000000400a50 <main>:
400a50: f3 Of le fa endbr64
400a54: 55 push %rbp
400a55: 48 89 e5 mov %rsp,%rbp
400a58: 48 83 e4 80 and $0xffffffffffffff80,%rsp
400a5c: 48 81 ec 80 00 00 00 sub $0x80,%rsp
400a63: 33 f6 xor %esi,%esi
400a65: bf 03 00 00 00 mov $0x3,%edi
400a6a: e8 81 00 00 00 callq 400af0 <new_feature_proc_init>
400a6f: Of ae lc 24 stmxcsr (%rsp)
400a73: 81 Oc 24 40 80 00 00 orl $0x8040,(%rsp)
400a7a: Of ae 14 24 ldmxcsr (%rsp)
400a7e: Of 31 rdtsc
400a80: ff c8 dec %eax
400a82: 83 f8 04 cmp $0x4,%eax
400a85: 77 47 ja 400ace <main+0x7e>
400a87: 48 8b 04 c5 08 Id 40 mov 0x401d08(,%rax,8),%rax
400a8e: 00
400a8f: 3e ff eo no-trk jmpq *%rax
400a92: bf 30 Id 40 00 mov $0x401d30,%edi
400a97: e8 84 fe ff ff callq 400920 <puts@plt>
400a9c: eb 3a jmp 400ad8 <main+Ox88>
400a9e: bf 38 Id 40 00 mov $0x401d38,%edi
400aa3: e8 78 fe ff ff callq 400920 <puts@plt>
400aa8: eb 2e jmp 400ad8 <main+Ox88>
400aaa: bf 40 Id 40 00 mov $0x401d40,%edi
400aaf: e8 6c fe ff ff callq 400920 <puts@plt>
400ab4: eb 22 jmp 400ad8 <main+Ox88>
400ab6: bf 48 Id 40 00 mov $0x401d48,%edi
400abb: e8 60 fe ff ff callq 400920 <puts@plt>
400ac0: eb 16 jmp 400ad8 <main+Ox88>
400ac2: bf 50 Id 40 00 mov $0x401d50,%edi
400ac7: e8 54 fe ff ff callq 400920 <puts@plt>
400acc: eb Oa jmp 400ad8 <main+Ox88>
400ace: bf 58 Id 40 00 mov $0x401d58,%edi
400ad3: e8 48 fe ff ff callq 400920 <puts@plt>
400ad8: 33 cO xor %eax,%eax
400ada: 48 89 ec mov %rbp,%rsp
400add: 5d pop %rbp
400ade: c3 retq
[0049] In this example, the C code at the top of Table 1 is translated by a compiler 108 into the sequence of instructions that is shown below the C program. Here the code at address 400a8f is the no-track (subcode) jump emitted by the compiler. The compiler 108 can safely emit the no- track indirect jump here because the compiler has sanitized the jump locations at address 400a82 and 400a85 to ensure that the jump target is within bounds and the offset used for the targets of the jump are known at compile time. In this way, the compiler 108 can avoid emitting the
ENDBRANCH64 (endbr64) instruction at the targets of, for example, addresses 400aaa and 400ab6 that follow this CALL or JMP instruction.
[0050] When an indirect CALL or JMP instruction lacking the subcode is decoded (or any far CALL or JMP or a CALL or JMP that accesses memory is decoded), the state machine enters a WAIT_FOR_ENDBRANCH state 220. When the next instruction that is decoded is not an
ENDBRANCH instruction of the proper operation mode (e.g., ENDBRANCH32 for 32-bit or compatibility modes and ENDBRANCH64 for 64-bit mode), then the state machine 200 performs a DELIVER_EXECUTION ..EXCEPTION operation 230 which can also cause generation of a fault μορ (and the state machine 200 can remain in the WAIT_FOR_ENDBRANCH state 220), When, instead, the next instruction to be decoded following a control transfer instruction is an ENDBRANCH instruction of the proper mode, the state machine 200 transitions back to the IDLE state 210.
[0051] The INT3, shown as circling within the WAIT_FOR_ENDBRANCH state 220, is an instruction that is used to invoke a debugger for the state machine 200. When an INT3 instruction is encountered at the target of an indirect CALL or JMP, the state machine 200 is maintained in the WAIT_FOR_ENDBRANCH state 220. This is to support breakpoint generation by debuggers. The way a debugger sets up breakpoints in a program is by replacing the code byte at the address where the debugger wants to break with an INT3 instruction. This gives control to the debugger. The debugger can then examine the program state and then return the original code bytes that were replaced by the INT3 and restart program execution at that address. By retaining the state of the program as WAIT-FOR-ENDBRANCH when this program is restarted by the debugger, the hardware verifies whether the debugger has put back the code bytes for ENDBRANCH (that it had originally replaced with INT3).
[0052] When a RET instruction is decoded, the state machine 200 can determine whether the RET instruction includes the subcode indicating that a target of the RET instruction is valid and safe. (Note that in some instruction architectures, the check for the subcode can be unnecessary if the RET instructions do not access memory to determine a target address, e.g., there is no threat of gadget generation.) When the RET instruction includes the subcode, the state machine 200 can remain in the IDLE state. Otherwise, when the RET instruction lacks the subcode, the state machine can enter the WAIT_FOR_ENDRET state 240.
[0053] When the next instruction that is decoded is not an ENDRET instruction of the proper mode (e.g., ENDRET32 for 32-bit or compatibility modes and ENDRET64 for 64-bit mode), the state machine 200 performs the DELIVER... EXECUTION...EXCEPTION operation 230. When the next instruction that is decoded is an ENDRET instruction of the proper mode, the state machine 200 transitions back to the IDLE state 210.
[0054] The state machine 200 thus enforces the following rules: the instruction at the target of a RET instruction must be an ENDRET instruction of the proper mode and the instruction at the target of an indirect CALL or indirect JMP instruction must be an ENDBRANCH instruction of the proper mode. When these rules are violated, then the violating instruction (the instruction at
the target of a RET or CALL/JMP instruction) faults and is prevented from retiring by the retirement unit 130.
[0055] Thus by placing ENDB R ANCH32 or ENBRANCH64 and ENDRET32 or ENRET64 instructions in a program at valid control transfer locations, a programmer or compiler can prevent unintended control transfers from happening. This placement of E ND B RANCH and ENDRET instructions is as illustrated below in Table 2, as an example:
TABLE 2 main( ) {
int (*f)( );
f = foo;
f( );
}
int foo( ) {
return
}
0000000000400513
<main>:
endbranch64
push %rbp
mov %rsp,%rbp
sub $0x10, %rsp
movq $0x4004fb, -8(%rbp)
mov -8(%rbp), %rdx
mov $0x0, %eax
call *%rdx
endret64
Leaveq
Retq
00000000004004fb <foo>:
endbranch64
TABLE 2 push %rbp
mov %rsp,%rbp
leaveq
retq
[0056] In this example, the C code at the top of Table 2 is translated by a compiler into the sequence of instructions that is shown below the C program. The compiler 108 places an
ENDBRANCH64 instruction as the first instruction in the subroutine foo and in the main program, and an ENDRET64 instruction is placed after the CALL instruction to subroutine foo. Thus there are now three ("3") valid control transfer points in this program. Specifically, in execution of the main program, a call instruction (call *%rdx) is executed, causing a control transfer to the subroutine foo., the first instruction in this subroutine is an ENDBRANCH64 instruction, such that a valid control transfer occurs and the CTT state machine thus proceeds from an IDLE state, to a W A rr_FOR_E ND B ANCH state and back to the IDLE state, without raising a fault.
[0057] Similarly, at the conclusion of the subroutine foo, a return instruction (RETQ) is executed, thus causing control to transfer to the first instruction after the calling instruction in the main program. Here, this instruction is an ENDRET64 instruction and as such, a valid control transfer occurs. In this case, the CTT state machine proceeds from the IDLE state, to the
WAIT.. FOR..ENDRET state, and thereafter back to the IDLE state, without raising a fault.
[0058] Thus, using CTT processing logic in accordance with an embodiment of the present disclosure, a constraint is introduced that a ROP gadget be preceded with an ENDRET32 (or ENDRET64) to be usable, effectively eliminating the possibility for a sequence of instructions to be used as a ROP gadget. As such, a significant reduction in the number of gadgets that can be harvested from a library is realized, and the quality of such gadgets is significantly lower in terms of functionality that these remaining gadgets expose, making ROP attacks harder to execute.
[0059] Figure 3A is a flow chart of a method 300 of a compiler deciding whether to add a predefined subcode to control transfer instructions of a high-level programming language. The method can begin by receiving, by a processing device executing a high-level programming language compiler, a list of keywords identifying a programming language statement to be translated into control transfer commands for execution in a non-tracked mode (301). The keywords can include a switch-case statement or a table lookup, for example, where the destination address is known at compile time.
[0060] The method 300 can continue by determining whether the programming language statement includes a keyword from the list of keywords (302). Responsive to determining that the programming language statement includes a keyword from the list of keywords, the method can continue by translating the programming language statement into a control transfer instruction having a pre-defined subcode, the pre-defined subcode to instruct a processor not to track the control transfer instruction (304). Responsive to determining that the programming language statement does not include a keyword from the list of keywords, the method can continue by translating the programming language statement into a trackable control transfer instruction (306) and emitting an ENDBRANCH instruction to follow the trackable control transfer instruction (308).
[0061] Figure 3B is a flow chart of a method 310 for non-tracked control transfers and mode- specific control flow termination according to an embodiment of the present disclosure. The method 310 can be performed by a compiler and by a processor that includes a control transfer termination (CTT) state machine (e.g., processing logic of a decode unit). The method 300 can determine whether a control transfer instruction needs to access memory to determine an address of a target instruction of an indirect call, jump or return (control transfer) instruction (312). The method 310 can also determine whether a target instruction of the control transfer instruction is computed at compile time by the compiler (330). When the answer is no in block 312 and/or yes in block 330, the compiler can add a subcode (such as a prefix or suffix) to the control transfer instruction (315). The state machine can then be placed or retained in an IDLE state (320) for that control transfer instruction, after decoded, in response to detecting the subcode in the control transfer instruction.
[0062] When the answer is yes to block 312 and/or no to block 330, the compiler can compile program instructions as before, adding CTT instructions following control transfer instructions as directed (335). The method 310 can then continue, during decoding, by determining whether the control transfer instruction is followed by a CTT instruction (340). When no, then the processing logic raises an execution exception or generates a fault micro-operation as in step 230 of Figure 2 (360). If the answer is yes to block 340, then the method continues with determining whether the CTT instruction is of the same mode as the processing logic following the execution of the control transfer instruction (whether 32-bit mode or 64-bit mode, for example) (345). When the answer is yes to block 345, then the processing logic can place or retain the state machine in an IDLE state (350), corresponding to state 210 in Figure 2. When the answer is no to block 345, then the processing logic raises an execution exception or generates a fault micro- operation as discussed with respect to as in step 230 of Figure 2 (360). The processor can then take appropriate action in response to the execution exception or the fault. In one embodiment,
the retirement unit 130 can send an execution exception to the fault handler 140 upon receipt of the fault micro-operation through the pipeline of the portion 100 of the processor.
[0063] Figure 4 is a flow chart of another method 400 for mode- specific control flow termination according to another embodiment of the present disclosure. The method 400 can be performed by logic of a retirement unit to handle CTT -based retirement operations. The method 400 can begin by determining whether a control transfer micro-instruction (μορ) associated with a WAIT state (from a CTT state machine) is followed by a CTT μορ (410). When the answer is no, then the method generates a fault and sends the fault to a fault handier (450). When the answer is yes, then the method 400 can further determine whether the CTT μορ is of the same mode as the current mode of the machine (420), whether of a 32-bit or a 64-bit mode, for example. When the answer to block 420 is yes, the logic can retire the CTT μορ (430), signal to the state machine to move the state to IDLE (435), and perform further retirement operations (440). When the answer is no at block 420, the logic can generate and send an execution exception to the fault handler (450). The logic can also retain the target μορ in active execution, e.g., not retire the target μορ (which could belong to a gadget) contingent on the fault handler resolving the execution exception (460).
[0064] Figure 5A is a flow diagram of a method 500 of control transfer management in accordance with an embodiment of the present disclosure. As shown, the method 500 can be performed by a processor including a control transfer termination (CTT) state machine as described herein. Note that the operations shown in Figure 5A relate to state machine operations for control transfer-related instructions. For other instructions, if the state machine is currently in the IDLE state, the state machine remains in the IDLE state. The method 500 can begin by determining whether a feedback signal is received to update the CTT state machine (510). In an embodiment, this feedback signal can be received from a retirement unit or fault handler to cause the state of the state machine to transition to a given state, e.g., due to a misprediction (as from a retirement unit) or responsive to resolving a fault (as from a fault handler). If such feedback signal was received, control passes to block 515 where the state machine is updated with the state communicated through this feedback signal.
[0065] From both of these cases, control passes next to block 520 where an indication that an indirect control transfer instruction such as a call, jump or return has occurred (assuming that the decode unit has decoded such an instruction). And as such, control passes to block 525 where a transition into a WAIT sate of the state machine can occur.
[0066] Still referring to Figure 5A, method 500 can further determine whether an indication of a control transfer termination instruction of the correct mode is received (530). If so, control
passes to block 535 where the IDLE state of the state machine is entered, as pursuant to this proper CTT instruction following the control transfer instruction, a valid control transfer occurs.
[0067] When instead the method 500 determines that the next decoded instruction is not a CTT instruction or is a CTT instruction that does not match the current mode of the machine, control passes to block 540 where a control transfer termination fault instruction can be inserted into the processor pipeline. Note here that the state of the state machine does not change and thus remains in the selected WAIT state. In an embodiment, this fault instruction is a μορ that travels through the processor pipeline and if it is selected for retirement, the retirement unit causes a fault to enable an OS-based fault handler to execute to determine the cause of the fault and take appropriate action.
[0068] Figure 5B is a flow diagram of another method 550 of control transfer management in accordance with an embodiment of the present disclosure. The method 550 can be performed at least in part by logic of a retirement unit to handle CTT-based retirement operations. As seen, the method 550 begins by retiring a given micro-instruction (a μορ) and storing a CTT state associated with the μορ (555). In an embodiment, this information can be stored in a given storage of the retirement unit such as reorder buffer entry. As will be discussed further below, this state can be used in case a misprediction occurs. Next, the method 500 determines whether a misprediction has occurred. If so, control passes to block 570 where information regarding the last validly retired μορ present in an entry of the reorder buffer can be obtained and sent back to CTT logic (of the decode unit) to enable updating the state of the state machine into the appropriate state. There further typical retirement operations can continue (575).
[0069] Referring still to Figure 5B, when a fault μορ is received (580), control passes to block 585 where a call can be issued to a fault handler. As an example, an OS-based fault handler can be executed. As part of this fault handling, when the fault is due to a CTT fault μορ, a supervisor-based CTT state machine can be enabled and used to access the state of the user mode CTT state machine to determine the reason for the fault and to act accordingly. As an example, a target μορ (namely a non-CTT target μορ) can be prevented from retiring and an appropriate correction mechanism can be performed. Or, the fault handler can take any other action. As part of such operations, the fault handler can cause the user mode CTT state machine to be set to the appropriate state. After completion of the fault handler, retirement operations can be resumed responsive to control of the fault handler (590).
[0070] With CTT instructions enforcing valid control transfer locations, software checks can be placed after these instructions to further check for valid control transfers using techniques like stack canaries. Stack canaries are used to detect stack buffer overflow. This is done by placing a random number on the stack before the return address on entering a function and checking this
random number before return from the function. The CTT logic 115 provides strong positions in the program to add additional checks for detecting buffer overflows. Without CTT logic, these checks could be bypassed. CTT logic, therefore, ensures that these checks cannot be bypassed since the function must be called at the Endbranch and not past the Endbranch to skip the checks.
For the example discussed above, reference is made to Table 3:
TABLE 3 main( ) {
foo( );
endret32;
<detour/hook to anti-malware code to perform branch
sanity check>
{
int foo( ) {
return
}
[0071] In the example above, there is thus one place in the program (after the ENDRET32) where such a check is to be placed. Without the CTT processing logic, software cannot effectively check all places that can be used as gadgets as these gadgets can be crafted out of byte sequences in the middle of valid instructions.
[0072] The execution of a program using CTT instructions can be performed by a compiler. In an embodiment, a just-in-time (JIT) compiler or a regular (cc) compiler can perform the instrumentation of the CTT instructions. Alternately such instrumentation can be performed by rewriting the program binary to insert the CTT instructions using a binary rewriting tool that reconstructs the control flow graph from the application binary. The binary rewriting technique can be used in cases where the source of the binary is not available for recompilation. Such binary rewriting can also be done by anti-malware software using such tools.
[0073] In some cases, applications and libraries compiled with CTT instrumentation can be merged with libraries that are not compiled with CTT instrumentation, such as non-CTT instrumented libraries referred to herein as "legacy libraries."
[0074] To support continued operation with these legacy libraries, embodiments can provide additional instructions. In one such embodiment, a suppression instruction, referred to herein as a DISCTT instruction, can be used to suppress the CTT state machine such that it stays in the
IDLE state instead of transitioning to the WAIT... FOR.. ENDB RANCH or
WAIT_FOR_ENDRET states on an indirect CALL/JMP or RET, respectively. Additionally this instruction returns, in a general purpose register, the state of the CTT suppression at the time the instruction was issued. An enable instruction, referred to herein as an ENCTT instruction, is used to remove the suppression of the CTT state machine put in place by the DISCTT instruction such that the state machine enforces the CTT rules. Additionally, this instruction returns the state of the CTT suppression at the time the instruction was issued.
[0075] The use of DISCTT and ENCTT instructions can be enabled for a process by an operating system. If the operating system does not allow a program to disable CTT, then the DISCTT instruction executes as a NOP and does not suppress CTT.
[0076] The use of the DISCTT and ENCTT instructions in a program to perform legacy interworking is illustrated below in Table 4.
TABLE 4
// Issue a DISCTT before invoking a legacy library function foo( )
temp_variable = DISCTT;
foo( );
// If CTT was suppressed by DISCTT prior to this legacy library call then
un-suppress it
IF (temp_variable == NOT_SUPPRESSED)
ENCTT;
ENDIF
[0077] Returning the previous state of CTT as a result of the DISCTT instruction allows for supporting call chains like below:
CTT_function 1 ->legacy_function 1 ->CTT_f unction2->legaey_f unction2.
[0078] Here the CTT_function 1 issues a DISCTT instruction before calling the
legacy_functionl. The DISCTT instruction returns the current state of CTT functionality as NOTJSUPPRESS ED and then suppresses the CTT functionality. The legacy_functionl calls the CTT___function2. Now when the CTT___function2 calls legacy.. functioii2, it again issues a DISCTT instruction. The DISCTT instruction now returns the current state of the CTT functionality as SUPPRESSED since it has been suppressed by CTT.. function 1. When the control returns from legacy_function2 to CTT_function2, it does not un-suppress the CTT functionality since it was already suppressed when it was invoked. When the control returns to CTT_functionl, it tin- suppresses the CTT functionality using the ENCTT instruction since it was suppressed by that function.
[0079] Returning the previous state of CTT responsive to the ENCTT instruction allows for a
CTT-enabled library function to be called by a non-CTT enabled library/application to un- suppress CTT before it starts executing and suppress CTT functionality before returning to the caller, if it was suppressed when the function was called.
[0080] This is as illustrated below in Table 5:
TABLE 5
Legacy_functionl( )
{
CTT_functionl( );
}
CTT_functionl( )
{
//ENDBRANCH is a NOP if this function was called with CTT suppressed/disabled ENDBRANCH;
// Un-suppress CTT. If already unsuppressed this is gratuitous temp_variable = ENCTT;
// If CTT was suppressed when this function was called the suppress
// it before returning
IF ( temp_variable == SUPPRESSED )
DISCTT;
ENDIF RET;
}
[0081] Figure 6 is a block diagram of a configuration register in accordance with an embodiment of the present disclosure. As shown in Figure 6, configuration register 600 can include various fields to store state values used in performing CTT functionality. In an embodiment, two such configuration registers can be provided, with each register associated with a particular mode of operation. Stated another way, one configuration register can be used
to control CTT operation in a user mode (e.g., ring 3) while a second configuration register can be used to control CTT functionality in a supervisor mode (e.g., rings less than 3).
[0082] In the embodiment shown, configuration register 600 includes an enable field 605 to store an enable indicator to indicate whether CTT is enabled for the current privilege level. A legacy enable field 610 can be used to store an indicator to indicate whether legacy interworking is enabled. A suppression field 615 can be used to store a suppression indicator to indicate whether CTT faults and tracking are to be suppressed. A tracker field 620 can be used to store a value of the CTT state machine. In an embodiment, this tracker field can be three bits where a value of zero ("0") can indicate the IDLE state, a value of one ("1") can indicate a
WAIT . FOR. ENDRET32 state, a value of two ("2") can indicate a WAIT. FOR ENDRET64 state, a value of three ("3") can indicate a WAIT_ FORJENDBRANCH32 state, and a value of four ("4") can indicate a WAIT...FOR... ENDBRANCH64 state. A reserved field 425 can be used for various extensions. Other fields can be present in other embodiments than those specifically sho wn in Figure 4.
[0083] Referring now to Figure 7A, shown is a block diagram of a call stack frame for code execution that interlaces CTT-enabled code and legacy code without CTT-enabled functionality. As shown in Figure 7, a code segment 750 includes a first CTT call stack frame 760 and a second CTT call stack frame 762 that in turn calls a legacy call stack frame 765. Thus at the point of calling this legacy call stack frame, the CTT functionality is disabled responsive to a DISCTT instruction. Thus at this point execution begins with CTT functionality disabled for a first legacy call stack frame 765 and a second legacy call stack frame 766. Note that as the called functions return back, at the point of returning to call stack frame 762, execution with CTT functionality is re-enabled by an ENCTT instruction.
[0084] As such, Figure 7A shows an example where a first transfer to legacy code suppresses CTT, which is done using indirect CALL/JMP instructions (not RET) for security reasons. Once CTT is suppressed by a DISCTT instruction, subsequent CALL/JMP/RET instructions can land on instructions other than ENDBRANCH/ENDRET without causing faults. CTT operation is unsuppressed when control returns to the point where suppression was done, via an ENCTT instruction.
[0085] Figure 7B is a block diagram of control transfer termination logic with legacy interworking in accordance with an embodiment of the present disclosure. As shown in Figure 7B, an implementation is present with a CTT-enabled application image 770 that issues a call to a CTT enabled library 775 (Call_l) that in turn initiates a call to a legacy library 785 (Call_2). In turn, legacy library 785 issues a call to a second CTT-enabled library 790 (Call_3). Also present is a heap/stack 780. After execution in second CTT-enabled library 790, control passes back to
legacy library 785 (RET_1), and from there control returns back to first CTT-enabled library 775 (RET_2), and finally control returns back to application image 770 (RET_3).
[0086] Note that upon Call_2, a legacy transfer occurs and thus CTT is suppressed via a DISCTT instruction. Accordingly, for Call_3, CTT remains suppressed, as it does for RET_1. Finally, RET 2 causes a return to the point of suppression and, as such, CTT is unsuppressed via an ENCTT instruction. Note that this legacy interworking can be entered when a legacy interworking enable indicator of a CTT control logic is set and an indirect control transfer (namely a jump or call) occurs to a non-ENDB RANCH instruction.
[0087] The DISCTT and ENCTT instructions can be placed in the program by the programmer if she is aware of the interworking, and/or these DISCTT and ENCTT instructions can be placed in the program by the compiler/linker when it is linking statically to legacy libraries.
[0088] When linking dynamically to libraries, a loader or anti-malware software can insert trampoline functions between the application and the library, where the trampoline functions use DISCTT and ENCTT instructions. For example, calls to functions in a legacy library that are dynamically linked to a CTT enabled application go through a trampoline function, which suppresses CTT and then calls the legacy library function. The legacy library function returns to the trampoline function that un-suppresses CTT and returns to the CTT-enabled application.
[0089] Embodiments can be used by anti-malware software to wrap non-CTT binaries such that they can be used with CTT-enabled binaries. In addition, anti-malware software can restrict the use of the gadgets that can be found in the program even with CTT in use. Embodiments can be particularly applicable to mobile and other portable low power systems, in that software only- techniques to mitigate against ROP (like rewriting binaries to remove all instances of RET by use of functionally equivalent, but larger, more complex sequences), generally lead to much larger binaries and increase the execution time of the program and thereby are not suited for mobi le applications where power efficiency is a primary concern.
[0090] Figure 8 is a block diagram of a processor core 800 in accordance with one
embodiment of the present disclosure. As shown in Figure 8, the processor core 800 can be a multi-stage pipelined out-of-order processor. The core 800 can support one or more instructions sets (e.g., the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of MIPS Technologies of Sunnyvale, Calif.; the ARM instruction set (with optional additional extensions such as NEON) of ARM Holdings of Sunnyvale, Calif.). It should be understood that the core 800 can support multithreading
(executing two or more parallel sets of operations or threads), and can do so in a variety of ways including time-sliced multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that physical core is simultaneously
multithreading), or a combination thereof (e.g., time sliced fetching and decoding and simultaneous multithreading thereafter such as in the Intel® Hyperthreading technology).
[0091] A processor including the core 800 can be a general-purpose processor, such as a Core™ 13, 15, 17, 2 Duo and Quad, Xeon™, Itanium™, XScale™ or StrongARM™ processor, which are available from Intel Corporation. Alternatively, the processor can be from another company, such as a design from ARM Holdings, Ltd, MIPS, etc. The processor can be a special- purpose processor, such as, for example, a network or communication processor, compression engine, graphics processor, co-processor, embedded processor, or the like. The processor can be implemented on one or more chips, and can be a part of and/or can be implemented on one or more substrates using any of a number of process technologies, such as, for example, BiCMOS, CMOS. or NMOS,
[0092] As shown in Figure 8, core 800 can operate at various voltages and frequencies as a result of integrated voltage regulator 809. As seen in Figure 8, core 800 includes front end units 810, which can be used to fetch instructions to be executed and prepare them for use later in the processor. For example, the front end units 810 can include a fetch unit 801, an instruction cache 803, and an instruction decoder 805. Instruction decoder 805 can include CTT logic 806 in accordance with an embodimeni of the present disclosure, with an associated CTT state machine to perform CTT operations as described herein. In some implementations, the front end units 810 can further include a trace cache, along with microcode storage as well as a micro- operation storage. Fetch unit 801 can fetch macro-instructions, e.g., from memory or instruction cache 803, and feed them to instruction decoder 805 to decode the macro-instructions into primitives, e.g., micro-operations for execution by the processor.
[0093] Coupled between front end units 810 and execution units 820 is an out-of-order (OOO) engine 815 that can be used to receive the micro-instructions and prepare them for execution. More specifically, the OOO engine 815 can include various buffers to re-order flow of microinstructions and allocate various resources needed for execution, as well as to provide renaming of logical registers onto storage locations within various register files such as a register file 830 and an extended register file 835. The register file 830 can include separate register files for integer and floating point operations. The extended register file 835 can provide storage for vector-sized units, e.g., 256 or 512 bits per register.
[0094] Various resources can be present in execution units 820, including, for example, various integer, floating point, and single instruction multiple data (SIMD) logic units, among other specialized hardware. For example, such execution units can include one or more arithmetic logic units (ALUs) 822, among other such execution units.
[0095] Results from the execution units can be provided to a retirement unit 840 including a reorder buffer (ROB). This ROB can include various arrays and logic to receive information associated with instructions that are executed. This information is then examined by retirement unit 840 to determine whether the instructions can be validly retired and result data committed to the architectural state of the processor, or whether one or more exceptions occurred that prevent a proper retirement of the instructions. Of course, retirement unit 840 can handle other operations associated with retirement. For retirement operations here, CTT logic 845 of the retirement unit 840 can store CTT state machine state received with incoming instructions, and feed this information back to the CTT state machine responsive to a misprediction.
[0096] Figure 9A is a block diagram illustrating a micro-architecture for a processor core 900 that can be incorporated into the processor of Figure 1 or execute the state machine 200 (or CTT processing logic) of Figure 2. Specifically, processor core 900 depicts an in-order architecture core and a register renaming logic, out-of-order issue/execution logic to be included in a processor according to at least one embodiment of the disclosure. The embodiments of the error correcting code that carry additional bits can be implemented by processor core 900.
[0097] The processor core 900 includes a front end unit 930 coupled to an execution engine unit 950, and both are coupled to a memory unit 970. The processor core 900 can include a reduced instruction set computing (RISC) core, a complex instruction set computing (CISC) core, a very long instruction word (VLIW) core, or a hybrid or alternative core type. As yet another option, processor core 900 can include a special-purpose core, such as, for example, a network or communication core, compression engine, graphics core, or the like. In one embodiment, processor core 900 can be a multi-core processor or can be part of a multiprocessor system.
[0098] The front end unit 930 includes a branch prediction unit 932 coupled to an instruction cache unit 934, which is coupled to an instruction translation lookaside buffer (TLB) 936, which is coupled to an instruction fetch unit 938, which is coupled to a decode unit 940. The decode unit 940 (also known as a decoder) can decode instructions, and generate as an output one or more micro-operations, micro-code entry points, microinstructions, other instructions, or other control signals, which are decoded from, or which otherwise reflect, or are derived from, the primary instructions. The decoder 940 can be implemented using various different mechanisms. Examples of suitable mechanisms include, but are not limited to, look-up tables, hardware implementations, programmable logic arrays (PLAs), microcode read only memories (ROMs), etc. The instruction cache unit 934 is further coupled to the memory unit 970. The decode unit 940 is coupled to a rename/allocator unit 952 in the execution engine unit 950.
[0099] The execution engine unit 950 includes the rename/allocator unit 952 coupled to a retirement unit 954 and a set of one or more scheduler unit(s) 956. The scheduler unit(s) 956 represents any number of different schedulers, including reservations stations (RS), central instruction window, etc. The scheduler unit(s) 956 can be coupled to the physical register file unit(s) 958. Each of the physical register file unit(s) 958 represents one or more physical register files, different ones of which store one or more different data types, such as scalar integer, scalar floating point, packed integer, packed floating point, vector integer, vector floating point, etc., status (e.g., an instruction pointer that is the address of the next instruction to be executed), etc.
The physical register file(s) unit(s) 958 can be overlapped by the retirement unit 954 to illustrate various ways in which register renaming and out-of-order execution can be implemented (e.g., using a reorder buffer(s) and a retirement register file(s), using a future file(s), a history buffer(s), and a retirement register file(s); using a register maps and a pool of registers; etc.).
[00100] Generally, the architectural registers are visible from the outside of the processor or from a programmer's perspective. The registers are not limited to any known particular type of circuit. Various different types of registers are suitable as long as they are capable of storing and providing data as described herein. Examples of suitable registers include, but are not limited to, dedicated physical registers, dynamically allocated physical registers using register renaming, combinations of dedicated and dynamically allocated physical registers, etc. The retirement unit
954 and the physical register file(s) unit(s) 958 are coupled to the execution cluster(s) 960. The execution cluster(s) 960 includes a set of one or more execution units 962 and a set of one or more memory access units 964. The execution units 962 can perform various operations (e.g., shifts, addition, subtraction, multiplication) and operate on various types of data (e.g., scalar floating point, packed integer, packed floating point, vector integer, vector floating point).
[00101] While some embodiments can include a number of execution units dedicated to specific functions or sets of functions, other embodiments can include only one execution unit or multiple execution units that all perform all functions. The scheduler unit(s) 956, physical register file(s) unit(s) 958, and execution cluster(s) 960 are shown as being possibly plural because certain embodiments create separate pipelines for certain types of data/operations (e.g., a scalar integer pipeline, a scalar floating point/packed integer/packed floating point/vector integer/vector floating point pipeline, and/or a memory access pipeline that each have their own scheduler unit, physical register file(s) unit, and/or execution cluster - and in the case of a separate memory access pipeline, certain embodiments are implemented in which only the execution cluster of this pipeline has the memory access unit(s) 964). It should also be understood that where separate pipelines are used, one or more of these pipelines can be out-of-order issue/execution and the rest in-order.
[00102] The set of memory access units 964 can be coupled to the memory unit 970, which can include a data prefetcher 980, a data TLB unit 972, a data cache unit (DCU) 974, and a level 2
(L2) cache unit 976, to name a few examples. In some embodiments DCU 974 is also known as a first level data cache (LI cache). The DCU 974 can handle multiple outstanding cache misses and continue to service incoming stores and loads. It also supports maintaining cache coherency.
The data TLB unit 972 is a cache used to improve virtual address translation speed by mapping virtual and physical address spaces. In one exemplary embodiment, the memory access units 964 can include a load unit, a store address unit, and a store data unit, each of which is coupled to the data TLB unit 972 in the memory unit 970. The L2 cache unit 976 can be coupled to one or more other levels of cache and eventually to a main memory.
[00103] In one embodiment, the data prefetcher 980 speculatively loads/prefetches data to the DCU 974 by automatically predicting which data a program is about to consume. Prefetching can refer to transferring data stored in one memory location (e.g., position) of a memory hierarchy (e.g., lower level caches or memory) to a higher-level memory location that is closer (e.g., yields lower access latency) to the processor before the data is actually demanded by the processor. More specifically, prefetching can refer to the early retrieval of data from one of the lower level caches/memory to a data cache and/or to prefetch buffer before the processor issues a demand for the specific data being returned.
[00104] The processor core 900 can support one or more instructions sets (e.g., the x86 instruction set (with some extensions that have been added with newer versions); the MIPS instruction set of Imagination Technologies of Kings Langley, Hertfordshire, UK; the ARM instruction set (with optional additional extensions such as NEON) of ARM Holdings of Sunnyvale, CA).
[00105] It should be understood that the core can support multithreading (executing two or more parallel sets of operations or threads), and can do so in a variety of ways including time sliced multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that physical core is simultaneously multithreading), or a combination thereof (e.g., time sliced fetching and decoding and simultaneous multithreading thereafter such as in the Intel® Hyperthreading technology).
[00106] While register renaming is described in the context of out-of-order execution, it should be understood that register renaming can be used in an in-order architecture. While the illustrated embodiment of the processor also includes a separate instruction and data cache units and a shared L2 cache unit, alternative embodiments can have a single internal cache for both instructions and data, such as, for example, a Level 1 (LI) internal cache, or multiple levels of internal cache. In some embodiments, the system can include a combination of an internal cache
and an external cache that is external to the core and/or the processor. Alternatively, all of the cache can be external to the core and/or the processor.
[00107] Figure 9B is a block diagram illustrating an in-order pipeline and a register renaming stage, out-of-order issue/execution pipeline implemented by processor core 900 of Figure 9A according to some embodiments of the disclosure. The solid lined boxes in Figure 9B illustrate an in-order pipeline, while the dashed lined boxes illustrates a register renaming, out-of-order issue/execution pipeline. In Figure 9B, a processor pipeline 990 includes a fetch stage 902, a length decode stage 904, a decode stage 906, an allocation stage 908, a renaming stage 910, a scheduling (also known as a dispatch or issue) stage 912, a register read/memory read stage 914, an execute stage 916, a write back/memory write stage 918, an exception handling stage 922, and a commit stage 924. In some embodiments, the ordering of stages 902-924 can be different than illustrated and are not limited to the specific ordering shown in Figure 9B.
[00108] Figure 10 illustrates a block diagram of the micro- architecture for a processor 1000 (which can represent the processor of Figure 1 in one embodiment) that includes logic circuits. In some embodiments, an instruction in accordance with one embodiment can be implemented to operate on data elements having sizes of byte, word, doubleword, quadword, etc., as well as datatypes, such as single and double precision integer and floating point datatypes. In one embodiment, the in-order front end 1001 is the part of the processor 1000 that fetches instructions to be executed and prepares them to be used later in the processor pipeline.
[00109] The front end 1001 can include several units. In one embodiment, the instruction pref etcher 1016 fetches instructions from memory and feeds them to an instruction decoder 1018 which in turn decodes or interprets them. For example, in one embodiment, the decoder decodes a received instruction into one or more operations called "micro-instructions" or "micro- operations" (also called micro-op or μορ8) that the machine can execute. In other embodiments, the decoder parses the instruction into an opcode and corresponding data and control fields that are used by the micro-architecture to perform operations in accordance with one embodiment. In one embodiment, the trace cache 1030 takes decoded μορ8 and assembles them into program ordered sequences or traces in the μορ queue 1034 for execution. When the trace cache 1030 encounters a complex instruction, the microcode ROM (or RAM) 1032 can provide the μορ8 needed to complete the operation.
[00110] Some instructions are converted into a single micro-op, whereas others need several micro-ops to complete the full operation. In one embodiment, if more than four micro-ops are needed to complete an instruction, the decoder 1018 accesses the microcode ROM 1032 to do the instruction. For one embodiment, an instruction can be decoded into a small number of micro ops for processing at the instruction decoder 1018. In another embodiment, an instruction can be
stored within the microcode ROM 1032 should a number of micro-ops be needed to accomplish the operation. The trace cache 1030 refers to an entry point programmable logic array (PLA) to determine a correct micro-instruction pointer for reading the micro-code sequences to complete one or more instructions in accordance with one embodiment from the micro-code ROM 1032. After the microcode ROM 1032 finishes sequencing micro-ops for an instruction, the front end 1001 of the machine resumes fetching micro-ops from the trace cache 1030.
[00111] The out-of-order execution engine 1003 is where the instructions are prepared for execution. The out-of-order execution logic has a number of buffers to smooth out and re-order the flow of instructions to optimize performance as they go down the pipeline and get scheduled for execution. The allocator logic allocates the machine buffers and resources that each uop needs in order to execute. The register renaming logic renames logic registers onto entries in a register file. The allocator also allocates an entry for each uop in one of the two uop queues, one for memory operations and one for non-memory operations, in front of the instruction
schedulers: memory scheduler, fast scheduler 1002, slow/general floating point scheduler 1004, and simple floating point scheduler 1006. The μορ schedulers 1002, 1004, 1006, determine when a uop is ready to execute based on the readiness of their dependent input register operand sources and the availability of the execution resources the μορ8 need to complete their operation. The fast scheduler 1002 of one embodiment can schedule on each half of the main clock cycle while the other schedulers can only schedule once per main processor clock cycle. The schedulers arbitrate for the dispatch ports to schedule μορ8 for execution.
[00112] Register files 1008, 1010, sit between the schedulers 1002, 1004, 1006, and the execution units 1012, 1014, 1016, 1018, 1020, 1022, 1024 in the execution block 1011. There is a separate register file 1008, 1010, for integer and floating point operations, respectively. Each register file 1008, 1010, of one embodiment also includes a bypass network that can bypass or forward just completed results that have not yet been written into the register file to new dependent μορ8. The integer register file 1008 and the floating point register file 1010 are also capable of communicating data with the other. For one embodiment, the integer register file 1008 is split into two separate register files, one register file for the low order 32 bits of data and a second register file for the high order 32 bits of data. The floating point register file 1010 of one embodiment has 128 bit wide entries because floating point instructions typically have operands from 64 to 128 bits in width.
[00113] The execution block 1011 contains the execution units 1012, 1014, 1016, 1018, 1020, 1022, 1024, where the instructions are actually executed. This section includes the register files 1008, 1010, that store the integer and floating point data operand values that the microinstructions need to execute. The processor 1000 of one embodiment is comprised of a number
of execution units: address generation unit (AGU) 1012, AGU 1014, fast ALU 1016, fast ALU
1018, slow ALU 1020, floating point ALU 1022, floating point move unit 1014. For one embodiment, the floating point execution blocks 1022, 1024, execute floating point, MMX, SIMD, and SSE, or other operations. The floating point ALU 1022 of one embodiment includes a 64-bit-by-64-bit floating point divider to execute divide, square root, and remainder micro-ops. For embodiments of the present disclosure, instructions involving a floating point value can be handled with the floating point hardware.
[00114] In one embodiment, the ALU operations go to the high-speed ALU execution units 1016, 1018. The fast ALUs 1016, 1018, of one embodiment can execute fast operations with an effective latency of half a clock cycle. For one embodiment, most complex integer operations go to the slow ALU 1020 as the slow ALU 1020 includes integer execution hardware for long latency type of operations, such as a multiplier, shifts, flag logic, and branch processing.
Memory load/store operations are executed by the AGUs 1012, 1014. For one embodiment, the integer ALUs 1016, 1018, 1020, are described in the context of performing integer operations on 64 bit data operands. In alternative embodiments, the ALUs 1016, 1018, 1020, can be implemented to support a variety of data bits including 16, 32, 128, 256, etc. Similarly, the floating point units 1022, 1024, can be implemented to support a range of operands having bits of various widths. For one embodiment, the floating point units 1022, 1024, can operate on 128 bits wide packed data operands in conjunction with SIMD and multimedia instructions.
[00115] In one embodiment, the μορ8 schedulers 1002, 1004, 1006, dispatch dependent operations before the parent load has finished executing. As μορ8 are speculatively scheduled and executed in processor 1000, the processor 1000 also includes logic to handle memory misses. If a data load misses in the data cache, there can be dependent operations in flight in the pipeline that have left the scheduler with temporarily incorrect data. A replay mechanism tracks and re-executes instructions that use incorrect data. Only the dependent operations need to be replayed and the independent ones are allowed to complete. The schedulers and replay mechanism of one embodiment of a processor are also designed to catch instruction sequences for text string comparison operations.
[00116] The processor 1000 also includes logic to implement compression/decompression optimization in solid-state memory devices according to one embodiment. In one embodiment, the execution block 1011 of processor 1000 can include MCU 115, to perform
compression/decompression optimization in solid-state memory devices according to the description herein.
[00117] The term "registers" can refer to the on-board processor storage locations that are used as part of instructions to identify operands. In other words, registers can be those that are usable
from the outside of the processor (from a programmer's perspective). However, the registers of an embodiment should not be limited in meaning to a particular type of circuit. Rather, a register of an embodiment is capable of storing and providing data, and performing the functions described herein. The registers described herein can be implemented by circuitry within a processor using any number of different techniques, such as dedicated physical registers, dynamically allocated physical registers using register renaming, combinations of dedicated and dynamically allocated physical registers, etc. In one embodiment, integer registers store thirty- two bit integer data. A register file of one embodiment also contains eight multimedia SEVID registers for packed data.
[00118] For the discussions herein, the registers are understood to be data registers designed to hold packed data, such as 64 bits wide MMX™ registers (also referred to as 'mm' registers in some instances) in microprocessors enabled with MMX technology from Intel Corporation of Santa Clara, California. These MMX registers, available in both integer and floating point forms, can operate with packed data elements that accompany SIMD and SSE instructions. Similarly, 128-bit wide XMM registers relating to SSE2, SSE3, SSE4, or beyond (referred to generically as "SSEx") technology can also be used to hold such packed data operands. In one embodiment, in storing packed data and integer data, the registers do not need to differentiate between the two data types. In one embodiment, integer and floating point are either contained in the same register file or different register files. Furthermore, in one embodiment, floating point and integer data can be stored in different registers or the same registers.
[00119] Embodiments can be implemented in many different system types. Referring now to Figure 11, shown is a block diagram of a multiprocessor system 1100 in accordance with an implementation. As shown in Figure 11, multiprocessor system 1100 is a point-to-point interconnect system, and includes a first processor 1170 and a second processor 1180 coupled via a point-to-point interconnect 1150. As shown in Figure 11, each of processors 1170 and 1180 can be multicore processors, including first and second processor cores (i.e., processor cores 1174a and 1174b and processor cores 1184a and 1184b), although potentially many more cores can be present in the processors. The processors each can include hybrid write mode logics in accordance with an embodiment of the present. The embodiments of the page additions and content copying can be implemented in the processor 1170, processor 1180, or both.
[00120] While shown with two processors 1170, 1180, it is to be understood that the scope of the present disclosure is not so limited. In other implementations, one or more additional processors can be present in a given processor.
[00121] Processors 1170 and 1180 are shown including integrated memory controller units 1172 and 1182, respectively. Processor 1170 also includes as part of its bus controller units
point-to-point (P-P) interfaces 1176 and 1188; similarly, second processor 1180 includes P-P interfaces 1186 and 1188. Processors 1170, 1180 can exchange information via a point-to-point (P-P) interface 1150 using P-P interface circuits 1178, 1188. As shown in Figure 11, IMCs 1172 and 1182 couple the processors to respective memories, namely a memory 1132 and a memory 1134, which can be portions of main memory locally attached to the respective processors.
[00122] Processors 1170, 1180 can each exchange information with a chipset 1190 via individual P-P interfaces 1152, 1154 using point to point interface circuits 1176, 1194, 1186, 1198. Chipset 1190 can also exchange information with a high-performance graphics circuit 1138 via a high-performance graphics interface 1139.
[00123] A shared cache (not shown) can be included in either processor or outside of both processors, yet connected with the processors via P-P interconnect, such that either or both processors' local cache information can be stored in the shared cache if a processor is placed into a low power mode.
[00124] Chipset 1190 can be coupled to a first bus 1116 via an interface 1196. In one embodiment, first bus 1116 can be a Peripheral Component Interconnect (PCI) bus, or a bus such as a PCI Express bus or another third generation I/O interconnect bus, although the scope of the present disclosure is not so limited.
[00125] As shown in Figure 11, various I/O devices 1114 can be coupled to first bus 1116, along with a bus bridge 1118 which couples first bus 1116 to a second bus 1120. In one embodiment, second bus 1120 can be a low pin count (LPC) bus. Various devices can be coupled to second bus 1120 including, for example, a keyboard and/or mouse 1122,
communication devices 1127 and a storage unit 1128 such as a disk drive or other mass storage device which can include instructions/code and data 1130, in one embodiment. Further, an audio I/O 1124 can be coupled to second bus 1120. Note that other architectures are possible. For example, instead of the point-to-point architecture of Figure 11, a system can implement a multidrop bus or other such architecture.
[00126] Referring now to Figure 12, shown is a block diagram of a third system 1200 in accordance with an embodiment of the present disclosure. Like elements in Figures 11 and 12 bear like reference numerals, and certain aspects of Figure 11 have been omitted from Figure 11 in order to avoid obscuring other aspects of Figure 12.
[00127] Figure 12 illustrates that the processors 1270, 1280 can include integrated memory and I/O control logic ("CL") 1272 and 1282, respectively. For at least one embodiment, the CL 1272, 1282 can include integrated memory controller units such as described herein. In addition. CL 1272, 1282 can also include I/O control logic. Figure 12 illustrates that the memories 1232, 1234 are coupled to the CL 1272, 1282, and that I/O devices 1214 are also coupled to the control logic
1272, 1282. Legacy I/O devices 1215 are coupled to the chipset 1290. The embodiments of the page additions and content copying can be implemented in processor 1270, processor 1280, or both.
[00128] Figure 13 is an exemplary system on a chip (SoC) 1300 that can include one or more of the cores 1302. Other system designs and configurations known in the arts for laptops, desktops, handheld PCs, personal digital assistants, engineering workstations, servers, network devices, network hubs, switches, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, micro controllers, cell phones, portable media players, hand held devices, and various other electronic devices, are also suitable. In general, a huge variety of systems or electronic devices capable of incorporating a processor and/or other execution logic as disclosed herein are generally suitable.
[00129] With further reference to the SOC 1300, dashed lined boxes are features on more advanced SoCs. In Figure 13 an interconnect unit(s) 1302 is coupled to: an application processor 1317 which includes a set of one or more cores 1302A-N and shared cache unit(s) 1306; a system agent unit 1310; a bus controller unit(s) 1316; an integrated memory controller unit(s) 1314; a set of one or more media processors 1320 which can include integrated graphics logic 1308, an image processor 1324 for providing still and/or video camera functionality, an audio processor 1326 for providing hardware audio acceleration, and a video processor 1328 for providing video encode/decode acceleration; a static random access memory (SRAM) unit 1330; a direct memory access (DMA) unit 1332; and a display unit 1340 for coupling to one or more external displays. The embodiments of the pages additions and content copying can be implemented in SoC 1300.
[00130] Turning next to Figure 14, an embodiment of a system on-chip (SoC) design in accordance with embodiments of the disclosure is depicted. As an illustrative example, SoC 1400 is included in user equipment (UE). In one embodiment, UE refers to any device to be used by an end-user to communicate, such as a hand-held phone, smartphone, tablet, ultra-thin notebook, notebook with broadband adapter, or any other similar communication device. A UE can connect to a base station or node, which can correspond in nature to a mobile station (MS) in a GSM network. The embodiments of the page additions and content copying can be
implemented in SoC 1400.
[00131] Here, SoC 1400 includes 2 cores— 1406 and 1407. Similar to the discussion above, cores 1406 and 1407 can conform to an Instruction Set Architecture, such as a processor having the Intel® Architecture Core™, an Advanced Micro Devices, Inc. (AMD) processor, a MIPS- based processor, an ARM-based processor design, or a customer thereof, as well as their licensees or adopters. Cores 1406 and 1407 are coupled to cache control 1408 that is associated
with bus interface unit 1409 and L2 cache 1410 to communicate with other parts of SOC 1400.
Interconnect 1411 includes an on-chip interconnect, such as an IOSF, AMBA, or other interconnects discussed above, which can implement one or more aspects of the described disclosure.
[00132] Interconnect 1411 provides communication channels to the other components, such as a Subscriber Identity Module (SIM) 1430 to interface with a SIM card, a boot ROM 1435 to hold boot code for execution by cores 1406 and 1407 to initialize and boot SoC 1400, a SDRAM controller 1440 to interface with external memory (e.g., DRAM 1460), a flash controller 1445 to interface with non-volatile memory (e.g., Flash 1465), a peripheral control 1450 (e.g. Serial Peripheral Interface) to interface with peripherals, video codecs 1420 and Video interface 1425 to display and receive input (e.g. touch enabled input), GPU 1415 to perform graphics related computations, etc. Any of these interfaces can incorporate aspects of the embodiments described herein.
[00133] In addition, the system illustrates peripherals for communication, such as a Bluetooth module 1470, 3G modem 1475, GPS 1480, and Wi-Fi 1485. Note as stated above, a UE includes a radio for communication. As a result, these peripheral communication modules can not all be included. However, in a UE some form of a radio for external communication should be included.
[00134] Figure 15 illustrates a diagrammatic representation of a machine in the example form of a computing system 1500 within which a set of instructions, for causing the machine to perform any one or more of the methodologies discussed herein, can be executed. In alternative embodiments, the machine can be connected (e.g., networked) to other machines in a LAN, an intranet, an extranet, or the Internet. The machine can operate in the capacity of a server or a client device in a client- server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment. The machine can be a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine. Further, while only a single machine is illustrated, the term "machine" shall also be taken to include any collection of machines that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein. The embodiments that execute the processor of Figure 1 can be implemented in or as a part of the computing system 1500.
[00135] The computing system 1500 includes a processing device 1502, main memory 1504 (e.g., flash memory, dynamic random access memory (DRAM) (such as synchronous DRAM
(SDRAM) or DRAM (RDRAM), etc.), a static memory 1506 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 1516, which communicate with each other via a bus 1508.
[00136] Processing device 1502 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processing device can be complex instruction set computing (CISC) microprocessor, reduced instruction set computer (RISC) microprocessor, very long instruction word (VLIW) microprocessor, or processor implementing other instruction sets, or processors implementing a combination of instruction sets. Processing device 1502 can also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. In one embodiment, processing device 1502 can include one or processor cores. The processing device 1502 is configured to execute the processing logic or instructions 1526 for performing the operations discussed herein.
[00137] In one embodiment, processing device 1502 can be the processor of Figure 1.
Alternatively, the computing system 1500 can include other components as described herein. It should be understood that the core can support multithreading (executing two or more parallel sets of operations or threads), and can do so in a variety of ways including time sliced multithreading, simultaneous multithreading (where a single physical core provides a logical core for each of the threads that physical core is simultaneously multithreading), or a
combination thereof (e.g., time sliced fetching and decoding and simultaneous multithreading thereafter such as in the Intel® Hyperthreading technology).
[00138] The computing system 1500 can further include a network interface device 1518 communicably coupled to a network 1519. The computing system 1500 also can include a video display device 1510 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 1512 (e.g., a keyboard), a cursor control device 1514 (e.g., a mouse), a signal generation device 1520 (e.g., a speaker), or other peripheral devices. Furthermore, computing system 1500 can include a graphics processing unit 1522, a video processing unit 1528 and an audio processing unit 1532. In another embodiment, the computing system 1500 can include a chipset (not illustrated), which refers to a group of integrated circuits, or chips, that are designed to work with the processing device 1502 and controls communications between the processing device 1502 and external devices. For example, the chipset can be a set of chips on a motherboard that links the processing device 1502 to very high-speed devices, such as main memory 1504 and graphic controllers, as well as linking the processing device 1502 to lower- speed peripheral buses of peripherals, such as USB, PCI or ISA buses.
[00139] The data storage device 1516 can include a computer-readable storage medium 1524 on which is stored software 1526 embodying any one or more of the methodologies of functions described herein. The software 1526 can also reside, completely or at least partially, within the main memory 1504 as instructions 1526 and/or within the processing device 1502 as processing logic during execution thereof by the computing system 1500; the main memory 1504 and the processing device 1502 also constituting computer-readable storage media.
[00140] The computer-readable storage medium 1524 can also be used to store instructions 1526 utilizing the processing device 1502, such as described with respect to Figures 1-4, and/or a software library containing methods that call the above applications. While the computer- readable storage medium 1524 is shown in an example embodiment to be a single medium, the term "computer-readable storage medium" should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions. The term "computer-readable storage medium" shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instruction for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present embodiments. The term "computer-readable storage medium" shall accordingly be taken to include, but not be limited to, solid-state memories, and optical and magnetic media.
[00141] The following examples pertain to further embodiments.
[00142] Example 1 is a processor comprising: 1) an execution unit; and 2) a processing logic operatively coupled to the execution unit, the processing logic to: a) enter a first execution state; b) remain in the first execution state responsive to executing a control transfer instruction having a pre-defined subcode; c) transition into a second execution state responsive to executing a control transfer instruction not having the pre-defined subcode; and d) raise an execution exception responsive to determining, while in the second execution state, that a next instruction to be executed differs from an ENDBRANCH instruction.
[00143] In Example 2, the processor of Example 1, wherein the first execution state comprises an IDLE state and wherein the second execution state comprises a WAIT state.
[00144] In Example 3, the processor of Example 1, wherein the pre-defined subcode comprises a pre-defined opcode prefix.
[00145] In Example 4, the processor of Example 1, wherein the processing logic is further to, responsive to executing a control transfer instruction that is a far call or jump instruction, transition into the second execution state.
[00146] In Example 5, the processor of Example 1, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
[00147] In Example 6, the processor of Example 1, wherein the processing logic is further to, responsive to determining that the next instruction to be executed is the ENDBRANCH instruction, transition to the first execution state.
[00148] In Example 7, the processor of Example 1, wherein the processing logic includes a state machine to track an execution state of control transfer instructions.
[00149] Various embodiments can have different combinations of the structural features described above. For instance, all optional features of the computing system described above can also be implemented with respect to the method or process described herein and specifics in the examples can be used anywhere in one or more embodiments.
[00150] Example 8 is a processor comprising: 1) a decode unit to decode a first control transfer instruction, which generates a first micro-operation, wherein the first control transfer instruction includes a pre-defined subcode indicating to a processing logic of the decode unit to not track execution of the first micro-operation; and 2) wherein the processing logic is to raise an execution exception responsive to determining that a target instruction of a second control transfer instruction is not an ENDBRANCH instruction and the second control transfer instruction does not include the pre-defined subcode, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
[00151] In Example 9, the processor of Example 8, wherein the processing logic is further to associate a first state with the first micro-operation to indicate that the processing logic is in an IDLE state.
[00152] In Example 10, the processor of Example 8, wherein the processing logic is further to associate a second state with a second micro-operation decoded from the second control transfer instruction to indicate that the processing logic is in a WAIT state.
[00153] In Example 11, the processor of Example 8, further comprising: 1) an execution unit operatively coupled to the decode unit, the execution unit to execute micro-operations; and 2) a retirement unit operatively coupled to the execution unit, the retirement unit to raise the execution exception after processing a target micro-operation decoded from the target instruction.
[00154] In Example 12, the processor of Example 8, wherein the decode unit is further to decode the second control transfer instruction into a second micro -operation and to decode the target instruction into a target micro-operation, further comprising an execution pipeline, wherein the decode unit is further to: a) generate a fault micro-operation in response to determining that the target instruction of the second control transfer instruction is not an
ENDBRANCH instruction and the second control transfer instruction does not include the
subcode; and b) feed the second micro-operation, the target micro-operation and the fault micro- operation to the execution pipeline.
[00155] In Example 13, the processor of Example 12, further comprising: 1) an execution unit operatively coupled to the decode unit, the execution unit to execute micro-operations; and 2) a retirement unit operatively coupled to the execution unit, the retirement unit to communicate the execution exception to a fault handler responsive to receipt of the fault micro-operation.
[00156] Various embodiments can have different combinations of the structural features described above. For instance, all optional features of the computing system described above can also be implemented with respect to the method or process described herein and specifics in the examples can be used anywhere in one or more embodiments.
[00157] Example 14 is a method comprising: 1) receiving, by a processing device executing a high-level programming language compiler, a list of keywords identifying a programming language statement to be translated into control transfer commands for execution in a non- tracked mode; 2) determining, by the processing device, whether the programming language statement comprises a keyword from the list of keywords; and 3) responsive to determining that the programming language statement comprises a keyword from the list of keywords, translating the programming language statement into a control transfer instruction having a pre-defined subcode, the pre-defined subcode to instruct a processor not to track the control transfer instruction.
[00158] In Example 15, the method of claim 14, wherein the determining comprises determining whether the keyword identifies a switch-case statement or a table lookup.
[00159] In Example 16, the method of claim 14, wherein the determining further comprises determining whether a control transfer command corresponding to the programming language statement, when executed, needs to access memory to retrieve a destination address, wherein the method further comprises, responsive to determining that the control transfer command does not need to access memory, translating the programming language statement into a control transfer instruction having the pre-defined subcode.
[00160] In Example 17, the method of claim 14, wherein translating comprises appending the subcode to the control transfer instruction as a pre-defined prefix opcode.
[00161] In Example 18, the method of claim 14, further comprising, responsive to determining that the programming language statement does not comprise a keyword from the list of keywords: a) translating the programming language statement into a trackable control transfer instruction; and b) emitting an ENDBRANCH instruction to follow the trackable control transfer instruction.
[00162] Various embodiments can have different combinations of the structural features described above. For instance, all optional features of the computing system described above can also be implemented with respect to the method or process described herein and specifics in the examples can be used anywhere in one or more embodiments.
[00163] Example 19 is a processor comprising: 1) a fetch unit to fetch instructions, wherein the instructions include a first control transfer instruction having a pre-defined subcode and a second control transfer instruction that is missing the pre-defined subcode; 2) a decode unit to decode the instructions and including a processing logic to: a) decode the first control transfer instruction into a first micro-operation; b) remain in a first execution state responsive to detecting the pre-defined subcode of the first control transfer instruction; c) decode the second control transfer instruction into a second micro-operation; and d) enter into a second execution state responsive to detecting an absence of the pre-defined subcode of the second control transfer instruction; 3) an execution unit operatively coupled to the decode unit and to execute the first micro-operation and the second micro-operation; and 4) a retirement unit to retire the first micro- operation and to raise an execution exception responsive to a next micro-operation to be retired after the second micro-operation being other than an ENDBRANCH micro-operation, wherein the ENDBRANCH micro-operation is generated from a multi-byte opcode executable as a no operation.
[00164] In Example 20, the processor of claim 19, wherein the retirement unit is further to: a) retain the next micro-operation in active execution; and b) send the execution exception to a fault handler for corrective action before deciding whether to retire the next micro-operation.
[00165] In Example 21, the processor of claim 19, wherein the first execution state is an IDLE state and the processing logic is further to associate the IDLE state with the first micro-operation.
[00166] In Example 22, the processor of claim 19, wherein the second execution state is a WAIT state and the processing logic is further to associate the WAIT state with the second micro-operation.
[00167] While the present disclosure has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present disclosure.
[00168] In the description herein, numerous specific details are set forth, such as examples of specific types of processors and system configurations, specific hardware structures, specific architectural and micro architectural details, specific register configurations, specific instruction types, specific system components, specific measurements/heights, specific processor pipeline stages and operation etc. in order to provide a thorough understanding of the present disclosure.
It will be apparent, however, to one skilled in the art that these specific details need not be employed to practice the present disclosure. In other instances, well known components or methods, such as specific and alternative processor architectures, specific logic circuits/code for described algorithms, specific firmware code, specific interconnect operation, specific logic configurations, specific manufacturing techniques and materials, specific compiler
implementations, specific expression of algorithms in code, specific power down and gating techniques/logic and other specific operational details of computer system have not been described in detail in order to avoid unnecessarily obscuring the present disclosure.
[00169] The embodiments are described with reference to compression/decompression optimization in solid-state memory devices in specific integrated circuits, such as in computing platforms or microprocessors. The embodiments can also be applicable to other types of integrated circuits and programmable logic devices. For example, the disclosed embodiments are not limited to desktop computer systems or portable computers, such as the Intel® Ultrabooks™ computers, and can be also used in other devices, such as handheld devices, tablets, other thin notebooks, systems on a chip (SoC) devices, and embedded applications. Some examples of handheld devices include cellular phones, Internet protocol devices, digital cameras, personal digital assistants (PDAs), and handheld PCs. Embedded applications typically include a microcontroller, a digital signal processor (DSP), a system on a chip, network computers (NetPC), set-top boxes, network hubs, wide area network (WAN) switches, or any other system that can perform the functions and operations taught below. It is described that the system can be any kind of computer or embedded system. The disclosed embodiments can especially be used for low-end devices, like wearable devices (e.g., watches), electronic implants, sensory and control infrastructure devices, controllers, supervisory control and data acquisition (SCAD A) systems, or the like. Moreover, the apparatuses, methods, and systems described herein are not limited to physical computing devices, but can also relate to software optimizations for energy conservation and efficiency. As will become readily apparent in the description below, the embodiments of methods, apparatuses, and systems described herein (whether in reference to hardware, firmware, software, or a combination thereof) are vital to a 'green technology' future balanced with performance considerations.
[00170] Although the embodiments herein are described with reference to a processor, other embodiments are applicable to other types of integrated circuits and logic devices. Similar techniques and teachings of embodiments of the present disclosure can be applied to other types of circuits or semiconductor devices that can benefit from higher pipeline throughput and improved performance. The teachings of embodiments of the present disclosure are applicable to any processor or machine that performs data manipulations. However, the present disclosure is
not limited to processors or machines that perform 512 bit, 256 bit, 128 bit, 64 bit, 32 bit, or 16 bit data operations and can be applied to any processor and machine in which manipulation or management of data is performed. In addition, the description herein provides examples, and the accompanying drawings show various examples for the purposes of illustration. However, these examples should not be construed in a limiting sense as they are merely intended to provide examples of embodiments of the present disclosure rather than to provide an exhaustive list of all possible implementations of embodiments of the present disclosure.
[00171] Although the below examples describe instruction handling and distribution in the context of execution units and logic circuits, other embodiments of the present disclosure can be accomplished by way of a data or instructions stored on a machine-readable, tangible medium, which when performed by a machine cause the machine to perform functions consistent with at least one embodiment of the disclosure. In one embodiment, functions associated with embodiments of the present disclosure are embodied in machine-executable instructions. The instructions can be used to cause a general-purpose or special-purpose processor that is programmed with the instructions to perform the steps of the present disclosure. Embodiments of the present disclosure can be provided as a computer program product or software which can include a machine or computer-readable medium having stored thereon instructions which can be used to program a computer (or other electronic devices) to perform one or more operations according to embodiments of the present disclosure. Alternatively, operations of embodiments of the present disclosure might be performed by specific hardware components that contain fixed- function logic for performing the operations, or by any combination of programmed computer components and fixed-function hardware components.
[00172] Instructions used to program logic to perform embodiments of the disclosure can be stored within a memory in the system, such as DRAM, cache, flash memory, or other storage. Furthermore, the instructions can be distributed via a network or by way of other computer readable media. Thus a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), but is not limited to, floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto- optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable
Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic or optical cards, flash memory, or a tangible, machine-readable storage used in the transmission of information over the Internet via electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.). Accordingly, the computer-readable medium includes any type of tangible machine-readable
medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
[00173] A design can go through various stages, from creation to simulation to fabrication. Data representing a design can represent the design in a number of manners. First, as is useful in simulations, the hardware can be represented using a hardware description language or another functional description language. Additionally, a circuit level model with logic and/or transistor gates can be produced at some stages of the design process. Furthermore, most designs, at some stage, reach a level of data representing the physical placement of various devices in the hardware model. In the case where conventional semiconductor fabrication techniques are used, the data representing the hardware model can be the data specifying the presence or absence of various features on different mask layers for masks used to produce the integrated circuit. In any representation of the design, the data can be stored in any form of a machine readable medium. A memory or a magnetic or optical storage such as a disc can be the machine readable medium to store information transmitted via optical or electrical wave modulated or otherwise generated to transmit such information. When an electrical carrier wave indicating or carrying the code or design is transmitted, to the extent that copying, buffering, or re-transmission of the electrical signal is performed, a new copy is made. Thus, a communication provider or a network provider can store on a tangible, machine-readable medium, at least temporarily, an article, such as information encoded into a carrier wave, embodying techniques of embodiments of the present disclosure.
[00174] A module as used herein refers to any combination of hardware, software, and/or firmware. As an example, a module includes hardware, such as a micro-controller, associated with a non-transitory medium to store code adapted to be executed by the micro-controller. Therefore, reference to a module, in one embodiment, refers to the hardware, which is specifically configured to recognize and/or execute the code to be held on a non-transitory medium. Furthermore, in another embodiment, use of a module refers to the non-transitory medium including the code, which is specifically adapted to be executed by the microcontroller to perform predetermined operations. And as can be inferred, in yet another embodiment, the term module (in this example) can refer to the combination of the microcontroller and the non- transitory medium. Often module boundaries that are illustrated as separate commonly vary and potentially overlap. For example, a first and a second module can share hardware, software, firmware, or a combination thereof, while potentially retaining some independent hardware, software, or firmware. In one embodiment, use of the term logic includes hardware, such as transistors, registers, or other hardware, such as programmable logic devices.
[00175] Use of the phrase 'configured to,' in one embodiment, refers to arranging, putting together, manufacturing, offering to sell, importing and/or designing an apparatus, hardware, logic, or element to perform a designated or determined task. In this example, an apparatus or element thereof that is not operating is still 'configured to' perform a designated task if it is designed, coupled, and/or interconnected to perform said designated task. As a purely illustrative example, a logic gate can provide a 0 or a 1 during operation. But a logic gate 'configured to' provide an enable signal to a clock does not include every potential logic gate that can provide a
1 or 0. Instead, the logic gate is one coupled in some manner that during operation the 1 or 0 output is to enable the clock. Note once again that use of the term 'configured to' does not require operation, but instead focus on the latent state of an apparatus, hardware, and/or element, where in the latent state the apparatus, hardware, and/or element is designed to perform a particular task when the apparatus, hardware, and/or element is operating.
[00176] Furthermore, use of the phrases 'to,' 'capable of/to,' and or 'operable to,' in one embodiment, refers to some apparatus, logic, hardware, and/or element designed in such a way to enable use of the apparatus, logic, hardware, and/or element in a specified manner. Note as above that use of to, capable to, or operable to, in one embodiment, refers to the latent state of an apparatus, logic, hardware, and/or element, where the apparatus, logic, hardware, and/or element is not operating but is designed in such a manner to enable use of an apparatus in a specified manner.
[00177] A value, as used herein, includes any known representation of a number, a state, a logical state, or a binary logical state. Often, the use of logic levels, logic values, or logical values is also referred to as l's and 0's, which simply represents binary logic states. For example, a 1 refers to a high logic level and 0 refers to a low logic level. In one embodiment, a storage cell, such as a transistor or flash cell, can be capable of holding a single logical value or multiple logical values. However, other representations of values in computer systems have been used. For example the decimal number ten can also be represented as a binary value of 1010 and a hexadecimal letter A. Therefore, a value includes any representation of information capable of being held in a computer system.
[00178] Moreover, states can be represented by values or portions of values. As an example, a first value, such as a logical one, can represent a default or initial state, while a second value, such as a logical zero, can represent a non-default state. In addition, the terms reset and set, in one embodiment, refer to a default and an updated value or state, respectively. For example, a default value potentially includes a high logical value, i.e. reset, while an updated value potentially includes a low logical value, i.e. set. Note that any combination of values can be utilized to represent any number of states.
[00179] The embodiments of methods, hardware, software, firmware or code set forth above can be implemented via instructions or code stored on a machine-accessible, machine readable, computer accessible, or computer readable medium which are executable by a processing element. A non-transitory machine-accessible/readable medium includes any mechanism that provides (i.e., stores and/or transmits) information in a form readable by a machine, such as a computer or electronic system. For example, a non-transitory machine-accessible medium includes random-access memory (RAM), such as static RAM (SRAM) or dynamic RAM
(DRAM); ROM; magnetic or optical storage medium; flash memory devices; electrical storage devices; optical storage devices; acoustical storage devices; other form of storage devices for holding information received from transitory (propagated) signals (e.g., carrier waves, infrared signals, digital signals); etc., which are to be distinguished from the non-transitory mediums that can receive information there from.
[00180] Instructions used to program logic to perform embodiments of the disclosure can be stored within a memory in the system, such as DRAM, cache, flash memory, or other storage. Furthermore, the instructions can be distributed via a network or by way of other computer readable media. Thus a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), but is not limited to, floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto- optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable
Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic or optical cards, flash memory, or a tangible, machine-readable storage used in the transmission of information over the Internet via electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.). Accordingly, the computer-readable medium includes any type of tangible machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer)
[00181] Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present disclosure. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment.
Furthermore, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[00182] In the foregoing specification, a detailed description has been given with reference to specific exemplary embodiments. It will, however, be evident that various modifications and
changes can be made thereto without departing from the broader spirit and scope of the disclosure as set forth in the appended claims. The specification and drawings are, accordingly, to be regarded in an illustrative sense rather than a restrictive sense. Furthermore, the foregoing use of embodiment and other exemplarily language does not necessarily refer to the same embodiment or the same example, but can refer to different and distinct embodiments, as well as potentially the same embodiment.
[00183] Some portions of the detailed description are presented in terms of algorithms and symbolic representations of operations on data bits within a computer memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. An algorithm is here and generally, conceived to be a self-consistent sequence of operations leading to a desired result. The operations are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers or the like. The blocks described herein can be hardware, software, firmware or a combination thereof.
[00184] It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the above discussion, it is appreciated that throughout the description, discussions utilizing terms such as "defining," "receiving," "determining," "issuing," "linking," "associating," "obtaining," "authenticating," "prohibiting," "executing," "requesting," "communicating," or the like, refer to the actions and processes of a computing system, or similar electronic computing device, that manipulates and transforms data represented as physical (e.g., electronic) quantities within the computing system's registers and memories into other data similarly represented as physical quantities within the computing system memories or registers or other such information storage, transmission or display devices.
[00185] The words "example" or "exemplary" are used herein to mean serving as an example, instance or illustration. Any aspect or design described herein as "example' or "exemplary" is not necessarily to be construed as preferred or advantageous over other aspects or designs.
Rather, use of the words "example" or "exemplary" is intended to present concepts in a concrete fashion. As used in this application, the term "or" is intended to mean an inclusive "or" rather than an exclusive "or." That is, unless specified otherwise, or clear from context, "X includes A or B" is intended to mean any of the natural inclusive permutations. That is, if X includes A; X
includes B; or X includes both A and B, then "X includes A or B" is satisfied under any of the foregoing instances. In addition, the articles "a" and "an" as used in this application and the appended claims should generally be construed to mean "one or more" unless specified otherwise or clear from context to be directed to a singular form. Moreover, use of the term "an embodiment" or "one embodiment" or "an implementation" or "one implementation" throughout is not intended to mean the same embodiment or implementation unless described as such. Also, the terms "first," "second," "third," "fourth," etc. as used herein are meant as labels to distinguish among different elements and can not necessarily have an ordinal meaning according to their numerical designation.
Claims
1. A processor comprising:
an execution unit; and
a processing logic operatively coupled to the execution unit, the processing logic to:
enter a first execution state;
remain in the first execution state responsive to executing a control transfer instruction having a pre-defined subcode;
transition into a second execution state responsive to executing a control transfer instruction not having the pre-defined subcode; and
raise an execution exception responsive to determining, while in the second execution state, that a next instruction to be executed differs from an ENDBRANCH instruction.
2. The processor of claim 1 , wherein the first execution state comprises an IDLE state and wherein the second execution state comprises a WAIT state.
3. The processor of claim 1, wherein the pre-defined subcode comprises a pre-defined opcode prefix.
4. The processor of claim 1 , wherein the processing logic is further to, responsive to executing a control transfer instruction that is a far call or jump instruction, transition into the second execution state.
5. The processor of claim 1, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
6. The processor of claim 1, wherein the processing logic is further to, responsive to determining that the next instruction to be executed is the ENDBRANCH instruction, transition to the first execution state.
7. The processor of claim 1, wherein the processing logic includes a state machine to track an execution state of control transfer instructions.
8. A processor comprising:
a decode unit to decode a first control transfer instruction, which generates a first micro- operation, wherein the first control transfer instruction includes a pre-defined subcode indicating to a processing logic of the decode unit to not track execution of the first micro-operation; and
wherein the processing logic is to raise an execution exception responsive to determining that a target instruction of a second control transfer instruction is not an ENDBRANCH instruction and the second control transfer instruction does not include the pre-defined subcode, wherein the ENDBRANCH instruction is a multi-byte opcode executable as a no operation.
9. The processor of claim 8, wherein the processing logic is further to associate a first state with the first micro-operation to indicate that the processing logic is in an IDLE state.
10. The processor of claim 8, wherein the processing logic is further to associate a second state with a second micro-operation decoded from the second control transfer instruction to indicate that the processing logic is in a WAIT state.
11. The processor of claim 8, further comprising:
an execution unit operatively coupled to the decode unit, the execution unit to execute micro- operations; and
a retirement unit operatively coupled to the execution unit, the retirement unit to raise the execution exception after processing a target micro-operation decoded from the target instruction.
12. The processor of claim 8, wherein the decode unit is further to decode the second control transfer instruction into a second micro-operation and to decode the target instruction into a target micro- operation, further comprising an execution pipeline, wherein the decode unit is further to:
generate a fault micro-operation in response to determining that the target instruction of the second control transfer instruction is not an ENDBRANCH instruction and the second control transfer instruction does not include the subcode; and
feed the second micro-operation, the target micro-operation and the fault micro-operation to the execution pipeline.
13. The processor of claim 12, further comprising:
an execution unit operatively coupled to the decode unit, the execution unit to execute micro- operations; and
a retirement unit operatively coupled to the execution unit, the retirement unit to communicate the execution exception to a fault handler responsive to receipt of the fault micro-operation.
14. A method comprising:
receiving, by a processing device executing a high-level programming language compiler, a list of keywords identifying a programming language statement to be translated into control transfer commands for execution in a non-tracked mode;
determining, by the processing device, whether the programming language statement comprises a keyword from the list of keywords; and
responsive to determining that the programming language statement comprises a keyword from the list of keywords, translating the programming language statement into a control transfer instruction having a pre-defined subcode, the pre-defined subcode to instruct a processor not to track the control transfer instruction.
15. The method of claim 14, wherein the determining comprises determining whether the keyword identifies a switch-case statement or a table lookup.
16. The method of claim 14, wherein the determining further comprises determining whether a control transfer command corresponding to the programming language statement, when executed, needs to access memory to retrieve a destination address, wherein the method further comprises, responsive to
determining that the control transfer command does not need to access memory, translating the programming language statement into a control transfer instruction having the pre-defined subcode.
17. The method of claim 14, wherein translating comprises appending the subcode to the control transfer instruction as a pre-defined prefix opcode.
18. The method of claim 14, further comprising, responsive to determining that the programming language statement does not comprise a keyword from the list of keywords:
translating the programming language statement into a trackable control transfer instruction; and emitting an ENDBRANCH instruction to follow the trackable control transfer instruction.
19. A processor comprising:
a fetch unit to fetch instructions, wherein the instructions include a first control transfer instruction having a pre-defined subcode and a second control transfer instruction that is missing the predefined subcode;
a decode unit to decode the instructions and including a processing logic to:
decode the first control transfer instruction into a first micro-operation; remain in a first execution state responsive to detecting the pre-defined subcode of the first control transfer instruction;
decode the second control transfer instruction into a second micro-operation; and enter into a second execution state responsive to detecting an absence of the pre-defined subcode of the second control transfer instruction;
an execution unit operatively coupled to the decode unit and to execute the first micro-operation and the second micro-operation; and
a retirement unit to retire the first micro-operation and to raise an execution exception responsive to a next micro-operation to be retired after the second micro-operation being other than an
ENDBRANCH micro-operation, wherein the ENDBRANCH micro-operation is generated from a multi- byte opcode executable as a no operation.
20. The processor of claim 19, wherein the retirement unit is further to:
retain the next micro-operation in active execution; and
send the execution exception to a fault handler for corrective action before deciding whether to retire the next micro-operation.
21. The processor of claim 19, wherein the first execution state is an IDLE state and the processing logic is further to associate the IDLE state with the first micro-operation.
22. The processor of claim 19, wherein the second execution state is a WAIT state and the processing logic is further to associate the WAIT state with the second micro-operation.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US14/757,964 US9785800B2 (en) | 2015-12-23 | 2015-12-23 | Non-tracked control transfers within control transfer enforcement |
US14/757,964 | 2015-12-23 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017112315A1 true WO2017112315A1 (en) | 2017-06-29 |
Family
ID=59088432
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/US2016/063665 WO2017112315A1 (en) | 2015-12-23 | 2016-11-23 | Non-tracked control transfers within control transfer enforcement |
Country Status (3)
Country | Link |
---|---|
US (1) | US9785800B2 (en) |
TW (1) | TWI729033B (en) |
WO (1) | WO2017112315A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10108530B2 (en) * | 2016-02-24 | 2018-10-23 | Stmicroelectronics (Rousset) Sas | Method and tool for generating a program code configured to perform control flow checking on another program code containing instructions for indirect branching |
US10204219B2 (en) * | 2017-06-05 | 2019-02-12 | Karamba Security | In-memory protection for controller security |
US10878103B2 (en) * | 2017-06-05 | 2020-12-29 | Karamba Security Ltd. | In-memory protection for controller security |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7340589B2 (en) * | 2002-06-24 | 2008-03-04 | Seiko Epson Corporation | Shift prefix instruction decoder for modifying register information necessary for decoding the target instruction |
US8086438B2 (en) * | 2002-03-27 | 2011-12-27 | Synopsys, Inc. | Method and system for instruction-set architecture simulation using just in time compilation |
US20130111190A1 (en) * | 2011-11-02 | 2013-05-02 | International Business Machines Corporation | Operational code expansion in response to successive target address detection |
US20140095833A1 (en) * | 2011-10-03 | 2014-04-03 | International Business Machines Corporation | Prefix Computer Instruction for Compatibly Extending Instruction Functionality |
US20140156972A1 (en) * | 2012-11-30 | 2014-06-05 | Vedyvas Shanbhogue | Control Transfer Termination Instructions Of An Instruction Set Architecture (ISA) |
Family Cites Families (48)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5826055A (en) | 1991-07-08 | 1998-10-20 | Seiko Epson Corporation | System and method for retiring instructions in a superscalar microprocessor |
US20030097587A1 (en) | 2001-11-01 | 2003-05-22 | Gulick Dale E. | Hardware interlock mechanism using a watchdog timer |
US6996677B2 (en) | 2002-11-25 | 2006-02-07 | Nortel Networks Limited | Method and apparatus for protecting memory stacks |
EP1612638B1 (en) | 2004-07-01 | 2011-03-09 | Texas Instruments Incorporated | Method and system of verifying proper execution of a secure mode entry sequence |
US7752427B2 (en) | 2005-12-09 | 2010-07-06 | Atmel Corporation | Stack underflow debug with sticky base |
US7581089B1 (en) | 2006-04-20 | 2009-08-25 | The United States Of America As Represented By The Director Of The National Security Agency | Method of protecting a computer stack |
ATE466331T1 (en) | 2006-09-06 | 2010-05-15 | Silicon Hive Bv | DATA PROCESSING CIRCUIT HAVING MULTIPLE TYPES OF INSTRUCTIONS, METHOD FOR OPERATION OF SUCH DATA CIRCUIT, AND SCHEDULING METHOD FOR SUCH DATA CIRCUIT |
US8176477B2 (en) | 2007-09-14 | 2012-05-08 | International Business Machines Corporation | Method, system and program product for optimizing emulation of a suspected malware |
US8434073B1 (en) | 2008-11-03 | 2013-04-30 | Symantec Corporation | Systems and methods for preventing exploitation of byte sequences that violate compiler-generated alignment |
GB2482701C (en) | 2010-08-11 | 2018-12-26 | Advanced Risc Mach Ltd | Illegal mode change handling |
US8997218B2 (en) | 2010-12-22 | 2015-03-31 | F-Secure Corporation | Detecting a return-oriented programming exploit |
US8468600B1 (en) | 2011-03-04 | 2013-06-18 | Adobe Systems Incorporated | Handling instruction received from a sandboxed thread of execution |
US8943313B2 (en) | 2011-07-19 | 2015-01-27 | Elwha Llc | Fine-grained security in federated data sets |
US9465657B2 (en) | 2011-07-19 | 2016-10-11 | Elwha Llc | Entitlement vector for library usage in managing resource allocation and scheduling based on usage and priority |
US9170843B2 (en) | 2011-09-24 | 2015-10-27 | Elwha Llc | Data handling apparatus adapted for scheduling operations according to resource allocation based on entitlement |
US20150128262A1 (en) | 2011-10-28 | 2015-05-07 | Andrew F. Glew | Taint vector locations and granularity |
US9471373B2 (en) | 2011-09-24 | 2016-10-18 | Elwha Llc | Entitlement vector for library usage in managing resource allocation and scheduling based on usage and priority |
US8813085B2 (en) | 2011-07-19 | 2014-08-19 | Elwha Llc | Scheduling threads based on priority utilizing entitlement vectors, weight and usage level |
US9098608B2 (en) | 2011-10-28 | 2015-08-04 | Elwha Llc | Processor configured to allocate resources using an entitlement vector |
US9558034B2 (en) | 2011-07-19 | 2017-01-31 | Elwha Llc | Entitlement vector for managing resource allocation |
US8955111B2 (en) | 2011-09-24 | 2015-02-10 | Elwha Llc | Instruction set adapted for security risk monitoring |
US9460290B2 (en) | 2011-07-19 | 2016-10-04 | Elwha Llc | Conditional security response using taint vector monitoring |
US9798873B2 (en) | 2011-08-04 | 2017-10-24 | Elwha Llc | Processor operable to ensure code integrity |
US20130024676A1 (en) | 2011-07-19 | 2013-01-24 | Glew Andrew F | Control flow integrity |
US9443085B2 (en) | 2011-07-19 | 2016-09-13 | Elwha Llc | Intrusion detection using taint accumulation |
US9015860B2 (en) | 2011-09-24 | 2015-04-21 | Elwha Llc | Behavioral fingerprinting via derived personal relation |
US8555077B2 (en) | 2011-11-23 | 2013-10-08 | Elwha Llc | Determining device identity using a behavioral fingerprint |
US9621404B2 (en) | 2011-09-24 | 2017-04-11 | Elwha Llc | Behavioral fingerprinting with social networking |
US8713704B2 (en) | 2011-09-24 | 2014-04-29 | Elwha Llc | Behavioral fingerprint based authentication |
US9825967B2 (en) | 2011-09-24 | 2017-11-21 | Elwha Llc | Behavioral fingerprinting via social networking interaction |
US20130159217A1 (en) | 2011-09-24 | 2013-06-20 | Elwha LLC, a limited liability corporation of the State of Delaware | Environmentally-responsive behavioral fingerprinting |
US9298900B2 (en) | 2011-09-24 | 2016-03-29 | Elwha Llc | Behavioral fingerprinting via inferred personal relation |
US20140123249A1 (en) | 2012-10-31 | 2014-05-01 | Elwha LLC, a limited liability corporation of the State of Delaware | Behavioral Fingerprinting Via Corroborative User Device |
US8689350B2 (en) | 2011-09-24 | 2014-04-01 | Elwha Llc | Behavioral fingerprint controlled theft detection and recovery |
US9083687B2 (en) | 2011-09-24 | 2015-07-14 | Elwha Llc | Multi-device behavioral fingerprinting |
US20130197968A1 (en) | 2011-09-24 | 2013-08-01 | Elwha LLC, a limited liability corporation of the State of Delaware | Behavioral fingerprinting with retail monitoring |
US8869241B2 (en) | 2011-09-24 | 2014-10-21 | Elwha Llc | Network acquired behavioral fingerprint for authentication |
US20130151617A1 (en) | 2011-10-13 | 2013-06-13 | Elwha LLC, a limited liability corporation of the State of Delaware | Behavioral fingerprinting via social network verification |
US9729549B2 (en) | 2011-09-24 | 2017-08-08 | Elwha Llc | Behavioral fingerprinting with adaptive development |
US20130191887A1 (en) | 2011-10-13 | 2013-07-25 | Marc E. Davis | Social network based trust verification Schema |
US9348985B2 (en) | 2011-11-23 | 2016-05-24 | Elwha Llc | Behavioral fingerprint controlled automatic task determination |
US20130133054A1 (en) | 2011-09-24 | 2013-05-23 | Marc E. Davis | Relationship Based Trust Verification Schema |
US9141800B2 (en) | 2011-12-20 | 2015-09-22 | Advanced Micro Devices, Inc. | Method and apparatus for detecting intrusions in a computer system |
EP2867843A4 (en) | 2012-06-29 | 2016-01-13 | Elwha Llc | Behavioral fingerprinting with retail monitoring |
US9990202B2 (en) | 2013-06-28 | 2018-06-05 | Intel Corporation | Packed data element predication processors, methods, systems, and instructions |
US9684511B2 (en) | 2013-09-27 | 2017-06-20 | Intel Corporation | Using software having control transfer termination instructions with software not having control transfer termination instructions |
US10241787B2 (en) * | 2014-03-31 | 2019-03-26 | Intel Corporation | Control transfer override |
US9646154B2 (en) * | 2014-12-12 | 2017-05-09 | Microsoft Technology Licensing, Llc | Return oriented programming (ROP) attack protection |
-
2015
- 2015-12-23 US US14/757,964 patent/US9785800B2/en active Active
-
2016
- 2016-11-22 TW TW105138283A patent/TWI729033B/en not_active IP Right Cessation
- 2016-11-23 WO PCT/US2016/063665 patent/WO2017112315A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8086438B2 (en) * | 2002-03-27 | 2011-12-27 | Synopsys, Inc. | Method and system for instruction-set architecture simulation using just in time compilation |
US7340589B2 (en) * | 2002-06-24 | 2008-03-04 | Seiko Epson Corporation | Shift prefix instruction decoder for modifying register information necessary for decoding the target instruction |
US20140095833A1 (en) * | 2011-10-03 | 2014-04-03 | International Business Machines Corporation | Prefix Computer Instruction for Compatibly Extending Instruction Functionality |
US20130111190A1 (en) * | 2011-11-02 | 2013-05-02 | International Business Machines Corporation | Operational code expansion in response to successive target address detection |
US20140156972A1 (en) * | 2012-11-30 | 2014-06-05 | Vedyvas Shanbhogue | Control Transfer Termination Instructions Of An Instruction Set Architecture (ISA) |
Also Published As
Publication number | Publication date |
---|---|
TWI729033B (en) | 2021-06-01 |
US20170185803A1 (en) | 2017-06-29 |
TW201732562A (en) | 2017-09-16 |
US9785800B2 (en) | 2017-10-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11762982B2 (en) | Processor extensions to protect stacks during ring transitions | |
US10445494B2 (en) | Attack protection for valid gadget control transfers | |
US9697142B2 (en) | Execution-aware memory protection | |
US11650818B2 (en) | Mode-specific endbranch for control flow termination | |
US9934164B2 (en) | Memory write protection for memory corruption detection architectures | |
US9971702B1 (en) | Nested exception handling | |
US10394595B2 (en) | Method to manage guest address space trusted by virtual machine monitor | |
US10228956B2 (en) | Supporting binary translation alias detection in an out-of-order processor | |
US9785800B2 (en) | Non-tracked control transfers within control transfer enforcement | |
US9946566B2 (en) | Method and apparatus for light-weight virtualization contexts | |
EP3400525A1 (en) | Binary translation support using processor instruction prefixes | |
US10318440B2 (en) | Mapping security policy group registers |
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: 16879799 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16879799 Country of ref document: EP Kind code of ref document: A1 |