Hardware mitigations for Spectre and Meltdown-like attacks

By introducing a global generation counter and generation tag memory processing circuit, the vulnerability of the processor to Meltdown and Spectre attacks is solved, achieving efficient side-channel attack defense, maintaining processor performance and reducing defense costs.

CN116601631BActive Publication Date: 2026-11-20INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180084375.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-12-15
Filing Date
2021-10-26
Publication Date
2026-11-20
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

Existing processors are vulnerable to side-channel attacks such as Meltdown and Spectre, which can lead to the leakage of sensitive information, and existing defenses are costly and unreliable.

Method used

The introduction of first and second global generation counters and generation tag memory, combined with a wait queue, prevents potential side-channel attacks by incrementing the counter value during speculative loading and resetting it during rollback, ensuring that instructions are executed in order or with delay.

Benefits of technology

It effectively prevents side-channel attacks, avoids changes to application software, maintains processor performance, reduces defense costs, and decreases the complexity of countermeasures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116601631B_ABST
    Figure CN116601631B_ABST
Patent Text Reader

Abstract

Aspects include circuitry including a first global generation counter (GGC) that is incremented on decoding a branch instruction and a second GGC that is incremented on completion of the branch instruction. The first GGC is reset on a triggered rollback. The circuitry also includes a generation tag memory associated with a register loaded during a side-channel attack that is set to the first GGC on a first load, and a determination unit that determines, for a second load from an address that depends on the register of the first load, a generation tag value associated with a register of the second load as a function of the first GGC, the second GGC, and the generation tag value associated with the register of the first load. A wait queue is configured to stall the second load if the generation tag is greater than the second GGC.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention generally relates to computer processing, and more specifically, to preventing side-channel attacks against processors. Background Technology

[0002] The design of processors for modern information technology (IT) infrastructure is both a science and an art. Processor complexity increases with shrinking architecture size. On the other hand, cybersecurity attacks targeting IT infrastructure, aimed at stealing data or disrupting the overall functionality of computer systems, are also flourishing. One highly sophisticated type of attack may target the internal functions of the processor, particularly out-of-order (OoO) processors, where machine instructions are not executed as programmed or optimized by the compiler. Instead, OoO processors optimize instruction sequences at the hardware level for better performance.

[0003] One of these hardware-level optimization techniques relates to branch prediction. In some OoO processors, the front end (i.e., the incoming instruction stream) and back end (i.e., the final output instruction string) are executed sequentially, but the execution of the instructions themselves at the front and back ends can malfunction. Everything at the back end is re-serialized, dependencies are checked, and either committed or rolled back. Therefore, rollback only affects the processor's architectural state (i.e., register and memory contents). Rollback does not affect microarchitectural state, such as caches and translation backstops (TLBs). This optimization technique can further improve the performance of modern central processing units (CPUs), but it can also open the door to attacks on microarchitectural state.

[0004] Meltdown and Spectre are two types of attacks that have emerged in recent years. Meltdown attacks violate a fundamental assumption of operating system security: applications running in user space cannot access kernel memory. This can be important because kernel memory may contain sensitive information from another application, such as passwords. To enforce this access restriction, the operating system uses page tables to divide virtual memory into multiple parts—one for the kernel and another for untrusted user-mode applications. The kernel then relies on the processor to allow higher-privileged kernel access to both parts while restricting user applications to the user part. It has been proven that some processors do not support this restriction. A Meltdown attack can occur when an OoO execution leaks kernel memory into user mode long enough for it to be caught by a sidetrack cache attack.

[0005] On the other hand, Spectre is a type of exploit, two of which have been discovered, in which the attacking application initiates a branch predictor cache to cause the victim application to speculatively execute a malicious code path. Speculative execution has a special type of OoO execution, making Spectre similar to Meltdown. The execution of this malicious code path is rolled back, but it leaves metadata in the cache that can be used for possible side-channel attacks. Side-channel attacks may leak some information over time or in other ways beyond the state of the architecture. To attempt to defend against potential security vulnerabilities caused by Meltdown and Spectre attacks, changes to the application code can be implemented, but such changes can be costly and unreliable. Summary of the Invention

[0006] Embodiments of the present invention are intended to prevent side-channel attacks against the processor. A non-limiting example system includes processing circuitry that includes a first global generation counter (GGC) incremented each time a branch-type instruction is decoded and predicted, and a second GGC incremented each time a branch-type instruction is completed. The first GGC counter is configured to be reset to the value of the second GGC upon a triggered rollback. The circuitry also includes at least one generation tag memory, each generation tag memory associated with a register in at least one register on the processor loaded during a side-channel attack. Each generation tag memory is configured to store a generation tag value associated with the register. Each of the at least one generation tag memory is configured to be set to the value of the first global generation counter when first loaded into its associated register. The circuitry also includes a determination unit configured to determine a generation tag value associated with a second-loaded register for a second load of a register in at least one register loaded from an address dependent on the value of the first-loaded register. The second-loaded generation tag value is a function of the value of the first global generation counter, the value of the second global generation counter, and the register generation tag value associated with the first-loaded register. The circuit also includes a waiting queue configured to prevent a second loading if the determined generation tag value is more than one generation ahead of the value of the second global generation counter.

[0007] Other embodiments of the present invention implement the features of the above system using computer-implemented methods and computer program products.

[0008] Additional technical features and benefits are achieved through the technology of this invention. Embodiments and aspects of this invention are described in detail herein and are considered part of the claimed subject matter. For a better understanding, reference is made to the specific embodiments and the accompanying drawings. Attached Figure Description

[0009] The specific details of the proprietary rights described herein are specifically pointed out and explicitly claimed in the claims at the end of the specification. The above and other features and advantages of the embodiments of the invention will become apparent from the following detailed description taken in conjunction with the accompanying drawings, wherein:

[0010] Figure 1 A block diagram of an embodiment of a processing circuit for preventing side-channel attacks against a processor, according to one or more embodiments of the present invention, is shown.

[0011] Figure 2 A diagram illustrating an example of preventing side-channel attacks against a processor according to one or more embodiments of the present invention is shown.

[0012] Figure 3 A diagram illustrating an example of preventing side-channel attacks against a processor according to one or more embodiments of the present invention is shown.

[0013] Figure 4 A diagram illustrating an example of preventing side-channel attacks against a processor according to one or more embodiments of the present invention is shown.

[0014] Figure 5 A block diagram illustrating an embodiment of an out-of-order (OoO) processor core according to one or more embodiments of the present invention is shown; and

[0015] Figure 6 A flowchart of a method for preventing side-channel attacks against a processor according to one or more embodiments of the present invention is shown. Detailed Implementation

[0016] One or more embodiments of the present invention relate to preventing side-channel attacks against processors.

[0017] As used herein, the term "block" refers to an instruction that is not forwarded by the processor's instruction wait queue to the execution unit in the relevant register in an out-of-order (OoO) manner. Alternatively, blocking may keep an instruction active until a condition is met so that it can be executed in an ordered manner or, alternatively, in a "less OoO" manner, for example, an instruction may enter the OoO region as soon as possible at a later time after the condition is met.

[0018] As used herein, the term "side-channel attack" refers to a specific form of malware's unauthorized or improper access to memory or other data in a computer system. Side-channel attacks may track data that is still in memory but should not be retained. For example, an attack may occur when a speculative load relies on a previous speculative load that has a malicious process-controlled address that is outside the scope of a valid memory address check.

[0019] As used in this article, the term "register" refers to the known internal memory of a processor core, in which instructions and data are stored to become elements of an execution unit for execution.

[0020] As used in this article, the term "load" refers to data and / or instructions stored in a register.

[0021] As used in this article, the term "first global generation counter" refers to a newly introduced element in the processor core that has a value that increases each time a branch-type instruction is decoded by the processor's instruction / data decoder.

[0022] As used in this article, the term "prediction" refers to a branch predictor, which attempts to guess which path a branch instruction (e.g., an if-then-else or conditional jump) might take, or the address of the branch's target before it is absolutely known. The purpose of a branch predictor is to improve the flow of the instruction pipeline to enhance processor performance.

[0023] As used in this article, the term "branching instruction" refers to, but is not limited to, if-then-else instructions or conditional jump instructions.

[0024] As used in this article, the term "triggered rollback" refers to the result of not using instructions already executed in the predicted branch path due to a later-known erroneous prediction.

[0025] As used in this article, the term "generational tag memory" refers to memory closely associated with registers that can store counter values ​​(i.e., generational tag values).

[0026] As used herein, the term "first load" may refer to the first indirect load to the first register.

[0027] As used herein, the term "second load" may refer to a second indirect load to a second register. In some cases, the first and second registers may be the same.

[0028] As used herein, the term "wait queue" refers to a known element of the processor that determines the execution order of incoming instructions. The wait queue can determine whether data and instructions are sent to registers and execution units for OoO execution, or, according to one or more embodiments of the invention, can make OoO execution impossible and force sequential execution or delay OoO execution to a point in time after all conditions are met.

[0029] As used in this article, the term "ahead generation" refers to a situation where the generation tag value stored in the register to be loaded is greater than the second global generation counter ("GC_COMPLETE").

[0030] As used in this article, the term "cache refresh" refers to the cache contents being declared invalid because the main memory in the cache actually needs other data.

[0031] As used in this article, the term "immediate load" refers to the direct loading of a register with a specific value.

[0032] As used in this article, the terms "indirect load" or "relative load" refer to a register being loaded with a value that depends on the address of the load instruction (relative to the instruction address).

[0033] As used herein, the term "load and store unit" refers to a dedicated execution unit responsible for executing load and store instructions, generating virtual addresses for load and store operations, and loading data from memory / cache or storing data from registers back to memory / cache.

[0034] One or more embodiments of the present invention are used to prevent side-channel attacks on processors, providing a number of advantages and technical effects:

[0035] Typically, side-channel attacks on modern central processing units (CPUs), particularly those operating according to the OoO paradigm, can be completely prevented and / or avoided through one or more embodiments of the present invention. One or more embodiments can also prevent changes to application software, middleware software, and / or operating system software to address potential side-channel attacks.

[0036] An interesting aspect of these side-channel attacks is that the speculation of the second load might use a value from a previously speculated first load as part of the address of the second load. In other words, to exploit Spectre or Meltdown, it might require a speculatively dependent load that could have an address controlled by the attacker. One or more embodiments of the present invention go beyond current circumventions, such as OoO barriers at branch points, which results in subsequent loads not being speculative. However, this solution could significantly degrade processor performance.

[0037] The performance impact of one or more embodiments of the present invention is minimal because it only delays the affected instructions, while every other instruction can be executed using normal OoO mechanisms as in an unprotected processor.

[0038] One or more embodiments of the present invention also render other countermeasures redundant, such as building data dependencies in addition to control dependencies, or means of slowing down branch operations and / or global branch prediction barriers, or marking a subset that may only help defend against currently known side-channel attacks (e.g., Spectre 2).

[0039] According to one or more embodiments of the present invention, no software changes are required to existing applications or other programs and / or compiler optimization routines.

[0040] Another advantage of one or more embodiments of the present invention is that the total amount of additional hardware (logic gates and registers) is low enough that it is feasible to supplement existing designs, both in terms of area (size) and time (processor frequency). This allows implementation without sacrificing general-purpose processor performance, even without using new features.

[0041] According to a useful embodiment of the processing circuitry, the processor may include at least one of a central processing unit, a CPU core, and threads of the processor core. In all these units, speculative branch prediction may be possible and can be executed, thus making them potential victims of side-channel attacks.

[0042] According to one embodiment of the invention, a rollback can be triggered at one of the events selected from a group consisting of error prediction of branch-type instructions, pipeline restart in the processor, and refresh of the processor's cache. All of these triggering events are likely to occur in modern CPUs due to their efficiency. However, one or more embodiments of the invention can allow these triggering events to be used for rollback and can also prevent side-channel attacks.

[0043] According to one embodiment of the invention, during a triggered rollback, all values ​​of the generation tag memory associated with the register involved in one of the trigger events can be set to a second global generation counter. This will be explained in more detail with reference to Rule 6 below.

[0044] According to one or more embodiments of the present invention, the first load can be an immediate load or a relative load. The first load may not be controlled by side-channel attacks and is therefore less susceptible to attacks by malicious processes. Therefore, the type of load instruction is not important.

[0045] According to one or more embodiments of the present invention, the determining unit may be part of the processor's load and store units. This may be a natural location in an OoO processor architecture, as all the relevant states required by the proposed concept may reside within the processor's load and store units.

[0046] According to one or more embodiments of the present invention, the first loaded register is the same as the second loaded register. This may be a requirement for Spectre and Meltdown type attacks against OoO processors. Therefore, one or more embodiments can precisely address this security vulnerability, making it impossible to perform Spectre and Meltdown type attacks through hardware processor internal countermeasures.

[0047] According to one or more embodiments of the invention, the blocking can further depend on whether the data for the second load is in the processor's cache. If the data is already in the cache, a side-channel attack is impossible. Therefore, malicious instructions may not be "smuggled" into the cache memory via a side-channel attack.

[0048] According to one or more embodiments of the present invention, the dependency of the function is at least one of the following: if the value of the first global generation counter is equal to the value of the second global generation counter, then the second loaded generation tag value is set to be equal to the value of the second global generation counter; if the value of the first global generation counter is equal to the value of the first loaded generation tag, then the second loaded generation tag value is set to be equal to the value of the first loaded generation tag; and if the value of the first global generation counter is greater than the value of the first loaded generation tag, then the second loaded generation tag value is set to be equal to the value of the first loaded generation tag plus one.

[0049] These dependencies allow for the simple and direct implementation of the proposed processing circuitry and method. This processing circuitry and method will be further discussed below with reference to Rules 1, 2, and 4.

[0050] The accompanying drawings are described below. All illustrations in the drawings are illustrative. First, a circuit block diagram for implementing an embodiment to prevent side-channel attacks against the processor is given. Further embodiments, as well as embodiments of methods for preventing side-channel attacks against the processor, will then be described.

[0051] Figure 1 A block diagram of embodiment 100 of processing circuitry for preventing side-channel attacks against processor 102 (particularly an OoO processor) is shown. Instruction blocking can cause the OoO processor 102 to delay or sequentially execute instructions. That is, OoO execution of instructions is partially blocked or postponed to a later point in time. OoO execution may involve speculative execution of branch-type instructions. Processor 102 includes at least one register 108 that can receive loads during a side-channel attack.

[0052] Figure 1 The processing circuitry 104 shown includes a first global generation counter (first GGC or GC_DECODE) 106, which increments each time a branch-type instruction is decoded and predicted. This could also be a conditional jump instruction at the entry point of OoO execution.

[0053] The processing circuit 104 also includes a second global generation counter (second GGC or GC_COMPLETE) 108, which increments each time a branch type instruction is completed. Therefore, a branch type instruction mentioned in the context of the first loading generation counter 106 is not necessarily the same branch type instruction mentioned in the context of the second global generation counter 108. Thus, the two branch type instructions mentioned above may be different.

[0054] The first global generation counter 106 is configured to be reset to the value of the second global generation counter by the reset unit 110 upon triggering a rollback, wherein the rollback may involve the rollback of branches subject to branch-type instructions or erroneously predicted branches following branch-type instructions.

[0055] The processing circuitry 104 also includes at least one generation tag memory 116 configured to store generation tag values ​​(GT_REGx) associated with at least one register 118 of the processor 102. In one possible implementation, the generation tag may be implemented as several additional bits of a register, such that each register has its associated generation tag memory 116.

[0056] Each of at least one generation tag memory 116 is configured to be set to the value of the first global generation counter 106 when first loaded into the associated register.

[0057] Additionally, the processing circuitry 104 includes a determination unit 112, which may be associated with the generation tag memory 116 and is configured to determine the generation tag value (GT_REG2) associated with the second-loaded register (REG2) for a second load of a register in at least one register (typically a second register (REG2) loaded from an address that depends on the value of the first-loaded register (REG1)). The generated tag value is a function of the value of the first global generation counter (GC_DECODE) 106, the value of the second global generation counter (GC_COMPLETE) 108, and the register generation tag value (GT_REG1) associated with the first-loaded register (REG1).

[0058] In addition, the processing circuit 104 also includes a wait queue 114, which is configured to block (or reject instructions until the instructions can be executed) the second load (i.e., the subordinate load in the two loads) as long as the determined generation tag value (GT_REGx) is more than (i.e. greater than) one generation earlier than the value of the second global generation counter (GC_COMPLETE) 108.

[0059] Therefore, one or more embodiments of the present invention are based on the idea that speculative dependency loading is prevented by using a flag based on a global generation counter, allowing full OoO speculation for most instructions and speculation at least one level for loading.

[0060] Before moving on to the description of the diagram below, here are some simple examples. By convention, the expression Rx = [Ry] indicates that register x is loaded from an address that depends on the contents of register y.

[0061] Below are 5 examples, where the corresponding access is valid:

[0062] Example 1: R1 = [R0]; branch; R2 = [R1]; because R2 = [R1], it is only one speculative load instead of two.

[0063] Example 2: Branch; R1 = [relative]; R2 = [R1]; R3 = [R2]; [relative] is a load with an absolute or relative address, such as R1 = [relative], which does not depend on any value before the branch.

[0064] Example 3: R1 = [R0]; branch; R2 = [R1] nospec R3 = [R2]; R4 = [R3]; Since R2 is loaded in a non-speculated manner (e.g., because the branch has already completed), the loading of R3 is not speculative.

[0065] Example 4: R1 = [R0]; branch; R2 = [R1]; R3 = [R2] nospec R4 = [R3]; Since R2 is only a speculative load, R3 is a non-speculative load, and R4 is similar to Example 3.

[0066] Example 5: R1 = [R0]; branch; R2 = [R1]; R3 = [R1]; since R2 and R3 are independent of each other; dependency is necessary to utilize speculation.

[0067] However, the following accesses are not allowed, for example, and are potentially dangerous: R1 = [R0]; branch; R2 = [R1]; R3 = [R2]; in this case, the value of R3 is determined by the address of R2, and R2 in turn depends on the address of register R1. This could represent a dangerous situation in the sense of a side-channel attack.

[0068] This is because attackers expect dependent speculative loads to exist after speculative loads (i.e., one speculative load is not enough). Therefore, one or more embodiments of the invention have two global generation counters: one (GC_DECODE) increments when each branch-type instruction is decoded (i.e., on entries processed in OoO) and the other (GC_COMPLETE) increments each time that branch-type instruction completes. Furthermore, one or more embodiments provide the option to reset GC_DECODE to the value of GC_COMPLETE in the event of cache error prediction, restart, or flush.

[0069] According to one or more embodiments of the invention, a generational tag is appended to each register GT_REG, and for immediate or relative loads, GT_REG is set to the value of GC_DECODE. For loading register R2 from an address based on R1, dual dependencies are tracked by calculating the registered generational tag GT_REG2 based on GC_COMPLETE and GT_REG1. Then, as an important step, the load can be blocked when GT_REG precedes GC_COMPLETE by more than one generation.

[0070] Subsequently, according to one or more embodiments of the present invention, six rules can be applied to load REG2 from [REG1]:

[0071] 1. If (GC_DECODE == GC_COMPLETE), then GT_REG2 = GC_COMPLETE;

[0072] 2. If (GC_DECODE – GT_REG1 == 0), then GT_REG2 = GT_REG1;

[0073] 3. If (GT_REG1–GC_COMPLETE>=1), then reject the operation / instruction; and

[0074] 4. If (GC_DECODE–GT_REG1>0), then GT_REG2=GTREG1+1.

[0075] In addition, the relevant rules also include:

[0076] 5. Relative / Just-in-Time Loading: GT_REG2 = GC_DECODE; and

[0077] 6. During rollback: GT_REG0 = GT_REG2… = GT_REGn = GC_DECODE = GC_COMPLETE.

[0078] According to one or more embodiments of the present invention, the increment of the counter and the addition of rule 4 are logical additions, thus wraparound can be handled.

[0079] Smaller counters with a finite range of values ​​can also be considered (i.e., only a few bits of the counter are available). For sufficiently large counters (greater than the OoO window), it is well known that GC_DECODE cannot override GC_COMPLETE. For smaller counters, one or more embodiments can prevent further branching before a wraparound occurs.

[0080] As a further optimization, one or more embodiments of the present invention consider that for more than two loads, blocking will only occur if the load is not in the fastest cache, primarily in the L1 (Level 1) cache.

[0081] Turn now Figure 2 According to one or more embodiments of the present invention, a schematic diagram 200 is generally shown illustrating an example of preventing side-channel attacks against the processor. Here, consider the following example: R1 = [R0]; branch; R2 = [R1]; R3 = [R2], where a third load operation on R3 is dangerous.

[0082] for Figure 2 The explanation may also note that if the value remains unchanged, only a "." is shown. The other values ​​shown are those after the corresponding instruction has been updated.

[0083] All counters are initialized with the value "0". <init>Since the counter can maintain a range related to size, any other starting value is also possible. Various instructions are shown on the left side of the table, where "Br complete" means "branch complete". The nomenclature for loading from an address is the same as explained above. It can be seen that after the first load of R1 from the address stored in [R0] (i.e., R1[R0]), the value of the first global generation counter (GC_DECODE) changes from "0" to "1" due to the branch. When the instruction R2[R1] is loaded, the generation tag counter (GT_REG2) in register 2 is set to "1". In the next step, this could mean executing R3[R2], which will be blocked until it can be executed again. The term "deny" refers to a denial that occurs only before the blocking is lifted to allow execution in the order of incoming instructions.

[0084] It can also be seen that after the branch completes ("Br complete"), the blocked instruction R3[R2] is executed because the rule no longer blocks instruction R3[R2] (see above). Therefore, all instructions are executed, most of which are executed in OoO mode (except for instructions that need to wait because they were blocked), until instruction execution becomes possible again. According to one or more embodiments of the invention, the rules indicated on the right side of the table can be implemented using hardware elements. Alternatively, the rules can also be implemented as microcode (different from the hardware implementation), which may have performance implications.

[0085] Turn now Figure 3 According to one or more embodiments of the present invention, a schematic diagram 300 is shown in general as another example of preventing side-channel attacks against the processor. Figure 3 The examples shown include: branches; R1 = [relative]; R2 = [R1]; and R3 = [R2]. In this case, blocking may not be necessary.

[0086] Turn now Figure 4 According to one or more embodiments of the present invention, a schematic diagram 400 is shown in general as another example of preventing side-channel attacks against the processor. Figure 4 The examples shown include: R1 = [R0]; branch; R2 = [R1] nospec R3 = [R2]; R4 = [R3]. Because only rule 1 is applied, this example does not cause one of the OoO instructions to be blocked.

[0087] Turn now Figure 5 According to one or more embodiments of the present invention, a block diagram of an embodiment of an OoO processor 500 is generally shown. The OoO processor 500 is divided into three parts by two vertical lines. The middle part includes an OoO core 502, with a front-end unit 504 of the processor 500 on its left and a back-end unit 506 on its right. The core 502 of the processor 500 includes at least a register 508, a construction wait queue 510, and execution units 512, 514, ..., 516.

[0088] Instruction 518 (symbolically represented as six instructions i1, ..., i6, arriving sequentially at processor 500) is decoded by decoder 520 and formatted into instruction wait queue 510. In the middle section, within core 502, instructions are typically executed in OoO mode by execution units 512, 514, ..., 516. Instruction results are then sequentially processed again by back-end units (specifically, commit unit 522). The result can be considered as instruction result 524, also symbolically represented as i1, ..., i6.

[0089] According to one or more embodiments of the present invention, the processing circuit 526 includes a processing circuit controller 528, a first global generation counter 530 (CG_DECODE), a second global generation counter 532, and a registration tag 534. The interdependencies and interactions between these units have been described above.

[0090] According to one or more embodiments of the present invention, instructions to be executed in one of the execution units 512, 514, ..., 516 can be controlled by interacting with the instruction wait queue 510 through the processing circuit 526 (particularly the processing circuit controller 528), in a manner that allows them to be directly fed (e.g., in an OoO manner) to the execution units 512, 514, ..., 516. However, in certain circumstances, according to rules 1 to 6 explained above, immediate OoO execution can be prevented or suppressed until conditions are met where side-channel attacks are no longer possible; by Figure 5 The vertical line 536 in the text represents the point that meets these conditions.

[0091] Turn now Figure 6 According to one or more embodiments of the present invention, a flowchart of a method 600 for preventing side-channel attacks against a processor is generally shown. The processor includes at least one register that receives a load during a side-channel attack. Method 600 includes incrementing a first global generation counter at block 602 each time a branch-type instruction is decoded and predicted, and incrementing a second global generation counter at block 604 each time a branch-type instruction is completed.

[0092] In box 606, the first global generation counter is reset to the value of the second global generation counter when a rollback is triggered.

[0093] Processing continues at block 608, storing the generation tag value in generation tag memory associated with at least one register of the processor. The generation tag value is set to the value of a first global generation counter when first loaded into the associated register. At block 610, a generation tag value associated with a second-loaded register is determined for a second load of a register from at least one register loaded from an address depending on the value of the first-loaded register. The generation tag value is a function of the value of the first global generation counter, the value of the second global generation counter, and the register generation tag value associated with the first-loaded register.

[0094] If the determined generation tag value is more than one generation ahead of the value of the second global generation counter, processing continues at box 612, with the second loading blocked by the waiting queue.

[0095] Various embodiments of the invention are described herein with reference to the accompanying drawings. Alternative embodiments of the invention can be devised without departing from its scope. Various connections and positional relationships (e.g., above, below, adjacent, etc.) between elements are illustrated in the following description and drawings. Unless otherwise stated, these connections and / or positional relationships can be direct or indirect, and the invention is not intended to be limited in this respect. Accordingly, coupling between entities can refer to direct or indirect coupling, and positional relationships between entities can be direct or indirect positional relationships. Furthermore, the various tasks and process steps described herein can be incorporated into a more comprehensive program or process with additional steps or functions not described in detail herein.

[0096] One or more methods described herein can be implemented using any one or a combination of the following techniques, each of which is well known in the art: discrete logic circuits with logic gates for implementing logic functions on data signals, application-specific integrated circuits (ASICs) with appropriate combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0097] For the sake of brevity, conventional techniques related to the manufacture and use of aspects of the present invention may or may not be described in detail herein. In particular, various aspects of computing systems and specific computer programs that implement the various technical features described herein are well known. Therefore, for the sake of brevity, many conventional implementation details are only briefly mentioned or omitted entirely without providing well-known system and / or process details.

[0098] In some embodiments, various functions or actions may occur at a given location and / or be related to the operation of one or more devices or systems. In some embodiments, a portion of a given function or action may be performed at a first device or location, while the remainder of the function or action may be performed at one or more additional devices or locations.

[0099] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting. As used herein, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that, when used in this specification, the terms "comprising" and / or "including" specify the presence of the stated features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, element components, and / or combinations thereof.

[0100] All the means or steps plus functional elements, their corresponding structures, materials, actions, and equivalents in the following claims are intended to include any structure, material, or action that, in combination with other claimed elements as particularly claimed, performs the function. This disclosure is presented for purposes of illustration and description, but is not intended to be exhaustive or limiting of the forms disclosed. Many modifications and variations will be apparent to those skilled in the art without departing from the scope of this disclosure. The embodiments were chosen and described in order to best explain the principles and practical application of this disclosure and to enable others skilled in the art to understand the disclosure of various embodiments with various modifications suited to the intended particular purpose.

[0101] The diagrams depicted herein are illustrative. Many variations may be made to the diagrams or steps (or operations) described herein without departing from the scope of this disclosure. For example, actions may be performed in a different order, or actions may be added, deleted, or modified. Furthermore, the term "coupling" describes the presence of a signal path between two elements and does not imply a direct connection between elements without intermediate elements / connections. All such variations are considered part of this disclosure.

[0102] The following definitions and abbreviations are used to interpret the claims and the specification. As used herein, the terms "comprising," "including," "comprise," "containing," "having," "comprising," or "containing," or any other variation thereof, are intended to cover non-exclusive inclusion. For example, a composition, mixture, process, method, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such compositions, mixtures, processes, methods, articles, or apparatus.

[0103] Furthermore, the term "exemplary" as used herein means "serving as an example, instance, or illustration." Any embodiment or design described herein as "exemplary" is not necessarily to be construed as superior to or better than other embodiments or designs. The terms "at least one" and "one or more" should be understood to include any integer greater than or equal to one, i.e., one, two, three, four, etc. The term "multiple" should be understood to include any integer greater than or equal to two, i.e., two, three, four, five, etc. The term "connection" can include both indirect "connection" and direct "connection."

[0104] The terms "approximately," "basically," "about," and variations thereof are intended to include the degree of error associated with measuring a specific quantity based on the equipment available at the time of application submission. For example, "about" may include a range of ±8%, 5%, or 2% of a given value.

[0105] This invention can be a system, method, and / or computer program product at any possible level of technical detail integration. The computer program product may include a computer-readable storage medium (or medium) having computer-readable program instructions thereon for causing a processor to execute aspects of the invention.

[0106] Computer-readable storage media can be tangible devices capable of retaining and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes the following: portable computer floppy disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable read-only optical disc storage (CD-ROM), digital versatile optical disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or raised structures in recesses on which instructions are recorded, and any suitable combination of the foregoing. As used herein, computer-readable storage media should not be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0107] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network to an external computer or external storage device, such as the Internet, local area network, wide area network, and / or wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer-readable program instructions from the network and forwards them to a computer-readable storage medium within the corresponding computing / processing device.

[0108] Computer-readable program instructions used to perform the operations of this invention may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and procedural programming languages ​​such as the "C" programming language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) may execute the computer-readable program instructions to personalize the electronic circuitry in order to perform aspects of this invention by utilizing the status information of the computer-readable program instructions.

[0109] Various aspects of the present invention will be described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0110] These computer-readable program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / actions specified in the flowchart and / or block diagram blocks. These computer-readable program instructions can also be stored in a computer-readable storage medium that can instruct a computer, programmable data processing apparatus, and / or other apparatus to operate in a particular manner, such that the computer-readable storage medium in which the instructions are stored includes an article of manufacture comprising instructions that implement aspects of the functions / actions specified in the blocks or blocks of the flowchart and / or block diagram.

[0111] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus or other apparatus to cause a series of operational steps to be performed on the computer, other programmable apparatus or other apparatus to produce a computer-implemented process, such that the instructions executed on the computer, other programmable apparatus or other apparatus implement the functions / actions specified in the boxes or blocks of a flowchart and / or block diagram.

[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a portion of a module, segment, or instruction, which includes one or more executable instructions for implementing a specified logical function. In some alternative embodiments, the functions marked in the blocks may occur in a non-consecutive order. For example, two blocks shown consecutively may actually execute substantially simultaneously, or these blocks may sometimes execute in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a system based on dedicated hardware that performs a specific function or action, or by a combination of dedicated hardware and computer instructions.

[0113] The description of various embodiments of the present invention is given for illustrative purposes and is not intended to be exhaustive or limiting of the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope of the described embodiments. The terminology used herein has been chosen to best explain the principles of the embodiments, their practical application, or technical improvements to techniques found in the market, or to enable others skilled in the art to understand the embodiments described herein.< / init>

Claims

1. A processing circuit for a processor for preventing a side-channel attack against the processor, the processor including at least one register receiving a load during the side-channel attack, the processing circuit comprising: The first global generation counter increments each time a first branch type instruction is decoded and predicted; A second global generation counter increments each time a second branch type instruction is completed, wherein the first global generation counter is configured to be reset to the value of the second global generation counter upon a triggered rollback, wherein the first branch type instruction and the second branch type instruction are the same or different; At least one generation tag memory is configured to store generation tag values ​​associated with at least one register of the processor, wherein each of the at least one generation tag memory is configured to be set to the value of the first global generation counter when first loaded into the associated register; A determining unit, configured to, for a second load of a register from at least one of the registers loaded from an address dependent on the value of the first loaded register, determine a generation tag value associated with the second loaded register, the generation tag value being a function of the value of the first global generation counter, the value of the second global generation counter, and the generation tag value associated with the first loaded register; and A waiting queue is configured to block the second loading if the determined generation tag value is more than one generation ahead of the value of the second global generation counter.

2. The processing circuit according to claim 1, wherein, The processor includes at least one of a central processing unit, a core of the central processing unit, and a thread of the core of the processor.

3. The processing circuit according to claim 1, wherein, The rollback is triggered on one of the following events: a misprediction of one of the first branch type instructions and the second branch type instructions, a pipeline restart in the processor, and a cache refresh in the processor.

4. The processing circuit according to claim 3, wherein, During the triggered rollback, all values ​​of the generation tag memory associated with the register involved in one of the events are set to the second global generation counter.

5. The processing circuit according to claim 1, wherein, The first load is one of immediate load and relative load.

6. The processing circuit according to claim 1, wherein, The determining unit is part of the processor's loading and storage unit.

7. The processing circuit according to claim 1, wherein, The register loaded in the first loading is the same as the register loaded in the second loading.

8. The processing circuit according to claim 1, wherein, The blocking further depends on whether the second loaded data is in the processor's cache.

9. The processing circuit according to claim 1, wherein, The dependencies of the function include one of the following: If the value of the first global generation counter is equal to the value of the second global generation counter, then the generation tag value associated with the second loaded register is set to be equal to the value of the second global generation counter; If the value of the first global generation counter is equal to the first loaded generation tag value, then the generation tag value associated with the second loaded register is set to be equal to the generation tag value associated with the first loaded register. as well as If the value of the first global generation counter is greater than the first loaded generation tag value, then the second loaded generation tag value is set to be equal to the generation tag value associated with the first loaded register plus one.

10. A method for preventing a side-channel attack against a processor, the processor including at least one register receiving a load during the side-channel attack, the method comprising: Increment the first global generation counter each time the first branch type instruction is decoded and predicted; A second global generation counter is incremented each time a second branch type instruction is completed, wherein the first global generation counter is reset to the value of the second global generation counter when a rollback is triggered, and wherein the first branch type instruction and the second branch type instruction are the same or different; A generation tag value is stored in a generation tag memory associated with at least one register of the processor, which is set to the value of the first global generation counter upon a first load into the associated register; For a second load of a register from at least one of the registers loaded from an address depending on the value of the first loaded register, a generation tag value associated with the second loaded register is determined, the generation tag value being a function of the value of the first global generation counter, the value of the second global generation counter, and the generation tag value associated with the first loaded register; and If the determined generation tag value is more than one generation ahead of the value of the second global generation counter, the second loading is blocked by the waiting queue.

11. The method according to claim 10, wherein, The processor includes at least one of a central processing unit, a core of the central processing unit, and a thread of the core of the processor.

12. The method according to claim 10, wherein, The rollback is triggered on one of the following events: a misprediction of one of the first branch type instructions and the second branch type instructions, a pipeline restart in the processor, and a cache refresh in the processor.

13. The method according to claim 12, wherein, During the triggered rollback, all values ​​of the generation tag memory associated with the register involved in one of the events are set to the second global generation counter.

14. The method of claim 10, wherein, The first load is one of immediate load and relative load.

15. The method according to claim 10, wherein, The determination is performed by the processor's loading and storage unit.

16. The method of claim 10, wherein, The register loaded in the first loading is the same as the register loaded in the second loading.

17. The method according to claim 10, wherein, The blocking further depends on whether the second loaded data is in the processor's cache.

18. The method according to claim 10, wherein, The dependencies of the function include one of the following: If the value of the first global generation counter is equal to the value of the second global generation counter, then the generation tag value associated with the second loaded register is set to be equal to the value of the second global generation counter; If the value of the first global generation counter is equal to the first loaded generation tag value, then the generation tag value associated with the second loaded register is set to be equal to the generation tag value associated with the first loaded register. as well as If the value of the first global generation counter is greater than the first loaded generation tag value, then the second loaded generation tag value is set to be equal to the generation tag value associated with the first loaded register plus one.

19. A computer program product for preventing side-channel attacks against a processor, the processor including at least one register loaded during the side-channel attack, the computer program product including program instructions executable by one or more processors including the processor to cause the one or more processors to perform operations, the operations including: Increment the first global generation counter each time the first branch type instruction is decoded and predicted; A second global generation counter is incremented each time a second branch type instruction is completed, wherein the first global generation counter is reset to the value of the second global generation counter when a rollback is triggered, and wherein the first branch type instruction and the second branch type instruction are the same or different; A generation tag value is stored in a generation tag memory associated with at least one register of the processor, which is set to the value of the first global generation counter upon a first load into the associated register; For a second load of a register from at least one of the registers loaded from an address depending on the value of the first loaded register, a generation tag value associated with the second loaded register is determined, the generation tag value being a function of the value of the first global generation counter, the value of the second global generation counter, and the generation tag value associated with the first loaded register; and If the determined generation tag value is more than one generation ahead of the value of the second global generation counter, the second loading is blocked by the waiting queue.

20. The computer program product of claim 19, wherein, The rollback is triggered on one of the following events: a misprediction of one of the first branch type instructions and the second branch type instructions, a pipeline restart in the processor, and a cache refresh in the processor.

Citation Information

Patent Citations

  • Device for defending transient attack of processor based on cache rollback

    CN111274584A

  • Apparatus and method for controlling allocation of information into a cache storage

    US20200364154A1