JP7307727B2 - Encode the input to the branch prediction circuit - Google Patents
Encode the input to the branch prediction circuit Download PDFInfo
- Publication number
- JP7307727B2 JP7307727B2 JP2020528089A JP2020528089A JP7307727B2 JP 7307727 B2 JP7307727 B2 JP 7307727B2 JP 2020528089 A JP2020528089 A JP 2020528089A JP 2020528089 A JP2020528089 A JP 2020528089A JP 7307727 B2 JP7307727 B2 JP 7307727B2
- Authority
- JP
- Japan
- Prior art keywords
- branch
- target
- key
- address
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012545 processing Methods 0.000 claims description 80
- 238000000034 method Methods 0.000 claims description 71
- 230000002441 reversible effect Effects 0.000 claims description 21
- 230000004044 response Effects 0.000 claims description 18
- 238000013507 mapping Methods 0.000 claims description 14
- 230000003068 static effect Effects 0.000 claims description 8
- 230000009466 transformation Effects 0.000 claims description 7
- 238000012544 monitoring process Methods 0.000 claims description 4
- 230000001419 dependent effect Effects 0.000 claims description 3
- 238000000844 transformation Methods 0.000 claims 1
- 230000008569 process Effects 0.000 description 50
- 230000006870 function Effects 0.000 description 19
- FFBHFFJDDLITSX-UHFFFAOYSA-N benzyl N-[2-hydroxy-4-(3-oxomorpholin-4-yl)phenyl]carbamate Chemical compound OC1=C(NC(=O)OCC2=CC=CC=C2)C=CC(=C1)N1CCOCC1=O FFBHFFJDDLITSX-UHFFFAOYSA-N 0.000 description 15
- 239000000872 buffer Substances 0.000 description 13
- 238000013459 approach Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 6
- 230000001960 triggered effect Effects 0.000 description 6
- 238000013519 translation Methods 0.000 description 5
- 230000006399 behavior Effects 0.000 description 4
- 230000008901 benefit Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000004224 protection Effects 0.000 description 3
- 241001522296 Erithacus rubecula Species 0.000 description 2
- 230000009471 action Effects 0.000 description 2
- 230000015556 catabolic process Effects 0.000 description 2
- 238000006731 degradation reaction Methods 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000523 sample Substances 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000004931 aggregating effect Effects 0.000 description 1
- 210000005100 blood-tumour barrier Anatomy 0.000 description 1
- 230000006378 damage Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/14—Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
- H04L63/1441—Countermeasures against malicious traffic
-
- 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/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
- G06F9/3844—Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
-
- 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/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/52—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
- G06F21/53—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
-
- 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/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
- G06F21/78—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
-
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/14—Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
- H04L63/1408—Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
- H04L63/1416—Event detection, e.g. attack signature detection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Advance Control (AREA)
Description
本技法はデータ処理の分野に関する。より詳細には、分岐予測に関する。 The technique relates to the field of data processing. More specifically, it relates to branch prediction.
データ処理装置は、分岐命令の結果を、それらが実際に実行される前に予測するための、分岐予測回路を有する場合がある。分岐命令が実際に実行される前に分岐結果を予測することによって、その分岐に続く後続の命令がフェッチされ始め、分岐命令の実行が完了する前に投機的に実行され始めることが可能であり、それによって、分岐の結果が実際に分かって初めてフェッチされるよりも早期に後続の命令を実行することができるため、予測が正しい場合はパフォーマンスが節約される。 A data processing apparatus may have branch prediction circuitry for predicting the outcome of branch instructions before they are actually executed. By predicting the branch outcome before the branch instruction is actually executed, it is possible for subsequent instructions following the branch to begin being fetched and speculatively executed before the branch instruction has completed execution. , which saves performance if the prediction is correct, because subsequent instructions can be executed earlier than they are fetched only after the outcome of the branch is actually known.
少なくとも一部の実例は、一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶するように構成される分岐予測回路と、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信するための入力回路であって、少なくとも1つの入力は複数ビットを含む、入力回路と、一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、複数ビットの少なくとも一部をエンコードするためのエンコード演算を実施するように構成されるコーディング回路とを備えるデータ処理装置を提供する。 At least some examples include a branch prediction circuit configured to store at least one branch prediction state entry associated with a sequence of instructions and receiving at least one input to generate a new branch prediction state entry. at least a portion of the bits based on values associated with the input circuit and the current execution environment in which the sequence of instructions is being executed, wherein the at least one input includes the bits. and a coding circuit configured to perform an encoding operation for encoding.
少なくとも一部の実例は、一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶する手段と、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信する手段であって、少なくとも1つの入力は複数ビットを含む、受信する手段と、一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、前記少なくとも1つの入力の複数ビットの少なくとも一部をエンコードする手段とを備えるデータ処理装置を提供する。 At least some examples include means for storing at least one branch prediction state entry associated with a sequence of instructions, and means for receiving at least one input to generate a new branch prediction state entry, comprising: means for receiving, wherein one input includes multiple bits; and means for encoding at least a portion of the multiple bits of said at least one input based on a value associated with a current execution environment in which a sequence of instructions is being executed. and a data processing apparatus.
少なくとも一部の実例は、一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶することと、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信することであって、少なくとも1つの入力は複数ビットを含む、受信することと、一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、複数ビットの少なくとも一部をエンコードすることとを含む方法を提供する。 At least some examples include storing at least one branch prediction state entry in association with a sequence of instructions and receiving at least one input to generate a new branch prediction state entry; receiving, one input comprising multiple bits; and encoding at least a portion of the multiple bits based on a value associated with a current execution environment in which the sequence of instructions is being executed. do.
本技法のさらなる態様、特徴及び利点は、添付の図面と併せて読まれる実例の以下の説明から明らかとなろう。 Further aspects, features and advantages of the present technique will become apparent from the following description of examples read in conjunction with the accompanying drawings.
処理回路が、複数の実行環境のうちの1つでデータ処理を実施することができる。例えば、それぞれの実行環境は、処理回路によって実行される異なるソフトウェア・プロセス、異なる特権レベルのソフトウェア(例えばアプリケーションとオペレーティング・システム)、所与のソフトウェア・プロセスの異なる部分、処理回路で実行される異なる仮想マシン、などに対応することがある。分岐予測回路は、一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶するために提供され得る。分岐予測状態エントリは、例えば遂行する若しくは遂行しないと予測される結果、又は予測される分岐ターゲット・アドレスなどの、分岐の予測される性質を指定することができる。分岐予測回路を使用して、分岐命令の結果を、それらが実際に実行されるよりも前に予測することができ、予測された分岐の性質に基づいて早期のフェッチ及び後続の命令の投機的な実行を可能にする。入力回路は、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信するために提供され得、この場合少なくとも1つの入力は複数ビットを含む。例えば、入力は、新しいエントリが分岐予測回路に割り当てられる分岐命令の命令アドレスの少なくとも一部、及び/又は将来的な機会に対して予測される分岐ターゲット・アドレスとして使用され得る分岐命令についての実際の分岐ターゲット・アドレスを指定することができる。必要とされる記憶容量を低減するために、一部の実施例は分岐ターゲット・アドレスを、例えば分岐命令のアドレスからのオフセットとして指定することにより、間接的に記憶することができる。 A processing circuit can perform data processing in one of a plurality of execution environments. For example, each execution environment may represent a different software process executed by a processing circuit, different privilege levels of software (e.g., applications and operating systems), different portions of a given software process, different It may correspond to a virtual machine, etc. A branch prediction circuit may be provided for storing at least one branch prediction state entry associated with a sequence of instructions. A branch prediction state entry may specify the predicted nature of a branch, such as a predicted taken or not taken result, or a predicted branch target address. Branch prediction circuitry can be used to predict the outcome of branch instructions before they are actually executed, allowing early fetching and speculative prediction of subsequent instructions based on the nature of the predicted branch. enable execution. Input circuitry may be provided for receiving at least one input for generating a new branch prediction state entry, where the at least one input includes multiple bits. For example, the input may be at least a portion of the instruction address of the branch instruction for which the new entry is assigned to the branch prediction circuit, and/or the actual branch instruction for the branch instruction that may be used as the branch target address predicted for future opportunities. branch target address can be specified. To reduce storage requirements, some embodiments may store branch target addresses indirectly, for example, by specifying them as offsets from the address of the branch instruction.
分岐予測のメカニズムは通常、その誤予測がシステムによって処理されたデータのセキュリティにとって致命的ではなく、達成されるパフォーマンス・レベルに影響するだけの、パフォーマンス向上メカニズムと見なされる。したがって、通常は分岐予測器の内容を保護するセキュリティ対策が必要であると期待しないかも知れない。 Branch prediction mechanisms are generally viewed as performance enhancing mechanisms whose mispredictions are not fatal to the security of data processed by the system, but only affect the level of performance achieved. Therefore, one might not normally expect security measures to protect the contents of the branch predictor to be necessary.
本技法は、一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、入力回路によって受信される入力の複数ビットの少なくとも一部をエンコードするためのエンコード演算を実施するためのコーディング回路を提供する。次いで、入力のエンコードされたバージョンを使用して、分岐予測回路のために生成されるよう新しい分岐予測状態エントリを形成することができる。 The techniques are for performing an encoding operation to encode at least a portion of bits of an input received by an input circuit based on values associated with a current execution environment in which the sequence of instructions is being executed. A coding circuit is provided. The encoded version of the input can then be used to form new branch prediction state entries to be generated for the branch prediction circuit.
直観に反して、分岐予測回路が、一実行環境が別の実行環境に関連付けられるデータにアクセスすることを制限する処理回路に設けられたセキュリティ保護を、攻撃者がすり抜けるために利用できるルートを与え得ることが認識されている。その理由は、分岐予測回路によって分岐予測状態エントリが異なる実行環境からエントリを割り当てた実行環境にアクセスできるようになる場合があるため、第1の実行環境によって分岐予測回路に割り当てられた分岐予測状態を使用して第2の実行環境で実行される分岐の挙動を制御することができるからである。以前、このことは単にパフォーマンスの問題と見なされており、第2の実行環境が異なるコンテキストによって割り当てられた間違ったエントリをヒットするかのようであり、分岐の実際の分岐結果が予測に一致しないと特定されると、後に第2の実行環境による分岐の実行中に誤予測が特定されることがあった。しかしながら、誤予測された分岐のために誤って投機的に実行された命令は、キャッシュ内のデータ又はデータ処理装置によって使用される他の非アーキテクチャ的な記憶構造において、なお影響を及ぼし、攻撃者が第2の実行環境からアクセス可能な重要なデータである可能性がある一部の情報を得るために試行するよう利用され得ることが認識されている。 Counter-intuitively, the branch prediction circuit provides a route that an attacker can use to circumvent the security protections in place in processing circuits that restrict one execution environment from accessing data associated with another execution environment. It is recognized that you can get The reason for this is that the branch prediction state assigned to the branch prediction circuit by the first execution environment may be accessible from execution environments that have different branch prediction state entries. can be used to control the behavior of branches executed in the second execution environment. Previously, this was simply viewed as a performance issue, as if the second execution environment hit the wrong entry allocated by a different context, and the actual branch outcome of the branch did not match the prediction. , the misprediction could later be identified during execution of the branch by the second execution environment. However, erroneously speculatively executed instructions due to mispredicted branches can still have an impact on data in caches or other non-architectural storage structures used by data processors, and attackers can be utilized to attempt to obtain some information that may be important data accessible from the second execution environment.
新しい分岐予測状態エントリの生成の際、現在の実行環境に関連付けられる値に基づいて分岐予測回路への入力の少なくとも一部のビットをエンコードすることを適用するためにコーディング回路を設けることにより、入力の少なくとも一部のビットのエンコードが実行環境特有の値に基づいているため、2つの異なる実行環境が同一の入力を与えたとしても分岐予測器は異なるように出力し、別の実行コンテキストを騙して同一の分岐予測状態エントリを再利用させる試行において、ある実行コンテキストが分岐予測回路を悪意のある分岐情報で訓練することをより困難にする。これにより上で議論したタイプの攻撃のリスクを低減する。分岐予測器は通常はセキュリティリスクをもたらすとは見なされず純粋にパフォーマンス向上対策として見なされているため、そのようなコーディング回路は有用であり、驚きである。 input by providing coding circuitry to apply, upon generation of a new branch prediction state entry, encoding at least some bits of an input to the branch prediction circuitry based on values associated with a current execution environment; is based on execution-environment-specific values, the branch predictor will output differently even if two different execution environments are given the same input, tricking another execution context. Certain execution contexts make it more difficult to train the branch prediction circuit with malicious branch information, in an attempt to force the same branch prediction state entry to be reused. This reduces the risk of the types of attacks discussed above. Such a coding circuit is useful and surprising because branch predictors are usually not considered to pose a security risk, but purely as a performance enhancement measure.
一部の実例では、エンコード演算は一連の命令が実行されている現在の実行パーミッションを示す値に基づいて入力値の複数ビットの少なくとも一部をエンコードすることを含むことがある。これにより、異なる実行パーミッションに関連付けられる実行環境が入力を様々な方法でエンコードすることを可能にしており、攻撃者にはアクセス可能ではなくvictim(ヴィクティム)実行環境にはアクセス可能なデータを露出させる試行において、攻撃者が所望のターゲット・アドレスへ分岐するようvictim実行環境を異なる実行パーミッションで成功裏に制御できることを困難にしているが、なぜなら攻撃者の実行環境に関連付けられる値を使用してエンコードされた場合、入力のどの値が、攻撃対象となる別の実行環境に関連付けられる異なる値を使用してエンコードされたターゲット入力に一致するか、を攻撃者が推測することが困難な場合があるからである。 In some instances, the encoding operation may include encoding at least some of the bits of the input value based on a value indicative of current execution permissions for which the sequence of instructions is executing. This allows execution environments associated with different execution permissions to encode input in different ways, exposing data accessible to the victim execution environment but not to an attacker. Attempts have made it difficult for an attacker to be able to successfully control the victim execution environment with different execution permissions to branch to the desired target address, because the value associated with the attacker's execution environment is used to encode , it may be difficult for an attacker to guess which values in the input match target inputs encoded using different values associated with different execution environments to attack. It is from.
コーディング回路によって適用されるエンコード演算は、現在の実行環境に関連付けられる値に基づいて入力の少なくとも一部のビットのビット値を変化させるあらゆる演算を含むことができる。現在の実行環境に関連付けられる値の単なる連結、及び入力回路によって受信される入力は、入力の少なくとも一部のビットのエンコードとは見なされないが、なぜなら、この場合入力のすべてのビットが、その本来の値を依然として保持することになるからであることに留意されたい。したがって、一般に、エンコードすることは、現在の実行環境に関連付けられる値によって定義される変形を使用して少なくとも1つのビットの値を変化させる。 Encoding operations applied by the coding circuitry may include any operation that changes the bit values of at least some bits of the input based on values associated with the current execution environment. A mere concatenation of the values associated with the current execution environment and the input received by the input circuit is not considered an encoding of at least some bits of the input, because in this case all bits of the input Note that it will still hold the original value. Thus, encoding generally changes the value of at least one bit using a transformation defined by a value associated with the current execution environment.
例えば、エンコード演算は、キーを使用して少なくとも一部のビットをエンコードすることを含むことがあり、この場合キーは一連の命令が実行されている現在の実行環境に基づいている。エンコード演算は、キーを使用して少なくとも一部のビットを再配列することを含むことができる(例えば、ビットのシフト又は他の並べ替えを適用すること)。さらに、エンコード演算は、キーを使用して入力のビットの少なくとも一部をトグルすることを含むことがある。例えば、トグルすることは、XOR(排他的OR)演算を入力の少なくとも一部のビット、及び現在の実行環境に関連付けられる値から導出したキーに適用することにより実装することができる。XOR演算は、パフォーマンス及びハードウェアの観点から効率的な場合がある。代替的に、エンコード演算は、キーに基づいて入力の少なくとも一部のビットに適用されるハッシュ関数を含んでもよい。エンコード演算は可逆であり得る(例えば、初めのXOR演算の結果に対して、同一のキーを使用して第2のXOR演算を適用することは、本来の入力を復元することができる)か、又は一方向のハッシュ関数であり得る。 For example, an encoding operation may involve encoding at least some bits using a key, where the key is based on the current execution environment in which the sequence of instructions is being executed. The encoding operation can include rearranging at least some of the bits using the key (eg, applying bit shifts or other permutations). Additionally, the encoding operation may involve toggling at least some of the bits of the input using the key. For example, toggling may be implemented by applying an XOR (exclusive OR) operation to at least some bits of the input and a key derived from values associated with the current execution environment. XOR operations may be efficient from a performance and hardware standpoint. Alternatively, the encoding operation may include a hash function applied to at least some bits of the input based on the key. the encoding operation can be reversible (e.g., applying a second XOR operation using the same key to the result of the first XOR operation can restore the original input); Or it can be a one-way hash function.
分岐予測回路への入力は、複数の情報を含む場合がある。エンコードは、入力の異なる部分に適用することができる。入力の全体をエンコードする必要はない。 An input to a branch prediction circuit may contain multiple pieces of information. Encoding can be applied to different parts of the input. It is not necessary to encode the entire input.
例えば、少なくとも1つの入力は、分岐命令の命令アドレスの指標を含むことがあり、それを使用してその分岐命令についての予測を与える新しい分岐予測状態エントリを形成することができる。分岐予測回路にクエリする時、分岐予測回路は、分岐予測がなされる命令の命令アドレスの指標を含むクエリ値を受信し、そのクエリ値を使用して検索を実施することができる。検索は、例えば、分岐予測回路が1つ又は複数の命令に関連する分岐予測状態エントリを記憶するかどうかを、命令アドレスがクエリ値によって指定されることに対応して、特定することがある。例えば、それぞれのエントリは、いくつかのタグ情報、又は分岐予測回路に与えられたクエリがそのエントリに一致するかどうかを検索が特定できるようにする他の状態データを含むことがある。クエリがミスとなり、続いてクエリによって示される命令アドレスが分岐命令に対応すると判断される場合、タグ情報又はミスを起こしたクエリに対応する他の状態を指定し、また分岐命令について決定された実際の分岐情報を指定する新しい分岐予測状態エントリを分岐予測回路に割り当てることができる。 For example, at least one input may include an index of the instruction address of a branch instruction, which can be used to form a new branch prediction state entry that provides a prediction for that branch instruction. When querying the branch prediction circuit, the branch prediction circuit may receive a query value containing an indication of the instruction address of the instruction for which the branch is predicted, and use the query value to perform a search. The search may, for example, identify whether the branch prediction circuit stores branch prediction state entries associated with one or more instructions, corresponding to the instruction address specified by the query value. For example, each entry may contain some tag information or other state data that allows a search to identify whether a query given to the branch prediction circuit matches that entry. If the query misses and it is subsequently determined that the instruction address indicated by the query corresponds to a branch instruction, specify the tag information or other state corresponding to the query that caused the miss and the actual determined for the branch instruction. A new branch prediction state entry can be assigned to the branch prediction circuit that specifies the branch information for .
一実例において、コーディング回路は、検索の実施に先立って、現在の実行環境に関連付けられる1つ又は複数の値から導出されるキーを使用してクエリ値の複数ビットの少なくとも一部に対してエンコード演算を実施することができる。したがって、異なる実行環境はその環境特有のキーに基づいて同一のクエリを異なる方法でエンコードし、入力クエリと分岐予測回路のエントリとの間の、一致するとしてリターンされるマッピングを変更し、それによって異なる実行環境において一部の他のクエリ値に関連付けられる分岐を騙して攻撃者の実行環境によって割り当てられる予測状態を使用させるために、攻撃者が分岐予測器を訓練するためのクエリとして入力のどの値を与えるべきかを予測することをより複雑にしている。(分岐について予測されるデスティネーション・アドレスなどの予測される分岐状態に、ではなく)クエリ値にコーディングを適用することの利点は、エンコード演算を分岐予測回路へのクエリ入力に適用することが攻撃者をいらだたせるのに十分であり得、予測される分岐情報が依然として分岐予測回路にクリアな状態で記憶され得るため、分岐予測器から分岐状態情報を読み出す際にあらゆるデコードを適用することが必須ではないことである。これは、分岐予測器から出力される際デコード回路を通過する追加的なタイミング・パスを回避することによりパフォーマンスを改善することができる。 In one instance, the coding circuitry encodes at least some of the bits of the query value using a key derived from one or more values associated with the current execution environment prior to performing the search. Arithmetic can be performed. Thus, different execution environments encode the same query differently based on keys specific to that environment, altering the mapping between input queries and entries in the branch prediction circuit that are returned as matching, thereby In order to trick a branch associated with some other query value in a different execution environment into using a prediction state assigned by the attacker's execution environment, an attacker uses which of the inputs as a query to train a branch predictor. It makes it more complicated to predict when to give a value. The advantage of applying the coding to the query value (as opposed to the predicted branch state, such as the predicted destination address for the branch) is that applying the encoding operation to the query input to the branch prediction circuit is an attack. It is essential to apply any decoding when reading branch state information from the branch predictor, as the predicted branch information can still be stored in the clear in the branch prediction circuit. It is not. This can improve performance by avoiding an additional timing pass through the decoding circuitry as it exits the branch predictor.
他の実例では、ビットが新しい分岐予測状態エントリを形成するためにコーディング回路によってエンコードされる少なくとも1つの入力は、分岐命令のデスティネーション・アドレス(「分岐ターゲット・アドレス」又は「分岐ターゲット・オフセット」としても知られる)の指標を含むことができる。この場合は、装置は、命令アドレスを示すクエリ値に基づいてトリガされた分岐予測回路の検索に応じて出力される分岐予測回路からの出力に対して、逆のエンコード演算を実施するための逆エンコード回路(又はデコード回路)をさらに含むことができる。逆エンコード演算は、コーディング回路によって適用されたエンコード演算の効果を逆転させ、値がエンコード演算によって変形されたビットの本来の値を復元するあらゆる演算であり得る。この場合は、クエリ値とアクセスされる分岐予測回路のエントリとのマッピングを変更するのではなく、予測される分岐状態は現在の実行環境に関連付けられるキーに基づいて環境特有のやり方でエンコードされ、それによって第2の実行環境が第1の実行環境によって訓練された分岐予測状態エントリをヒットしたとしても、得られる分岐予測は、同一のエントリが第1の実行環境からアクセスされる場合になされる予測とは異なることができる。これは悪意をもって分岐予測器を訓練することによって攻撃者が異なる実行環境が分岐する位置を成功裏に制御することをより困難にする。これは、間違った分岐予測器状態エントリをヒットする機会を低減することによりパフォーマンスを改善することができる。 In another example, at least one input whose bits are encoded by the coding circuit to form a new branch prediction state entry is the destination address of a branch instruction (“branch target address” or “branch target offset”). (also known as ). In this case, the apparatus includes an inverse for performing an inverse encoding operation on output from the branch predictor output in response to a branch predictor search triggered based on a query value indicative of an instruction address. Encoding circuitry (or decoding circuitry) may also be included. An inverse encoding operation can be any operation that reverses the effect of the encoding operation applied by the coding circuit and restores the original values of the bits whose values were modified by the encoding operation. In this case, rather than changing the mapping between query values and accessed branch prediction circuit entries, the predicted branch state is encoded in an environment-specific manner based on a key associated with the current execution environment, Even if the second execution environment thereby hits a branch prediction state entry trained by the first execution environment, the resulting branch prediction will be made if the same entry is accessed from the first execution environment. Expectations may differ. This makes it more difficult for an attacker to successfully control where different execution environments branch by maliciously training the branch predictor. This can improve performance by reducing the chance of hitting the wrong branch predictor state entry.
逆エンコード回路は、現在の実行環境に関連付けられるキーの値を再計算し、キーの再計算された値を使用して逆エンコード演算を実施することができる。したがって、現在の実行環境が、分岐予測状態エントリが割り当てられる時間と、分岐予測状態エントリが予測を行うためにアクセスされる時間との間に変わると、現在の実行環境に関連付けられる値から導出されるキーは再計算されるため、逆エンコード演算はそのエントリの割り当てに対して予測分岐状態として与えられる情報に、異なる情報をもたらすことがある。 The de-encoding circuitry can recompute the values of the keys associated with the current execution environment and perform de-encoding operations using the re-computed values of the keys. Therefore, when the current execution environment changes between the time the branch prediction state entry is assigned and the time the branch prediction state entry is accessed to make a prediction, the value associated with the current execution environment is derived. Because the key is recomputed, the reverse encoding operation may yield different information to that given as the predicted branch state for that entry assignment.
上で議論した2つの手法を組み合わせるために、分岐の命令アドレス、及びデスティネーション・アドレスの両方へのエンコード演算を適用することも可能である。 To combine the two approaches discussed above, it is also possible to apply the encoding operation to both the instruction address and the destination address of the branch.
現在の実行環境に関連付けられるキーは、現在の実行環境に関連付けられる1つ又は複数の識別子の組み合わせに基づくことができる。例えば、キーは以下のうちの1つ又は複数のあらゆる組み合わせに基づくことができる:
例外レベル(異なる動作モード、例えば、ユーザ・モード、カーネル・モード、ハイパーバイザ・モードを区別する)
特権レベル(異なる実行パーミッションを区別する)
ASID(アドレス空間ID(address space ID)―異なるアプリケーション・レベルの実行コンテキストを区別する)
VMID(仮想マシンID(virtual machine ID)―異なるオペレーティング・システム若しくは仮想マシン・レベルの実行コンテキスト、又は異なるオペレーティング・システム若しくは仮想マシンの制御下で実行する同一のASIDを有するアプリケーションを区別する)
NS(non-secure/secure)(装置の現在のセキュリティ状態を示す非セキュア/セキュア状態)
物理プロセッサ・コア数(ハードウェア内に設けられる異なるプロセッサ・コアで実行するプロセスを区別する)
論理コア数(ハードウェア内に設けられる共有プロセッサ・コアの異なる論理パーティションで実行される実行環境を区別する)
1つ又は複数のソフトウェア書き込み可能レジスタ(キーのさらなる変形を提供するためのキーを導出するために使用されるさらなる入力をソフトウェアが与えることができるように、例えば、これはそのプロセス下で実行しているプロセスのASID又はVMIDなどのコンテキスト識別子を知っているプロセスが、そのプロセスによって使用されるキーの値を予測することをより困難にする)。
A key associated with the current execution environment can be based on a combination of one or more identifiers associated with the current execution environment. For example, keys can be based on any combination of one or more of the following:
Exception level (distinguishes between different modes of operation, e.g. user mode, kernel mode, hypervisor mode)
Privilege level (distinguishes different execute permissions)
ASID (address space ID - distinguishes between different application level execution contexts)
VMID (virtual machine ID - distinguishes between different operating system or virtual machine level execution contexts or applications with the same ASID running under the control of different operating systems or virtual machines)
NS (non-secure/secure) (non-secure/secure state indicating the current security state of the device)
Number of physical processor cores (distinguishes processes running on different processor cores provided in the hardware)
Number of logical cores (distinguishes execution environments running on different logical partitions of shared processor cores provided in hardware)
One or more software writable registers (e.g., this executes under the process so that software can provide further input used to derive the key to provide further variants of the key). making it more difficult for a process that knows the context identifier, such as the ASID or VMID, of the process it is using to predict the value of the key used by that process).
また、キーは、以前に生成された乱数に基づいてさらに生成することができる。これは、現在の実行環境に関連付けられる識別子の所与の組み合わせについて生成されるキーのさらなる変形を与えることができ、あるデバイスによって使用されるキー(又はキーを導出するために使用される関数)を特定することができる攻撃者が、その知識を異なる乱数を使用し得る他のデバイスに適用することを困難にしている。乱数は、論理プロセッサごとの要素、物理プロセッサごとの要素、及びシステム全体の要素の少なくとも1つを含むことができる。以前に生成された乱数の少なくとも一部は、スタート・アップ時に生成することができるため、データ処理装置がスタート・アップする都度変化し、所与の実行環境に関連付けられるキーの破壊に対してさらなる耐性を提供する。例えば、ハードウェア乱数生成器又は疑似乱数生成器は、装置がブートされる都度新しい乱数を生成するようトリガされ得る。以前に生成された乱数の少なくとも一部は、真の乱雑さが求められなくてもよい疑似乱数であってもよい。 Also, the key can be further generated based on a previously generated random number. This can give further variants of the key generated for a given combination of identifiers associated with the current execution environment, the key used by a device (or the function used to derive the key) makes it difficult for an attacker who is able to identify , to apply that knowledge to other devices that may use different random numbers. The random number may include at least one of a per logical processor component, a per physical processor component, and a system wide component. At least some of the previously generated random numbers can be generated at start-up, so that they change each time the data processing apparatus starts up, providing additional protection against key destruction associated with a given execution environment. provide resistance. For example, a hardware random number generator or pseudo-random number generator can be triggered to generate a new random number each time the device is booted. At least some of the previously generated random numbers may be pseudo-random numbers, for which true randomness may not be desired.
一部の実施例では、一連の命令は、最低の実行パーミッション(最低の特権を有する実行パーミッション・レベル)で実行するように構成される複数の実行環境のうちの1つで実行され得る。例えば、最低の実行パーミッションにある実行環境は、アプリケーション又はアプリケーションのサブ部分を含む場合がある。一部の実例では、コーディング回路は、一連の命令が実行されている最低の実行パーミッションにある複数の実行環境のうちの1つの識別子にさらに基づくエンコード演算を実施することができる。これは、同一のアドレス変換レジームを共有することができ、そのために分岐予測器入力の分岐予測器のエントリへのマッピングを共有すると期待され得るアプリケーション・レベルのソフトウェアの異なる部分が、分岐予測器入力の異なるエンコードを使用させ、同一のアドレス変換レジームを共有する別のアプリケーション又はアプリケーションの別の部分に対して、あるアプリケーション又はアプリケーションの一部が上で議論した形態の攻撃を作り出すリスクを低減することを可能にしている。 In some embodiments, a sequence of instructions may be executed in one of multiple execution environments configured to execute with the lowest execution permissions (the least privileged execution permission level). For example, an execution environment with lowest execution permissions may contain an application or a sub-portion of an application. In some instances, the coding circuitry may perform the encoding operation further based on an identifier of one of multiple execution environments in which the sequence of instructions is executing with the lowest execution permission. This means that different pieces of application-level software can share the same address translation regime, and therefore can be expected to share the mapping of branch predictor inputs to branch predictor entries. to reduce the risk of one application or part of an application creating the forms of attack discussed above against another application or part of an application sharing the same address translation regime. making it possible.
一連の命令が投機的な状態で実行されている間、命令フェッチ又はデコード・フォールトのレートを検出し、例外を発生させるか、又は所定のしきい値を超える増加などの所定の判定基準を満たす命令フェッチ及び/若しくはデコード・フォールトの検出率に応じてエラー応答を作り出すために監視回路を設けてもよい。例えば、しきい値は直前のレートよりも少なくとも20%高くてもよい。代替的に、しきい値は他のアプリケーションについての平均レートを20%上回ることができる。これは上で議論した形態の攻撃を検出するための技法を提供することができる。命令フェッチ・フォールトの回数が増加する場合、可能性のある説明としては、攻撃者が他のコードを騙して、不適切な分岐アドレスから命令を実行するように分岐予測器を訓練しようと試行していることが挙げられ得、これは後で誤予測として検出される。投機的な命令フェッチ又はデコード・フォールトのレートが増加する時に、例外又はエラー応答をトリガすることによって、潜在的な攻撃の警告を与えることができる。そのような警告に対してソフトウェアがどのように応答するよう選択するか、は実行されている特定のソフトウェアに依存することがあるが、命令フェッチ・フォールトで異常に高い増加が検出される際に割り込み/エラー応答をトリガするために監視回路を設けることは、ソフトウェアがそのソフトウェアに適当なやり方で応答することを可能にするためのハードウェア・フレームワークを提供することができる。 Detecting the rate of instruction fetch or decode faults and raising an exception or satisfying a predetermined criterion, such as an increase above a predetermined threshold, while a sequence of instructions is executing speculatively A supervisory circuit may be provided to produce an error response in response to the detection rate of instruction fetch and/or decode faults. For example, the threshold may be at least 20% higher than the previous rate. Alternatively, the threshold can be 20% above the average rate for other applications. This can provide techniques for detecting the forms of attacks discussed above. If the number of instruction fetch faults increases, a possible explanation is that an attacker is trying to trick other code into training the branch predictor to execute instructions from improper branch addresses. , which is later detected as a misprediction. Warning of potential attacks can be provided by triggering exceptions or error responses when the rate of speculative instruction fetch or decode faults increases. How the software chooses to respond to such warnings may depend on the specific software being run, but it may be Providing supervisory circuitry to trigger interrupt/error responses can provide a hardware framework for allowing software to respond in an appropriate manner to the software.
一実例では、分岐予測回路は複数の分岐ターゲット・エントリを含む分岐ターゲット予測構造を含むことができ、それぞれの分岐ターゲット・エントリは少なくとも1つの分岐ターゲット・アドレスを指定する。コーディング回路は、現在の実行環境に関連付けられる暗号化キーを使用して、分岐ターゲット予測構造に書き込まれる新しい分岐ターゲット・エントリの少なくとも一部を暗号化するための暗号化回路を備えることができる。 In one instance, the branch prediction circuit may include a branch target prediction structure including a plurality of branch target entries, each branch target entry specifying at least one branch target address. The coding circuitry may comprise encryption circuitry for encrypting at least a portion of new branch target entries written to the branch target prediction structure using an encryption key associated with the current execution environment.
それぞれの分岐ターゲット・エントリはタグ情報を指定することができる。装置は、現在の実行環境に関連付けられる命令フェッチ・アドレスについて分岐ターゲット予測ルックアップを実施する分岐ターゲット予測回路を有することができる。分岐ターゲット予測ルックアップは、分岐ターゲット・エントリのサブセットのいずれかが命令フェッチ・アドレスについて決定されたターゲット・タグに対応するタグ情報を指定するかどうか判断することを含むことができる。分岐ターゲット予測ルックアップでルックアップされる分岐ターゲット・エントリのサブセットは、fully-associative(フルアソシアティブ型)キャッシュの実装形態の場合に分岐ターゲット予測構造の分岐ターゲット・エントリのすべてを含むことができるか、又はset-associative(セットアソシアティブ型)の実装形態で分岐ターゲット・エントリの一部のみ(分岐ターゲット・エントリの適切なサブセット)を含むことができる。set-associativeの実装形態では、ルックアップされる分岐ターゲット・エントリのサブセットを、例えば所与の分岐命令のアドレスの一部に基づいて選択することができる。 Each branch target entry can specify tag information. The apparatus may have branch target prediction circuitry that performs branch target prediction lookups for instruction fetch addresses associated with the current execution environment. A branch target prediction lookup may include determining whether any of the subset of branch target entries specify tag information corresponding to the target tag determined for the instruction fetch address. Can the subset of branch target entries looked up in a branch target prediction lookup include all of the branch target entries of the branch target prediction structure for fully-associative cache implementations? , or only some of the branch target entries (a proper subset of the branch target entries) in a set-associative implementation. In a set-associative implementation, the subset of branch target entries that are looked up may be selected based, for example, on part of the address of a given branch instruction.
一般に、ターゲット・タグは、命令フェッチ・アドレス、フェッチ・アドレスが生じる現在の実行環境、又は命令フェッチ・アドレスによって表現される現在の実行ポイントの何らかの性質を示す処理回路の最近の演算の一部の過去の履歴の何らかの性質に基づいて、何らかの方法で決定され得る。使用される特定のタグは、実装される分岐ターゲット予測構造のタイプに依存して変わってもよい。例えば、ターゲット・タグは命令フェッチ・アドレスから、又は現在の実行環境に関連付けられる1つ若しくは複数の識別子から導出することができるか、或いは命令フェッチ・アドレスによって特定される命令にたどり着く分岐結果の過去の履歴に基づいている場合もある。 In general, the target tag is part of a recent operation of the processing circuitry that indicates some aspect of the instruction fetch address, the current execution environment in which the fetch address occurs, or the current execution point represented by the instruction fetch address. It can be determined in some way based on some property of the past history. The particular tags used may vary depending on the type of branch target prediction structure implemented. For example, the target tag can be derived from the instruction fetch address, or from one or more identifiers associated with the current execution environment, or past branch results leading to the instruction identified by the instruction fetch address. may be based on the history of
ターゲット・タグの値は、複数の実行環境で再利用可能であってもよい。したがって、ターゲット・タグは特定の実行環境に一意でなくてもよい。これは、例えば、特定の分岐ターゲット予測構造が現在の実行環境に関連付けられる識別子とは完全に独立しているタグを使用するため、又は分岐ターゲット予測構造のタグ情報記憶における回路エリアを節約するために、タグが現在の実行環境に関連付けられる値から導出された少なくとも一部を含む一方で、タグ情報及びターゲット・タグが、現在の実行環境を特定する1つ又は複数の実行環境識別子の圧縮されたバージョンに基づくことができるからであり得、そのため圧縮された識別子の値は実行環境ごとに再利用可能となり得る。 Target tag values may be reusable in multiple execution environments. Therefore, target tags do not have to be unique to a particular execution environment. This is because, for example, a particular branch target prediction structure uses tags that are completely independent of the identifiers associated with the current execution environment, or to save circuit area in storing tag information for branch target prediction structures. In addition, the tag information and the target tag are compressed versions of one or more execution environment identifiers that identify the current execution environment, while the tags include at least a portion derived from values associated with the current execution environment. can be based on different versions, so the compressed identifier value can be reusable for each execution environment.
したがって、一実行環境で使用されるターゲット・タグが、異なる実行コンテキストに関連付けられる分岐命令の実行後、分岐ターゲット予測構造のエントリに割り当てられたタグ情報とは一致しないことを保証することができない。これは分岐ターゲット予測構造で偽陽性ヒットをもたらすことがあるため、時に誤った分岐ターゲット・アドレスがリターンされることがあり、ひいては分岐誤予測は分岐後に間違った命令を実施させることがある。そのような偽陽性ヒットが処理パフォーマンスの低下を引き起こすことがある一方で、プロセッサをトリガして誤予測の分岐後にパイプラインされた命令をフラッシュし、いったん分岐結果が解決されると正しい処理経路から命令フェッチを再開させることによって、誤予測を扱うための分岐誤予測解決回路が既に設けられている場合がある。したがって、複数の実行環境にわたってタグ値の再利用によって引き起こされる偽陽性ヒットは、分岐誤予測の他の原因に類似する方法で解決される可能性があるため、またこれはパフォーマンスに影響する一方で典型的にはデータ・セキュリティにとってのリスクとは見なされることがないため、典型的には大きな問題とは考えられないであろう。 Therefore, it cannot be guaranteed that the target tag used in one execution environment will not match the tag information assigned to entries in branch target prediction structures after execution of branch instructions associated with different execution contexts. Since this can result in false positive hits in the branch target prediction structure, the wrong branch target address can sometimes be returned and branch mispredictions can cause the wrong instruction to be executed after the branch. While such false-positive hits can cause processing performance degradation, they can also trigger the processor to flush pipelined instructions after a mispredicted branch and exit the correct processing path once the branch outcome is resolved. Branch misprediction resolution circuitry may already be in place to handle mispredictions by restarting instruction fetching. Thus, while false-positive hits caused by tag value reuse across multiple execution environments may be resolved in a manner similar to other causes of branch misprediction, and while this affects performance, It would typically not be considered a major problem as it would not typically be considered a risk to data security.
しかしながら、実際には分岐ターゲット予測回路におけるそのような偽陽性ヒットは、データ処理装置によって処理されるデータのセキュリティへの脆弱性をもたらすことがあると認識されている。装置は、例えば特権ベースのデータ・アクセス保護スキームを使用して、一部のデータへのアクセスを一定の実行環境に制限することができる。分岐ターゲット予測回路での偽陽性ヒットは、そのようなセキュリティ・メカニズムをすり抜けさせることがあるため、第2の実行環境にはアクセス可能であり且つ第1の実行環境にはアクセス不可能な重要な情報についての情報を、攻撃者によって制御される第1の実行環境が取得できることが認識されている。分岐予測のメカニズムは通常、その誤予測がシステムによって処理されたデータのセキュリティにとって致命的ではなく、達成されるパフォーマンス・レベルに影響するだけの、パフォーマンス向上メカニズムと見なされるため、これは驚くべきことである。 However, it has been recognized that, in practice, such false positive hits in branch target prediction circuitry can pose security vulnerabilities to the data processed by the data processing apparatus. A device may restrict access to some data to certain execution environments, for example using a privilege-based data access protection scheme. A false-positive hit in the branch target prediction circuit can circumvent such security mechanisms, resulting in critical It is recognized that information about information can be obtained by a first execution environment controlled by an attacker. This is surprising because branch prediction mechanisms are usually viewed as performance-enhancing mechanisms whose mispredictions are not fatal to the security of data processed by the system, but only affect the level of performance achieved. is.
潜在的なセキュリティ脆弱性の理由としては、第1の実行コンテキストを制御している攻撃者が、第2の実行環境をトリガし、その分岐ターゲット・アドレスとして一定の既知のアドレス(以下で「偽ヒット・ターゲット・アドレス」と称される)を示す第1の実行環境によって割り当てられるエントリにヒットさせるよう実行環境同士のターゲット・タグ値の再利用を利用することができる場合、これは攻撃者が第2の実行環境を制御して偽ヒット・ターゲット・アドレスに配置された一定の悪意のあるコードに分岐させることができる。結果的に、第2の実行環境によって実行される分岐の実際のターゲット・アドレスが偽ヒット・ターゲット・アドレスとは一致しない可能性があるため、分岐予測が誤っていると判断することができ、次いで誤って実行された命令のアーキテクチャ上の効果を逆転させるために、誤って実行された命令に関連付けられるあらゆるアーキテクチャ的な状態を以前の正しい状態値に巻き戻すことができ、その一方で誤って実行された命令は、キャッシュ内のデータ、又はトランスレーション・ルックアサイド・バッファ(TLB:translation lookaside buffer)などの非アーキテクチャ的なプロセッサ状態を変えさせることもでき、これは誤予測が解決された後も存続することがある。攻撃者は、誤って実行された命令の結果としてデータがキャッシュされる特定のアドレスが、攻撃者がアクセスしたいと思う重要な情報に依存することを確実にするために、偽ヒット・ターゲット・アドレスに悪意のあるコードを設計しておくことがある。したがって、攻撃者は次に、どのデータがキャッシュされているかを精査するよう設計された第1の実行環境で命令を実行すること、及び誤予測された命令が実行された期間に、第2の実行環境によってどの情報がキャシュされたかを精査するためにキャッシュ・ミス・カウント又はメモリ・アクセス・レイテンシ測定値などのパフォーマンス・インジケータを使用することができる。これにより、攻撃者が第2の実行環境によって処理される潜在的に重要なデータについての情報を得て、システムのセキュリティ・メカニズムをすり抜けることが可能になる。 The reason for the potential security vulnerability is that an attacker in control of a first execution context could trigger a second execution environment and set its branch target address to a certain known address (hereinafter "fake If the reuse of target tag values between execution environments can be exploited to hit an entry assigned by the first execution environment that indicates the "hit target address"), this would allow an attacker to A second execution environment can be controlled to branch to certain malicious code located at the false hit target address. Consequently, it can be determined that the branch prediction is incorrect because the actual target address of the branch executed by the second execution environment may not match the false hit target address; To reverse the architectural effects of the erroneously executed instruction, any architectural state associated with the erroneously executed instruction can then be rewound to its previous correct state value, while the erroneously Executed instructions can also cause data in caches, or non-architectural processor state such as the translation lookaside buffer (TLB) to change, which can occur after a misprediction has been resolved. may also persist. Attackers may use fake hit target addresses to ensure that the specific addresses where data is cached as a result of mis-executed instructions depend on the important information they wish to access. Sometimes malicious code is designed in Therefore, an attacker can then execute instructions in a first execution environment designed to probe what data has been cached, and during the period in which the mispredicted instruction was executed, a second Performance indicators such as cache miss counts or memory access latency measurements can be used to probe what information has been cached by the execution environment. This allows an attacker to obtain information about potentially sensitive data processed by the second execution environment and bypass the security mechanisms of the system.
したがって、分岐ターゲット予測構造に書き込まれる新しい分岐ターゲット・エントリの少なくとも一部は、その分岐情報に割り当てられる対応する実行環境に関連付けられる暗号化キーを使用して暗号化することができる。新しい分岐ターゲット・エントリのタグ情報、若しくは新しい分岐ターゲット・エントリの分岐データ(少なくとも予測される分岐ターゲット・アドレスを指定する)のいずれか、又は両方を暗号化することができる。タグ情報が新しい分岐ターゲット・エントリを割り当てる際暗号化キーを使用して少なくとも部分的に暗号化される場合、分岐ターゲット予測ルックアップの間、暗号化回路は命令フェッチ・アドレスについて決定されたターゲット・タグを現在の実行環境に関連付けられる(再計算された)暗号化キーを使用して暗号化することができ、分岐ターゲット予測回路は、分岐ターゲット・エントリのサブセットのいずれかがターゲット・タグに対応するタグ情報を指定しているかどうかを識別するために暗号化されたターゲット・タグを分岐ターゲット・エントリのサブセットのタグ情報と比較することができるか、又はルックアップされるエントリに記憶された暗号化されたタグ情報は復号化され(暗号化されていない)ターゲット・タグと比較されるか、のいずれかである。分岐データが新しいエントリを分岐予測構造に割り当てられる際に暗号化される場合、装置は、分岐ターゲット予測ルックアップでターゲット・タグに対応するタグ情報を指定するとして特定された分岐ターゲット・エントリのサブセットのうちの1つの分岐データの暗号化された部分を復号化するため復号化回路をさらに有する場合がある。 Accordingly, at least some of the new branch target entries written to the branch target prediction structure may be encrypted using the encryption key associated with the corresponding execution environment assigned to that branch information. Either the new branch target entry's tag information, or the new branch target entry's branch data (specifying at least the predicted branch target address), or both, can be encrypted. If the tag information is at least partially encrypted using the encryption key when assigning a new branch target entry, then during a branch target prediction lookup, the encryption circuitry uses the determined target address for the instruction fetch address. The tag can be encrypted using a (recomputed) encryption key associated with the current execution environment, and the branch target prediction circuit will determine if any subset of the branch target entries corresponds to the target tag. The encrypted target tag can be compared to the tag information of a subset of the branch target entries to identify whether it specifies tag information to or the encrypted target tag stored in the entry being looked up. The encrypted tag information is either decrypted (unencrypted) and compared to the target tag. If the branch data is encrypted when a new entry is assigned to the branch prediction structure, then the apparatus specifies a subset of the branch target entries identified as specifying tag information corresponding to the target tag in the branch target prediction lookup. may further comprise decryption circuitry for decrypting an encrypted portion of the branch data of one of the .
例えば、ある特定の実例では、分岐ターゲット予測ルックアップにおいて、ルックアップされた分岐ターゲット・エントリのサブセットのいずれもターゲット・タグに対応するタグ情報を指定しない場合、また命令フェッチ・アドレスが分岐命令を含む1つ又は複数の命令のブロックを指定する場合、暗号化回路は、現在の実行環境に関連付けられる暗号化キーを使用して分岐命令について決定された実際の分岐情報を暗号化することができ、分岐ターゲット予測回路は、分岐ターゲット・エントリを、暗号化された分岐情報及びターゲット・タグに対応するタグ情報を指定する分岐ターゲット予測構造に割り当てることができる。一方で、ルックアップのヒットの際、分岐ターゲット・エントリのサブセットのうちの1つがターゲット・タグに対応するタグ情報を指定する場合、そのエントリに記憶される分岐情報は、現在の実行環境に関連付けられる暗号化キーを使用して復号化することができ、また復号化された分岐情報は、所与の分岐命令について予測された分岐情報として出力することができる。 For example, in one particular instance, in a branch target prediction lookup, if none of the subset of branch target entries looked up specify tag information corresponding to a target tag, and the instruction fetch address does not specify a branch instruction. When specifying a block of one or more instructions to contain, the cryptographic circuitry can encrypt the actual branch information determined for the branch instruction using a cryptographic key associated with the current execution environment. , the branch target prediction circuit may assign the branch target entry to a branch target prediction structure that specifies tag information corresponding to the encrypted branch information and target tag. On the other hand, on a lookup hit, if one of the subset of branch target entries specifies tag information corresponding to the target tag, then the branch information stored in that entry is associated with the current execution environment. The decrypted branch information can be output as predicted branch information for a given branch instruction.
したがって、この実例では、分岐ターゲット予測構造内の分岐情報はその分岐情報に関連付けられる対応する実行環境に関連付けられる暗号化キーによって保護されるため、ある実行環境が分岐情報を割り当てる場合は、その環境はその環境に関連付けられるキーを使用して暗号化され、そうすると別の実行環境がそのエントリの同一のタグ情報を再利用する時に偽陽性ヒットが偶然に起こると、分岐情報は他の実行環境に関連付けられるキーを使用して復号化されることになり、同一の分岐ターゲット・アドレスを、エントリを割り当てた実行環境によって元々提供されたものとして示すことがない。通常、分岐予測器はデータのセキュリティ又は一貫性に影響を及ぼさない、純粋にパフォーマンス向上の対策として考えつくものであるため、分岐予測器で暗号化が有用であることは驚くべきことであるが、実行環境特有キーを使用して分岐情報を暗号化することにより、攻撃者がそれぞれの実行環境に関連付けられるキーを知らない場合、攻撃者が別の実行環境が分岐する位置を制御することがより困難であるため、上で議論したタイプの攻撃をずっと困難にする。 Therefore, in this example, the branch information in the branch target prediction structure is protected by the cryptographic key associated with the corresponding execution environment associated with that branch information, so if one execution environment assigns branch information, that environment is encrypted using the key associated with that environment, so that if a false positive hit happens to happen when another execution environment reuses the same tag information for that entry, the branch information will be passed to the other execution environment. It will be decrypted using the associated key and will not show the same branch target address as originally provided by the execution environment that allocated the entry. It is surprising that encryption is useful in branch predictors, since branch predictors are usually thought of purely as a performance enhancement measure that does not affect data security or consistency. By encrypting branch information using execution environment-specific keys, it is easier for attackers to control where different execution environments branch if they do not know the key associated with each execution environment. Difficult, which makes the types of attacks discussed above much more difficult.
いくつかの実例では、暗号化回路及び復号化回路は、別個の回路を備えることができる。例えば、場合によっては、暗号化された分岐情報を復号化するために適用される演算は、分岐情報を暗号化するために適用される演算とは同一でなくてもよく、そのため別個の暗号化及び復号化の方法を適用することができる。代替的に、暗号化及び復号化の演算は実際に同一の演算であってもよい。例えば、暗号化演算は分岐情報及び暗号化キーに対して可逆的な演算(例えば、XOR)を適用することを含むことができ、また復号化演算は暗号化された分岐情報及び暗号化キーに対して同一の可逆的な演算(例えば、XOR)を適用することを含むことができる。したがって、いくつかの実例では、暗号化回路と復号化回路とは両方、ハードウェアに設けられる同一の回路に対応することができる(2つの別個の回路ユニットを提供することが必要とならない)。代替的に、暗号化及び復号化演算が同一であっても、分岐ターゲット予測構造のあるエントリについての分岐情報の復号化を、別のエントリについての分岐情報の暗号化と並行して実施することができるように、別個の暗号化及び復号化回路を設けることがなお有用である場合がある。 In some instances, the encryption circuitry and decryption circuitry may comprise separate circuitry. For example, in some cases, the operations applied to decrypt encrypted branch information may not be the same as the operations applied to encrypt the branch information, so separate encryption and decoding methods can be applied. Alternatively, the encryption and decryption operations may actually be the same operation. For example, the encryption operation can include applying a reversible operation (e.g., XOR) to the branch information and the encryption key, and the decryption operation can be applied to the encrypted branch information and the encryption key. applying the same reversible operation (eg, XOR) to the . Therefore, in some instances, both the encryption and decryption circuitry may correspond to the same circuitry provided in hardware (no need to provide two separate circuit units). Alternatively, decrypting branch information for one entry in the branch target prediction structure in parallel with encrypting branch information for another entry, even though the encryption and decryption operations are identical. It may still be useful to have separate encryption and decryption circuits so that the
いくつかの実例では、暗号化キーは現在の実行環境に固定の静的なキーを含むことができる。したがって、それぞれの実行環境は、変わることのないある固定されたキーに関連付けられることができる。これは、攻撃者が、ある暗号化キーを使用して暗号化された値を復号化する結果を、暗号化で使用されたキーとは異なる復号化キーを使用して予測することをなお困難にできるため、十分なセキュリティを提供するために足る場合があり、この場合キーの1つ又は複数は未知である。複数の環境特有のキーは、それぞれの実行環境の記憶構造に記憶することができるが、複数の実行環境は大きい場合があるため、これは著しく大容量の記憶を要求することがある。現在の実行環境についての静的なキーを決定するための単純な手法は、複数の実行環境と現在の実行環境に特有の少なくとも1つの環境識別子とで共有される共通キーから静的なキーを導出することであり得る。例えば、共通キーは、上で議論したような、以前に生成された乱数であってもよい。例えば、共通キーは、上で言及したASID、VMIDなどの現在の実行環境の識別子に基づいてハッシュ化又は改変される場合がある。 In some instances, encryption keys may include static keys that are fixed to the current execution environment. Therefore, each execution environment can be associated with some fixed key that never changes. This makes it even more difficult for an attacker to predict the outcome of decrypting a value encrypted using one encryption key using a decryption key different from the one used for encryption. may be sufficient to provide sufficient security, in which case one or more of the keys is unknown. Multiple environment-specific keys can be stored in each execution environment's storage structure, but since multiple execution environments can be large, this can require a significantly large amount of storage. A simple technique for determining a static key for the current execution environment is to extract the static key from a common key shared by multiple execution environments and at least one environment identifier unique to the current execution environment. can be derived. For example, the common key may be a previously generated random number as discussed above. For example, the common key may be hashed or modified based on the identifier of the current execution environment, such as the ASID, VMID, etc. mentioned above.
別の手法では、暗号化キーは現在の実行環境に可変の動的なキーを含むことができる。したがって、環境ごとに変わるのと同様に、暗号化キーは特有の環境について時間ごとに変化することもできる。これは、攻撃者が、ある期間にかけてデータ処理システムの挙動を観察することによって所与の環境についてのキーを導出できる機会を低減するため、かなりのセキュリティを与えることができる。したがって、装置は、現在の実行環境についての更新された暗号化キーを生成するためのキー生成回路を備えることができる。例えば、キー生成回路は、必要とされる場合に所与の実行環境についての暗号化キーのために、新しい乱数値又は疑似乱数値を生成するために、線形帰還シフト・レジスタ(LFSR:linear feedback shift register)などの乱数又は疑似乱数生成器を備えることができる。キーが更新されるタイミングは、任意であることができるか、又はある所定のイベントに応じたものであってもよく、或いは一定の時間期間若しくは分岐予測イベントの回数の満了においてであってもよい。いくつかの実例では、それぞれの分岐ターゲット・エントリのタグ情報は、クリアな状態で記憶されているため、タグ情報には暗号化も復号化も適用されない。これはタグの比較を単純にすることができる。分岐情報を暗号化することは、上で議論したような攻撃の確率を低減するのに足りる場合がある。 In another approach, the encryption key can include dynamic keys that are variable in the current execution environment. Thus, as well as changing from environment to environment, encryption keys can also change from time to time for a particular environment. This can provide significant security as it reduces the chances of an attacker being able to derive keys for a given environment by observing the behavior of the data processing system over time. Accordingly, the device may comprise key generation circuitry for generating updated encryption keys for the current execution environment. For example, a key generation circuit may use a linear feedback shift register (LFSR) to generate new random or pseudo-random values for a cryptographic key for a given execution environment when needed. A random or pseudo-random number generator such as shift register) may be provided. The timing at which the keys are updated can be arbitrary, or can be in response to some predetermined event, or can be at the expiration of a fixed period of time or number of branch prediction events. . In some instances, the tag information for each branch target entry is stored in the clear, so no encryption or decryption is applied to the tag information. This can simplify tag comparison. Encrypting the branch information may be sufficient to reduce the probability of attacks such as those discussed above.
代替的に、分岐ターゲット・アドレスを示す分岐情報を暗号化することに加えて(又はその代わりに)、タグ情報は暗号化することができる。したがって、命令フェッチ・アドレスが分岐を含む命令のブロックを参照しているとして特定される場合、分岐ターゲット予測ルックアップでミスがあると、ターゲット・タグは、現在の実行環境に関連付けられる暗号化キーを使用して暗号化することができ、暗号化されたターゲット・タグは、割り当てられる分岐ターゲット・エントリについてのタグ情報として指定することができる。分岐ターゲット予測ルックアップにおいて、復号化回路が分岐ターゲット・エントリのサブセットのそれぞれのタグ情報を復号化することができ、分岐ターゲット予測回路は復号化されたタグ情報をターゲット・タグと比較することができる。代替的に、分岐ターゲットのルックアップから暗号化されたターゲット・タグは、分岐ターゲット予測構造に記憶される暗号化されたタグ情報と直接比較し、タグ同士が一致するかどうか特定することができ、復号化の必要性を回避する。 Alternatively, in addition to (or instead of) encrypting the branch information indicating the branch target address, the tag information can be encrypted. Thus, if an instruction fetch address is identified as referring to a block of instructions containing a branch, and a miss in the branch target prediction lookup, the target tag is the cryptographic key associated with the current execution environment. and the encrypted target tag can be specified as tag information for the assigned branch target entry. In a branch target prediction lookup, decoding circuitry can decode tag information for each of a subset of branch target entries, and branch target prediction circuitry can compare the decoded tag information with the target tags. can. Alternatively, the encrypted target tag from the branch target lookup can be compared directly with the encrypted tag information stored in the branch target prediction structure to determine if the tags match. , avoiding the need for decryption.
場合によっては、タグ及び分岐情報は、ある暗号化はタグに適用され別の暗号化は分岐に適用されて、別個に暗号化又は復号化することができ、この場合、タグの暗号化(所望であれば、暗号化された、又は復号化された形態で比較)を扱う手法のいずれかが使用され得る。しかしながら、他の実例では、タグ情報及び分岐情報は単一の暗号化スキームで共に暗号化することができる。暗号化された値が分岐情報及び環境特有の暗号化キーだけでなく、分岐に伴って与えられるタグ情報にも依存する場合(タグ情報は、分岐情報の暗号化についてさらなる乱雑さを与えることができる)、分岐情報に適用された暗号化を破ることが困難な場合があるため、これはさらなるセキュリティを与えることができる。しかしながら、この場合、一致エントリがあるかどうか確認するために、復号化されたタグがターゲット・タグと比較され得る前に、復号化回路はタグのブロック全体及びそれぞれのルックアップされたエントリの分岐情報を復号化する必要がある場合があるため、これは低速である可能性があり、もしそうであれば、復号化された分岐情報を出力することができる。 In some cases, the tag and branch information can be separately encrypted or decrypted, with one encryption applied to the tag and another applied to the branch, in which case the tag encryption (desired If so, any of the techniques that deal with comparisons in encrypted or decrypted form can be used. However, in other instances tag information and branch information can be encrypted together in a single encryption scheme. If the encrypted value depends not only on the branch information and the environment-specific encryption key, but also on the tag information supplied with the branch (tag information can add additional complexity to the encryption of the branch information). can), this can provide additional security as it may be difficult to break the encryption applied to the branch information. However, in this case, the decoding circuit must branch the entire block of tags and each looked-up entry before the decoded tag can be compared with the target tag to see if there is a matching entry. This may be slow as information may need to be decoded, and if so the decoded branch information can be output.
したがって、要約すると、暗号化/復号化のために遂行される手法、並びに分岐情報及びタグが暗号化される程度は、パフォーマンスとセキュリティとの所望のトレードオフに依存する可能性がある。 So, in summary, the technique followed for encryption/decryption and the extent to which branch information and tags are encrypted may depend on the desired trade-off between performance and security.
一般に、分岐ターゲット・アドレスを示すあらゆる情報を、分岐情報として使用することができる。いくつかの実例では、分岐情報(暗号化の前、又は復号化の後のクリアな状態で見た時)は明示的に分岐ターゲット・アドレスを示すことがある。分岐ターゲット・アドレスは、絶対アドレスとして、又は分岐ターゲット予測ルックアップが実施される現在の命令フェッチ・アドレスに対するオフセットを使用して相対アドレスとして示されることができる。いくつかの実例では、分岐ターゲット・アドレスは、分岐情報によって直接特定されなくてもよいが、分岐情報は分岐ターゲット・アドレスを特定する何らかの他の構造へのポインタを提供することができるか、又は分岐ターゲット・アドレスを計算するために使用することができる。したがって、一般に、分岐情報は、予測される分岐ターゲット・アドレスを決定できるようにする、あらゆる情報を含むことができる。 In general, any information that indicates a branch target address can be used as branch information. In some instances, the branch information (before encryption or when viewed in the clear after decryption) may explicitly indicate the branch target address. A branch target address can be indicated as an absolute address or as a relative address using an offset to the current instruction fetch address where the branch target prediction lookup is performed. In some instances, the branch target address may not be specified directly by the branch information, but the branch information may provide a pointer to some other structure that specifies the branch target address, or Can be used to calculate branch target addresses. Thus, in general, branch information can include any information that allows a predicted branch target address to be determined.
いくつかの実例では、分岐情報は分岐ターゲット・アドレス以外のあらゆる他の情報を指定しなくてもよい。しかしながら、いくつかの実例では、分岐情報は少なくとも1つの他の分岐情報をさらに示すことがあり、命令フェッチ・アドレスによって特定される1つ又は複数の命令のブロック内において分岐命令のいくつかの予測される性質を表現している。例えば、さらなる情報は、分岐が条件付きの分岐命令かどうか、分岐ターゲット・アドレスが分岐ターゲット予測構造とは別個の何らかの他の分岐ターゲット予測器を使用して予測されるべきかどうか(例えば、ターゲット・アドレスがその分岐に先行する過去の処理結果に応じて変化する多形(polymorphic)分岐のターゲットを予測するための分岐ターゲット予測器)、又は分岐がファンクション・コール若しくはファンクション・リターンを表現しているかどうかを指定することができる。そのような追加的な分岐情報は、分岐ターゲット・アドレスを特定する情報と共に暗号化/復号化することができる。 In some instances, the branch information may not specify any other information other than the branch target address. However, in some instances the branch information may further indicate at least one other branch information, and some predictions of branch instructions within a block of one or more instructions identified by the instruction fetch address. It expresses the nature of being For example, the additional information may be whether the branch is a conditional branch instruction, whether the branch target address should be predicted using some other branch target predictor separate from the branch target prediction structure (e.g., target a branch target predictor for predicting the target of a polymorphic branch whose address varies depending on past processing results preceding the branch), or where the branch represents a function call or function return; You can specify whether or not Such additional branch information can be encrypted/decrypted along with information specifying the branch target address.
ターゲット・タグは命令フェッチ・アドレスの性質の範囲に依存し得るが、一実例では、分岐ターゲット予測回路はターゲット・タグを、現在の実行環境に関連付けられる少なくとも1つの環境識別子に応じて決定することができる。これは異なる環境で生じる同一のアドレスについてなされた予測同士の偽陽性ヒットを回避することを助けることができる。例えば環境識別子は、アドレスに関連付けられる仮想マシンを識別する仮想マシン識別子、及び/又はアドレスに関連付けられるプロセスを識別するプロセス識別子を含むことができる。 Although the target tag may depend on the range of properties of the instruction fetch address, in one instance the branch target prediction circuit determines the target tag as a function of at least one environment identifier associated with the current execution environment. can be done. This can help avoid false positive hits between predictions made for the same address that occur in different environments. For example, the environment identifier can include a virtual machine identifier identifying a virtual machine associated with the address and/or a process identifier identifying a process associated with the address.
ターゲット・タグが現在の実行環境に関連付けられる少なくとも1つの実行環境識別子に依存する場合、実行環境同士の間でターゲット・タグ値の再利用があるべきではないことを期待するかも知れない。しかしながら、実際には、データ処理装置によって実行され得る多くの異なる環境があり得るが、情報を分岐ターゲット予測構造に記憶されて有する異なる環境の数は、いつでもずっと少なくなる可能性がある。ひいては、それぞれのエントリのタグ情報の完全な環境識別子を表現することは、大量のビット数を必要とすることがあり、実際にはこの情報の多くは冗長であり得るが、それは分岐ターゲット予測ルックアップの目的について、現在の実行環境を、分岐ターゲット予測構造でキャッシュされた分岐情報を現在有する他の実行環境と区別することだけが必要とされるため、また、現在の実行環境を分岐ターゲット予測構造内で表現される分岐情報を有していない他の環境と区別する必要がないためである。したがって、完全な環境識別子を記憶することは、不必要にそれぞれの領域エントリのサイズを大きくし、比較器の数がタグ情報のそれぞれのビットをターゲット・タグと比較するために必要とされ、回路エリアを大きくする。 If the target tag depends on at least one execution environment identifier associated with the current execution environment, one might expect that there should be no reuse of target tag values between execution environments. In practice, however, there may be many different environments that may be executed by the data processing apparatus, although the number of different environments having information stored in the branch target prediction structure may be much smaller at any given time. In turn, expressing the complete environment identifier in each entry's tag information can require a large number of bits, and in practice much of this information can be redundant, but it is a branch target prediction look. For the purposes of up, since it is only necessary to distinguish the current execution environment from other execution environments that currently have branch information cached in the branch target prediction structure, we also call the current execution environment a branch target prediction structure. This is because there is no need to distinguish it from other environments that do not have branch information represented within the structure. Therefore, storing the complete environment identifier unnecessarily increases the size of each region entry, the number of comparators required to compare each bit of tag information with the target tag, and the circuit Enlarge area.
したがって、回路エリア及び電力消費を削減するために、いくつかの実装形態は、複数の領域エントリを有する領域テーブルを提供することができ、それぞれの領域エントリは分岐コンテキスト情報を、分岐コンテキスト情報よりも少ないビットを含む領域識別子にマッピングする。分岐コンテキスト情報は、対応する実行環境に関連付けられる少なくとも1つの識別子を含むことができる。分岐ターゲット予測ルックアップを実施する際、ターゲット・タグは、現在の命令フェッチ・アドレスに関連付けられる領域テーブルによって分岐コンテキスト情報(少なくとも1つの識別子を含む)にマッピングされるターゲット領域識別子に基づいて決定することができる。それぞれの分岐ターゲット・エントリについてのタグ情報は、実行環境の識別子の代わりに領域識別子を指定することができる。したがって、領域テーブルは、実行環境識別子の大量のセット、及び分岐コンテキスト情報を特定するために使用されるあらゆる他の情報を、分岐ターゲット予測構造内でタグとして使用されるより短い識別子に圧縮してエリアを節約することを、効果的に可能にしている。 Thus, to reduce circuit area and power consumption, some implementations may provide a region table with multiple region entries, each region entry containing branch context information rather than branch context information. Maps to region identifiers containing fewer bits. Branch context information can include at least one identifier associated with the corresponding execution environment. When performing a branch target prediction lookup, the target tag is determined based on a target region identifier mapped to branch context information (including at least one identifier) by a region table associated with the current instruction fetch address. be able to. The tag information for each branch target entry can specify a region identifier instead of an execution environment identifier. Thus, the region table compresses a large set of execution environment identifiers, and any other information used to identify branch context information, into shorter identifiers that are used as tags within branch target prediction structures. It effectively makes it possible to save area.
そのような領域テーブルを使用する手法では、領域エントリの数は有限であり得るため、領域テーブルで割り当てられる対応する領域エントリをまだ有していない新しい実行環境に遭遇すると、以前異なる実行環境に割り当てられた領域エントリが現在の実行コンテキストについて再利用される必要がある場合がある。領域エントリが再利用される場合、対応する領域識別子は、依然として分岐ターゲット予測構造においてあるエントリについてのタグとして使用される場合がある。偽陽性ヒットを防ぐためにこれらの古くなった分岐ターゲット・エントリが分岐ターゲット予測構造から無効化されることがある一方で、そのような無効化を実施することは、再利用されている選択された領域識別子の情報を削除するために、分岐ターゲット予測構造をウォーク・スルーするための特殊な回路を必要とすることがあるため、パフォーマンス及び複雑性の観点からコスト高であり得る。実際には、あらゆるケースで、そのエントリに基づく分岐誤予測がある場合、古くなったエントリは削除されると期待されるため、このパフォーマンス・コストは正当化されない場合がある。したがって、領域テーブルを使用する実装形態は、領域テーブルの更新の際、分岐ターゲット・エントリを無効化しないようにする傾向があるため、分岐ターゲット予測構造で偽陽性ヒットとなりやすい。したがって、上で議論したような分岐情報の暗号化/復号化は、セキュリティを改善するために領域テーブルを使用する分岐ターゲット予測器について、特に有用である場合がある。 In such a region table approach, the number of region entries can be finite, so when a new execution environment is encountered that does not already have a corresponding region entry assigned in the region table, a previously assigned to a different execution environment will be assigned. A region entry that has been deleted may need to be reused for the current execution context. If a region entry is reused, the corresponding region identifier may still be used as a tag for the entry in the branch target prediction structure. While these stale branch target entries may be invalidated from the branch target prediction structure to prevent false-positive hits, performing such invalidation may prevent the reused selected Removing the region identifier information may require specialized circuitry to walk through the branch target prediction structure, which can be costly in terms of performance and complexity. In practice, this performance cost may not be justified, since in all cases an obsolete entry is expected to be removed if there is a branch misprediction based on that entry. Therefore, implementations using region tables tend not to invalidate branch target entries when updating the region table, which is prone to false positive hits in the branch target prediction structure. Therefore, encryption/decryption of branch information as discussed above may be particularly useful for branch target predictors that use region tables to improve security.
それぞれの実行環境に関連付けられる暗号化キーは、別個の記憶構造に記憶することができるが、領域テーブルが与えられると、それぞれの領域エントリが対応する実行環境に関連付けられる暗号化キーを指定すると効率的な場合がある。したがって、暗号化キーはターゲット領域識別子をルックアップするのと同時に領域テーブルから読み出され、別個の記憶構造の別個のルックアップの必要性を省くことができる。この手法は、すべての実行環境についての暗号化キーを記憶する必要がないことをさらに意味している。代わりに、キーは、領域テーブルによって領域識別子に現在マッピングされる特定の実行環境についてのみ維持され得る。他の実行環境については、分岐ターゲット予測構造に現在関与していないため、あらゆる暗号化キーを維持する必要がない。したがって、この手法は、記憶する必要があるキーの数をさらに低減することができる。 The encryption key associated with each execution environment can be stored in a separate storage structure, but given the region table, it is efficient if each region entry specifies the encryption key associated with the corresponding execution environment. There are some cases. Thus, the encryption key can be read from the region table at the same time as looking up the target region identifier, obviating the need for a separate lookup of a separate storage structure. This approach also means that there is no need to store encryption keys for every execution environment. Alternatively, keys may be maintained only for specific execution environments that are currently mapped to region identifiers by region tables. For other execution environments, there is no need to maintain any cryptographic keys, as they are not currently involved in branch target prediction structures. Therefore, this approach can further reduce the number of keys that need to be stored.
所与の実行環境に関連付けられる暗号化キーは、領域テーブルの所与の領域エントリによって与えられるマッピングがやはり更新される時に、更新され得る。つまり、領域テーブルの領域エントリが異なる実行環境に割り当てられなければならない時、マッピング更新後にその領域エントリに関連付けられる実行環境についての新しいキーを生成するために、その領域エントリについて指定された暗号化キーもやはり更新され得る。これは、ある環境に関連付けられる古いキーが新しい環境に対して同一なままとなることを防ぎ、ひいてはそれぞれの環境が異なるキーを使用することを確実にしている。 The encryption key associated with a given execution environment can be updated when the mapping given by a given realm entry in the realm table is also updated. That is, when a Region Entry in the Region Table must be assigned to a different Execution Environment, the encryption key specified for that Region Entry is used to generate a new key for the Execution Environment associated with that Region Entry after a mapping update. can also be updated. This prevents the old key associated with one environment from remaining the same for the new environment, thus ensuring that each environment uses a different key.
いくつかの実装形態では、領域テーブルによって領域識別子にマッピングされた分岐コンテキスト情報は、現在の実行環境を識別する1つ又は複数の実行環境識別子を含むことができるが、あらゆる他の情報を含むことができない。 In some implementations, the branch context information mapped to region identifiers by the region table may include one or more execution environment identifiers that identify the current execution environment, but may include any other information. can't
しかしながら、他の手法では、分岐コンテキスト情報は他の情報にもやはり依存することがある。例えば、分岐コンテキスト情報は、以前の分岐ターゲット予測ルックアップによって所与の領域エントリが領域テーブルに割り当てられた命令フェッチ・アドレスの部分をさらに含むことがある。したがって、命令フェッチ・アドレスの一部は、領域テーブルをルックアップし、対応する領域識別子を特定するために使用され、これは命令フェッチ・アドレスのその部分を、分岐ターゲット予測構造のそれぞれの分岐ターゲット・エントリに、タグ情報として記憶する必要を回避している。しばしば、命令フェッチ・アドレスの最上位部分は、所与の実行環境によって使用される多くのフェッチ・アドレスと同一である場合があり、特定の実行環境の所与の時間フレーム内で使用されるすべての命令フェッチ・アドレスにわたって使用される、その最上位部分について異なる値の数は、比較的少ないことがある。したがって、領域テーブル内の命令フェッチ・アドレスのこの部分を表現し、それを実行環境識別子と共に短い領域識別子に圧縮することによって、それぞれの分岐ターゲット・エントリに必要とされるタグ記憶の量、及びターゲット・タグを記憶されたタグ情報と比較するための比較ロジックの量を低減することができる。 However, in other approaches branching context information may also depend on other information. For example, the branch context information may further include the portion of the instruction fetch address where a given region entry was assigned to the region table by a previous branch target prediction lookup. Therefore, a portion of the instruction fetch address is used to look up the region table and identify the corresponding region identifier, which translates that portion of the instruction fetch address into the respective branch target of the branch target prediction structure. • Avoids the need to store tag information in entries. Often the most significant portion of an instruction fetch address may be the same as many fetch addresses used by a given execution environment, all used within a given time frame for a particular execution environment. The number of different values for its most significant portion used across instruction fetch addresses of may be relatively small. Therefore, by representing this portion of the instruction fetch address in the region table and compressing it into a short region identifier along with the execution environment identifier, the amount of tag storage required for each branch target entry, and the target • The amount of comparison logic for comparing tags to stored tag information can be reduced.
分岐ターゲット予測構造の他の形態は、所与の実行環境に関連付けられる実行環境識別子とは独立したタグを使用する可能性がある。例えば、分岐ターゲット予測構造のあるタイプを使用して、実行された以前の分岐に応じて挙動が変化する、ある分岐命令のターゲット・アドレスを予測することができる。例えば、所与の分岐命令の分岐ターゲット・アドレスは、例えばより前の条件付き命令の結果に応じて、それらの条件付き命令自身が分岐結果の過去の履歴に依存することがある、異なる可能な分岐ターゲット・アドレスの範囲の1つとして計算されることができる。そのような分岐ターゲット予測構造に関して、タグは命令フェッチ・アドレス、及び命令フェッチ・アドレスの命令に先行する以前の分岐命令の分岐結果の履歴に依存することがあるが、現在の実行環境の環境識別子とは独立していることができる。したがって、このタイプのタグでは、所与の命令アドレス及び分岐結果の履歴が異なる環境で生成された可能性があるため、タグのその値は複数の実行環境で再利用可能であることができる。異なる環境間の偽陽性ヒットに起因してvictim環境を攻撃者環境によって制御される何らかの命令アドレスへ強制的に分岐させようとする試行において、やはり、これは攻撃者に分岐ターゲット予測構造を、攻撃対象となる何らかのvictim環境で使用されると期待される所与の分岐履歴についての分岐情報でポピュレートさせる道筋を与える場合があり得る。上で議論したような分岐ターゲット予測構造において、分岐情報及び/又はタグ情報の暗号化(また、必要であれば復号化)を使用することによって、間違った環境の暗号化キーを使用して暗号化された分岐情報を復号化することは、攻撃者によって制御することができる既知のアドレスにたどり着く可能性が低いため、そのような攻撃をより困難にすることができる。 Other forms of branch target prediction structures may use tags independent of the execution environment identifier associated with a given execution environment. For example, one type of branch target prediction structure can be used to predict the target address of certain branch instructions that change behavior depending on the previous branch taken. For example, the branch target address of a given branch instruction may be different, depending on, for example, the results of earlier conditional instructions, which conditional instructions themselves may depend on the past history of branch outcomes. It can be calculated as one of a range of branch target addresses. For such branch target prediction structures, the tag may depend on the instruction fetch address and the history of branch outcomes of previous branch instructions preceding the instruction at the instruction fetch address, but the environment identifier of the current execution environment. can be independent of Thus, with this type of tag, the value of the tag can be reusable in multiple execution environments, as the history of a given instruction address and branch outcome may have been generated in different environments. In an attempt to force the victim environment to branch to some instruction address controlled by the attacker environment due to false-positive hits between different environments, this again gives the attacker a branch target prediction structure, It may provide a path to be populated with branch information for a given branch history that is expected to be used in some victim environment of interest. By using encryption (and decryption if necessary) of branch information and/or tag information in branch target prediction structures as discussed above, Decrypting encrypted branch information can make such an attack more difficult because it is less likely to reach known addresses that can be controlled by the attacker.
図1は、複数のパイプライン工程を含む処理パイプラインを有するデータ処理装置2の実例を概略的に図示している。パイプラインは、分岐命令の結果を予測するため、及びフェッチされる命令の一連のフェッチ・アドレスを生成するための、分岐予測器4を含む。フェッチ工程6は、フェッチ・アドレスによって特定された命令を命令キャッシュ8からフェッチする。デコード工程10は、フェッチされた命令をデコードして、パイプラインの後続の工程を制御するための制御情報を生成する。リネーム工程12は、レジスタのリネームを実施して、命令によって特定されたアーキテクチャ上のレジスタ指定子をハードウェアに設けられたレジスタ14を特定する物理レジスタ指定子にマッピングする。レジスタのリネームは、アウトオブオーダー実行をサポートするために有用である場合があるが、これにより、同一のアーキテクチャ上のレジスタを指定する命令間の障害を、それらをハードウェア・レジスタ・ファイル内の異なる物理レジスタにマッピングすることにより除去できるからであり、命令がキャシュ8からフェッチされた際のそのプログラム順とは異なる順で実行することができる見込みを高め、オペランドが利用可能になるのを前方の命令が待機している間に後方の命令が実行できるようにすることによってパフォーマンスを改善することができる。アーキテクチャ上のレジスタを異なる物理レジスタにマッピングする機能は、分岐誤予測が起こった場合にアーキテクチャ的な状態のロール・バックをさらに促進できる。発行工程16は、実行待ちの命令を、それらの命令を処理するために必要とされるオペランドがレジスタ14で利用可能になるまでキューイングする。実行工程18は、対応する処理演算を実行するための命令を実行する。ライトバック工程20は、実行された命令の結果をレジスタ14に書き戻す。
FIG. 1 schematically illustrates an example of a
実行工程18は、分岐命令が正しく予測されていたかどうかを評価するための分岐ユニット21、算術又は論理演算を実施するための算術論理ユニット(ALU:arithmetic logic unit)22、浮動小数点オペランドを使用する演算を実施するための浮動小数点ユニット24、及びメモリ・システムからのデータをレジスタ14にロードするためのロード演算、又はレジスタ14からのデータをメモリ・システムに格納するためのストア演算を実施するためのロード/ストア・ユニット26などの複数の実行ユニットを含むことができる。この実例では、メモリ・システムは、レベル1命令キャッシュ8、レベル1データ・キャッシュ30、データと命令との間で共有されるレベル2キャシュ32、及びメイン・メモリ34を含むが、これは可能なメモリ・ヒエラルキの一実例に過ぎず、他の実装形態ではさらなるキャシュのレベル又は様々な配置構成を有することができることを了解されたい。ロード/ストア・ユニット26は、トランスレーション・ルックアサイド・バッファ36を使用することがあり、フェッチ・ユニット6はトランスレーション・ルックアサイド・バッファ37を使用して、パイプラインによって生成される仮想アドレスをメモリ・システム内の位置を特定する物理アドレスにマッピングすることができる。図1に示されるパイプラインは一実例に過ぎず、他の実例はパイプライン工程又は実行ユニットの様々なセットを有する場合があることを了解されたい。例えば、インオーダ・プロセッサはリネーム工程12を有していないことがある。
The
図2は、割り当てられる新しい分岐予測状態エントリを生成するために分岐予測器4へ入力を与える実例を図示している。入力には複数ビットが含まれる。例えば、この実例の入力は、分岐として特定された命令の命令アドレス、及び分岐が実行される時に分岐先のアドレスを示す分岐デスティネーション・アドレス(ターゲット・アドレス)を指定する。コーディング回路52は、一連の命令が実行されている現在の実行環境に関連付けられる値54に基づいて、入力の少なくとも一部のビットに対するエンコード演算を実施するために提供される。エンコード演算から得られるエンコードされた入力値は、次いで分岐予測回路4に与えられる。例えば、エンコードは、入力の命令アドレス又はデスティネーション・アドレスの一方又は両方の、すべて又は一部に適用することができる。
FIG. 2 illustrates an example of providing inputs to branch predictor 4 to generate new branch prediction state entries to be assigned. The input contains multiple bits. For example, the inputs in this example specify the instruction address of an instruction identified as a branch, and a branch destination address (target address) that indicates the address to which the branch will be taken when it is taken. A
図3A~図3Cは、エンコード演算を実施する異なる実例を図示している(実例図3A及び図3Bでは、分岐のデスティネーション・アドレスの一部に適用されているが、実例図3Cのように命令アドレスに適用することもできる)。図3A~図3Cで示されるように、入力アドレスの一部のビットはエンコード演算を残りのビットに適用される前に除去することができる。図3Aでは、現在の実行環境(又は現在の実行パーミッション)に関連付けられる値から導出されたキーに基づいて、残りのビットの相対的順序の再配置が実施される。例えば、キーによって指定されるビット数分の右シフト、又は何らかの他のビットの並べ替えを実施することができる。図3Bの実例では、エンコード演算は、キーと分岐予測器への入力の選択されたビットとのXORとして実施される。XORは、対応するキーに基づいてさらなるXORを実施することにより逆エンコード演算を実施することができる、可逆的なエンコード演算の実例である。図3Cの実例では、キーに基づいて選択された入力のビットにハッシュ関数を適用することができる。キーはエンコードされる選択されたビットと同じビット数を含む必要はないことに留意されたい。一般に、適用されるエンコードの特定の形態に関わらず、入力の一部の値は、エンコードされる入力を分岐予測回路に与える前に変更されたそのビット値を有している。デスティネーション・アドレスのエンコードを示している図3A及び図3Bの実例では、除去されたビットは、逆エンコードを適用する時にその値が推論され得るか、又は知られている、ビットである場合がある。例えば、命令が既にそれらのサイズにアラインされている場合、アドレスの1つ又は複数の下位ビットを、常にそれらがゼロであるように除去することができる。同様に、デスティネーション・アドレスが命令アドレスからのオフセットとして表現されている場合、上位ビットは常にゼロである可能性があるため、逆エンコードを適用する際それらを復元する必要性がないことからコーディングを適用する前に除去することができる。対照的に、命令アドレスのエンコードについて、この手法では逆エンコードが必要ではなく、また変形は一方向変形であり得るため、除去されたビットが逆エンコードによって復元され得ることを確実にする必要がない。 Figures 3A-3C illustrate different examples of implementing the encoding operation (in example Figures 3A and 3B it is applied to part of the destination address of the branch, but as in example Figure 3C can also be applied to instruction addresses). As shown in FIGS. 3A-3C, some bits of the input address can be removed before the encoding operation is applied to the remaining bits. In FIG. 3A, a rearrangement of the relative order of the remaining bits is performed based on keys derived from values associated with the current execution environment (or current execution permissions). For example, a right shift by the number of bits specified by the key, or some other bit permutation may be performed. In the example of FIG. 3B, the encoding operation is implemented as an XOR of the key and selected bits of the input to the branch predictor. XOR is an example of a reversible encoding operation where the reverse encoding operation can be performed by performing a further XOR based on the corresponding key. In the example of FIG. 3C, a hash function can be applied to bits of the input selected based on the key. Note that the key need not contain the same number of bits as the selected bits to be encoded. In general, regardless of the particular form of encoding applied, some values of the input will have their bit values modified before the input to be encoded is presented to the branch prediction circuit. In the examples of FIGS. 3A and 3B showing encoding of the destination address, the removed bits may be bits whose values can be inferred or known when applying the inverse encoding. be. For example, if the instructions are already aligned to their size, one or more low order bits of the address can be removed so that they are always zero. Similarly, if the destination address is expressed as an offset from the instruction address, the high-order bits may always be zero, so there is no need to restore them when applying the reverse encoding. can be removed before applying. In contrast, for encoding instruction addresses, this approach does not require reverse encoding, and since the transformation can be a one-way transformation, there is no need to ensure that the removed bits can be restored by reverse encoding. .
図4A~図4Bは、所与の命令アドレスを指定するクエリに応答して予測された分岐情報を取り出すために分岐予測回路をクエリする2つの実例を示している。図2のコーディング回路52が、エンコード演算を分岐のデスティネーション・アドレスの少なくとも一部のビットに適用する実例において、図4Aが使用され得る。この実例では、分岐予測がなされる命令アドレスを指定する分岐予測回路に、クエリが与えられる。分岐予測回路4は、その記憶構造のルックアップを実施して、いずれかのエントリがクエリに一致するかどうかを特定し、あるエントリが一致する場合、エンコードされたデスティネーション・アドレス(現在の実行環境に関連付けられる値54に基づいてコーディング回路52によって生成された)が取り出され、出力される。逆エンコード回路56(いくつかの実施例ではコーディング回路52と同一である場合があり、又は実装されるエンコード/デコードのアルゴリズムに応じて異なっていてもよい)は、(図2のように)一致する分岐予測エントリが分岐予測回路に書き込まれた時点ではなく分岐予測回路のクエリが実施された時点の現在の実行環境54に関連付けられるパラメータに基づいて再計算されていることを除いて、図2で使用された現在の実行環境54に関連付けられる値と同じ方法で形成される再計算キー58に基づいて、エンコードされるデスティネーション装置へ逆エンコード演算を適用する。したがって、クエリがエントリを割り当てたのと同一の実行環境によってトリガされた後に一致エントリがアクセスされる場合、逆エンコード回路56によって出力される得られるデスティネーション・アドレスは、図2で入力として元々与えられたデスティネーション・アドレスと同一となる。しかしながら、一致エントリがそのエントリを割り当てたのとは異なる実行環境からアクセスされる場合、デコードされるデスティネーション・アドレス60は元々割り当てられたものとは異なる。エンコード/逆エンコードのアルゴリズム、及び/又はキー(若しくはキーを生成するために使用される方法)は、攻撃者が逆エンコードされたアドレス60(アドレスをエンコードしたのとは異なるキーを使用して逆エンコードされる場合)を、攻撃者が一部の他の実行環境を分岐させたい所望の分岐ターゲット・アドレスに一致させるためにデスティネーション・アドレスのどの代替的な値を図2で入力として与えるべきかを予測することを困難にするよう選択することができる。
Figures 4A-4B show two examples of querying the branch prediction circuit to retrieve predicted branch information in response to a query specifying a given instruction address. FIG. 4A may be used in an example where
図4Bは、エンコード演算がコーディング回路52によって命令アドレス(又は、分岐予測回路4で一致エントリを位置付けるために使用される他のタグ情報)に適用される実例において分岐予測回路4をクエリするために使用される代替的な手法を示している。この場合、分岐情報の検索を実施するために分岐予測回路4をクエリする際、対応するコーディング回路52(図2で使用されるものと同一の物理回路である可能性があり、又は異なる回路である可能性がある)は、同一のエンコード演算を、現在の実行環境に関連付けられる識別子に基づいて再計算された再計算キー58(分岐予測器にクエリする時点で再計算される)に基づいてクエリされた命令アドレスに適用し、例えば、キーにしたがって命令アドレスをエンコードするために一方向ハッシュを適用する。この手法では、分岐予測回路4から出力されたデータはエンコードされる必要がなく、代わりに分岐予測器へ入力として与えられるクエリと、クエリに一致すると思われる分岐予測器での位置とのマッピングをスクランブルすることによって攻撃に対する耐性が提供されるため、可逆的な演算を使用することは必須ではない。したがって、分岐予測回路4は、ハッシュ化されたクエリ情報に基づいて検索され、一致エントリから出力されるデスティネーション・アドレス62は、あらゆる逆エンコードを適用されることなくクリアな状態で出力され、クエリ入力として与えられる命令アドレスによって表現される分岐のための予測される分岐ターゲット・アドレスとして使用され得る。
FIG. 4B illustrates the encoding operation applied by coding
図5は、現在の実行環境に関連付けられる複数の識別子からキーを形成する実例を示している。これらの識別子は、処理パイプライン2に関連付けられる1つ又は複数の制御レジスタから取得することができ、これらは現在の実行環境の性質を指定する。例えば、キーは以下のいずれかに基づくことができる:
・例外レベル79
・実行特権レベル80
・アドレス空間ID(ASID)81
・仮想マシンID(VMID)82
・セキュリティ状態(NS)83
・物理コア数84
・論理コア数85
・真の乱数、又は疑似乱数であり得る、乱数値86。(疑似)乱数は、それぞれの論理プロセッサに関して異なる論理プロセッサごとの(疑似)乱数89、それぞれの物理プロセッサ・コアに関して異なる物理プロセッサごとの(疑似)乱数90、及びデータ処理システム内のすべての論理又は物理プロセッサ・コア間で共有されるが、あるシステム上でのキー・ブレイクが別のシステムで再利用され得る機会を低減するためにシステムごとに異なっている、システム(疑似)乱数91、のうちの少なくとも1つから導出することができる。(或いは、これらのうちの任意の1つ又は複数)。乱数のこれらの要素89、90、91のそれぞれは、データ処理装置2がスタート・アップする都度、更新され得る。
・1つ又は複数のソフトウェア書き込み可能レジスタ値87、エンコード演算についてさらなる乱雑さを与えるためにソフトウェアの制御下でレジスタ14に書き込むことができる。
・コンテナID86(最も制限されるアクセス権を有する最低の特権レベルにある実行環境の異なる部分を区別する識別子)。
FIG. 5 shows an example of forming a key from multiple identifiers associated with the current execution environment. These identifiers can be obtained from one or more control registers associated with
・
・
- Address space ID (ASID) 81
- Virtual machine ID (VMID) 82
- Security status (NS) 83
・84 physical cores
・85 logical cores
• A
• One or more software writable register values 87, which can be written to the
• Container ID 86 (an identifier that distinguishes different parts of the execution environment at the lowest privilege level with the most restricted access rights).
もちろん、特定の実装形態について、これらのパラメータのすべてを考慮する必要はない。一般に、現在の実行環境に関連付けられる1つ又は複数の識別子80~85、88に基づいて、また任意選択でソフトウェア定義値である乱数などのさらなるパラメータに基づいて、エンコード演算(及び、必要であれば逆エンコード演算)用のキーを生成することによって、異なる特権レベルを有する2つの異なる実行環境は、同一のキーを有する可能性は低く、そのため攻撃者がある実行環境において、多くのデータ・アクセス特権を有する実行環境を騙してセキュアなデータの露出を導き得る悪意のあるコードへ分岐させるように分岐予測器を訓練することが困難である。さらには、(疑似)乱数値をキー生成プロセスに追加することにより、攻撃者がどのキーかを決定することがなお困難となる。特に、乱数値を使用することは、攻撃者があるシステムに対して完全なアクセスを有していたとしても、リバース・エンジニアリングによって得られたいかなる情報も、(疑似)乱数値が異なるために別のシステムに使用されるキーを予測するために使用することができないことを意味している。同様に、それぞれの論理プロセッサ・コアでそれぞれの実行環境ごとに生成された異なるキーを有することが望ましい場合がある。複雑さとパフォーマンス上の理由から、論理プロセッサごとに別個の(疑似)乱数生成器を有することが望ましくない場合がある。この場合、キー生成プロセスにおいて、論理及び/又は物理コア数を伴う、プロセッサごと又はシステム・レベルごとの(疑似)乱数を使用することによって、同一の結果を得ることが可能な場合がある。いくつかの実施例では、キー生成プロセスは、様々なキー入力を共にハッシュ化することを含む場合がある。使用されるハッシュ化アルゴリズムは、(セキュアな)一方向ハッシュであり得る。 Of course, it is not necessary to consider all of these parameters for a particular implementation. Encoding operations (and, if necessary, By generating the key for the reverse encoding operation), two different execution environments with different privilege levels are unlikely to have the same key, so an attacker can gain many data accesses in one execution environment. It is difficult to train a branch predictor to trick a privileged execution environment into branching to malicious code that can lead to exposure of secure data. Furthermore, by adding a (pseudo-)random value to the key generation process, it is still difficult for an attacker to determine which key. In particular, using random values means that even if an attacker had complete access to a system, any information obtained by reverse engineering would be different because the (pseudo)random values would be different. This means that it cannot be used to predict the keys that will be used in other systems. Similarly, it may be desirable to have different keys generated for each execution environment on each logical processor core. For complexity and performance reasons, it may not be desirable to have a separate (pseudo-)random number generator for each logical processor. In this case, it may be possible to obtain the same result by using per-processor or per-system-level (pseudo-)random numbers with the number of logical and/or physical cores in the key generation process. In some embodiments, the key generation process may include hashing together various key inputs. The hashing algorithm used can be a (secure) one-way hash.
つまり、いくつかの実例では、キーは少なくとも1つのキー入力パラメータに適用される一方向変形に基づいていることがあり、この場合、少なくとも1つのキー入力パラメータは、現在の実行環境に関連付けられる少なくとも1つの値を含むが(例えば、ASID、VMID、又は上で議論した例外レベル)、ソフトウェア書き込み可能値の乱数などの他の入力を含むこともできる。キーを生成するために一方向変形を使用することによって、これは攻撃者が1つを除くすべての入力を観察でき、アルゴリズムを知っており、また生成されたキーのいくつかを観察できたとしても、攻撃者が欠落している入力(例えば、乱数)が何であるかを理解することができないことを意味しており、ひいては攻撃者が異なる実行環境用のキーが何であるかを予測することができないことを意味している。 That is, in some instances a key may be based on a one-way transformation applied to at least one key-in parameter, where the at least one key-in parameter is at least Although it contains one value (eg, ASID, VMID, or the exception level discussed above), it can also contain other inputs, such as random numbers of software writable values. By using a one-way transformation to generate the keys, this is possible even if an attacker could observe all but one of the inputs, know the algorithm, and observe some of the generated keys. also means that an attacker cannot figure out what the missing input (e.g. a random number) is, and thus cannot predict what the keys are for different execution environments. means that you cannot
図6は、フェッチ工程6が遭遇する命令フェッチ・フォールト、及び/又はデコード工程10が遭遇する命令デコード・フォールトのレートを監視するために監視回路95が設けられる実例を示している。フェッチ・フォールトのレートとデコード・フォールトのレートとは、別個に監視されてもよく、又は組み合わされたレートとして監視されてもよい。また、いくつかの実例では、これらのタイプのフォールトのうち1つだけが監視されてもよい(例えば、フェッチ・フォールトのみ、又はデコード・フォールトのみ)。フェッチ及びデコード・フォールトは様々な理由で発生することがあるが、1つとしては分岐予測器4による分岐誤予測を挙げることができる。攻撃者が分岐予測器を使用して上で議論したような攻撃をさせるよう試行する場合、より頻繁な分岐誤予測がある可能性がある。したがって、命令フェッチ及びデコード・フォールトのレートを、攻撃が仕掛けられているかのヒントを与え得るインジケータとして使用することができる。監視回路95は、一定のしきい値による所与の期間において命令フェッチ又はデコード・フォールトのレート数の増加が検出された場合、エラー応答をトリガする(割り込み又は例外を発生させるなど)ことができる。図7は、連続的な時間の持続時間Tにおいて、命令フェッチ・フォールトのレートを集計するグラフを示している。図7に示すように、命令フェッチ・フォールトのレートにおける増加が、ある期間から次の期間の間に、しきい値(例えば、20%)を上回って増加している場合、フォールト・ハンドリング応答がトリガされ得る。当業者であれば、本発明の範囲内で攻撃を検出するためにフォールト・レートを使用する多くの方法があることが了解されよう(例えば、所定のしきい値と比較する、又はプログラムの以前の実行のフォールト・レートと比較する)。ソフトウェアがそのような例外に対してどのように応答するよう選択するかは、変わることがあるが、これは攻撃が進行中であることをソフトウェアに伝達する手段を提供する。
FIG. 6 illustrates an example in which
図8は、分岐予測器4の別の実例を概略的に図示しており、分岐命令が遂行されるか、遂行されないかを予測するための分岐方向予測器(BDP:branch direction predictor)140、遂行される場合に分岐命令がプログラムの実行をリダイレクトする先のターゲット・アドレスを予測するための分岐ターゲット・バッファ(BTB:branch target buffer)142、及びキャシュ8からフェッチされるプログラム命令のブロックを特定するフェッチ・アドレスをキューイングするためのフェッチ・キュー144(場合によっては、フェッチ・キューは分岐予測器4の一部の代わりにフェッチ工程6の一部と見なされることがあるが、機能性は同一であることに留意されたい)を含む。フェッチ・キュー144に配置されるアドレスは、命令キャッシュ8からフェッチされる命令のブロックのアドレスを表現しており、分岐予測器の以前の予測から導出される。キャシュ8から1ブロックでフェッチされる命令の単位は、「フェッチ・ブロック」と称されることがあり、一定のデフォルトのサイズ、例えば、16、32、又は64バイトを有することができるが、場合によっては、フェッチが実施される開始アドレスが自然なフェッチ・ブロック境界とアラインしていない場合、デフォルトのサイズよりも小さなサイズで部分的なフェッチ・ブロックのフェッチが実施される場合がある。
FIG. 8 schematically illustrates another example of a branch predictor 4, a branch direction predictor (BDP) 140 for predicting whether a branch instruction will be taken or not taken; A branch target buffer (BTB) 142 for predicting the target address to which the branch instruction will redirect program execution if taken, and a block of program instructions to be fetched from
分岐履歴バッファ又は分岐結果予測器とも称されることがあるBDP140は、分岐命令が、遂行される/遂行されない、の結果を予測するための分岐履歴情報を記録する。あらゆる既知の分岐が遂行される/遂行されない、の予測スキームが、BDP140のために使用され得る。例えば、gshare又はTAGEが、既知の分岐方向予測アルゴリズムの実例である。
BTB142は、分岐命令について命令アドレスの一部に対応するタグによって特定された複数の分岐命令についての予測情報を保持している(また、可能性としては、コンテキスト識別子、又は現在の実行環境の他の識別子などの他の情報に依存する)。予測情報は、分岐についてのターゲット・アドレス、並びに対応する分岐命令の命令アドレス(プログラム・カウンタ、すなわちPC(program counter))、分岐に関するいくつかの属性(例えば、間接的、条件無し、ファンクション・コール、ファンクション・リターン、・・・かどうか)などの他の情報、又は以下で説明するような分岐の結果を予測するための他の情報を示すことができる。
分岐予測器4は、多形である分岐命令のターゲット・アドレスを予測するために使用される特殊な種類の分岐ターゲット・バッファである、マルチターゲット分岐のターゲット予測器146をさらに含み、つまりそれらの分岐ターゲット・アドレスは時々変化するため、同一の命令フェッチ・アドレスにおける分岐命令の実行の異なるインスタンスは、分岐を進める以前の命令の結果に応じて異なるターゲット・アドレスとなる場合がある。BTB142及びマルチターゲット間接分岐ターゲット予測器146の両方は、分岐ターゲット予測構造の実例である。さらに、分岐予測器4は、コンテキスト識別子を、BTB142用のタグ情報として使用される短い領域識別子に圧縮するために使用される領域テーブル148を備える。
Branch predictor 4 further includes a multi-target
フェッチ工程6が、命令キャッシュ8から命令のブロックをフェッチするために、所与のフェッチ・アドレスについて新しいフェッチを開始する時、分岐予測器4は、BDP140、BTB142及びマルチターゲット分岐のターゲット予測器146において、そのフェッチ・アドレスをさらにルックアップする。BTB142が、現在のフェッチ・アドレスによって表現されるプログラム・カウンタ・アドレスについての分岐ターゲット・アドレスを含む予測された分岐情報を保持する場合、その情報は、BTB142から読み出され、BDP140によって認められる。ルックアップは、分岐予測制御ロジック150によって制御することができる。BDP140によって、分岐が遂行されないと予測される場合、分岐予測制御ロジック150は、次のフェッチ・アドレスとして、加算器152によって一定のストライド量の分、インクリメントされた現在のフェッチ・アドレスのインクリメントされたバージョンを選択し、それによって以降のサイクルで使用される次のフェッチ・アドレスは、現在のフェッチ・アドレスから順次続いていく。一方で、BDP140が、分岐が遂行されると予測される場合、分岐予測制御ロジック150は次のフェッチ・アドレスとして、BTB142によって出力される予測された分岐ターゲットを選択する。いくつかの命令フェッチ・アドレスについて、BTB142は、アドレスが以前に多形であるとして検出された分岐を含む命令のブロックを参照することを示す属性を出力することがあり、この場合、多形の分岐属性は分岐予測制御ロジック150を制御して、マルチターゲット分岐のターゲット予測器146によって出力される分岐ターゲット・アドレスを、BTB142の出力の代わりに、次のフェッチ・アドレスとして選択する。マルチターゲット分岐のターゲット予測器は、その予測されたターゲット・アドレスを、現在の命令フェッチ・アドレスによって特定される現在の実行ポイントに先行する昔の分岐の分岐履歴を元にしており、分岐履歴とは無関係なBTB142によってなされる予測とは対照的である。
When fetch
分岐予測制御ロジック150によって出力される次のフェッチ・アドレスは、フェッチ・キュー144に割り当てられ、それによって、やがてアドレスがキューの手前に到達すると、フェッチ工程6によって対応する命令のブロックが命令キャッシュ8からフェッチされる。さらに、次のフェッチ・アドレスは、そのフェッチ・アドレスについての分岐予測器4の別のルックアップをトリガするために、以降の処理サイクルにおいて現在のフェッチ・アドレスとして入力される。このプロセスは、実行中のプログラム・コードをステップ実行するために、サイクルごとに続く。分岐ユニット21で分岐誤予測が検出された場合、分岐命令の実際の結果が分岐予測器4によって生成された予測された結果と異なる時、信号がフェッチ工程6に送信し戻され、フェッチ・キューをリセットして実際の分岐ターゲット・アドレスからのフェッチを再開し、将来的に予測が正しい可能性を高めるべく分岐の実際の結果に基づいて様々な予測構造140、142、146の内容を更新する。
The next fetch address output by branch
要約すると、BTB142(分岐ターゲット・アドレス・キャッシュ(BTAC:branch target address cache)としても知られることがある)は、分岐の予測されるターゲット・アドレスを特定するために使用される分岐予測器4の構成要素である。したがって、BTBは事実上、それぞれのエントリが分岐位置(分岐命令の、プログラム・カウンタ、又は分岐命令アドレス)、分岐についての予測されたターゲット・アドレス、及び可能性としては分岐が条件付きかどうか、また例えば分岐がファンクション・コール又はファンクション・リターンを表現しているかどうかを指定する属性などの他の傾向を与える、小さなエントリのキャッシュであることができる。異なる実行コンテキスト(例えば、プロセッサ2又は異なる仮想マシンによって実行中の、異なるプロセス)は異なる分岐を参照するために同一の仮想アドレスを使用することがあるため、不必要なアドレス衝突を回避するためにそれぞれのBTBエントリは、プロセス識別子及び/又は仮想マシン識別子などのコンテキスト情報でタグ付けされてもよい。
In summary, the BTB 142 (sometimes known as the branch target address cache (BTAC)) is the branch predictor 4's cache used to identify the predicted target address of a branch. It is a component. Thus, the BTB effectively contains each entry containing the branch location (of the branch instruction, program counter, or branch instruction address), the predicted target address for the branch, and possibly whether the branch is conditional, It can also be a cache of small entries giving other characteristics such as an attribute specifying whether a branch represents a function call or a function return. To avoid unnecessary address collisions, since different execution contexts (e.g., different processes running by
図9は、領域テーブル148を使用しない実施例における、BTBの実装形態を示している。この実例では、BTB142は、それぞれのエントリ156がBTBルックアップの際そのエントリが現在のフェッチ・アドレスに関連するか特定するためのタグ情報を与えるタグ部分158を含む複数のエントリ156と、分岐ターゲット・アドレス166及び現在の対応する分岐に関連付けられるあらゆる他の情報168を含む予測された分岐情報を与えるデータ部分160とを含む。この実例では、タグ部分158は、タグ情報として、対応する分岐が実行され命令フェッチ・アドレス164が分岐に対応している(命令のブロックのプログラム・カウンタが分岐を含んでいる)実行環境(コンテキスト)を識別する1つ又は複数の実行環境識別子162を指定する。データ部分は、分岐ターゲット・アドレス166、及び分岐が条件付き、ファンクション・コア、ファンクション・リターンなどかどうかを指定する属性などの他の情報168を含む。
FIG. 9 shows an implementation of the BTB in an embodiment that does not use region table 148. FIG. In this example, the
いくつかの実装形態では、データ部分160は、(図9には図示していないが)分岐アドレス164の最下位ビットをさらに含むことができる。これは、複数の命令がサイクルごとに実行される、スーパスカラのプロセッサで有用である場合があり、この場合、分岐予測器4は複数命令のブロックを並列に予測する必要があるため、それぞれのエントリが命令のブロックにマッピングする場合がある。命令フェッチ・アドレスの最下位ビットは、ブロック内のあらゆる命令がエントリに対して一致できるよう、タグ部分158から排除されることがある。しかしながら、所与のエントリによって表現されるブロックからの命令フェッチ・アドレスが入力されても、命令フェッチ・アドレスがそのエントリに関連付けられるブロックで発生する最後の分岐のアドレスよりも後方である場合、その命令フェッチ・アドレスの後で分岐は発生せず、そのためその分岐に関連付けられる分岐予測は実行されるべきではない。したがって、分岐ターゲット・アドレス・エントリ156のデータ部分160で分岐アドレスの最下位ビットを含むことにより、これはBTB142でルックアップされた現在の命令フェッチ・アドレスが与えられた場合、一致エントリによって表現される予測が実行されるべきかどうかの判断を可能にする。
In some implementations,
BTBに与えられるキャッシュは、様々な方法で実装することができる。いくつかの実例では、キャッシュは、所与の分岐についての分岐情報がBTB内のあらゆる場所に配置できるように、fully associativeであることができる。しかしながら、実際にはset-associativeキャッシュの実装形態がより効率的である場合があり、この場合、所与の分岐についての分岐情報を記憶できる場所は、分岐ターゲット・バッファのルックアップの間に所与のフェッチ・アドレスについてルックアップされなければならないエントリの数を低減するために、特定のセット(分岐を含む命令ブロックの命令フェッチ・アドレスに基づいて特定される)に限定される可能性がある。 The cache provided in the BTB can be implemented in various ways. In some instances, a cache can be fully associative such that branch information for a given branch can be placed anywhere within the BTB. In practice, however, a set-associative cache implementation may be more efficient, in which case the branch information for a given branch can be stored during a branch target buffer lookup. May be limited to a specific set (identified based on instruction fetch addresses for instruction blocks containing branches) to reduce the number of entries that must be looked up for a given fetch address .
典型的には、十分に高いパフォーマンスを提供するために十分な分岐情報を記憶することができるように、BTBは比較的多数、例えば数千のエントリを有することができる。しかしながら、実際には、1つの実行コンテキストはそのコンテキストの多くの命令についてキャッシュされた分岐情報を有することができるため、所与の時間にBTBに記憶された情報を有するコンテキストの数は例えば最大10などずっと少ない可能性がある。やはり、所与のコンテキストに関連付けられる分岐命令の多くは、分岐命令アドレス164の上位の部分について同一の値をすべて共有することができる。このことは、図3に示される方法で実装されている場合、識別子の完全なコンテキストを明示的に示しているため、タグ情報158が大量の冗長な情報を含むことがあることを意味しており、完全な分岐命令アドレスはタグ158について比較的多数のビットを必要とする場合があり、BTB142に必要な回路エリアを増加させ、BTB142のルックアップ中にタグの比較に必要とされる比較器の数も増加させる。
Typically, the BTB can have a relatively large number of entries, eg thousands, so that it can store enough branch information to provide sufficiently high performance. However, in practice, one execution context can have branch information cached for many instructions in that context, so the number of contexts with information stored in the BTB at a given time can be up to, for example, 10. and possibly much less. Again, many of the branch instructions associated with a given context may all share the same value for the high portion of
図10に示すように、BTBのエリア効率を改善するために、分岐予測器4は、領域テーブル148を使用してこの冗長な情報を短いタグ値に圧縮することができる。図10の実例では、BTBのそれぞれのエントリ156は、やはりタグ部分158及びデータ部分160を有しており、データ部分160は図9と同一である。しかしながら、BTB152内でタグ158の実行コンテキスト識別子162及び完全な分岐命令アドレス・タグ164を表現する代わりに、タグ部分は代わりに分岐命令アドレスのタグ部分の下位部分169、並びにコンテキスト識別子162及び分岐命令アドレスの上方部分167を指定する領域テーブル内の対応する領域エントリ170を指す領域識別子171のみを指定する。図10では、それぞれの領域エントリ170に領域識別子は明示的に示されていないが、対応する領域エントリ170のインデックスから暗示されていることに留意されたい(例えば、領域テーブルの第1のエントリは領域識別子#0に関連付けられ得、次のエントリは領域識別子#1に関連付けられ得るなど)。領域テーブル148は、BTB142よりずっと小さい場合があり、例えば10から100の間のエントリを有し、図10の実例で例えば32などである。BTB142をルックアップする時、現在の実行コンテキスト及びプログラム・カウンタの上方ビット(例えばビット48~21)を特定する1つ又は複数のコンテキスト識別子が、領域テーブル内でルックアップされ、対応する領域識別子を特定し、次いで領域識別子及びプログラム・カウンタのタグ・ビットの下位部分(例えばビット20~16)がBTB142をルックアップするためのタグ情報として使用される。プログラム・カウンタの最下位ビット(例えば15~0)は、set associativeのBTB142の対応するセットにインデックス付けするために使用されるビットであるため、タグでは全く使用されないことに留意されたい。したがって、領域テーブル148によって、BTBエントリ156のタグ部分158のサイズを小さくすることができる。これは、BTB142をルックアップする目的のために、現在の実行コンテキストをすべての他の実行コンテキストと区別することは必須ではなく、代わりに必要なことは現在の実行コンテキストをBTB142で分岐情報を現在有しているあらゆる他の実行コンテキストと区別することである、という事実を活用している。
To improve the area efficiency of the BTB, branch predictor 4 can use region table 148 to compress this redundant information into short tag values, as shown in FIG. In the example of FIG. 10, each
しかしながら、図11に示すように、領域テーブル148を使用してBTB142を実装する場合、これは分岐予測器4が、ある実行コンテキストからの分岐が、異なる実行コンテキストによって割り当てられたBTBエントリの分岐情報と一致すると判断する、何らかの偽ヒットにつながることがある。これは、領域テーブル148への更新の前後での、ある実例におけるBTBの内容を示している、図10と図11を比較することで分かる。図10では、BTBはaddr1、addr2、addr3において、現在3つの分岐についての分岐情報をそれぞれ含んでいる(それぞれエントリ156-1、156-2、156-3によって表現されている)。エントリ156-1及び156-3によって表現される分岐は、領域テーブル・エントリ#Aによって表現されるプロセス1に関連付けられ、BTBエントリ156-2によって表現される分岐は、領域テーブル・エントリ#Bによって表現されるプロセス2に関連付けられる。
However, when implementing
図11に示すように、次に第3のプロセスが分岐命令を実行し、情報をBTB142に割り当てることを必要とするが、プロセス3は割り当てられた領域テーブル148にエントリを現在1つも有していない。すべての領域テーブル・エントリが既に占有されている場合、これは領域エントリ170を削除して新しいプロセスに再割り当てするよう要求するため、例えば、以前はプロセス1に割り当てられていた領域エントリ170-1は、今度はコンテキスト識別子及びプロセス3に関連付けられる上方アドレス・ビットを提供するように更新され得る。分岐ターゲット・バッファ・エントリ156-1は、以前の分岐1をプロセス3に関連付けられる新しい分岐で置き換えるように、さらに更新され得る。しかしながら、更新された領域テーブル・エントリの領域識別子#Aを指定している別のBTBエントリ156-3は、この工程で無効化されなくてもよく、以前はプロセス1に関連付けられていた分岐3に関連付けられる情報を提供し続けることができる。領域テーブルへの更新があった場合に、そのような古くなった分岐を除去するためにBTB142をウォーク・スルーするための無効化ロジックは、通常は用意されないが、その理由は、さらなる回路を必要とすることになるからであり、また、そのような誤った分岐情報は、予測がその情報に基づいてなされる場合あらゆるケースで検出可能であると期待されるが、その理由は実行工程18において分岐の実際の分岐結果は、間違った実行コンテキストからの分岐予測データが使用される場合は予測とは異なり、そして関与するBTBエントリの無効化がトリガされ得るからである。これがパフォーマンスの低下を引き起こすことがある一方で、実際には領域テーブル識別子の再利用とは関連しない他の理由で誤予測が起こる可能性があるが、処理パイプライン2における同一の誤予測解決ロジックを再利用することができるため、これは大きな問題ではない。したがって、領域テーブル148を使用する典型的なBTB実装形態では、更新されている領域テーブル・エントリにマッピングする領域識別子を有するエントリは、図11で示される実例156-3のように、異なる実行コンテキストによって割り当てられた古くなった分岐情報と存続し続けることがある。
As shown in FIG. 11, a third process now executes a branch instruction, requiring information to be allocated to
したがって、領域テーブル・エントリが更新される場合、BTB142の古いエントリは、更新された領域テーブル・エントリに割り当てられる新しいプロセスからの後続の分岐命令に対してヒットすることがあり、これは異なる実行コンテキストからの以前に割り当てられた分岐情報に対する偽ヒットを引き起こす場合がある。以前、このことはセキュリティの問題ではなく、パフォーマンスの問題と見なされるだけであった。しかしながら、攻撃者が、攻撃者の制御下にない別の実行コンテキストの投機的実行を制御して、そのプロセスによって管理される秘密データについての情報を露出させるために、BTBのこの性質を使用することができることが認識されている。これは、以下の条件の両方が満足される場合に可能である:
・条件1:プロセスAが、別のプロセスBによってBTB142に与えられたターゲット・アドレスを使用することができる。
・条件2:プロセスBが、プロセスAによってアクセスされるBTBエントリのターゲットを制御することができる。
図11の上の実例では、異なるコンテキスト間のBTBにおいてタグ情報として使用される領域識別子の再利用により、プロセス3はプロセス1によって与えられるターゲット・アドレスを使用することができる(条件1)。やはり、プロセス1は、プロセス3によってアクセスされるBTBエントリのターゲットを制御することができるが、その理由はプロセス3の分岐とタグ・ビット[20:16]を共有する所望のターゲット・アドレスで分岐を実行することができるからであり、それによって、所望のターゲット・アドレスは、プロセス3によってヒットされるBTB142のエントリに割り当てられることになる。より一般的には、これらの条件は、タグ情報158の値が複数の実行コンテキスト間で再利用することができる分岐ターゲット予測構造で生じる可能性がある。領域テーブルは、これが生じ得る理由の1つであるが、他の理由は単純にタグ情報が現在の実行コンテキスト(現在の実行環境)の識別子に依存しないことである。
Therefore, if a region table entry is updated, the old entry in
• Condition 1: process A can use the target address given to
• Condition 2: process B can control the target of the BTB entry accessed by process A;
In the upper illustration of FIG. 11, reuse of region identifiers used as tag information in BTBs between different contexts allows process 3 to use the target address given by process 1 (condition 1). Again,
上述の2つの条件は、以下のような攻撃の基本として使用され得る。第1に、プロセス1を制御する攻撃者は、victimプロセス3を制御して攻撃者へ秘密データを露出し得る何らかの動作を実施させるために、そのvictimプロセス3によって実行されるよう設計された何らかの悪意のある一連の命令にマッピングする分岐ターゲット・アドレスを指定するBTBエントリが割り当てられる結果となる分岐命令を実行する可能性がある。領域テーブルが更新され、以前攻撃者プロセス1に使用された領域識別子がvictimプロセス3に再割り当てされた後、victimプロセス3は、攻撃者プロセス1によって割り当てられた古くなったBTBエントリ内のタグ・データと一致するアドレスからの命令を実行し、そして攻撃者によって与えられたその情報に基づいて分岐予測が行われる。これにより、一連の命令の投機的実行に、攻撃者によって与えられた分岐ターゲット・アドレスを形成させることになる、つまり、非アーキテクチャ的な状態におけるような足跡を残すことにより(例えばデータ・キャッシュ)、victimプロセス3を騙して秘密データを露出させるようにする、攻撃者によって与えられた特殊な命令である。これらの命令は、例えば、それらのターゲットのメモリ・アドレスを、攻撃者がアクセスしたいと思う秘密情報を使用して計算するメモリ・アクセス命令を含むことがある。したがって、メモリ・アクセス命令によって、キャッシュ30、32にロードされるデータは、秘密情報に依存する可能性がある。最終的に分岐誤予測が特定され、プロセッサ・パイプライン2のレジスタ14のアーキテクチャ的な状態が、一連の命令が誤予測されvictimプロセス3によって投機的実行されるより前のポイントに巻き戻されたとしても、誤って投機的実行された命令によってメモリからロードされたデータは、なおキャッシュ30、32に存続することができる。したがって、実行が攻撃者プロセス1にスイッチ・バックする時、攻撃者は秘密データに基づくターゲット・アドレスを計算した結果得られたそれぞれの可能なアドレスにアクセスを試行することができる。そのようなメモリ・アクセスを実施する場合、攻撃者プロセス1は、ロード命令に関する実行時間などのパフォーマンス・データ、又はキャッシュ・ミス数のカウントなどを測定することができ、攻撃者はパフォーマンスについてのそのようなサイド・チャネル情報から、所与のアドレスからのデータがvictimプロセス3によってキャシュ内に配置されたか、そうでないかを判断することができ、これはvictimプロセス3にはアクセスできたが攻撃者プロセス1にはアクセスできなかった、秘密データの性質を推測するために使用することができる。
The above two conditions can be used as the basis for the following attacks. First, an attacker in control of
そのような攻撃が成功するためには、上で与えた2つの条件が満足される必要がある。図12は、偽陽性ヒットの場合に攻撃者がvictimコンテキストによって使用される分岐ターゲット・アドレスを制御することを困難にすることにより、そのような攻撃を阻止する、この第2の条件を破る技法を示している。分岐ターゲット予測構造142、146が、現在の実行コンテキストに関連付けられる暗号化キーに基づいて分岐ターゲット予測構造に書き込まれる分岐情報を暗号化するための暗号化回路174、及び現在の実行コンテキストに関連付けられる暗号化キーに基づいて分岐ターゲット予測構造から読み出された分岐情報を復号化するための復号化回路176と共に設けられる。キー生成回路179(例えば、線形帰還シフト・レジスタ又は他の乱数生成器)は、コンテキストごとに時々キーを生成することができる。分岐ターゲット予測回路178(図8の分岐予測制御ロジック150、並びにターゲット・タグ値を生成するため、及び分岐ターゲット・エントリをルックアップして所与の命令フェッチ・アドレスについての分岐情報を特定するための、分岐ターゲット予測構造142、146に関連付けられるあらゆるキャッシュ・アクセス回路に対応することができる)は、命令フェッチ・アドレスから(例えば、領域テーブル148を使用して)ターゲット・タグを生成し、分岐ターゲット予測構造でヒットがあれば暗号化された分岐情報を出力するよう分岐ターゲット予測構造を制御することができる。ミスがあり、分岐が引き続き実行工程18によって実行される場合、分岐についての実際の分岐情報は、暗号化回路174によって暗号化され、分岐を特定するタグ情報に関連して、分岐ターゲット予測回路の制御下で分岐ターゲット予測構造に書き込まれる。暗号化及び復号化回路174、176は、図12では別個の回路として示されているが、同一の回路であってもよい(例えば、XOR回路)。
For such an attack to be successful, the two conditions given above need to be met. FIG. 12 illustrates a technique for breaking this second condition that thwarts such attacks by making it difficult for an attacker to control the branch target addresses used by the victim context in the event of a false positive hit. is shown. A branch
上で議論したように、分岐情報を暗号化することの代替法は、ターゲット・タグの一部を暗号化することであり、この場合復号化回路176は必要とされない場合がある。
As discussed above, an alternative to encrypting branch information is to encrypt a portion of the target tag, in which
図13は、暗号化/復号化が適用される場合の、領域テーブル148及び分岐ターゲット・バッファ142の内容の実例を示している。この実例では、それぞれの領域テーブル・エントリ170は、その領域テーブル・エントリ170によって表現される対応する実行コンテキストに関連付けられる暗号化キー180を記憶している。キー180は、線形帰還シフト・レジスタ(LFSR)又は他の乱数生成器179によって乱数又は疑似乱数として、キーが同一の領域テーブル・エントリを再利用する異なる実行コンテキストについて異なっているように、対応する領域テーブル・エントリ170が更新される都度生成することができる。BTB142のルックアップがミスの場合、現在のフェッチ・アドレスを超えてフェッチが順次続けられるが、実行工程18においてフェッチされた命令ブロックからの分岐が実行される場合、実際の分岐情報が決定され、BTB142の新しい分岐エントリ156に割り当てることができる。BTBの新しいエントリを割り当てる際、分岐情報が現在の実行コンテキストについての領域テーブル148に記憶されている対応する暗号化キー180を使用して暗号化される。任意選択で、同様にキーを使用してタグ情報158を暗号化することができる。しかしながら、タグの暗号化は必須ではない。いくつかの実施例では、予測分岐データ160として記憶されるあらゆる追加的な情報168は暗号化されなくてもよいため、分岐ターゲット情報のみが暗号化され得るが、分岐情報160のすべてが暗号化されるほうがセキュリティは強固であり得る。
FIG. 13 shows an example of the contents of region table 148 and
BTB142でヒットを生成する分岐予測ルックアップの際、タグ情報158が現在の命令フェッチ・アドレスについて生成されるターゲット・タグに一致するべく、この時BTB142から直接分岐情報160を単純に出力することの代わりに、まず分岐情報は領域テーブル148によって定義される現在の実行コンテキストに関連付けられる対応する暗号化キー180を使用して復号化され、次いで復号化された分岐情報は、次のフェッチ・アドレスを導出するために分岐予測ロジック150によって使用される。BTBコンテキストを保護するために使用される暗号化及び復号化は、秘密キー暗号法を使用して、又は公開キー暗号法を使用して実装することができる。分岐ターゲット・アドレス予測は、処理パイプラインのクリティカル・タイミング・パス上にあることがあるため、例えばより複雑なマルチラウンドの暗号法を使用する代わりに、比較的軽量な暗号化方法(例えば、分岐情報とキー180のXORを取る)を使用することは有用である場合がある。
During a branch prediction lookup that generates a hit in
図14に示すように、この技法は上で議論した攻撃についての第2の条件を妨げることができるが、その理由は、その情報に割り当てられた実行コンテキストに関連付けられるキーを使用して分岐情報を暗号化することによって、同一のBTBエントリ156-3が新しい実行コンテキストからアクセスされ、次いで新しい実行コンテキストのキーを使用して復号化される場合、これは元々のコンテキストによって割り当てられたターゲット・アドレスではなく、ガーベッジ情報を生成することになり、それによって攻撃者が悪意のあるターゲットをBTBにプッシュし、既知の位置から悪意のあるコードを実行するために異なる実行コンテキストを制御することが困難となるからである。例えば、図14では、プロセス1を制御する攻撃者は特定のエントリ156-3を割り当て、次いで領域エントリ170-1が更新され、図11のようにプロセス3を指す。領域テーブルを更新する際、新しいキー180が領域テーブル・エントリ170-1について生成されるため、続いて新しい実行コンテキスト3からの実行の間にBTBエントリ156-3でヒットがある場合、新しいキーを使用する分岐情報の復号化は、同一の分岐ターゲット・アドレスを、プロセス1によって元々与えられた分岐ターゲット・アドレスとして与えることがない。分岐ターゲット情報の古い情報が、古くなったキー(領域テーブルでもはや利用可能ではない、キー1)によって暗号化される一方で、領域テーブル・エントリ#Aは新しいキーを有する。上で議論したタイプの攻撃を作成し、victimプロセス3を制御して悪意のあるターゲット・アドレスTにジャンプさせることができるように、攻撃者はDec(Enc(T’,key1),New key)==Tとなるように異なるターゲット・アドレスT’を与える必要があり、これは暗号化キーについて十分なビット数があれば古いキー及び新しいキーを知らない攻撃者が、victimプロセス3を強制してTに分岐させる必要があるT’の値を予測することを実行不能にすることができる。
As shown in FIG. 14, this technique can thwart the second condition for the attack discussed above, because the branch information is processed using the key associated with the execution context assigned to that information. by encrypting the same BTB entry 156-3 is accessed from a new execution context and then decrypted using the new execution context's key, it will have the target address Instead, it would generate garbage information, making it difficult for an attacker to push malicious targets into the BTB and control different execution contexts to execute malicious code from a known location. Because it becomes For example, in FIG. 14, an
図13及び図14は、個々の実行コンテキストに関連付けられるキーが領域テーブル148にキャッシュされる実例を示しているが、これは必須ではなく、それぞれの実行コンテキストに関連付けられるキーを記憶するための別個の記憶構造も可能である。 13 and 14 show an example in which keys associated with individual execution contexts are cached in region table 148, this is not required, and a separate cache for storing the keys associated with each execution context is shown. storage structures are also possible.
図13及び図14の実例では、キーは、領域テーブルの置き換えが発生する都度更新されるため、ワンタイム使用の動的なキーである。これは、攻撃を困難にすることができるが、その理由は攻撃者がキーを特定し、それを利用してキーの寿命が終わる前に秘密情報を読み出す必要があるからであり、これは攻撃者が、キーが更新される前の利用可能な時間内にBTBからの一連の分岐予測結果を観察することによりキーについての情報を知ることができる可能性を低減する。それにもかかわらず、他の実装形態では、領域テーブル・エントリに割り振られた動的なキーの代わりに、同一キーが所与の実行コンテキスト用に、そのコンテキストの寿命の間中使用されるように、それぞれの実行コンテキストについて静的なキーを使用することができる。この場合、記憶装置の要求を低減するためにそれぞれのコンテキスト用のキーを生成する効率的な方法は、すべての実行コンテキスト間で共有される共通キーを提供するが、それぞれのコンテキストごとにその共通キーから、共通キーをコンテキストに関連付けられるコンテキスト識別子でハッシュ化することによりコンテキスト特有のキーを導出することである場合がある。 In the examples of FIGS. 13 and 14, the key is a one-time-use dynamic key because it is updated each time a region table replacement occurs. This can make attacks difficult, because the attacker must identify the key and use it to retrieve the secret information before the key's lifetime expires. It reduces the likelihood that someone can learn information about a key by observing a series of branch prediction results from the BTB in the available time before the key is updated. Nevertheless, in other implementations, instead of dynamic keys allocated to region table entries, the same key is used for a given execution context throughout the life of that context. , you can use static keys for each execution context. In this case, an efficient way to generate keys for each context to reduce storage requirements is to provide a common key that is shared among all execution contexts, but that common From the key, it may be to derive a context-specific key by hashing the common key with the context identifier associated with the context.
図15及び図16は、マルチターゲット間接分岐予測器146を使用する実例を示す。ターゲット・アドレスがプログラムの間に時々変化する多形の分岐について、それぞれの分岐プログラム・カウンタ・アドレスごとに固定のターゲット・アドレスを与えるBTB142は、信頼できる予測を与えることができない場合があるため、別個の予測構造146を設けることができる。そのような多形の分岐については、BTB142の分岐情報を更新して、BTBの予測されたターゲット・アドレスは将来的に使用するべきではなく、代わりにそのような分岐についての分岐ターゲット・アドレスを、マルチターゲット間接分岐予測器146を使用して予測すべきであることを示すインジケータを提供することができる。マルチターゲット間接分岐予測器は、それぞれが分岐について予測されたターゲット・アドレスを示す情報、及び以前の分岐の結果の履歴に基づくタグ情報194を含む複数の分岐ターゲット・エントリ190(例えば、以前の分岐が、遂行されたか、遂行されなかったかどうかを示す一連のビット)を含む。したがって、同一の分岐命令を、その分岐までたどり着く異なる分岐履歴に対応するマルチターゲット間接分岐予測器146の複数エントリに割り当てることができる。タグ情報194は、分岐を含む命令のブロックの命令フェッチ・アドレスにさらに依存する。BTB142とは違って、タグ情報は対応する実行コンテキストのコンテキスト識別子、又はプログラム・カウンタ・アドレスの上方ビットを含んでいない。マルチターゲット間接分岐予測器46でそれぞれのエントリに関連付けられるタグは現在の実行コンテキストとは独立しているため、やはりこれは、タグ値が複数の実行コンテキスト間で再利用することができることを意味している。プロセス2を制御する攻撃者が、victimプロセス1において特定の間接的な分岐に到達するために使用されるアクセス・パターン(分岐履歴)を知っている場合、攻撃者は、類似のセキュリティ問題を、プロセス1によってアクセスされる既知の分岐履歴パターン(例えば図14のタグA)によってタグ付けされた悪意のあるターゲット・アドレスをプッシュすることにより、上で議論した問題に利用することができる。ここでの仮定は、攻撃者がマルチターゲット間接分岐予測器146におけるタグの衝突を意図的に予測できるということである。
15 and 16 show examples of using the multi-target
図16に示すように、この弱点が利用されることを妨げるために、領域テーブルからの暗号化キー180は、マルチターゲット間接分岐予測器146のコンテンツを暗号化するためにさらに使用され得る。したがって、分岐情報がマルチターゲット間接分岐予測器146のエントリ190に割り当てられると、現在の実行コンテキストについての暗号化キー180は、領域テーブルから読み出され、これは分岐情報192、及び任意選択で対応するエントリ190のタグ194を暗号化するために使用される。マルチターゲット間接分岐予測器146のルックアップの際、分岐情報192は、現在の実行コンテキストの暗号化キー180を使用して復号化され、それによって、現在の実行コンテキストが以前の実行コンテキストによって割り当てられたエントリにヒットする場合、データを暗号化するために使用されたキーとは異なるキーを使用する復号化は、以前の実行コンテキストによって元々与えられたアドレスとは異なり、ガーベッジ・データを出力させることにつながる。
To prevent this weakness from being exploited, the
したがって、領域テーブル148を使用しない実装形態においても、分岐予測器がマルチターゲット間接分岐予測器146、又は現在の実行コンテキストとは独立しているタグを使用する別の予測構造を使用すると、やはり、分岐予測器の内容の暗号化は、攻撃者が分岐予測構造で偽陽性ヒットを使用して、秘密データを可視化するよう意図された悪意のあるコードを実行するためにvictimプロセスを制御できることを回避するために有用である場合がある。
Thus, even in implementations that do not use region table 148, if the branch predictor uses multi-target
図17は、分岐ターゲット予測ルックアップ、及び分岐ターゲット予測構造142、146において分岐情報の更新を実施する方法を図示する流れ図である。図17は、実施することができる分岐予測のすべての特徴を示していないことを了解されたい(例えば、BDP140による分岐方向予測、同様に投機的に実行される命令の実行を停止し、誤予測の場合にプロセッサ状態を巻き戻すために遂行されるステップが示されていない―これらは、あらゆる既知の分岐予測技法と同様に実施することができる)。
FIG. 17 is a flow diagram illustrating a method for performing branch target prediction lookups and updating branch information in branch target prediction structures 142,146. It should be understood that FIG. 17 does not show all aspects of branch prediction that can be implemented (e.g., branch direction prediction by
ステップ200において、ターゲット・タグが、分岐予測器のルックアップが実施される命令フェッチ・アドレスについて取得される。ターゲット・タグの特定の性質は、分岐予測器構造が実装される方法に依存する。例えば、上で議論したような領域テーブル148を使用して実装されたBTBについて、ターゲット・タグは、現在の実行コンテキストのコンテキスト識別子及び命令フェッチ・アドレスの一部に基づいて領域テーブルから決定することができる。次の図18に関連して、この手法をより詳細に議論する。代替的に、マルチターゲット間接分岐予測器146について、ターゲット・タグは、命令フェッチ・アドレス、及び以前の遂行した/遂行しなかった、の結果の履歴に基づいている。ターゲット・タグを生成する他の方法が、やはり可能である。
At step 200, a target tag is obtained for an instruction fetch address at which a branch predictor lookup is performed. The specific nature of the target tag depends on how the branch predictor structure is implemented. For example, for a BTB implemented using a region table 148 as discussed above, the target tag may be determined from the region table based in part on the context identifier of the current execution context and the instruction fetch address. can be done. This approach is discussed in more detail in connection with FIG. 18 below. Alternatively, for the multi-target
ステップ202において、分岐予測制御ロジック150は、分岐ターゲット予測構造142、146を制御して分岐ターゲット・エントリ156、190のサブセットをルックアップする。エントリのサブセットは、例えば命令アドレスに基づいて選択することができるか、又はfully associativeキャッシュの実装形態では、分岐ターゲット予測構造のすべてのエントリを含むことができる。分岐予測回路は、選択されたエントリのセットのいずれかが、ステップ200で所与の分岐命令について取得されたターゲット・タグに対応するタグ情報を指定するかどうかを判断する。どの分岐ターゲット・エントリのサブセットもターゲット・タグに対応するタグ情報を指定しない場合、分岐ターゲット予測構造でのルックアップはミスとなり、分岐予測制御ロジック150は、現在のフェッチ・アドレスのインクリメントされたバージョンを次のフェッチ・アドレスとして加算器152から出力する。対応する命令のブロックがデコードされると、ステップ203においてデコード工程10はブロック内のいずれかの命令が分岐命令かどうかを判断する。分岐命令を含んでいない場合、いかなる分岐情報も更新する必要がないため、方法は終了する。フェッチされた/デコードされた命令のブロックが、分岐命令を含む場合、ステップ204において、victimエントリが、ルックアップされる分岐ターゲット・エントリのサブセットから選択される。例えば、分岐ターゲット・エントリのサブセットのうちの1つが、現在無効である場合、無効なエントリをvictimエントリとして選択することができる。分岐ターゲット・エントリのサブセットのすべてが現在有効である場合、有効なエントリのうちの1つが削除されて新しい分岐情報用に空けられる。あらゆる削除ポリシを使用してvictimエントリを選択することができる(例えばラウンド・ロビン、又はleast recently used)。
In
ステップ206において、実際の分岐情報が所与の分岐命令について実行工程18によって解決されると、実際の分岐情報は、現在の実行コンテキストに関連付けられる暗号化キーを使用して暗号化される。分岐情報は、分岐ターゲット・アドレスを導出すること、又は指定するための情報を含む場合があり、また上で議論したような分岐についての他の情報をさらに含むことができる。暗号化キーは領域テーブル148から、又は別個の記憶装置から読み出すことができる。一部の事例では、ターゲット・タグも暗号化することができる。ステップ208において、暗号化された分岐情報、及びターゲット・タグに基づいて決定された(任意選択で暗号化された)タグ情報が、ステップ204で選択されたvictimエントリに書き込まれる。
At step 206, once the actual branch information has been resolved by
ステップ202において、分岐ターゲット予測構造142、146でヒットがあり、ルックアップされる分岐ターゲット・エントリのサブセットのうちの1つがターゲット・タグに対応するタグ情報を指定していた場合、ステップ210において、その一致エントリに記憶された分岐情報が、現在の実行コンテキストに関連付けられる暗号化キーを使用して復号化される。ステップ212において、復号化された分岐情報が、所与の分岐命令についての予測として出力される。復号化された分岐情報から導出された分岐ターゲット・アドレスは、命令の後続のフェッチを制御するためにフェッチ・キュー144に割り当てられ、復号化された分岐情報によって指定される分岐命令の他の予測される属性は、処理パイプラインの他の態様を制御することができる。分岐が実行工程に到達すると、実際の分岐情報が分岐命令について決定され、予測が正しかったかどうかを判断することができる。誤予測があった場合、分岐命令に続く命令をパイプラインからフラッシュすることができ、分岐が遂行されるべきではない場合、分岐の命令アドレスに続く順次のアドレスからすべて取られる場合は、分岐の正しいターゲット・アドレスから命令のフェッチを再開するためにフェッチ工程6に信号を送信することができる。また、分岐予測器4は、同一の命令フェッチ・アドレスについての後続の予測が次回はより正確である見込みが高くなるように、実際の分岐結果に基づいて分岐ターゲット予測構造142、146に記憶される分岐情報を訂正するよう更新することができる。
If at
図18は、それぞれのエントリのタグ部分を圧縮するために領域テーブル148を使用する分岐ターゲット予測構造がBTB142である実施例において、図17のステップ200においてターゲット・タグを取得する方法をさらに詳細に示す流れ図である。ステップ220において、領域テーブル148は、現在の命令フェッチ・アドレスに関連付けられる分岐コンテキスト情報に基づいてルックアップされる。例えば、分岐コンテキスト情報は、分岐が実行される実行コンテキストを特定する1つ又は複数のコンテキスト識別子を含む場合があり、命令フェッチ・アドレスの上方の分岐命令アドレス・ビットをさらに含む場合がある。ステップ222において、分岐予測制御回路は、エントリ190に記憶される分岐コンテキスト情報が所与の分岐命令に与えられた分岐コンテキスト情報に一致する、一致する領域テーブル・エントリ190を、領域テーブルが含んでいるかどうかを判断する。一致する領域テーブル・エントリを含んでいる場合、領域テーブルでヒットがあり、ステップ224において、ターゲット・タグが、一致する領域テーブル・エントリに関連付けられる領域ID、及び命令アドレスのタグ部分の1つ又は複数の下位ビット(例えば、図13の実例では、ビット20:16)を含んでいるとして、決定される。やはり、ステップ226において、現在の実行コンテキストに対応する暗号化キーが、一致する領域テーブル・エントリからキーを読み出すことによって、領域テーブルからリターンされる。
FIG. 18 illustrates in greater detail how target tags are obtained in step 200 of FIG. Fig. 4 is a flow diagram showing; At
ステップ222において、現在の命令フェッチ・アドレスに与えられる分岐コンテキスト情報に一致する分岐コンテキスト情報を有する一致する領域テーブル・エントリがないように、領域テーブルでルックアップがミスとなる場合、ステップ230において、victim領域テーブル・エントリが選択され、例えば、特定のコンテキストにまだマッピングされていない無効な領域テーブル・エントリ、又は無効なエントリが存在しない場合は削除されることになる有効な領域テーブル・エントリである。やはり、victim領域テーブル・エントリを選択するために、LRU又はラウンド・ロビンなどの削除ポリシを使用することができる。ステップ232において、victim領域テーブル・エントリに記憶される暗号化キー180が、更新される。例えば、新しい乱数又は疑似乱数を出力するために、線形帰還シフト・レジスタ、又は他の乱数若しくは疑似乱数生成器がトリガされる場合がある。更新された暗号化キーはvictim領域テーブル・エントリに書き込まれる。さらに、ステップ234において、ステップ220において所与の分岐命令について決定された分岐コンテキスト情報が、ステップ230で選択されたvictim領域テーブル・エントリに書き込まれる。victim領域テーブル・エントリに関連付けられる領域識別子は、新しい実行コンテキストにマッピングされており、現在の実行コンテキストからルックアップされる場合、その領域識別子に以前マッピングされたBTB142のあらゆるエントリが、今度は偽陽性ヒットをリターンする可能性があるが、その理由はこれらが同一領域識別子を共有する以前の実行コンテキストによって割り当てられたからである。しかしながら、ステップ232において暗号化キーを更新することによって、これらの偽陽性エントリの暗号化されたコンテキストは、これらのエントリをBTB142に割り当てた以前の実行コンテキストによって期待されるやり方で振る舞うことにはならず、そのためこれは悪意のあるプロセスが、攻撃者によって選択された特定のアドレスにマッピングするために、別のコンテキストによって実行される特定の分岐ターゲット・アドレスを制御できることを妨げる。ステップ234に続いて、図18の方法はステップ224に続き、分岐ターゲット予測構造の後続のルックアップについてのターゲット・タグをリターンし、暗号化キーをリターンするために、領域テーブルルックアップがヒットを生成したかのようにステップ224及び226が同一のやり方で実施される。図18の完了に続いて、生成されたタグを、図17のステップ202以降にしたがって分岐ターゲット予測ルックアップのために使用することができる。
If in step 222 the lookup misses in the region table such that there is no matching region table entry with branch context information that matches the branch context information provided at the current instruction fetch address, then in step 230: A victim realm table entry is selected, e.g., an invalid realm table entry that has not yet been mapped to a particular context, or a valid realm table entry that will be deleted if no invalid entry exists. . Again, deletion policies such as LRU or round robin can be used to select victim region table entries. At
要約すると、分岐ターゲット予測構造の分岐情報は、分岐情報を分岐ターゲット予測構造に割り当てさせる原因となった実行コンテキストに関連付けられる暗号化キーに基づいて暗号化される。分岐ターゲット予測構造のルックアップの際、ヒットがある場合、一致エントリからの分岐情報は、現在の実行コンテキストに関連付けられる暗号化キーを使用して復号化される。暗号化及び復号化は、異なるコンテキストからエントリを割り当てたコンテキストへの分岐ターゲット予測構造のエントリにおける偽陽性ヒットを利用することにより攻撃者が別の実行コンテキストから重要データにアクセスを得ることをずっと困難にするため、複数の実行コンテキストで再利用可能な値を伴うタグ情報を使用する分岐ターゲット予測構造にとって、これは有用である。 In summary, the branch information in the branch target prediction structure is encrypted based on the encryption key associated with the execution context that caused the branch information to be assigned to the branch target prediction structure. Upon lookup of the branch target prediction structure, if there is a hit, the branch information from the matching entry is decrypted using the encryption key associated with the current execution context. Encryption and decryption make it much harder for an attacker to gain access to critical data from another execution context by exploiting false positive hits in entries of branch target prediction structures to contexts that have assigned entries from different contexts. This is useful for branch target prediction structures that use tag information with values that can be reused in multiple execution contexts to ensure
図8~図18に示した具体的な実例は分岐予測器を実装する方法の一例に過ぎないことを了解されたい。より一般的には、新しい分岐予測エントリを生成する時、分岐予測器への入力の一部を、現在の実行コンテキストに関連付けられる値に基づいてエンコードすることができ、所与のクエリ入力について分岐予測器にクエリする際、クエリをトリガしている実行環境に関連付けられる値を使用してクエリ入力をエンコードすることができるか、又は分岐予測器の出力を最新の実行環境に関連付けられる値を使用して逆エンコード若しくはデコードすることができるか、或いはその両方であり、victimプロセスを制御して、異なる実行環境間の分岐予測器における偽ヒットを使用して特定のアドレスへの分岐を制御するために、攻撃者が分岐予測器においてどの状態が訓練されるべきかを推測することを困難にしている。 It should be appreciated that the specific examples shown in FIGS. 8-18 are but one example of how a branch predictor may be implemented. More generally, when generating a new branch prediction entry, some of the inputs to the branch predictor can be encoded based on values associated with the current execution context, allowing branching for a given query input. When querying the predictor, the query input can be encoded using values associated with the execution environment that is triggering the query, or the output of the branch predictor can be associated with the latest execution environment. and/or to control the victim process to control branches to specific addresses using false hits in the branch predictor between different execution environments. In addition, it makes it difficult for an attacker to guess which states should be trained in the branch predictor.
さらには、例示の配置構成を以下の条項で詳述する。
(1)一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶するように構成される分岐予測回路と、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信するための入力回路であって、少なくとも1つの入力は複数ビットを含む、入力回路と、一連の命令が実行されている現在の実行パーミッションを示す値に基づいて、複数ビットの少なくとも一部をエンコードするように構成されるコーディング回路とを備える、データ処理装置。
(2)コーディング回路は、キーを使用することによりビットの少なくとも一部をエンコードするよう構成され、キーは一連の命令が実行されている現在の実行パーミッションに基づいている、条項(1)に記載のデータ処理装置。
(3)コーディング回路は、キーを使用して複数ビットの少なくとも一部を再配列することにより、複数ビットの少なくとも一部をエンコードするよう構成される、条項(2)に記載のデータ処理装置。
(4)コーディング回路は、キーを使用して複数ビットの少なくとも一部をトグルすることにより、複数ビットの少なくとも一部をエンコードするよう構成される、条項(2)に記載のデータ処理装置。
(5)コーディング回路は、キーを使用してハッシュ関数を実施することにより、複数ビットの少なくとも一部をエンコードするよう構成される、条項(2)に記載のデータ処理装置。
(6)ハッシュ関数は、可逆的である、条項(5)に記載のデータ処理装置。
(7)コーディング回路は、キーでXOR演算を実施することにより、複数ビットの少なくとも一部をエンコードするよう構成される、条項(2)に記載のデータ処理装置。
(8)ハッシュ関数は、一方向のハッシュ関数である、条項(5)に記載のデータ処理装置。
(9)少なくとも1つの入力は分岐命令の命令アドレスの指標を含み、分岐予測回路は分岐命令の命令アドレスの指標を含むクエリ値を受信してクエリ値を使用して検索を実施するよう構成され、コーディング回路は検索に先立ってキーを使用してクエリ値のビットの少なくとも一部をエンコードするよう構成される、条項(2)から(8)までのいずれか一項に記載のデータ処理装置。
(10)コーディング回路は、現在の実行環境に関連付けられるキーの値を再計算し、キーの再計算された値を使用してクエリ値の複数ビットの少なくとも一部にエンコード演算を実施するよう構成される、条項(9)に記載のデータ処理装置。
(11)少なくとも1つの入力は分岐命令のデスティネーション・アドレスの指標を含み、分岐予測回路は分岐命令の命令アドレスの指標を含むクエリ値を受信してクエリ値を使用して検索を実施するよう構成され、装置はクエリ値を受信することに応じて出力される分岐予測回路の出力に対してデコードを実施するためのデコード回路を備える、条項(2)から(10)までのいずれか一項に記載のデータ処理装置。
(12)デコードは、キーの値を再計算し、次いでデコード関数を実施することを含む、条項(11)に記載のデータ処理装置。
(13)キーは、一連の命令が実行されている例外レベル、特権レベル、ASID、VMID、NS、物理プロセッサ・コア数、及び論理コア数を示す値のあらゆる組み合わせ、並びに1つ又は複数のソフトウェア書き込み可能レジスタ、にさらに基づいている、条項(1)から(12)までのいずれかに記載のデータ処理装置。
(14)キーは、以前に生成された乱数にさらに基づいている、条項(1)から(13)までのいずれかに記載のデータ処理装置。
(15)以前に生成された乱数は、論理プロセッサごとの要素、物理プロセッサごとの要素、及びシステム全体の要素の少なくとも1つを含む、条項(14)に記載のデータ処理装置。
(16)以前に生成された乱数の少なくとも一部は、スタートアップ時に生成される、条項(15)に記載のデータ処理装置。
(17)以前に生成された乱数の少なくとも一部は、疑似乱数である、条項(14)から(16)までのいずれか一項に記載のデータ処理装置。
(18)キーは、現在の実行環境又は現在の実行パーミッションに関連付けられる少なくとも1つの値を含む、少なくとも1つのキー入力パラメータに適用される一方向変形に基づいている、条項(1)から(17)までのいずれか一項に記載のデータ処理装置。
(19)一連の命令は、最低の実行パーミッションで実行するよう構成された複数の実行環境のうちの1つで実行することができ、コーディング回路は、一連の命令が実行されている複数の実行環境のうちの1つの識別子にさらに基づいて、複数ビットの少なくとも一部をエンコードするよう構成される、条項(1)から(17)までのいずれかに記載のデータ処理装置。
(20)一連の命令が投機的な状態で実行されている間、命令フェッチ・フォールト及び命令デコード・フォールトのあらゆる組み合わせのレートを検出し、レートが所定のしきい値を上回って増加することに応答して割り込みを発生させるか、又はエラー応答を作成するするよう構成された、監視回路を備える、条項(1)から(19)までのいずれかに記載のデータ処理装置。
(21)所定のしきい値は、直前のレートよりも少なくとも20%上回る、条項(20)に記載のデータ処理装置。
(22)一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶する手段と、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信する手段であって、少なくとも1つの入力は複数ビットを含む、受信する手段と、一連の命令が実行されている現在の実行パーミッションを示す値に基づいて、前記少なくとも1つの入力の複数ビットの少なくとも一部をエンコードする手段とを備える、データ処理装置。
(23)一連の命令に関連して少なくとも1つの分岐予測状態エントリを記憶することと、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信することであって、少なくとも1つの入力は複数ビットを含む、受信することと、一連の命令が実行されている現在の実行パーミッションを示す値に基づいて、複数ビットの少なくとも一部をエンコードすることとを含む、方法。
(24)複数の実行コンテキストのうちの1つでデータ処理を実施するための処理回路と、複数の分岐ターゲット・エントリを含み、それぞれの分岐ターゲット・エントリは少なくとも1つの分岐ターゲット・アドレスを示す分岐情報を指定する、分岐ターゲット予測構造と、現在の実行コンテキストに関連付けられる暗号化キーを使用して分岐ターゲット予測構造に書き込まれる分岐情報を暗号化するための暗号化回路と、現在の実行コンテキストに関連付けられる暗号化キーを使用して分岐ターゲット予測構造から読み出された分岐情報を復号化するための復号化回路とを備える、装置。
(25)それぞれの分岐ターゲット・エントリは、タグ情報を指定し、装置は、現在の実行コンテキストに関連付けられる命令フェッチ・アドレスについて分岐ターゲット予測ルックアップを実施するための分岐ターゲット予測回路を備え、分岐ターゲット予測ルックアップは、分岐ターゲット予測構造の分岐ターゲット・エントリのサブセットのいずれかが、命令フェッチ・アドレスについて決定されたターゲット・タグに対応するタグ情報を指定するかどうかを判断することを含む、条項(24)に記載の装置。
(26)ターゲット・タグの値は、複数の実行コンテキストのうち2つ以上で再利用可能である、条項(25)に記載の装置。
(27)分岐ターゲット・エントリのサブセットのいずれもターゲット・タグに対応するタグ情報を指定しない場合、また命令フェッチ・アドレスが分岐命令を含む少なくとも1つの命令のブロックを指定する場合、暗号化回路は、現在の実行コンテキストに関連付けられる暗号化キーを使用して分岐命令についての実際の分岐情報を暗号化するよう構成され、分岐ターゲット予測回路は、暗号化された分岐情報を指定し、ターゲット・タグに対応するタグ情報を指定する分岐ターゲット予測構造の分岐ターゲット・エントリを割り当てるよう構成される、条項(25)又は(26)に記載の装置。
(28)分岐ターゲット・エントリのサブセットのうちの1つがターゲット・タグに対応するタグ情報を指定する場合、復号化回路は、エントリのサブセットのうちの前記1つに記憶される分岐情報を現在の実行コンテキストに関連付けられる暗号化キーを使用して復号化するよう構成され、分岐ターゲット予測回路は、復号化された分岐情報を命令フェッチ・アドレスについての予測された分岐情報として出力するよう構成される、条項(25)から(27)までのいずれかに記載の装置。
(29)暗号化キーは、現在の実行コンテキストに固定された静的なキーを含む、条項(24)から(28)までのいずれかに記載の装置。
(30)現在の実行コンテキストについての静的なキーは、複数の実行コンテキストの少なくとも2つと、現在の実行コンテキストに特有の少なくとも1つのコンテキスト識別子とで共有される共通キーに依存している、条項(29)に記載の装置。
(31)暗号化キーは、現在の実行コンテキストに可変の動的なキー含む、条項(24)から(30)までのいずれかに記載の装置。
(32)現在の実行コンテキストについての更新された暗号化キーを生成するためのキー生成回路を備える、条項(31)に記載の装置。
(33)分岐ターゲット・エントリのサブセットのいずれもターゲット・タグに対応するタグ情報を指定しない場合、また命令フェッチ・アドレスが分岐命令を含む少なくとも1つの命令のブロックを指定する場合、暗号化回路は、現在の実行コンテキストに関連付けられる暗号化キーを使用してターゲット・タグを暗号化するよう構成され、分岐ターゲット予測回路は、暗号化されたターゲット・タグを割り当てられた分岐ターゲット・エントリについてのタグ情報として指定するよう構成され、分岐ターゲット予測ルックアップにおいて、復号化回路は分岐ターゲット・エントリのサブセットのそれぞれのタグ情報を復号化するよう構成され、分岐ターゲット予測回路は、復号化されたタグ情報をターゲット・タグと比較するよう構成される、条項(25)に記載の装置。
(34)分岐情報は、分岐ターゲット・アドレス以外の少なくとも1つの分岐情報をさらに示す、条項(24)から(33)までのいずれかに記載の装置。
(35)分岐ターゲット予測回路は、現在の実行コンテキストに関連付けられる少なくとも1つのコンテキスト識別子に依存するターゲット・タグを決定するよう構成される、条項(25)に記載の装置。
(36)それぞれの領域エントリが、分岐コンテキスト情報よりも少ないビットを含む領域識別子へ分岐コンテキスト情報をマッピングする、複数の領域エントリを含む領域テーブルを備え、分岐コンテキスト情報は対応する実行コンテキストに関連付けられる少なくとも1つのコンテキスト識別子を含む、条項(25)に記載の装置。
(37)命令フェッチ・アドレスについてのターゲット・タグは、領域テーブルによって命令フェッチ・アドレスに関連付けられる分岐コンテキスト情報にマッピングされたターゲット領域識別子を含む、条項(36)に記載の装置。
(38)それぞれの領域エントリは対応する実行コンテキストに関連付けられる暗号化キーを指定する、条項(36)又は(37)に記載の装置。
(39)領域テーブルの所与の領域エントリによって与えられたマッピングが更新される場合、分岐ターゲット予測回路は、マッピング更新後に所与の領域エントリに関連付けられる実行コンテキストに関連付けられる暗号化キーの更新をトリガするよう構成される、条項(36)から(38)までのいずれかに記載の装置。
(40)所与の領域エントリの分岐コンテキスト情報は、以前の分岐ターゲット予測ルックアップによって所与の領域エントリが領域テーブルに割り当てられた命令フェッチ・アドレスの部分をさらに含む、条項(36)から(39)までのいずれかに記載の装置。
(41)分岐ターゲット予測回路は、ターゲット・タグが命令フェッチ・アドレス、及び命令フェッチ・アドレスの命令に先行する以前の分岐命令の分岐結果の履歴に依存するかどうか判断するように構成される、条項(25)に記載の装置。
(42)複数の実行コンテキストのうちの1つでデータ処理を実施するための手段と、それぞれの分岐ターゲット・エントリは少なくとも1つの分岐ターゲット・アドレスを示す分岐情報を指定する、分岐ターゲット予測構造の分岐ターゲット・エントリを記憶するための手段と、現在の実行コンテキストに関連付けられる暗号化キーを使用して記憶するための手段に書き込まれる分岐情報を暗号化するための手段と、現在の実行コンテキストに関連付けられる暗号化キーを使用して記憶するための手段から読み出された分岐情報を復号化するための手段とを備える、装置。
(43)複数の実行コンテキストのうちの1つでデータ処理を実施することと、それぞれの分岐ターゲット・エントリは少なくとも1つの分岐ターゲット・アドレスを示す分岐情報を指定する、分岐ターゲット予測構造の分岐ターゲット・エントリを記憶することと、現在の実行コンテキストに関連付けられる暗号化キーを使用して分岐ターゲット予測構造に書き込まれる分岐情報を暗号化することと、現在の実行コンテキストに関連付けられる暗号化キーを使用して分岐ターゲット予測構造から読み出された分岐情報を復号化することとを含む、方法。
Further exemplary arrangements are detailed in the following sections.
(1) a branch prediction circuit configured to store at least one branch prediction state entry associated with a sequence of instructions, and an input for receiving at least one input to generate a new branch prediction state entry; A circuit configured to encode at least a portion of the plurality of bits based on the input circuit and a value indicative of current execution permissions for which a sequence of instructions is being executed, wherein at least one input includes the plurality of bits. A data processing apparatus, comprising: a coding circuit configured to:
(2) Clause (1), wherein the coding circuitry is configured to encode at least some of the bits by using a key, the key being based on current execution permissions under which the sequence of instructions is being executed; data processing equipment.
(3) The data processing apparatus of clause (2), wherein the coding circuit is configured to encode at least part of the plurality of bits by rearranging at least part of the plurality of bits using the key.
(4) The data processing apparatus of clause (2), wherein the coding circuit is configured to encode at least part of the plurality of bits by toggling at least part of the plurality of bits using a key.
(5) The data processing apparatus of clause (2), wherein the coding circuitry is configured to encode at least a portion of the plurality of bits by performing a hash function using the key.
(6) The data processing device according to clause (5), wherein the hash function is reversible.
(7) A data processing apparatus according to clause (2), wherein the coding circuit is configured to encode at least part of the plurality of bits by performing an XOR operation with the key.
(8) The data processing device according to clause (5), wherein the hash function is a one-way hash function.
(9) the at least one input includes an indication of an instruction address of a branch instruction, and the branch prediction circuit is configured to receive a query value including an indication of an instruction address of the branch instruction and perform a search using the query value; , the data processing apparatus according to any one of clauses (2) to (8), wherein the coding circuit is configured to encode at least some of the bits of the query value using the key prior to retrieval.
(10) the coding circuitry is configured to recalculate the value of the key associated with the current execution environment and perform an encoding operation on at least a portion of the multiple bits of the query value using the recalculated value of the key; A data processing apparatus according to clause (9), wherein the data processing apparatus is
(11) at least one input including an indication of a destination address of a branch instruction, the branch prediction circuit receiving a query value including an indication of an instruction address of the branch instruction and performing a search using the query value; any one of clauses (2) through (10), wherein the apparatus comprises decoding circuitry for performing decoding on an output of the branch prediction circuitry output in response to receiving the query value. The data processing device according to .
(12) The data processing apparatus of clause (11), wherein decoding includes recalculating the value of the key and then performing the decoding function.
(13) The key is any combination of values indicating the exception level, privilege level, ASID, VMID, NS, number of physical processor cores, and number of logical cores at which the sequence of instructions is being executed, and one or more software A data processing apparatus according to any one of clauses (1) to (12) further based on a writable register.
(14) The data processing apparatus of any of clauses (1) through (13), wherein the key is further based on a previously generated random number.
(15) The data processing apparatus of clause (14), wherein the previously generated random number includes at least one of a per logical processor element, a per physical processor element, and a system wide element.
(16) The data processing apparatus of clause (15), wherein at least some of the previously generated random numbers are generated at startup.
(17) The data processing apparatus according to any one of clauses (14) to (16), wherein at least some of the previously generated random numbers are pseudo-random numbers.
(18) the key is based on a one-way transformation applied to at least one key input parameter, including at least one value associated with the current execution environment or current execution permissions, clauses (1) through (17); ).
(19) the sequence of instructions is capable of executing in one of a plurality of execution environments configured to execute with the lowest execution permissions, the coding circuitry controlling multiple execution environments in which the sequence of instructions is being executed; A data processing apparatus according to any one of clauses (1) to (17), configured to encode at least part of the plurality of bits further based on an identifier of one of the environments.
(20) detecting the rate of any combination of instruction fetch faults and instruction decode faults during speculative execution of a sequence of instructions, and noting that the rate increases above a predetermined threshold; 19. A data processing apparatus according to any one of clauses (1) to (19), comprising a monitoring circuit configured to generate an interrupt or generate an error response in response.
(21) The data processing apparatus of clause (20), wherein the predetermined threshold is at least 20% above the previous rate.
(22) means for storing at least one branch prediction state entry associated with a sequence of instructions; and means for receiving at least one input for generating a new branch prediction state entry, the at least one input being data comprising a plurality of bits, comprising: means for receiving; and means for encoding at least a portion of the plurality of bits of the at least one input based on a value indicative of current execution permissions for which a sequence of instructions is being executed. processing equipment.
(23) storing at least one branch prediction state entry associated with a sequence of instructions and receiving at least one input to generate a new branch prediction state entry, the at least one input being A method comprising: receiving a plurality of bits; and encoding at least a portion of the plurality of bits based on a value indicative of current execution permissions for a sequence of instructions being executed.
(24) a branch including processing circuitry for performing data processing in one of a plurality of execution contexts and a plurality of branch target entries, each branch target entry indicating at least one branch target address; a branch target prediction structure specifying information; an encryption circuit for encrypting branch information written to the branch target prediction structure using an encryption key associated with the current execution context; and decryption circuitry for decrypting branch information read from the branch target prediction structure using an associated encryption key.
(25) each branch target entry specifies tag information, the apparatus comprising a branch target prediction circuit for performing a branch target prediction lookup on an instruction fetch address associated with a current execution context; the target prediction lookup includes determining whether any of the subset of branch target entries of the branch target prediction structure specify tag information corresponding to the target tag determined for the instruction fetch address; A device according to clause (24).
(26) The apparatus of clause (25), wherein the target tag value is reusable in two or more of the multiple execution contexts.
(27) If none of the subset of branch target entries specify tag information corresponding to the target tag, and if the instruction fetch address specifies a block of at least one instruction containing a branch instruction, then the encryption circuitry , configured to encrypt the actual branch information for the branch instruction using an encryption key associated with the current execution context, the branch target prediction circuit specifying the encrypted branch information, and the target tag Apparatus according to clause (25) or (26), configured to allocate a branch target entry of a branch target prediction structure that specifies tag information corresponding to .
(28) if one of the subsets of branch target entries specifies tag information corresponding to a target tag, the decoding circuit converts the branch information stored in said one of the subsets of entries to the current A branch target prediction circuit configured to decrypt using an encryption key associated with the execution context, and a branch target prediction circuit configured to output the decrypted branch information as predicted branch information for the instruction fetch address. , an apparatus according to any one of clauses (25) to (27).
(29) The apparatus of any of clauses (24) through (28), wherein the encryption key comprises a static key fixed to the current execution context.
(30) the static key for the current execution context is dependent on a common key shared by at least two of the plurality of execution contexts and at least one context identifier specific to the current execution context, clause The device according to (29).
(31) The apparatus of any of clauses (24) through (30), wherein the encryption key comprises a dynamic key that is variable in the current execution context.
(32) Apparatus according to clause (31), comprising a key generation circuit for generating updated encryption keys for the current execution context.
(33) If none of the subset of branch target entries specify tag information corresponding to the target tag, and if the instruction fetch address specifies a block of at least one instruction containing a branch instruction, then the encryption circuitry , is configured to encrypt the target tag using an encryption key associated with the current execution context, and the branch target prediction circuit generates a tag for the branch target entry assigned the encrypted target tag. information, in a branch target prediction lookup, the decoding circuit is configured to decode tag information for each of a subset of the branch target entries; with the target tag.
(34) The apparatus of any of clauses (24) through (33), wherein the branch information further indicates at least one branch information other than a branch target address.
(35) The apparatus of clause (25), wherein the branch target prediction circuit is configured to determine the target tag dependent on at least one context identifier associated with the current execution context.
(36) comprising a region table containing a plurality of region entries, each region entry mapping branch context information to a region identifier containing fewer bits than the branch context information, the branch context information being associated with a corresponding execution context; Apparatus according to clause (25), comprising at least one context identifier.
(37) The apparatus of clause (36), wherein the target tag for the instruction fetch address includes a target region identifier mapped to branch context information associated with the instruction fetch address by the region table.
(38) The apparatus of clauses (36) or (37), wherein each realm entry specifies a cryptographic key associated with a corresponding execution context.
(39) If the mapping given by a given region entry in the region table is updated, the branch target prediction circuit updates the encryption key associated with the execution context associated with the given region entry after the mapping update. A device according to any of clauses (36) to (38), adapted for triggering.
(40) The branch context information for a given region entry further includes a portion of the instruction fetch address to which the given region entry was assigned in the region table by a previous branch target prediction lookup, from clause (36) ( 39).
(41) the branch target prediction circuit is configured to determine if the target tag depends on an instruction fetch address and a history of branch outcomes of previous branch instructions preceding the instruction at the instruction fetch address; A device according to clause (25).
(42) means for performing data processing in one of a plurality of execution contexts; and a branch target prediction structure, each branch target entry specifying branch information indicative of at least one branch target address; means for storing branch target entries; means for encrypting branch information written to the means for storing using an encryption key associated with the current execution context; and means for decrypting branch information read from the means for storing using an associated encryption key.
(43) a branch target of a branch target prediction structure, performing data processing in one of a plurality of execution contexts, each branch target entry specifying branch information indicative of at least one branch target address; - Storing the entry, encrypting the branch information written to the branch target prediction structure using the encryption key associated with the current execution context, and using the encryption key associated with the current execution context. and decoding branch information read from the branch target prediction structure.
本出願において、語句「するように構成される」は、装置の要素が定義される動作を実行することができる構成を有することを意味するために使用される。この文脈において、「構成」はハードウェア又はソフトウェアの内部接続の、配置又はやり方を意味する。例えば、装置は定義される動作を提供する専用のハードウェアを有してもよく、又はプロセッサ若しくは他の処理デバイスは機能を実施するためにプログラムされてもよい。「するように構成される」は、定義される動作を提供するために装置要素がいかなるやり方でも変更される必要があることを含意するものではない。 In this application, the phrase "configured to" is used to mean that an element of the device has a configuration that enables it to perform the defined action. In this context, "configuration" means the arrangement or manner of interconnection of hardware or software. For example, an apparatus may have dedicated hardware that provides defined operations, or a processor or other processing device may be programmed to perform the functions. "Configured to" does not imply that the device element must be altered in any way to provide the defined behavior.
本発明の図示的な実施例を本明細書において添付の図面を参照して詳細に説明してきたが、本発明はこれらの正確な実施例に限定されず、当業者により添付の特許請求の範囲によって定義されるような本発明の範囲及び精神を逸脱することなく、その様々な変形及び修正がそこになされ得ることを理解されたい。 Although illustrative embodiments of the present invention have been described in detail herein with reference to the accompanying drawings, the present invention is not limited to these precise embodiments, but rather will allow those skilled in the art to follow the appended claims. It should be understood that various changes and modifications may be made therein without departing from the scope and spirit of the invention as defined by.
Claims (25)
新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信するための入力回路であって、前記少なくとも1つの入力は複数のビットを含む、入力回路と、
前記一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、前記複数のビットの少なくとも一部をエンコードするためのエンコード演算を実施するように構成されるコーディング回路と
を備えるデータ処理装置であって、
前記エンコード演算は、キーを使用することにより前記複数のビットの前記少なくとも一部をエンコードすることを含み、前記キーは、前記一連の命令が実行されている前記現在の実行環境に基づいており、
前記少なくとも1つの入力は、分岐命令のデスティネーション・アドレスの指標を含み、
前記分岐予測回路は、命令の命令アドレスの指標を含むクエリ値を受信し、前記クエリ値を使用して検索を実施するよう構成され、
前記データ処理装置は、前記クエリ値を受信することに応じて出力される前記分岐予測回路の出力に対して逆エンコード演算を実施するための逆エンコード回路を備える、データ処理装置。 a branch prediction circuit configured to store at least one branch prediction state entry associated with a sequence of instructions;
input circuitry for receiving at least one input to generate a new branch prediction state entry, said at least one input including a plurality of bits;
and coding circuitry configured to perform an encoding operation to encode at least a portion of the plurality of bits based on values associated with a current execution environment in which the sequence of instructions is being executed. A processing device ,
the encoding operation includes encoding the at least a portion of the plurality of bits using a key, the key being based on the current execution environment in which the sequence of instructions is being executed;
the at least one input includes an index of a destination address of a branch instruction;
the branch prediction circuitry configured to receive a query value including an indication of an instruction address of an instruction and perform a search using the query value;
The data processing device, comprising a reverse encoding circuit for performing a reverse encoding operation on the output of the branch prediction circuit output in response to receiving the query value.
前記一連の命令が実行されている例外レベル、特権レベル、ASID、VMID、NS、物理プロセッサ・コア数、及び論理コア数、1つ又は複数のソフトウェア書き込み可能レジスタ、並びに以前に生成された乱数
のうちの少なくとも1つを示す1つ又は複数のキー入力値の任意の組み合わせにさらに基づいている、請求項1から4までのいずれか一項に記載のデータ処理装置。 The key is
exception level, privilege level, ASID, VMID, NS, number of physical processor cores and number of logical cores at which said sequence of instructions is being executed, one or more software writable registers, and a previously generated random number; 5. A data processing apparatus according to any one of claims 1 to 4 , further based on any combination of one or more key input values indicative of at least one of them.
論理プロセッサごとの要素、
物理プロセッサごとの要素、及び
システム全体の要素
の少なくとも1つを含む、請求項5に記載のデータ処理装置。 The previously generated random number is
elements per logical processor,
6. A data processing apparatus as claimed in claim 5 , comprising at least one of: a per physical processor element; and a system wide element.
前記コーディング回路は、前記現在の実行環境に関連付けられる暗号化キーを使用して、前記分岐ターゲット予測構造に書き込まれる新しい分岐ターゲット・エントリの少なくとも一部を暗号化するための暗号化回路を備える、請求項1から9までのいずれか一項に記載のデータ処理装置。 the branch prediction circuit comprising a branch target prediction structure including a plurality of branch target entries, each branch target entry specifying at least a branch target address;
The coding circuitry comprises encryption circuitry for encrypting at least a portion of new branch target entries written to the branch target prediction structure using an encryption key associated with the current execution environment. 10. A data processing apparatus according to any one of claims 1-9 .
前記データ処理装置は、前記現在の実行環境に関連付けられる命令フェッチ・アドレスについて分岐ターゲット予測ルックアップを実施するための分岐ターゲット予測回路を備え、前記分岐ターゲット予測ルックアップは、前記分岐ターゲット予測構造の分岐ターゲット・エントリのサブセットのいずれかが、前記命令フェッチ・アドレスについて決定されたターゲット・タグに対応するタグ情報を指定するか否かを判断することを含む、請求項10に記載のデータ処理装置。 each branch target entry specifying tag information and branch data specifying at least the branch target address;
The data processing apparatus comprises a branch target prediction circuit for performing a branch target prediction lookup on an instruction fetch address associated with the current execution environment, the branch target prediction lookup being performed on the branch target prediction structure. 11. The data processing of claim 10 , comprising determining whether any of a subset of branch target entries specify tag information corresponding to the target tag determined for said instruction fetch address. Device.
前記データ処理装置は、前記分岐ターゲット予測ルックアップで前記ターゲット・タグに対応するタグ情報を指定するように特定された分岐ターゲット・エントリの前記サブセットのうちの1つの前記分岐データの前記少なくとも一部を復号化する復号化回路を備える、請求項13に記載のデータ処理装置。 the encryption circuitry is configured to encrypt at least a portion of the branch data of the new branch target entry using the encryption key;
Said data processing apparatus stores said at least part of said branch data of one of said subset of branch target entries identified in said branch target prediction lookup to specify tag information corresponding to said target tag. 14. A data processing apparatus according to claim 13 , comprising a decoding circuit for decoding the .
新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信する手段であって、前記少なくとも1つの入力は複数のビットを含む、手段と、
前記一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、前記少なくとも1つの入力の前記複数のビットの少なくとも一部をエンコードするためのエンコード演算を実施する手段と
を備えるデータ処理装置であって、
前記エンコード演算は、キーを使用することにより前記複数のビットの前記少なくとも一部をエンコードすることを含み、前記キーは、前記一連の命令が実行されている前記現在の実行環境に基づいており、
前記少なくとも1つの入力は、分岐命令のデスティネーション・アドレスの指標を含み、
前記記憶する手段は、命令の命令アドレスの指標を含むクエリ値を受信し、前記クエリ値を使用して検索を実施するよう構成され、
前記データ処理装置は、前記クエリ値を受信することに応じて出力される前記記憶する手段の出力に対して逆エンコード演算を実施する手段を備える、データ処理装置。 means for storing at least one branch prediction state entry associated with a series of instructions;
means for receiving at least one input to generate a new branch prediction state entry, said at least one input including a plurality of bits;
and means for performing an encoding operation to encode at least a portion of the plurality of bits of the at least one input based on values associated with a current execution environment in which the sequence of instructions is being executed. A processing device ,
the encoding operation includes encoding the at least a portion of the plurality of bits using a key, the key being based on the current execution environment in which the sequence of instructions is being executed;
the at least one input includes an index of a destination address of a branch instruction;
the means for storing is configured to receive a query value including an indication of an instruction address of an instruction and perform a search using the query value;
A data processing apparatus comprising means for performing a reverse encoding operation on an output of said means for storing output in response to receiving said query value.
入力回路によって、新しい分岐予測状態エントリを生成するために少なくとも1つの入力を受信するステップであって、前記少なくとも1つの入力は複数のビットを含む、ステップと、
コーディング回路によって、前記一連の命令が実行されている現在の実行環境に関連付けられる値に基づいて、前記複数のビットの少なくとも一部をエンコードするためのエンコード演算を実施するステップと
を含む方法であって、
前記エンコード演算は、キーを使用することにより前記複数のビットの前記少なくとも一部をエンコードすることを含み、前記キーは、前記一連の命令が実行されている前記現在の実行環境に基づいており、
前記少なくとも1つの入力は、分岐命令のデスティネーション・アドレスの指標を含み、
前記方法は、
前記分岐予測回路によって、命令の命令アドレスの指標を含むクエリ値を受信し、前記クエリ値を使用して検索を実施するステップと、
逆エンコード回路によって、前記クエリ値を受信することに応じて出力される前記分岐予測回路の出力に対して逆エンコード演算を実施するステップと
を含む、方法。 storing at least one branch prediction state entry associated with a sequence of instructions by a branch prediction circuit ;
receiving , by an input circuit, at least one input for generating a new branch prediction state entry, said at least one input comprising a plurality of bits;
performing , by coding circuitry, an encoding operation to encode at least a portion of the plurality of bits based on values associated with a current execution environment in which the sequence of instructions is being executed . hand,
the encoding operation includes encoding the at least a portion of the plurality of bits using a key, the key being based on the current execution environment in which the sequence of instructions is being executed;
the at least one input includes an index of a destination address of a branch instruction;
The method includes:
receiving, by the branch prediction circuitry, a query value that includes an indication of an instruction address of an instruction, and performing a search using the query value;
performing, by a reverse encoding circuit, a reverse encoding operation on the output of the branch prediction circuit output in response to receiving the query value;
A method, including
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US15/825,524 US10819736B2 (en) | 2017-11-29 | 2017-11-29 | Encoding of input to branch prediction circuitry |
US15/825,524 | 2017-11-29 | ||
PCT/GB2018/053033 WO2019106333A1 (en) | 2017-11-29 | 2018-10-19 | Encoding of input to branch prediction circuitry |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021504800A JP2021504800A (en) | 2021-02-15 |
JP7307727B2 true JP7307727B2 (en) | 2023-07-12 |
Family
ID=64049461
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2020528089A Active JP7307727B2 (en) | 2017-11-29 | 2018-10-19 | Encode the input to the branch prediction circuit |
Country Status (6)
Country | Link |
---|---|
US (1) | US10819736B2 (en) |
EP (1) | EP3718003B1 (en) |
JP (1) | JP7307727B2 (en) |
KR (1) | KR102713620B1 (en) |
CN (1) | CN111417928B (en) |
WO (1) | WO2019106333A1 (en) |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10217182B1 (en) * | 2015-10-29 | 2019-02-26 | Digimarc Corporation | Construction of signal maps for images with encoded signals |
US11347507B2 (en) * | 2018-03-15 | 2022-05-31 | SiFive, Inc. | Secure control flow prediction |
US11797665B1 (en) * | 2018-06-28 | 2023-10-24 | Advanced Micro Devices, Inc. | Protection against branch target buffer poisoning by a management layer |
US10929535B2 (en) * | 2018-06-29 | 2021-02-23 | Intel Corporation | Controlled introduction of uncertainty in system operating parameters |
US11630920B2 (en) * | 2018-06-29 | 2023-04-18 | Intel Corporation | Memory tagging for side-channel defense, memory safety, and sandboxing |
US10740104B2 (en) * | 2018-08-16 | 2020-08-11 | International Business Machines Corporation | Tagging target branch predictors with context with index modification and late stop fetch on tag mismatch |
GB2578432B (en) * | 2018-10-25 | 2021-04-28 | Advanced Risc Mach Ltd | Technique for maintaining prediction data used to predict whether a branch represented by a branch instruction will be taken |
US11099851B2 (en) * | 2018-10-26 | 2021-08-24 | International Business Machines Corporation | Branch prediction for indirect branch instructions |
US11449343B2 (en) * | 2018-12-14 | 2022-09-20 | Apple Inc. | Indirect branch predictor storing encrypted branch information fields and security tag for security protection |
US11321095B2 (en) | 2018-12-14 | 2022-05-03 | Apple Inc. | Indirect branch predictor security protection |
US20200210626A1 (en) * | 2018-12-28 | 2020-07-02 | Samsung Electronics Co., Ltd. | Secure branch predictor with context-specific learned instruction target address encryption |
CN110347432B (en) * | 2019-06-17 | 2021-09-14 | 海光信息技术股份有限公司 | Processor, branch predictor, data processing method thereof and branch prediction method |
WO2022063419A1 (en) * | 2020-09-24 | 2022-03-31 | Arm Limited | Branch prediction using hypervectors |
FR3118234B1 (en) * | 2020-12-18 | 2024-01-19 | St Microelectronics Alps Sas | METHOD FOR DETECTING REVERSE ENGINEERING ON A PROCESSING UNIT USING AN INSTRUCTION POINTER AND CORRESPONDING INTEGRATED CIRCUIT |
US20220197661A1 (en) * | 2020-12-21 | 2022-06-23 | Intel Corporation | Context-based memory indirect branch target prediction |
US11397685B1 (en) * | 2021-02-24 | 2022-07-26 | Arm Limited | Storing prediction entries and stream entries where each stream entry includes a stream identifier and a plurality of sequential way predictions |
US12086600B2 (en) * | 2022-12-05 | 2024-09-10 | Microsoft Technology Licensing, Llc | Branch target buffer with shared target bits |
JP2024119606A (en) * | 2023-02-22 | 2024-09-03 | 富士通株式会社 | Microprocessor and processing method thereof |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080052499A1 (en) | 2006-07-11 | 2008-02-28 | Cetin Kaya Koc, Ph.D. | Systems and methods for providing security for computer systems |
US20090089564A1 (en) | 2006-12-06 | 2009-04-02 | Brickell Ernie F | Protecting a Branch Instruction from Side Channel Vulnerabilities |
US20110296206A1 (en) | 2010-05-25 | 2011-12-01 | Via Technologies, Inc. | Branch target address cache for predicting instruction decryption keys in a microprocessor that fetches and decrypts encrypted instructions |
US20160092702A1 (en) | 2014-09-26 | 2016-03-31 | David M. Durham | Cryptographic ponter address encoding |
US20160170769A1 (en) | 2014-12-15 | 2016-06-16 | Michael LeMay | Technologies for indirect branch target security |
Family Cites Families (28)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0682395B2 (en) | 1988-01-30 | 1994-10-19 | 株式会社東芝 | Bit mask generation circuit |
DE19526960A1 (en) | 1994-09-27 | 1996-03-28 | Hewlett Packard Co | A translation cross-allocation buffer organization with variable page size mapping and victim cache |
US5577231A (en) | 1994-12-06 | 1996-11-19 | International Business Machines Corporation | Storage access authorization controls in a computer system using dynamic translation of large addresses |
US6079004A (en) | 1995-01-27 | 2000-06-20 | International Business Machines Corp. | Method of indexing a TLB using a routing code in a virtual address |
US5752275A (en) | 1995-03-31 | 1998-05-12 | Intel Corporation | Translation look-aside buffer including a single page size translation unit |
KR100395763B1 (en) * | 2000-02-01 | 2003-08-25 | 삼성전자주식회사 | A branch predictor for microprocessor having multiple processes |
US6633963B1 (en) | 2000-03-31 | 2003-10-14 | Intel Corporation | Controlling access to multiple memory zones in an isolated execution environment |
KR20040014988A (en) | 2001-06-29 | 2004-02-18 | 코닌클리즈케 필립스 일렉트로닉스 엔.브이. | Method, apparatus and compiler for predicting indirect branch target addresses |
US7221764B2 (en) * | 2002-02-14 | 2007-05-22 | Agere Systems Inc. | Security key distribution using key rollover strategies for wireless networks |
US20040117318A1 (en) * | 2002-12-16 | 2004-06-17 | Grawrock David W. | Portable token controlling trusted environment launch |
WO2005057365A2 (en) | 2003-12-08 | 2005-06-23 | Ebay Inc. | System to automatically regenerate software code |
US20050160229A1 (en) | 2004-01-16 | 2005-07-21 | International Business Machines Corporation | Method and apparatus for preloading translation buffers |
US7389402B2 (en) | 2005-06-07 | 2008-06-17 | Advanced Micro Devices, Inc. | Microprocessor including a configurable translation lookaside buffer |
US9384003B2 (en) * | 2007-10-23 | 2016-07-05 | Texas Instruments Incorporated | Determining whether a branch instruction is predicted based on a capture range of a second instruction |
US7925871B2 (en) * | 2008-02-19 | 2011-04-12 | Arm Limited | Identification and correction of cyclically recurring errors in one or more branch predictors |
US7937573B2 (en) * | 2008-02-29 | 2011-05-03 | Freescale Semiconductor, Inc. | Metric for selective branch target buffer (BTB) allocation |
US8225139B2 (en) | 2009-06-29 | 2012-07-17 | Oracle America, Inc. | Facilitating transactional execution through feedback about misspeculation |
US20110093658A1 (en) * | 2009-10-19 | 2011-04-21 | Zuraski Jr Gerald D | Classifying and segregating branch targets |
US8635428B2 (en) | 2009-12-09 | 2014-01-21 | Oracle America, Inc. | Preventing duplicate entries in a non-blocking TLB structure that supports multiple page sizes |
US8296538B2 (en) | 2010-02-17 | 2012-10-23 | Arm Limited | Storing secure mode page table data in secure and non-secure regions of memory |
JP5494832B2 (en) * | 2011-01-07 | 2014-05-21 | 富士通株式会社 | Arithmetic processing device and branch prediction method |
CN104794123B (en) | 2014-01-20 | 2018-07-27 | 阿里巴巴集团控股有限公司 | A kind of method and device building NoSQL database indexes for semi-structured data |
US10380183B2 (en) | 2014-04-03 | 2019-08-13 | International Business Machines Corporation | Building and querying hash tables on processors |
US9690714B1 (en) | 2014-04-07 | 2017-06-27 | Google Inc. | Multiple page-size translation lookaside buffer |
US9690587B2 (en) * | 2014-04-08 | 2017-06-27 | International Business Machines Corporation | Variable updates of branch prediction states |
US9983878B2 (en) | 2014-05-15 | 2018-05-29 | International Business Machines Corporation | Branch prediction using multiple versions of history data |
US10185731B2 (en) | 2016-03-31 | 2019-01-22 | Arm Limited | Indexing entries of a storage structure shared between multiple threads |
WO2019040893A1 (en) * | 2017-08-24 | 2019-02-28 | Voice. Vote Spc | Method and apparatus for disconnection of user actions and user identity |
-
2017
- 2017-11-29 US US15/825,524 patent/US10819736B2/en active Active
-
2018
- 2018-10-19 JP JP2020528089A patent/JP7307727B2/en active Active
- 2018-10-19 WO PCT/GB2018/053033 patent/WO2019106333A1/en unknown
- 2018-10-19 CN CN201880075891.3A patent/CN111417928B/en active Active
- 2018-10-19 KR KR1020207017587A patent/KR102713620B1/en active IP Right Grant
- 2018-10-19 EP EP18795774.1A patent/EP3718003B1/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080052499A1 (en) | 2006-07-11 | 2008-02-28 | Cetin Kaya Koc, Ph.D. | Systems and methods for providing security for computer systems |
US20090089564A1 (en) | 2006-12-06 | 2009-04-02 | Brickell Ernie F | Protecting a Branch Instruction from Side Channel Vulnerabilities |
US20110296206A1 (en) | 2010-05-25 | 2011-12-01 | Via Technologies, Inc. | Branch target address cache for predicting instruction decryption keys in a microprocessor that fetches and decrypts encrypted instructions |
US20110296202A1 (en) | 2010-05-25 | 2011-12-01 | Via Technologies, Inc. | Switch key instruction in a microprocessor that fetches and decrypts encrypted instructions |
US20160092702A1 (en) | 2014-09-26 | 2016-03-31 | David M. Durham | Cryptographic ponter address encoding |
US20180101484A1 (en) | 2014-09-26 | 2018-04-12 | Intel Corporation | Cryptographic pointer address encoding |
US20160170769A1 (en) | 2014-12-15 | 2016-06-16 | Michael LeMay | Technologies for indirect branch target security |
US20180088957A1 (en) | 2014-12-15 | 2018-03-29 | Intel Corporation | Technologies for indirect branch target security |
Non-Patent Citations (1)
Title |
---|
D Evtyushkin, D Ponomarev, N Abu-Ghazaleh,Jump over ASLR: Attacking branch predictors to bypass ASLR,2016 49th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO),米国,IEEE,2016年10月15日,https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=778743/,令和4年10月24日検索 |
Also Published As
Publication number | Publication date |
---|---|
KR102713620B1 (en) | 2024-10-08 |
KR20200090837A (en) | 2020-07-29 |
JP2021504800A (en) | 2021-02-15 |
EP3718003B1 (en) | 2022-04-13 |
WO2019106333A1 (en) | 2019-06-06 |
US20190166158A1 (en) | 2019-05-30 |
US10819736B2 (en) | 2020-10-27 |
EP3718003A1 (en) | 2020-10-07 |
CN111417928A (en) | 2020-07-14 |
CN111417928B (en) | 2024-09-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7307727B2 (en) | Encode the input to the branch prediction circuit | |
US11126714B2 (en) | Encoding of input to storage circuitry | |
US10725992B2 (en) | Indexing entries of a storage structure shared between multiple threads | |
US10540181B2 (en) | Managing branch prediction information for different contexts | |
US8639945B2 (en) | Branch and switch key instruction in a microprocessor that fetches and decrypts encrypted instructions | |
CN111886580B (en) | Apparatus and method for controlling branch prediction | |
US11797673B2 (en) | Processor that mitigates side channel attacks by expeditiously initiating flushing of instructions dependent upon a load instruction that causes a need for an architectural exception | |
US11868469B2 (en) | Processor that mitigates side channel attacks by preventing all dependent instructions from consuming architectural register result produced by instruction that causes a need for an architectural exception | |
US11734426B2 (en) | Processor that mitigates side channel attacks by prevents cache line data implicated by a missing load address from being filled into a data cache memory when the load address specifies a location with no valid address translation or no permission to read from the location | |
US11733972B2 (en) | Processor that mitigates side channel attacks by providing random load data as a result of execution of a load operation that does not have permission to access a load address | |
JP7413280B2 (en) | Branch prediction cache for multiple software workloads | |
US11853424B2 (en) | Processor that mitigates side channel attacks by refraining from allocating an entry in a data TLB for a missing load address when the load address misses both in a data cache memory and in the data TLB and the load address specifies a location without a valid address translation or without permission to read from the location | |
US10599437B2 (en) | Managing obscured branch prediction information | |
TWI627556B (en) | Microprocessor and method for securely executing instructions therein | |
KR20210070936A (en) | Dynamic designation of instructions as sensitive | |
Chen et al. | Leaking control flow information via the hardware prefetcher | |
US10496825B2 (en) | In-memory attack prevention | |
US11263015B1 (en) | Microarchitectural sensitive tag flow | |
US11604873B1 (en) | Noisy instructions for side-channel attack mitigation | |
WO2024176669A1 (en) | Microprocessor and microprocessor processing method | |
Jaamoum | Strategies for securing cache memories against software side-channel attacks | |
Singh et al. | A Survey of Security Concerns and Countermeasures in Modern Micro-architectures with Transient Execution | |
CN116340963A (en) | Transient side channel aware architecture for dense state computation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20211012 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20221025 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20221111 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230210 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20230606 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230630 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7307727 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |