TW202420076A - Region identifier based on instruction fetch address - Google Patents

Region identifier based on instruction fetch address Download PDF

Info

Publication number
TW202420076A
TW202420076A TW112138906A TW112138906A TW202420076A TW 202420076 A TW202420076 A TW 202420076A TW 112138906 A TW112138906 A TW 112138906A TW 112138906 A TW112138906 A TW 112138906A TW 202420076 A TW202420076 A TW 202420076A
Authority
TW
Taiwan
Prior art keywords
instruction
address
request
memory
region identifier
Prior art date
Application number
TW112138906A
Other languages
Chinese (zh)
Inventor
亞力山大唐納德查爾斯 查德維克
Original Assignee
英商Arm股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 英商Arm股份有限公司 filed Critical 英商Arm股份有限公司
Publication of TW202420076A publication Critical patent/TW202420076A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1416Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights
    • G06F12/1425Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block
    • G06F12/1441Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block for a range
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1052Security improvement

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Computer Interaction (AREA)
  • Storage Device Security (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

An apparatus (100) comprising instruction fetch circuitry (105) responsive to an instruction fetch address to fetch an instruction associated with the instruction fetch address, processing circuitry (125) responsive to the instruction to perform, when the instruction comprises a request specifying a target memory address and the request specifying the target memory address is permitted, an operation dependent on the target memory address, and memory security circuitry (135) to, when the instruction comprises the request specifying the target memory address: determine, based on a predetermined slice of the instruction fetch address, a current region identifier; identify, based on the current region identifier, permissions information for requests issued in response to instructions associated with the current region identifier; determine, based on the permissions information, whether the request is prohibited; and issue, in response to determining that the request is prohibited, a response to the processing circuitry indicating that the request is prohibited.

Description

基於指令提取位址的區域識別符Region identifier based on instruction fetch address

本技術係關於資料處理領域。This technology is related to the field of data processing.

在資料處理系統中,可執行涉及存取記憶體中之資料或指令的指令。例如,一些指令可包含讀取或寫入記憶體中之位置的請求,而其他指令可包含執行儲存在記憶體中之位置的指令的請求。能夠為此等存取定義權限可係有用的。In a data processing system, instructions may be executed that involve accessing data or instructions in memory. For example, some instructions may include requests to read or write to locations in memory, while other instructions may include requests to execute instructions stored at locations in memory. It may be useful to be able to define permissions for such accesses.

鑑於本技術之第一實例,提供一種設備,其包含: 指令提取電路系統,其回應一指令提取位址而提取與該指令提取位址關聯的一指令; 處理電路系統,其回應該指令而在該指令包含指定一目標記憶體位址的一請求且指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作;及 記憶體安全電路系統,其在該指令包含指定該目標記憶體位址的該請求時: 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而對該處理電路系統發布指示該請求經禁止的一回應。 In view of the first example of the present technology, a device is provided, which includes: an instruction fetch circuit system, which fetches an instruction associated with an instruction fetch address in response to an instruction fetch address; a processing circuit system, which responds to the instruction and performs an operation depending on the target memory address when the instruction includes a request to specify a target memory address and the request to specify the target memory address is allowed; and a memory security circuit system, which, when the instruction includes the request to specify the target memory address: determines a current region identifier based on a predetermined slice of the instruction fetch address; identifies permission information of a request issued in response to an instruction associated with the current region identifier based on the current region identifier; determines whether to prohibit the request based on the permission information; and In response to determining that the request is prohibited, issuing a response to the processing circuit system indicating that the request is prohibited.

鑑於另一實例,提供一種方法,其包含: 回應於一指令提取位址而提取與該指令提取位址關聯的一指令;及 在該指令包含指定一目標記憶體位址的一請求時: 回應於該指令而在指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作;及 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而發布指示該請求經禁止的一回應。 In view of another example, a method is provided, comprising: Responsive to an instruction fetch address, fetching an instruction associated with the instruction fetch address; and When the instruction includes a request specifying a target memory address: Responsive to the instruction, when the request specifying the target memory address is permitted, performing an operation depending on the target memory address; and Determining a current region identifier based on a predetermined slice of the instruction fetch address; Based on the current region identifier, identifying permission information for the request issued in response to the instruction associated with the current region identifier; Determining whether to prohibit the request based on the permission information; and Responsive to determining that the request is prohibited, issuing a response indicating that the request is prohibited.

鑑於另一實例,提供一種電腦程式,當其在一電腦上執行時導致電腦提供: 指令提取程式邏輯,其回應一指令提取位址而提取與該指令提取位址關聯的一指令; 處理電路程式邏輯,其回應該指令而在該指令包含指定一目標記憶體位址的一請求且指定該目標記憶體位址的該請求經允許時執行指示該目標記憶體位置的一請求;及 記憶體安全程式邏輯,其在該指令包含指定該目標記憶體位址的該請求時: 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而對該處理程式邏輯發布指示該請求經禁止的一回應。 In view of another example, a computer program is provided that, when executed on a computer, causes the computer to provide: instruction fetch program logic that, in response to an instruction fetch address, fetches an instruction associated with the instruction fetch address; processing circuit logic that, in response to the instruction, executes a request indicating a target memory location when the instruction includes a request to specify a target memory address and the request to specify the target memory address is permitted; and memory security program logic that, when the instruction includes the request to specify the target memory address: determines a current region identifier based on a predetermined slice of the instruction fetch address; Based on the current zone identifier, identifying permission information for a request issued in response to a command associated with the current zone identifier; Determining whether to prohibit the request based on the permission information; and In response to determining that the request is prohibited, issuing a response to the processing program logic indicating that the request is prohibited.

鑑於另一實例,提供一種電腦可讀儲存媒體以儲存上述電腦程式。該電腦可讀儲存媒體可係一暫時性儲存媒體或一非暫時性儲存媒體。In view of another example, a computer-readable storage medium is provided to store the above-mentioned computer program. The computer-readable storage medium can be a temporary storage medium or a non-temporary storage medium.

在參照隨附圖式討論實例實施方案之前,提供以下實例實施方案及關聯優點的描述。Before discussing example implementations with reference to the accompanying drawings, the following description of example implementations and associated advantages is provided.

根據一種實例組態,提供一種設備,其包含指令提取電路系統,該提取電路系統回應一指令提取位址而提取與該指令提取位址關聯的一指令。例如,指令提取電路系統可從由指令提取位址指示的記憶體位置提取指令(例如,其可係虛擬位址或實體位址)。在特定實例中,指令提取位址可係與指令關聯的程式計數器(PC)位址。According to one example configuration, a device is provided that includes an instruction fetch circuit system that, in response to an instruction fetch address, fetches an instruction associated with the instruction fetch address. For example, the instruction fetch circuit system may fetch the instruction from a memory location indicated by the instruction fetch address (e.g., which may be a virtual address or a physical address). In a specific example, the instruction fetch address may be a program counter (PC) address associated with the instruction.

該設備亦包含處理電路系統,該處理電路系統回應該指令而在該指令包含指定一目標記憶體位址的一請求且指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作。例如,指定目標記憶體請求的載入或儲存指令可包含讀取或寫入與目標記憶體位址關聯的目標記憶體位置的請求,而指定目標記憶體位址的分支指令(其在一些實例中可係函數呼叫或函數返回指令)可包含用於執行至儲存在目標記憶體位置之指令之分支的請求。然而,應理解其他類型指令(載入、儲存、及分支指令以外的指令)亦可包括此類請求。The apparatus also includes a processing circuit system that responds to the instruction and performs an operation depending on the target memory address when the instruction includes a request to specify a target memory address and the request to specify the target memory address is allowed. For example, a load or store instruction that specifies a target memory request may include a request to read or write a target memory location associated with the target memory address, and a branch instruction that specifies a target memory address (which may be a function call or function return instruction in some examples) may include a request to execute a branch to an instruction stored at the target memory location. However, it should be understood that other types of instructions (instructions other than load, store, and branch instructions) may also include such requests.

提供保護儲存在記憶體中之資料及指令以免於由在不允許存取此等資料/指令之程序內的碼區域發布的讀取及寫入存取,及防止執行分支至某些碼區域的機制可係有用的。作到此的一種方式可係定義取決於目標記憶體位址的權限–此類權限可定義在諸如頁表的表中。然而,此類權限不考慮請求的來源–權限不定義哪些程序或程序的哪些部分經允許存取/分支至記憶體中的哪些位置。因此,除非更新頁表中的權限,所有指令對給定記憶體頁具有相同的存取權限。更新此等權限可招致顯著的延遲,因為需要產生對記憶體的存取,且因此此類更新可僅在程序之間執行,在該情形中,在任何一個程序(或應用程式)內,在該應用程式中的所有碼一般對從任何給定記憶體位置讀取/寫入/執行資料/指令具有與相等的特權。It may be useful to provide a mechanism to protect data and instructions stored in memory from read and write accesses issued by code areas within a program that is not allowed to access such data/instructions, and to prevent execution from branching to certain code areas. One way to do this may be to define permissions that depend on the target memory address - such permissions may be defined in a table such as a page table. However, such permissions do not take into account the source of the request - the permissions do not define which programs or which parts of programs are allowed to access/branch to which locations in memory. Therefore, unless the permissions in the page table are updated, all instructions have the same access permissions to a given memory page. Updating such permissions can incur significant delays because access to memory is required, and therefore such updates can only be performed between programs, in which case, within any one program (or application), all code in that application generally has equal privileges to read/write/execute data/instructions from any given memory location.

另一方法可係額外包括可根據CPU暫存器之撤銷或修改某些權限的程式化而動態地撤銷某些權限的「權限重疊(permission overlay)」或「權限金鑰(permission key)」機制。例如,若權限定義在頁表中(例如),在頁表項中可存在若干個「重疊索引(overlay index)」位元。記憶體的各頁因此使用「金鑰」註記,且存在可減去權限的可程式化「重疊解釋(overlay interpretation)」暫存器。例如,重疊解釋暫存器可指示變化,諸如「從具有索引2的頁移除寫入存取」或「將索引3從可寫入切換成可執行」。Another approach may be to additionally include a "permission overlay" or "permission key" mechanism that can dynamically revoke certain permissions based on programming of CPU registers to revoke or modify certain permissions. For example, if the permissions are defined in a page table (for example), there may be a number of "overlay index" bits in the page table entry. Each page of memory is thus annotated with a "key", and there is a programmable "overlay interpretation" register that can reduce permissions. For example, the overlay interpretation register may indicate a change such as "remove write access from the page with index 2" or "switch index 3 from writable to executable."

然而,甚至此方法僅提供權限的時間觀點:上文定義的方法皆不考慮存取請求的來源(例如,包含請求的指令),因為權限單獨地從「什麼內容最後寫入至組態暫存器中?」而非「現在正在執行何種碼?」定義。因此,因為權限係從暫存器的目前值及目前儲存在頁表項中的內容導出,控制流程完整性受損(例如)可導致記憶體的其他部分的完整性受損(例如,導因於當到達非預期位置的程式流程的預望路徑應已涉及對重疊解釋暫存器或頁表項的更新時,在重疊解釋暫存器或頁表項未更新的狀況下,執行至該位置的分支)。However, even this approach only provides a temporal view of permissions: none of the approaches defined above consider the source of the access request (e.g., the instruction containing the request), because permissions are defined solely from "what was last written to the configuration registers?" rather than "what code is being executed now?" Thus, because permissions are derived from the current values of registers and what is currently stored in page table entries, a control flow integrity compromise can (for example) result in a control flow integrity compromise of other parts of memory (e.g., due to a branch being taken to an unexpected location without the overlay interpret register or page table entry being updated when the expected path of program flow to that location should have involved an update to that location).

為解決此問題,本技術提供以其定義係碼-空間(例如,取決於記憶體存取請求的來源)而非僅係碼-時間(例如,取決於請求何時發布)之權限的機制。To address this problem, the present technology provides a mechanism by which permissions are defined in code-space (e.g., depending on the source of the memory access request) rather than just in code-time (e.g., depending on when the request was issued).

具體而言,本技術的設備包含記憶體安全電路系統以在指令包含指定目標記憶體位址的請求時基於指令提取位址的預定切片判定目前區域識別符(亦稱為「RegionID」)。因此,RegionID取決於請求的來源(例如,指令)而非僅取決於請求的目標(例如,目標記憶體位址–雖然應理解特定RegionID的權限亦可取決於記憶體存取的目標)。該記憶體安全電路系統經組態以基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊,且基於該權限資訊判定是否禁止該請求。該記憶體安全電路系統亦經組態以回應於判定該請求經禁止而對該處理電路系統發布指示該請求經禁止的一回應。Specifically, an apparatus of the present technology includes a memory security circuit system to determine a current region identifier (also referred to as a "RegionID") based on a predetermined slice of the instruction fetch address when the instruction includes a request that specifies a target memory address. Thus, the RegionID depends on the source of the request (e.g., the instruction) rather than just the target of the request (e.g., the target memory address - although it should be understood that the permissions of a particular RegionID may also depend on the target of the memory access). The memory security circuit system is configured to identify permission information of a request issued in response to an instruction associated with the current region identifier based on the current region identifier, and determine whether to prohibit the request based on the permission information. The memory security circuitry is also configured to, in response to determining that the request is prohibited, issue a response to the processing circuitry indicating that the request is prohibited.

RegionID係基於請求存取/分支至由目標記憶體位址識別的記憶體位置的指令的指令提取位址而判定(且可可選地亦取決於其他因素)。因此,因為權限資訊係基於RegionID查找,記憶體安全電路系統基於請求的來源判定是否禁止請求。此允許記憶體安全電路系統執行取決於經發布之請求所代表的程序/應用程式內的特定位置的細粒權限,且即使存在控制流程完整性受損,維持碼區域的完整性。另外,基於指令提取位址的切片判定RegionID提供用於判定RegionID的簡單低成本機制,其可避免需要,例如,實施基於指令提取位址的昂貴/高延遲表查找。應注意若權限資訊指示請求經允許,存取請求仍可在最終被拒絕,例如,若其無法通過由設備執行的任何其他檢查。The RegionID is determined based on the instruction fetch address of the instruction requesting access/branch to the memory location identified by the target memory address (and optionally also depending on other factors). Therefore, because the permission information is based on the RegionID lookup, the memory security circuit system determines whether to prohibit the request based on the source of the request. This allows the memory security circuit system to execute fine-grained permissions that depend on specific locations within the program/application represented by the issued request, and maintain the integrity of the code region even if there is a loss of control flow integrity. In addition, slicing based on the instruction fetch address to determine the RegionID provides a simple, low-cost mechanism for determining the RegionID, which avoids the need to, for example, implement an expensive/high latency table lookup based on the instruction fetch address. It should be noted that if the permission information indicates that the request is allowed, the access request may still ultimately be denied, for example if it fails any other checks performed by the device.

本技術亦提供為不同指令定義不同權限的機制,該等不同指令可(例如)係單一程序或應用程式的不同部分(例如,因為權限取決於請求的來源,而非僅基於請求的目標,或基於需要更新以更新權限組之組態暫存器中的值)。因此,本技術在,例如,應用程式中及作業系統(OS)核心中可係有用的,以用於硬化軟體的核心安全組件。在OS核心中,此機制可(例如)用以硬化核心記憶體管理碼及結構以防備為其他核心組件所意外或惡意地篡改。其亦可用以將核心驅動程式沙盒化,而沒有將此等組件委派至離散程序中的效能負擔。將相同益處施加在應用程式內:例如,藉由保護記憶體分配程式庫碼/結構及/或動態連接器碼/結構,以防備為應用程式的其餘部分所篡改。其亦可將益處提供給包括用於處理不受信任的輸入的沙盒環境或及時(just-in-time, JIT)環境的應用程式。The technology also provides a mechanism to define different permissions for different instructions, which may, for example, be different parts of a single program or application (e.g., because permissions depend on the source of the request, rather than just the target of the request, or based on the value in a configuration register that needs to be updated to update the permission set). Therefore, the technology can be useful, for example, in applications and in operating system (OS) kernels to harden core security components of software. In the OS kernel, this mechanism can, for example, be used to harden core memory management code and structures to prevent accidental or malicious tampering by other core components. It can also be used to sandbox core drivers without the performance overhead of delegating such components to discrete processes. Apply the same benefits within the application: for example, by protecting memory allocation library code/structures and/or dynamic linker code/structures from tampering by the rest of the application. It may also provide benefits to applications that include sandbox environments or just-in-time (JIT) environments for handling untrusted input.

在一些實例中,該記憶體安全電路系統經組態以基於從與該目標記憶體位址關聯的一頁表項導出的該頁表存取權限資訊判定是否禁止該請求。在此等實例中,該記憶體安全電路系統經組態以回應於基於該權限資訊及該頁表權限資訊之至少一者判定該請求經禁止而發布指示該請求經禁止的該回應。In some examples, the memory security circuit system is configured to determine whether to prohibit the request based on the page table access permission information derived from a page table entry associated with the target memory address. In these examples, the memory security circuit system is configured to issue the response indicating that the request is prohibited in response to determining that the request is prohibited based on at least one of the permission information and the page table permission information.

雖然基於請求的來源定義權限由於上文闡述的原因而係有利的,若除了提供定義在頁表中的頁表存取權限外,亦提供取決於由請求指定的目標記憶體位址的此等權限,本技術可尤其有效。在此類實例中,若相關於RegionID定義的權限與基於目標記憶體位址之頁表項定義的該等權限不同,記憶體安全電路系統經組態以將更具限制性的權限視為係正確的(例如,若一組或二組權限其中一者指示請求經禁止,藉由發布該請求經禁止的回應)。While defining permissions based on the source of the request is advantageous for the reasons set forth above, the present technique may be particularly effective if, in addition to providing page table access permissions defined in the page table, such permissions are provided as a function of the target memory address specified by the request. In such instances, if the permissions defined in relation to the RegionID differ from those defined in the page table entry based on the target memory address, the memory security circuitry is configured to treat the more restrictive permissions as correct (e.g., if one of the one or both sets of permissions indicates that the request is forbidden, by issuing a response that the request is forbidden).

在一些實例中,該記憶體安全電路系統經組態以基於該指令提取位址的該預定切片,判定對應於儲存該指令的一記憶體區域的一來源區域識別符,且取決於該來源區域識別符判定該目前區域識別符。In some examples, the memory security circuitry is configured to determine a source region identifier corresponding to a memory region storing the instruction based on the predetermined slice of the instruction fetch address, and determine the current region identifier based on the source region identifier.

如上文解釋的,目前區域識別符取決於指令提取位址。在此實例中,此相依性係由來源區域識別符(亦稱為空間區域識別符(SRegionID))表示,其對應於儲存指令的記憶體區域(且因此對應於包含指令提取位址的位址空間區域)。As explained above, the current region identifier depends on the instruction fetch address. In this example, this dependency is represented by a source region identifier (also called a space region identifier (SRegionID)), which corresponds to the memory region where the instructions are stored (and therefore corresponds to the address space region containing the instruction fetch address).

在一些實例中,該處理電路系統回應識別一目的地暫存器的一返回空間識別符指令而判定一目前來源區域識別符並將該目前來源區域識別符儲存在該目的地暫存器中。In some examples, the processing circuitry determines a current source region identifier in response to a return space identifier instruction identifying a destination register and stores the current source region identifier in the destination register.

此提供,例如,共用程式庫可其識別哪個碼區域呼叫(分支至)其的機制。應注意到返回空間識別符指令可係專用指令,或其可係現有指令的修改–例如,目前來源區域識別符可儲存在系統暫存器欄位中,且返回空間識別符指令可係讀取系統暫存器之該欄位的指令。This provides, for example, a mechanism by which a common library can identify which code region to call (branch to). It should be noted that the return space identifier instruction may be a dedicated instruction, or it may be a modification of an existing instruction - for example, the current source region identifier may be stored in a system register field, and the return space identifier instruction may be an instruction that reads that field of the system register.

在一些實例中,該設備包含一暫存器以儲存一目前時間識別符,其中該記憶體安全電路系統經組態以取決於該來源區域識別符及該目前時間識別符而判定該目前區域識別符,該目前時間識別符與該指令提取位址無關地查找。在此等實例中,該處理電路系統回應偵測到具有與一先前指令關聯的一來源區域識別符不同的一給定來源區域識別符的一指令,而將該目前時間識別符設定成一預定值。In some examples, the apparatus includes a register to store a current time identifier, wherein the memory security circuitry is configured to determine the current region identifier as a function of the source region identifier and the current time identifier, the current time identifier being looked up independently of the instruction fetch address. In these examples, the processing circuitry sets the current time identifier to a predetermined value in response to detecting an instruction having a given source region identifier that is different from a source region identifier associated with a previous instruction.

除了空間分量(例如,來源區域識別符)外,此實例中的目前區域識別符亦具有時間分量(例如,基於目前時間區域識別符TRegionID),且回應於來源區域識別符中的變化而將此識別符強制成預定值(例如,此可係零)。此方法提供額外安全性以防備控制流程完整性受損,因為分支至不同碼區域將時間區域識別符強制成可(例如)與一組預定權限關聯的預定值。In addition to a spatial component (e.g., a source region identifier), the current region identifier in this example also has a temporal component (e.g., based on a current temporal region identifier TRegionID), and this identifier is forced to a predetermined value (e.g., which may be zero) in response to changes in the source region identifier. This approach provides additional security against control flow integrity compromise because branching to a different code region forces the temporal region identifier to a predetermined value that may, for example, be associated with a set of predetermined permissions.

在一些實例中,該設備包含一組態暫存器以儲存指示該指令提取位址的該預定切片的切片識別資訊。In some examples, the device includes a configuration register to store slice identification information indicating the predetermined slice of the instruction fetch address.

指令提取位址之使用為預定切片的位元在一些實例中可係固線式的(例如,不可藉由軟體組態)。然而,在此實例中,預定切片係藉由儲存在組態暫存器中的切片識別資訊識別。可使此組態暫存器對軟體可存取,允許切片識別資訊由軟體組態。The use of bits of the instruction fetch address for a predetermined slice may be hard-wired in some examples (e.g., not configurable by software). However, in this example, the predetermined slice is identified by slice identification information stored in a configuration register. This configuration register may be made accessible to software, allowing the slice identification information to be configurable by software.

表示切片識別資訊的方式未受特別限制。例如,可將其表示為指令提取位址之待使用為預定切片的第一及最後位元位置(亦即,最高及最低有效位元位置)的指示(例如,若將使用指令提取位址的位元44:38,切片識別資訊可識別位元位置44及38)。替代地,組態暫存器可儲存切片的第一或最後位元位置其中一者及切片中之位元的數目的指示(例如,在使用位元44:38的實例中,可識別位元位置44或位元位置38其中一者,且切片中之位元的數目可指示為7)。The manner in which the slice identification information is represented is not particularly limited. For example, it may be represented as an indication of the first and last bit positions (i.e., the most and least significant bit positions) of the instruction fetch address to be used for the predetermined slice (e.g., if bits 44:38 of the instruction fetch address are to be used, the slice identification information may identify bit positions 44 and 38). Alternatively, the configuration register may store an indication of one of the first or last bit positions of the slice and the number of bits in the slice (e.g., in the example of using bits 44:38, one of bit position 44 or bit position 38 may be identified, and the number of bits in the slice may be indicated as 7).

在一些實例中,該記憶體安全電路系統回應判定該指令提取位址的一進一步切片具有與一預定值不同的一值而判定該來源區域識別符係一預設來源區域識別符。In some examples, the memory security circuitry determines that the source region identifier is a default source region identifier in response to determining that a further slice of the instruction fetch address has a value different than a predetermined value.

其可用以識別指令提取位址的進一步切片,且使用此切片以提供與來源區域識別符有關的額外資訊。例如,若此進一步切片保持特定值(或一些預定值以外的值),可判定將使用預設來源區域識別符。此在記憶體的哪些區域與哪些來源區域識別符關聯上提供額外彈性。例如,此方法可用以要求區域識別僅對位址空間的特定較大區域發生,使得(例如)應用程式可使用其自切出若干個區域的「周圍」位址空間操作(例如,具有零的預設來源區域識別符)。此允許選擇一組小位址空間區域以用於程序/應用程式內的沙盒化,而大部分位址空間係用於應用程式中的任何較不受信任的組件。將進一步切片使用為遮罩以提供此周圍位址空間僅具有小硬體成本,因為其係可在微架構的前端施加的簡單遮罩,意謂著可提前將來源區域識別符告知設備的其餘部分(例如,CPU管線)。It can be used to identify a further slice of the instruction fetch address, and use this slice to provide additional information about the source area identifier. For example, if this further slice holds a specific value (or a value other than some predetermined value), it can be determined that the default source area identifier is to be used. This provides additional flexibility in which areas of memory are associated with which source area identifiers. For example, this method can be used to require that area identification only occur for specific larger areas of the address space, so that (for example) an application can use "surrounding" address space operations that it slices out several areas of (e.g., with a default source area identifier of zero). This allows a small set of address space areas to be selected for sandboxing within a program/application, while the majority of the address space is used for any less trusted components in the application. Using a further slice as a mask to provide this surrounding address space has only a small hardware cost, since it is a simple mask that can be applied at the front end of the microarchitecture, meaning that the rest of the device (e.g., the CPU pipeline) can be informed of the source region identifier in advance.

在上述實例中,使用指令的預定切片判定來源區域識別符的方式未受特別限制。然而,在特定實例中,預定切片可直接使用為來源區域識別符。此提供比(例如)使用預定切片以間接地判定識別符(例如,藉由將一些功能施加至預定切片,或使用預定切片查找儲存結構以判定來源區域識別符)的替代方法需要更不複雜的電路系統的方法。然而,將預定切片直接使用為來源區域識別符的不利因素可係在將哪些區域或記憶體指派給哪些來源區域識別符上有較低彈性。In the above examples, the manner in which the source region identifier is determined using the predetermined slice of the instruction is not particularly limited. However, in a specific example, the predetermined slice can be used directly as the source region identifier. This provides a method that requires less complex circuit systems than alternative methods such as (for example) using the predetermined slice to indirectly determine the identifier (for example, by applying some functions to the predetermined slice, or using the predetermined slice to look up a storage structure to determine the source region identifier). However, the disadvantage of using the predetermined slice directly as the source region identifier may be that there is less flexibility in which regions or memories are assigned to which source region identifiers.

在一些實例中,該指令提取位址包含一虛擬位址,該指令提取電路系統經組態以取決於該指令提取位址的一給定部分提取該指令,該指令提取位址的該給定部分指示該指令在記憶體中所儲存的一位置,其中該指令提取位址的該給定部分及該指令提取位址的該預定切片以至少一個位元重疊。In some examples, the instruction fetch address comprises a virtual address, and the instruction fetch circuit system is configured to fetch the instruction depending on a given portion of the instruction fetch address, the given portion of the instruction fetch address indicating a location in memory where the instruction is stored, wherein the given portion of the instruction fetch address and the predetermined slice of the instruction fetch address overlap by at least one bit.

在一些架構中,程序可使用虛擬位址參考記憶體中的位置,該等虛擬位址可轉譯成識別記憶體中之位置的實體位址。此可允許,例如,定義各具有其等自身之至實體位址空間之映射的多個不同的虛擬位址空間。例如,不同程序可具有不同的虛擬位址空間。In some architectures, programs can reference locations in memory using virtual addresses, which can be translated into physical addresses that identify locations in memory. This can allow, for example, defining multiple different virtual address spaces, each with its own mapping to the physical address space. For example, different programs can have different virtual address spaces.

此可招致多個不同虛擬位址映射至相同實體位址上的情況,例如,若具有不同虛擬位址空間的多個不同程序希望存取共用碼程式庫中的給定指令,各可使用不同虛擬位址參考指令。此稱為別名。然而,別名可影響設備的效能–例如,轉譯後備緩衝區或指令快取記憶體中的項可由虛擬位址索引及/或標記,意謂著各別名虛擬位址將映射至不同項上。此可招致相同指令/轉譯的多個複本儲存在快取記憶體/TLB的單獨項中,佔用否則可用以儲存其他指令的空間。This can result in a situation where multiple different virtual addresses map to the same physical address, for example, if multiple different programs with different virtual address spaces wish to access a given instruction in a common code library, each may reference the instruction using a different virtual address. This is called aliasing. However, aliasing can affect the performance of the device - for example, entries in a translation lookaside buffer or instruction cache may be indexed and/or tagged by virtual address, meaning that each aliased virtual address will map to a different entry. This can result in multiple copies of the same instruction/translation being stored in separate entries in the cache/TLB, taking up space that could otherwise be used to store other instructions.

一個可解決問題,諸如藉由不允許別名的該等者–例如,藉由要求指令提取位址的給定部分對映射至特定實體位址上的各虛擬位址皆相同。然而,在給定部分中保留指示別名虛擬位址的特定實例係源自碼的哪個程序/區段的一些資訊可係有用的。為解決此,本技術的發明人提議允許給定部分的一或多個位元(用以識別對應實體位址)與預定切片的一或多個位元(用以判定來源區域識別符)重疊。例如,在給定部分中的其他位元保持相同的同時,此等位元可對別名虛擬位址不同。此允許結構(諸如快取記憶體)基於排除重疊位元的給定部分查找,使得僅將來自給定實體位址的指令的一個副本儲存在快取記憶體中,而仍保留資訊以區分別名位址。One solution to the problem, such as by not allowing aliases - for example, by requiring that a given portion of an instruction fetch address be the same for each virtual address that maps to a particular physical address. However, it may be useful to retain some information in a given portion that indicates which program/segment of the code a particular instance of an aliased virtual address originates from. To address this, the inventors of the present technology propose allowing one or more bits of a given portion (used to identify the corresponding physical address) to overlap with one or more bits of a predetermined slice (used to determine the source region identifier). For example, these bits may be different for an aliased virtual address while other bits in the given portion remain the same. This allows structures such as caches to be searched based on a given portion of the address excluding overlapping bits so that only one copy of the instruction from a given physical address is stored in the cache, while still retaining information to distinguish alias addresses.

在一些實例中,該記憶體安全電路系統經組態以基於識別下列之至少一者的該權限資訊而判定是否禁止該請求: ●      讀取存取權限; ●      寫入存取權限; ●      執行分支的權限;及 ●      執行分支而不導致儲存一返回位址的權限。 In some examples, the memory security circuitry is configured to determine whether to prohibit the request based on the permission information identifying at least one of the following: ●      read access permission; ●      write access permission; ●      permission to execute a branch; and ●      permission to execute a branch without causing a return address to be stored.

因此,存取權限資訊可指示讀取、寫入、及執行指令的任何組合,且可進一步指示何時需要將分支執行為函數呼叫(節省返回位址)。Thus, the access permission information may indicate any combination of read, write, and execute instructions, and may further indicate when a branch needs to be executed as a function call (saving the return address).

在一些實例中,該記憶體安全電路系統經組態以基於該目標記憶體位址判定一目的地區域識別符。在此等實例中,該記憶體安全電路系統包含表存取電路系統以基於該目前區域識別符及該目的地區域識別符,查找記憶體中的一權限表,該權限表定義該權限資訊。進一步地,在此等實例中,該表存取電路系統經組態以支援該權限表的至少一種編碼,其中不同的權限資訊係針對該目前區域識別符與不同目的地區域識別符的不同組合定義。In some embodiments, the memory security circuitry is configured to determine a destination region identifier based on the target memory address. In these embodiments, the memory security circuitry includes table access circuitry to look up a permission table in memory based on the current region identifier and the destination region identifier, the permission table defining the permission information. Further, in these embodiments, the table access circuitry is configured to support at least one encoding of the permission table, wherein different permission information is defined for different combinations of the current region identifier and different destination region identifiers.

在此實例中,可將權限表視為係二維表,其中該表基於目前區域識別符(取決於指令提取位址判定)及目的地區域識別符(取決於目標記憶體位址判定)二者而查找。此允許權限資訊對目前區域識別符及目標區域識別符的多個不同組合定義,使得可判定是否允許碼的目前執行部分存取/分支至由請求的目標記憶體位址指示的特定記憶體位置。此允許將特定記憶體區域的存取給予特定碼區域或拒絕特定碼區域對特定記憶體區域的存取。In this example, the permission table can be viewed as a two-dimensional table, where the table is looked up based on both the current region identifier (determined by the instruction fetch address) and the destination region identifier (determined by the target memory address). This allows permission information to be defined for multiple different combinations of the current region identifier and the target region identifier, so that it can be determined whether the currently executing portion of the code is allowed to access/branch to a specific memory location indicated by the requested target memory address. This allows access to a specific memory region to be given to a specific code region or access to a specific memory region to be denied to a specific code region.

在一些實例中,該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表,且該設備包含一表識別暫存器以儲存指示該權限表在記憶體中的一位置的位址資訊。In some examples, the memory security circuitry includes table access circuitry to access a permission table in memory that defines the permission information, and the device includes a table identification register to store address information indicating a location of the permission table in memory.

例如,位址資訊可係表在記憶體中的基底位址。表存取電路系統使用該位址資訊定位記憶體中的表。For example, the address information may be the base address of the table in memory. The table access circuitry uses the address information to locate the table in memory.

在一些實例中,該設備經配置以在複數個特權等級的一者中操作,且該設備包含複數個暫存器,其各經組態以儲存指示一對應權限表在記憶體中的一位置的位址資訊。在此等實例中,該設備亦包含暫存器選擇電路系統以基於一目前特權等級將該複數個暫存器的一者選擇為該權限表識別暫存器。In some embodiments, the device is configured to operate in one of a plurality of privilege levels, and the device includes a plurality of registers, each of which is configured to store address information indicating a location of a corresponding permission table in memory. In these embodiments, the device also includes a register selection circuit system to select one of the plurality of registers as the permission table identification register based on a current privilege level.

在此實例中,可為每個特權等級定義一個單獨的權限表。例如,可有一個暫存器用於核心及一個暫存器用於使用者空間。當設備以較低特權等級操作時,此允許,例如,定義更具限制性的權限。In this example, a separate permission table may be defined for each privilege level. For example, there may be one register for the kernel and one register for user space. This allows, for example, more restrictive permissions to be defined when the device is operating at a lower privilege level.

在一些實例中,該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表,該設備包含一暫存器以儲存指示定義在該目前區域識別符之該權限表中之該權限資訊的一組目前權限,且該表存取電路系統回應判定該目前區域識別符已改變至一新區域識別符而基於該新區域識別符查找該權限表以識別符及待儲存在該暫存器中的一組經更新權限。In some examples, the memory security circuit system includes a table access circuit system to access a permission table in memory that defines the permission information, the device includes a register to store a set of current permissions indicating the permission information in the permission table defined in the current zone identifier, and the table access circuit system searches the permission table for an identifier based on the new zone identifier and a set of updated permissions to be stored in the register in response to determining that the current zone identifier has changed to a new zone identifier.

因此,與目前區域識別符關聯的權限資訊在此實例中可載入至暫存器中,使得其可以經降低延遲存取。接著,每次目前區域識別符改變時,暫存器中的權限資訊可以與新區域識別符關聯的一組經更新權限置換。Therefore, the permission information associated with the current locale identifier can be loaded into the register in this example so that it can be accessed with reduced latency. Then, each time the current locale identifier changes, the permission information in the register can be replaced with a set of updated permissions associated with the new locale identifier.

暫存器的格式未受特別限制,但暫存器可,例如,為複數個目標區域識別符的各者包含一個欄位,各欄位儲存對應的權限資訊(例如,一個位元指示一個權限–諸如讀取位元、寫入位元、及執行位元)。The format of the register is not particularly limited, but the register may, for example, include a field for each of a plurality of target region identifiers, each field storing corresponding permission information (e.g., a bit indicating a permission - such as a read bit, a write bit, and an execute bit).

在一些實例中,該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表,且該設備包含一快取記憶體以儲存定義在該權限表中之該等權限的一子集。在此等實例中,該設備經組態以在各與一上下文識別符關聯的複數個上下文的一者中操作,且該快取記憶體包含各與一對應上下文識別符關聯的複數個項。In some examples, the memory security circuitry includes table access circuitry to access a permission table in memory defining the permission information, and the device includes a cache to store a subset of the permissions defined in the permission table. In these examples, the device is configured to operate in one of a plurality of contexts each associated with a context identifier, and the cache includes a plurality of entries each associated with a corresponding context identifier.

因此,在此實例中,可快取一些權限資訊,使得對權限資訊的進一步存取可以經降低延遲執行,因此改善效能。另外,將各項與上下文識別符關聯(例如,此可係虛擬機器識別符(VMID)及位址空間識別符(ASID)的組合)避免在上下文切換時需要清除快取記憶體,因此改善效能,因為經快取資料在未來仍可用於存取。Thus, in this example, some permission information may be cached so that further access to the permission information may be performed with reduced latency, thereby improving performance. Additionally, associating each entry with a context identifier (e.g., this may be a combination of a virtual machine identifier (VMID) and an address space identifier (ASID)) avoids the need to flush cache memory when context switching, thereby improving performance because cached data may still be available for access in the future.

在一些實例中,該設備包含複數個暫存器,其包含針對複數個目前區域識別符之各者的一暫存器以儲存指示該目前區域識別符之權限資訊的一組權限。In some examples, the apparatus includes a plurality of registers including a register for each of a plurality of current locale identifiers to store a set of permissions indicating permission information of the current locale identifier.

可提供此等暫存器以替代記憶體中的權限表,或除了記憶體中的權限表外,可提供此等暫存器。雖然加入額外暫存器可增加由設備佔用的電路面積,由於此類暫存器可以經降低延遲存取(因此允許改善設備的效能),其等可有利的。Such registers may be provided in place of or in addition to a permission table in memory. Although the addition of additional registers may increase the circuit area occupied by the device, such registers may be advantageous because they may reduce latency accesses (thereby allowing improved performance of the device).

由於上述實例,暫存器的格式未受特別限制,但暫存器的各者可,例如,為複數個目標區域識別符的各者包含一個欄位,各欄位儲存對應的存取權限資訊。As with the above examples, the format of the registers is not particularly limited, but each of the registers may, for example, include a field for each of a plurality of target region identifiers, each field storing corresponding access permission information.

上文討論的技術可實施在具有實施上文描述的指令提取電路系統、處理電路系統、及記憶體安全電路系統的電路硬體的硬體設備中。然而,在另一實例中,相同技術可實施在電腦程式(例如,架構模擬器或模型)中,其可提供用於控制主機資料處理設備以提供用於來自目標碼之指令的執行的指令執行環境。在一些特定實例中,此等指令可包括返回空間識別符指令、時間識別符更新指令、分支及變化時間識別符指令、及分支及保持時間識別符指令的任一者。The techniques discussed above may be implemented in a hardware device having circuit hardware that implements the instruction fetch circuitry, processing circuitry, and memory security circuitry described above. However, in another example, the same techniques may be implemented in a computer program (e.g., an architecture simulator or model) that may provide an instruction execution environment for controlling a host data processing device to provide an execution environment for instructions from target code. In some specific examples, such instructions may include any of a return space identifier instruction, a time identifier update instruction, a branch and change time identifier instruction, and a branch and keep time identifier instruction.

該電腦程式可包含指令提取程式邏輯以提取目標碼的指令,及處理程式邏輯以回應於該等指令而控制主機資料處理設備執行資料處理。因此,指令提取程式邏輯仿真如上文討論之硬體設備的指令提取電路系統的功能性,且處理程式邏輯仿真處理電路系統。The computer program may include instruction fetcher logic to fetch instructions from the object code, and processor logic to control the host data processing device to perform data processing in response to the instructions. Thus, the instruction fetcher logic emulates the functionality of the instruction fetch circuitry of the hardware device discussed above, and the processor logic emulates the processing circuitry.

再者,在一些實例中,可仿真上文描述之暫存器的一些或全部–具體而言,該程式可包括暫存器維持程式邏輯,該暫存器維持程式邏輯維持表示(仿真)由該程式模擬之指令集架構的架構暫存器的資料結構(在主機設備的記憶體或架構暫存器內)。經仿真暫存器可包括描述在上述一些實例中的複數個暫存器的任一者。Furthermore, in some examples, some or all of the registers described above may be emulated - specifically, the program may include registers maintaining program logic that maintains data structures (in the host device's memory or in the architecture registers) representing (emulating) the instruction set architecture emulated by the program. The emulated registers may include any of the plurality of registers described in some of the above examples.

因此,此一模擬器電腦程式可對在模擬器電腦程式上執行的目標碼呈現與將由能夠直接執行目標指令集的實際硬體設備提供的環境類似的指令執行環境,即使在正在執行模擬器程式的主機電腦上可能不存在提供此等特徵的任何實際硬體。此對於在不實際支援一個指令集架構的主機平台上執行針對該架構編寫的碼可係有用的。再者,在軟體開發與支援新架構之硬體裝置的開發並行地執行的同時,模擬器在開發新版本之指令集架構之軟體的期間可係有用的。此可允許軟體在模擬器上開發及測試,使得軟體開發可在支援新架構的硬體裝置可用之前開始。Thus, such an emulator computer program can present to target code executed on the emulator computer program an instruction execution environment similar to the environment that would be provided by actual hardware devices capable of directly executing the target instruction set, even though there may not be any actual hardware providing such features on the host computer on which the emulator program is being executed. This can be useful for executing code written for an instruction set architecture on a host platform that does not actually support that architecture. Furthermore, an emulator can be useful during the development of software for a new version of an instruction set architecture, while the software development is performed in parallel with the development of hardware devices supporting the new architecture. This allows software to be developed and tested on the emulator, allowing software development to begin before hardware devices supporting the new architecture are available.

現在將參考圖式描述特定實施例。Specific embodiments will now be described with reference to the drawings.

圖1示意地繪示可將本技術之實例實施於其內的資料處理設備100。如圖所示,資料處理設備100包含指令提取電路系統105以從記憶體提取指令(可選地經由一或多個快取記憶體)。提取電路系統105從由指令提取位址(例如,此等位址可係定義指令在記憶體中所儲存之位置的記憶體位址)所識別的記憶體位置或從一或多個中介快取記憶體(未圖示)提取指令。在圖1的實例中,待由指令提取電路系統105提取之次一指令的指令提取位址係保持在程式計數器(PC)暫存器110中,該暫存器係在此實例中提供的一組暫存器115的一者。PC暫存器110識別待提取的次一指令,且因此在每次提取指令時增加(使得其指向程式順序中的次一指令)。暫存器檔案115亦包含其他暫存器,在此實例中,包括儲存時間區域識別符(TRegionID)的時間區域識別符暫存器130。此將於下文更詳細地揭示。FIG. 1 schematically illustrates a data processing device 100 in which an example of the present technology may be implemented. As shown, the data processing device 100 includes an instruction fetch circuit system 105 to fetch instructions from a memory (optionally via one or more cache memories). The fetch circuit system 105 fetches instructions from a memory location identified by an instruction fetch address (e.g., such addresses may be memory addresses defining the location where the instruction is stored in the memory) or from one or more intermediate cache memories (not shown). In the example of FIG. 1 , the instruction fetch address of the next instruction to be fetched by the instruction fetch circuit system 105 is maintained in a program counter (PC) register 110, which is one of a set of registers 115 provided in this example. The PC register 110 identifies the next instruction to be fetched and is therefore incremented each time an instruction is fetched (so that it points to the next instruction in the program sequence). The register file 115 also includes other registers, including, in this example, a time region identifier register 130 that stores a time region identifier (TRegionID). This will be disclosed in more detail below.

指令提取電路系統105將指令提供至指令解碼電路系統120,該指令解碼電路系統解碼指令並發布控制信號至處理電路系統125以控制處理電路系統125執行經解碼指令。處理電路系統125參考儲存在暫存器115中的資料執行經解碼指令(例如,處理電路系統可從暫存器讀取資料處理操作的運算元,並將資料處理操作的結果儲存至暫存器)。Instruction fetch circuitry 105 provides instructions to instruction decode circuitry 120, which decodes the instructions and issues control signals to processing circuitry 125 to control processing circuitry 125 to execute the decoded instructions. Processing circuitry 125 executes the decoded instructions with reference to data stored in registers 115 (e.g., processing circuitry may read operands for data processing operations from registers and store results of data processing operations in registers).

處理電路系統125亦回應於一些指令而發布記憶體存取請求以存取記憶體儲存的資料或指令。例如,處理電路系統125可將記憶體存取請求發布至記憶體控制器(未圖示)以將資料從記憶體載入至暫存器中或將資料從暫存器儲存至記憶體中。處理電路系統125亦可回應於控制流程指令(諸如分支指令)而更新儲存在PC暫存器110中的值以改變待由指令提取電路系統105提取的指令流程。Processing circuit system 125 also issues memory access requests in response to some instructions to access data or instructions stored in memory. For example, processing circuit system 125 can issue memory access requests to a memory controller (not shown) to load data from memory to a register or to store data from a register to memory. Processing circuit system 125 can also update the value stored in PC register 110 in response to control flow instructions (such as branch instructions) to change the instruction flow to be fetched by instruction fetch circuit system 105.

此實例中的資料處理設備亦包含記憶體安全電路系統135,該記憶體安全電路系統將於下文更詳細地描述。The data processing device in this example also includes a memory security circuit system 135, which will be described in more detail below.

在許多現代硬體及軟體架構中,將資料載入或儲存至/自記憶體之特定區域的讀取及寫入權限及從記憶體的特定區域提取指令的執行權限係由描述在由作業系統程式化且儲存在記憶體中之頁表(例如,多級頁表)中的權限所控制。例如,記憶體控制器或記憶體管理單元(其回應於包括載入/儲存資料之請求及提取指令之請求的記憶體存取請求而控制對記憶體的存取)可包含頁表遍歷電路系統以存取頁表並識別特定存取請求的權限。具體而言,頁表係基於存取請求的目標記憶體位址(例如,待存取之資料或指令的位址)查找以識別有關權限。因此,此類存取權限係在存取請求之目標的基礎上而非基於經發布的存取請求所代表的指令定義。In many modern hardware and software architectures, read and write permissions to load or store data to/from a particular area of memory and execute permissions to fetch instructions from a particular area of memory are controlled by permissions described in page tables (e.g., multi-level page tables) that are programmed by the operating system and stored in the memory. For example, a memory controller or memory management unit (which controls access to memory in response to memory access requests including requests to load/store data and requests to fetch instructions) may include page table traversal circuitry to access the page table and identify permissions for a particular access request. Specifically, the page table is looked up based on the target memory address of the access request (e.g., the address of the data or instruction to be accessed) to identify the relevant permissions. Therefore, such access rights are defined based on the target of the access request rather than on the instructions represented by the issued access request.

在一般資料處理設備中,在任何一個程序(或應用程式)內,該應用程式中的所有碼對讀取/寫入/執行其位址空間中的任何記憶體具有相等特權,例如,給定程序內的不同指令一般具有相同權限。如上文解釋的,一些架構額外包括可根據允許撤銷或修改某些權限之CPU暫存器的程式化而動態地撤銷某些權限的「權限重疊」或「權限金鑰」機制,例如,頁表項可使用此等重疊位元/金鑰註記,且CPU暫存器的程式化可指示(例如)給定權限應對與某個金鑰值關聯的任何頁撤銷(例如,「撤銷權限金鑰2的讀取存取」)。此允許修改定義在頁表中的存取權限,但僅提供權限的時間觀點。本技術的發明人認知到,例如,若存在控制流程完整性受損(例如,若允許控制流程分支至未預期的碼區域),此可導致潛在問題。In a general data processing device, within any one program (or application), all code in that application has equal privileges to read/write/execute any memory in its address space, e.g., different instructions within a given program generally have the same permissions. As explained above, some architectures additionally include a "permission overlay" or "permission key" mechanism that can dynamically revoke certain permissions based on programming of CPU registers that allow certain permissions to be revoked or modified, e.g., page table entries can be annotated with such overlay bits/keys, and the programming of the CPU registers can indicate (for example) that a given permission should be revoked for any page associated with a certain key value (e.g., "revoke read access for permission key 2"). This allows modification of access permissions defined in the page tables, but only provides a temporal view of the permissions. The inventors of the present technology have recognized that, for example, if there is a loss of control flow integrity (e.g., if control flow is allowed to branch to unexpected code regions), this can lead to potential problems.

圖2至圖3協助說明此問題可如何發生。具體而言,圖2A及圖2B繪示可能希望對特定位址空間200定義之權限的實例。如圖所示,碼的不同部分(「碼1」、「碼2」、及「碼3」)及不同資料(「資料A」及「資料B」)可儲存在位址空間的不同區域中。此等不同區域之各者可具有不同的讀取/寫入存取權限,其可能額外取決於任何特定時間點正在執行什麼碼。例如,如圖2A所示,從碼區域1(碼1)提取的指令可具有對資料區域A之資料(資料A)的讀取(R)及寫入(W)存取(例如,自其載入資料及將資料儲存至其的權限),但不具有對儲存在資料區域B中之資料(資料B)的存取。同時,碼區域3(碼3)可對資料區域A具有唯讀(RO)存取,及對資料區域B的讀取及寫入存取。Figures 2-3 help illustrate how this problem can occur. Specifically, Figures 2A and 2B illustrate examples of permissions that one might wish to define for a particular address space 200. As shown, different portions of code ("Code 1", "Code 2", and "Code 3") and different data ("Data A" and "Data B") may be stored in different regions of the address space. Each of these different regions may have different read/write access permissions, which may depend, among other things, on what code is being executed at any particular point in time. For example, as shown in FIG. 2A , instructions fetched from code region 1 (code 1) may have read (R) and write (W) access to data (data A) in data region A (data A) (e.g., the right to load data from it and store data to it), but may not have access to data (data B) stored in data region B. Meanwhile, code region 3 (code 3) may have read-only (RO) access to data region A, and read and write access to data region B.

類似地,如圖2B所示,各碼區域可具有不同的執行存取權限(例如,定義是否允許來自給定碼部分的指令分支至不同碼部分中的指令)。例如,在此實例中,允許來自碼區域1的指令分支至碼區域2及碼區域4(碼4)中的指令,而允許來自碼區域3的指令分支至碼區域2中的指令但不允許分支至碼區域4中的指令。Similarly, as shown in FIG. 2B , each code region may have different execution access permissions (e.g., defining whether instructions from a given code portion are allowed to branch to instructions in a different code portion). For example, in this example, instructions from code region 1 are allowed to branch to instructions in code region 2 and code region 4 (code 4), while instructions from code region 3 are allowed to branch to instructions in code region 2 but not to instructions in code region 4.

可能預期上文定義的權限重疊機制可在執行此等權限時使用,例如,藉由在從一個碼區域切換時改變重疊解釋暫存器的內容。然而,如將參照圖3A及圖3B於下文解釋的,此機制在存在控制流程完整性受損的情形中係較不有效的。It may be expected that the permission overlay mechanism defined above can be used when enforcing such permissions, for example, by changing the contents of the overlay interpretation register when switching from one code region. However, as will be explained below with reference to Figures 3A and 3B, this mechanism is less effective in situations where there is a loss of control flow integrity.

圖3A及圖3B顯示可如何執行來自不同碼區的指令的實例。圖3A顯示預期指令流程的實例。如圖所示,在從碼區域3切換至碼區域1之前,執行指令以更新組態暫存器,使得由與重疊位元組合的頁表定義的存取權限經更新。在此更新後,執行來自碼區域1的指令(指令C),導致處理電路系統發布讀取區域B中的資料的存取請求。然而,與重疊位元組合的組態暫存器及頁表中的權限指示對資料區域B的讀取存取被禁止,且因此存取請求被拒絕。3A and 3B show examples of how instructions from different code regions may be executed. FIG. 3A shows an example of an expected instruction flow. As shown, before switching from code region 3 to code region 1, an instruction is executed to update the configuration register so that the access permissions defined by the page table combined with the overlap bit are updated. After this update, an instruction from code region 1 (instruction C) is executed, causing the processing circuit system to issue an access request to read the data in region B. However, the permissions in the configuration register and page table combined with the overlap bit indicate that read access to data region B is prohibited, and therefore the access request is denied.

然而,圖3B繪示控制流程完整性受損可如何導致資料完整性受損。例如,圖3B顯示若來自碼區域3的指令未預期地分支至碼區域1的指令所可能發生的事。在此情形中,在組態暫存器未更新的狀況下,將指令A分支至指令C。此意謂著在執行指令C時,由與頁表組合的組態暫存器定義的權限仍與用於碼區域3的權限相同。允許來自碼區域3的指令對資料區域A的讀取及寫入存取,且因此允許對資料區域B的讀取存取。因此,導因於控制流程完整性受損,儲存在資料區域B中之資料的完整性或機密性可能受損。換言之,儲存在資料區域B中之資料的完整性/機密性取決於控制流程完整性的維持。However, FIG. 3B illustrates how a loss of control flow integrity can lead to a loss of data integrity. For example, FIG. 3B shows what might happen if an instruction from code area 3 unexpectedly branches to an instruction from code area 1. In this case, instruction A is branched to instruction C without the configuration register being updated. This means that when instruction C is executed, the permissions defined by the configuration register in combination with the page table remain the same as for code area 3. Instructions from code area 3 are allowed read and write access to data area A, and therefore read access to data area B. Therefore, due to a loss of control flow integrity, the integrity or confidentiality of the data stored in data area B may be compromised. In other words, the integrity/confidentiality of the data stored in data area B depends on maintaining the integrity of the control process.

本技術提供解決此問題的機制。具體而言,本技術定義取決於請求對特定記憶體位置之存取(無論係讀取、寫入、或執行存取)的指令的指令提取位址的來源區域識別符(亦稱為空間區域識別符,SRegionID)。此允許存取權限資訊取決於存取請求的來源,而非僅取決於存取請求的目的地及/或存取請求的時序定義。The present technology provides a mechanism to solve this problem. Specifically, the present technology defines a source region identifier (also called a spatial region identifier, SRegionID) that depends on the instruction fetch address of an instruction requesting access to a specific memory location (whether read, write, or execute access). This allows access permission information to depend on the source of the access request, rather than just the destination of the access request and/or the timing definition of the access request.

例如,圖4繪示空間區域識別符(SRegionID)可如何基於指令提取位址(其可從PC暫存器獲得)判定。空間區域識別符可回應於由處理電路系統發布的記憶體存取請求而由記憶體安全電路系統135判定。For example, Figure 4 illustrates how a spatial region identifier (SRegionID) may be determined based on an instruction fetch address (which may be obtained from the PC register). The spatial region identifier may be determined by the memory security circuitry 135 in response to a memory access request issued by the processing circuitry.

在圖4中,顯示64位元指令提取位址,雖然應理解此僅係實例–指令提取位址可具有實施方案相依的大小,雖然繪示於圖4中的實例可更適用於採用更大位址寬度的架構,諸如64位元或更大的位址寬度。空間區域識別符係基於指令提取位址的經選擇部分判定,其中記憶體安全電路系統135中的一些狀態(例如,暫存器)400指示將使用指令提取位址的哪些位元,例如,記憶體安全電路系統中的狀態400可指示待使用之部分的第一及最後位元位置,或該部分的第一/最後位元位置及大小。在替代實例中,指令提取位址之待使用的部分可係固線式的,而非在組態暫存器中可程式化的。In FIG. 4 , a 64-bit instruction fetch address is shown, although it should be understood that this is merely an example—the instruction fetch address may have an implementation-dependent size, although the example illustrated in FIG. 4 may be more applicable to architectures employing larger address widths, such as 64 bits or larger. The spatial region identifier is determined based on a selected portion of the instruction fetch address, wherein some state (e.g., register) 400 in the memory security circuit system 135 indicates which bits of the instruction fetch address are to be used, for example, the state 400 in the memory security circuit system may indicate the first and last bit positions of the portion to be used, or the first/last bit positions and size of the portion. In an alternative example, the portion of the instruction fetch address to be used may be hard-wired rather than programmable in a configuration register.

圖4在「A」中顯示64位元PC的一般格式的實例。該圖亦顯示指令提取位址之待使用為或導出空間區域識別符之部分的三個實例(B、C、D)。在所有四個實例中,指令提取位址包括若干個正則/標籤位元,及定義指令在記憶體中所儲存之位置的有用VA(虛擬位址)位元。實例B、C、及D各包括用以導出空間區域識別符的部分(SRegionID)。應注意到雖然實例顯示使用虛擬指令提取位址判定空間區域識別符,可替代地使用實體位址。FIG. 4 shows an example of the general format of a 64-bit PC in “A”. The figure also shows three examples (B, C, D) of the portion of the instruction fetch address to be used as or derived as a space region identifier. In all four examples, the instruction fetch address includes a number of regular/tag bits, and useful VA (virtual address) bits that define the location where the instruction is stored in memory. Examples B, C, and D each include a portion (SRegionID) used to derive a space region identifier. It should be noted that although the examples show the use of a virtual instruction fetch address to determine the space region identifier, a physical address may be used instead.

第一實例(A)顯示一般指令提取位址的實例。正則/標籤位元佔據指令提取位址的位元位置63:49,且剩餘位元48:0全部係有用VA位元。The first example (A) shows an example of a general instruction fetch address. The regular/tag bits occupy bit positions 63:49 of the instruction fetch address, and the remaining bits 48:0 are all useful VA bits.

在第二實例(B)中,將相同位元63:49使用為正則/標籤位元,但使用位元44:38導出空間區域識別符。在此實例中,將可提供額外資訊的額外常數定義在位元位置48:45中,例如,記憶體安全電路系統可經配置以在常數具有某些值時判定應使用預設空間區域識別符。此留下位元37:0以定義有用VA位元。In the second example (B), the same bits 63:49 are used as regular/label bits, but bits 44:38 are used to derive the space region identifier. In this example, an additional constant that can provide additional information is defined in bit positions 48:45, for example, the memory security circuitry can be configured to determine that a default space region identifier should be used when the constant has certain values. This leaves bits 37:0 to define useful VA bits.

在第三實例(C)中,再度將相同位元63:49使用為正則/標籤位元,但使用位元48:45導出空間區域識別符。此留下位元44:0以定義有用VA位元。In the third example (C), the same bits 63:49 are again used as regularization/tag bits, but bits 48:45 are used to derive the spatial region identifier. This leaves bits 44:0 to define the useful VA bits.

在第四實例(D)中,使用位元位置63:55導出空間區域識別符,其中降低正則/標籤位元的數目以佔據位元位置54:49。此留下位元48:0以定義有用VA位元。In the fourth example (D), the spatial region identifier is derived using bit positions 63:55, where the number of regular/tag bits is reduced to occupy bit positions 54:49. This leaves bits 48:0 to define the useful VA bits.

在所有實例B至D中,指令提取位址之位元的選擇係用以判定空間區域識別符,使得空間區域識別符取決於記憶體存取請求的來源(例如,取決於導致記憶體存取請求發布之指令的指令提取位址),而非取決於記憶體存取請求的目的地(例如,待存取之資料或指令的目標位址)。以其使用經選擇位元以判定空間區域識別符的方式未受特別限制。在一些實例中,經選擇位元可直接使用為空間區域識別符,而在其他實例中,經選擇位元可以一些其他方式由記憶體安全電路系統映射成空間區域識別符。In all of Examples B to D, the bits of the instruction fetch address are selected to determine the space region identifier so that the space region identifier depends on the source of the memory access request (e.g., on the instruction fetch address of the instruction that caused the memory access request to be issued), rather than on the destination of the memory access request (e.g., the target address of the data or instruction to be accessed). The manner in which the selected bits are used to determine the space region identifier is not particularly limited. In some examples, the selected bits can be used directly as the space region identifier, while in other examples, the selected bits can be mapped into the space region identifier by the memory security circuit system in some other manner.

在一些實例中,SRegionID部分及有用VA位元可以若干個位元重疊(例如,若干個位元用以判定SRegionID及用以判定指令在記憶體中所儲存的位置)。如上文解釋的,在強制軟體保持別名虛擬位址之間的所有其他VA位元常數的情況中,此可提供在別名虛擬位址之間區分的機制。另外,可用VA位元在一些實例中可包括所有的SRegionID位元。In some examples, the SRegionID portion and the useful VA bits may overlap by a number of bits (e.g., a number of bits used to determine the SRegionID and used to determine where the instruction is stored in memory). As explained above, this may provide a mechanism to distinguish between alias virtual addresses while forcing the software to keep all other VA bits constant between alias virtual addresses. Additionally, the useful VA bits may include all of the SRegionID bits in some examples.

在一些實例中,架構可支援基於指令提取位址判定SRegionID的多個技術。例如,可支援顯示於圖4中之方法的二或更多者,例如,PC位元暫存器400可係可組態的,使得待處理為SRegionID切片的位元係可程式化的。In some examples, the architecture may support multiple techniques for determining SRegionID based on the instruction fetch address. For example, two or more of the methods shown in FIG. 4 may be supported, for example, the PC bit register 400 may be configurable so that the bits to be processed as SRegionID slices are programmable.

另外,架構除了支援使用指令提取位址的切片判定SRegionID外,還可支援額外機制。此可將額外彈性提供給使用該架構的晶片設計者。例如,圖5顯示判定空間區域識別符的另一方法。具體而言,如圖5所示的記憶體安全電路系統135包含將位址空間的不同區域(例如,虛擬或實體)映射至區域識別符的暫存器組500。在顯示於圖5中的特定實例中,為複數個空間區域識別符的各者提供一對暫存器,該對暫存器包括識別對應區域在記憶體中的基底位址的基底位址暫存器505及識別對應區域在記憶體中的大小的大小暫存器510。在此實例中,記憶體安全電路系統經配置以比較所有或部分的指令提取位址與由暫存器指示的基底位址及大小,以判定指令提取位址落在區域的何者內。空間區域識別符接著係對應於該區的識別。In addition, in addition to supporting the use of instruction fetch address slice determination SRegionID, the architecture can also support additional mechanisms. This can provide additional flexibility to chip designers using the architecture. For example, Figure 5 shows another method for determining a spatial region identifier. Specifically, the memory security circuit system 135 shown in Figure 5 includes a register group 500 that maps different regions of the address space (e.g., virtual or physical) to region identifiers. In the specific example shown in Figure 5, a pair of registers is provided for each of a plurality of spatial region identifiers, the pair of registers including a base address register 505 that identifies the base address of the corresponding region in the memory and a size register 510 that identifies the size of the corresponding region in the memory. In this example, the memory security circuitry is configured to compare all or part of the instruction fetch address with the base address and size indicated by the register to determine which of the regions the instruction fetch address falls within. The spatial region identifier is then associated with the identification of the region.

應注意到可將各區域的大小指示為,例如,對應區域中之記憶體的位元組的數目、記憶體區域中的頁的數目、基底位址之作為區域識別的部分或作為該區域在記憶體中的結束位址而遮蔽掉的位元的數目。It should be noted that the size of each region may be indicated as, for example, the number of bytes of memory corresponding to the region, the number of pages in the memory region, the number of bits of the base address masked out as part of the region identification or as the end address of the region in memory.

圖6顯示可在架構中受支援的另一額外機制,在此實例中,記憶體安全電路系統135包含表存取電路系統(亦稱為SRegionID表存取電路系統,空間區域識別符表存取電路系統,或來源區域識別符表存取電路系統)600。SRegionID表存取電路系統回應於記憶體存取請求而基於導致記憶體存取請求發布之指令的指令提取位址查找記憶體605中的表。表610定義空間區域識別符至指令提取位址的映射。6 shows another additional mechanism that may be supported in the architecture, in this example, the memory security circuitry 135 includes table access circuitry (also referred to as SRegionID table access circuitry, spatial region identifier table access circuitry, or source region identifier table access circuitry) 600. The SRegionID table access circuitry responds to a memory access request by looking up a table in memory 605 based on the instruction fetch address of the instruction that caused the memory access request to be issued. Table 610 defines a mapping of spatial region identifiers to instruction fetch addresses.

當記憶體中的表用以定義指令提取位址至空間區域識別符的映射時,如顯示於圖6中的實例,記憶體安全電路系統亦可包含一或多個快取記憶體以從記憶體中的表快取資料。When a table in memory is used to define the mapping of instruction fetch addresses to spatial region identifiers, such as the example shown in FIG. 6 , the memory security circuit system may also include one or more cache memories to cache data from the table in memory.

因此,空間區域識別符取決於記憶體存取的來源,且因此亦可稱為來源區域識別符。接著可定義取決於空間區域識別符(且可選地亦可取決於記憶體存取的目標位址)的一組記憶體存取權限(例如,讀取/寫入權限)。除了定義在頁表中的該等權限外,可定義此類權限。Thus, the spatial region identifier depends on the source of the memory access and may therefore also be referred to as a source region identifier. A set of memory access permissions (e.g., read/write permissions) may then be defined that depend on the spatial region identifier (and optionally also on the target address of the memory access). Such permissions may be defined in addition to those defined in the page table.

另外,雖然上文的許多討論聚焦在針對記憶體存取定義的權限(例如,將資料或指令載入及儲存自/至記憶體),應理解執行權限亦可取決於空間區域識別符定義–例如,分支指令的空間區域識別符可用以判定是否允許分支。Additionally, while much of the discussion above has focused on permissions defined for memory access (e.g., loading and storing data or instructions from/to memory), it should be understood that execution permissions may also depend on spatial region identifier definitions - for example, a spatial region identifier for a branch instruction may be used to determine whether the branch is allowed.

存取權限可進一步取決於可儲存在圖1所示之時間識別符暫存器130中的時間區域識別符(TRegionID)。此暫存器可係軟體可存取的,在此情形中,時間區域識別符可由處理電路系統執行的指令更新。在特定實例中,定義其係空間區域識別符(SRegionID)及時間區域識別符(TRegionID)之串接的區域識別符(RegionID)。The access rights may further depend on a temporal region identifier (TRegionID) which may be stored in a temporal identifier register 130 shown in FIG1 . This register may be software accessible, in which case the temporal region identifier may be updated by instructions executed by the processing circuit system. In a specific example, a region identifier (RegionID) is defined which is the concatenation of a spatial region identifier (SRegionID) and a temporal region identifier (TRegionID).

圖7顯示讀取、寫入、及執行權限可如何基於區域識別符定義的實例。在此特定實例中,給定記憶體存取請求或分支請求的存取權限係對目前區域識別符(例如,請求指令的空間區域識別符及目前時間區域識別符的串接)及目標區域識別符(例如,目標位址的空間區域識別符及目前時間識別符的串接)的若干個組合的各者定義。因此,可將顯示於圖7中的表視為係二維(2D)表,因為其藉由目前區域識別符及目標區域識別符二者查找。FIG7 shows an example of how read, write, and execute permissions can be defined based on region identifiers. In this particular example, the access permissions for a given memory access request or branch request are defined for each of several combinations of a current region identifier (e.g., the concatenation of the spatial region identifier of the request instruction and the current temporal region identifier) and a target region identifier (e.g., the concatenation of the spatial region identifier of the target address and the current temporal identifier). Thus, the table shown in FIG7 can be viewed as a two-dimensional (2D) table because it is searched by both the current region identifier and the target region identifier.

在表中,「RW」指示允許讀取及寫入存取、「RO」指示允許讀取存取但不允許寫入存取、「X」指示允許分支、且「XL」指示函數呼叫(將返回位址保存至,例如,鏈接暫存器的分支)而非其他類型的分支。短劃(dash)「-」指示不允許存取。In the table, "RW" indicates that read and write access is allowed, "RO" indicates that read access is allowed but write access is not allowed, "X" indicates that branches are allowed, and "XL" indicates function calls (branches that save the return address to, for example, a link register) but not other types of branches. A dash "-" indicates that access is not allowed.

該表(其可稱為權限表,例如)可儲存在記憶體中。例如,該表可係單一表,或其可係多級表。在一些實例中,可將分支及函數呼叫權限(「X」及「XL」)定義在單獨表或位元映像中,其中權限表僅定義讀取及寫入權限。The table (which may be referred to as a permission table, for example) may be stored in memory. For example, the table may be a single table, or it may be a multi-level table. In some examples, branch and function call permissions ("X" and "XL") may be defined in separate tables or bitmaps, where the permission table defines only read and write permissions.

圖8顯示可用以識別及存取一或多個權限表(諸如顯示於圖7中的該表)的電路系統的實例。在此實例中,記憶體安全電路系統135包含權限表存取電路系統800以存取記憶體605中的權限表805。權限表中的基底位址定義在一組暫存器810中。在此特定實例中,假設資料處理設備能夠在三個特權等級的任一者中操作,且為每個特權等級定義一個表。因此,提供暫存器815以儲存各表在記憶體中的基底位址,且權限表存取電路系統基於儲存在對應暫存器中的基底位址存取權限表。此實例中的記憶體安全電路系統亦包含經配置以快取權限表中之內容的子集的一或多個權限表快取記憶體820。權限表快取記憶體中的項可由虛擬機器識別符(VMID)及位址空間識別符(ASID)標記,使得快取記憶體不需要在每次存在上下文切換時清除。替代地,快取記憶體可由一些替代上下文識別符標記。FIG8 shows an example of a circuit system that can be used to identify and access one or more permission tables (such as the table shown in FIG7 ). In this example, the memory security circuit system 135 includes a permission table access circuit system 800 to access a permission table 805 in the memory 605. The base address in the permission table is defined in a set of registers 810. In this particular example, it is assumed that the data processing device can operate in any one of three privilege levels, and a table is defined for each privilege level. Therefore, a register 815 is provided to store the base address of each table in the memory, and the permission table access circuit system accesses the permission table based on the base address stored in the corresponding register. The memory security circuit system in this example also includes one or more permission table caches 820 configured to cache a subset of the contents of the permission table. The entries in the permission table cache can be marked by a virtual machine identifier (VMID) and an address space identifier (ASID) so that the cache does not need to be cleared every time there is a context switch. Alternatively, the cache can be marked by some alternative context identifier.

在顯示於圖8中的實例中,僅顯示可能存在於記憶體安全電路系統135中的電路系統的一些者。應理解此實例中的記憶體安全電路系統亦可包括諸如顯示在其他圖式中的SRegionID表存取電路系統600、SRegionID暫存器500、或PC位元暫存器的電路系統。進一步地,雖然此實例假設資料處理設備能夠在多個不同的特權等級中操作,此不係必要的。In the example shown in FIG8 , only some of the circuitry that may be present in the memory security circuitry 135 is shown. It should be understood that the memory security circuitry in this example may also include circuitry such as the SRegionID table access circuitry 600, the SRegionID register 500, or the PC bit register shown in other figures. Further, although this example assumes that the data processing device is capable of operating at multiple different privilege levels, this is not necessary.

圖9係繪示可回應於所發布的記憶體存取請求而由資料處理設備執行之方法的實例的流程圖。應注意到類似方法亦可回應於分支指令的執行而執行。9 is a flow chart illustrating an example of a method that may be performed by a data processing device in response to an issued memory access request. It should be noted that a similar method may also be performed in response to the execution of a branch instruction.

如圖所示,該方法包括從TRegionID暫存器讀取目前時間區域識別符的步驟900、及基於其執行招致記憶體存取請求發布之指令的指令提取位址判定目前空間區域識別符(SRegionID)的步驟905。該方法亦包括基於記憶體存取請求的目標位址判定目標空間區域識別符(亦即,對應於存取請求之目標的空間區域識別符)的步驟910。已判定目前時間區域識別符及目前空間識別符,該方法包括基於目前空間及時間區域識別符判定目前區域識別符(RegionID)(例如,如上文解釋的,RegionID可係SRegionID及TRegionID的串接)的步驟915。再者,該方法包括基於目標空間區域識別符及目前時間區域識別符判定目標區域識別符(RegionID)的步驟920。已判定目前及目標區域識別符,該方法包括基於此等二個識別符查找權限表的步驟925–例如,此可係在諸如圖7所示之表中的查找。As shown, the method includes step 900 of reading the current temporal region identifier from the TRegionID register, and step 905 of determining the current spatial region identifier (SRegionID) based on the instruction fetch address of the instruction whose execution caused the memory access request to be issued. The method also includes step 910 of determining the target spatial region identifier (i.e., the spatial region identifier corresponding to the target of the access request) based on the target address of the memory access request. Having determined the current temporal region identifier and the current spatial identifier, the method includes a step 915 of determining a current region identifier (RegionID) based on the current spatial and temporal region identifiers (e.g., as explained above, RegionID may be a concatenation of SRegionID and TRegionID). Further, the method includes a step 920 of determining a target region identifier (RegionID) based on the target spatial region identifier and the current temporal region identifier. Having determined the current and target region identifiers, the method includes a step 925 of looking up an authorization table based on these two identifiers—for example, this may be a lookup in a table such as that shown in FIG. 7 .

圖10係另一流程圖,在此情形中繪示資料處理設備可如何對分支指令的執行作出回應的實例。具體而言,在一些實例中,資料處理設備可經配置以在分支指令的執行導致空間區域識別符(SRegionID)變化時(例如,在分支指令與一個空間區域識別符關聯且分支指令的目標與不同空間區域識別符關聯時)將時間區域識別符設定為零(或某個其他預設值)。此有助於維持控制流程完整性。FIG. 10 is another flow chart, in this case illustrating an example of how a data processing device may respond to the execution of a branch instruction. Specifically, in some examples, the data processing device may be configured to set the temporal region identifier to zero (or some other default value) when the execution of a branch instruction causes the spatial region identifier (SRegionID) to change (e.g., when the branch instruction is associated with one spatial region identifier and the target of the branch instruction is associated with a different spatial region identifier). This helps maintain control flow integrity.

具體而言,顯示於圖10中的方法包含判定是否執行分支指令的步驟1000。當判定分支指令已執行時,該方法包含判定分支指令的執行是否已導致空間區域識別符改變的步驟1005。當判定此係該情形時,將時間區域識別符設定1010為零。Specifically, the method shown in Figure 10 includes a step 1000 of determining whether a branch instruction has been executed. When it is determined that the branch instruction has been executed, the method includes a step 1005 of determining whether the execution of the branch instruction has caused the spatial region identifier to change. When it is determined that this is the case, the temporal region identifier is set 1010 to zero.

圖11繪示可使用的模擬器實施方案。雖然稍早所述之實施例以用於操作支援所關注技術的特定處理硬體之設備及方法來實施本發明,但亦可能根據本文所述之實施例提供一指令執行環境,其係透過使用電腦程式實施。此類電腦程式常稱為模擬器,因為其等提供硬體架構之基於軟體的實施方案。模擬器電腦程式的種類包括仿真器、虛擬機、模型、及二進制轉譯器(包括動態二進制轉譯器)。一般而言,模擬器實施方案可在可選地運行主機作業系統1320、支援模擬器程式1310的主機處理器1330上運行。在一些配置中,在硬體與所提供的指令執行環境及/或相同的主機處理器上提供的多個相異指令執行環境之間可有多層模擬。歷史上,已需要強大的處理器來提供模擬器實施方案,其以合理速度執行,但此種方法在某些情況下可係有正當理由的,諸如當因為相容性或再使用原因此需要執行另一處理器原生的程式碼時。例如,模擬器實施方案可提供具有不為主機處理器硬體所支援之額外功能性的指令執行環境,或提供一般與不同的硬體架構相關聯的指令執行環境。模擬的綜述係於「Some Efficient Architecture Simulation Techniques」中給出,Robert Bedichek, Winter 1990 USENIX Conference,頁數53至63。FIG. 11 illustrates a simulator implementation that may be used. Although the embodiments described earlier implement the present invention with apparatus and methods for operating specific processing hardware supporting the technology of interest, it is also possible to provide an instruction execution environment according to the embodiments described herein that is implemented using a computer program. Such computer programs are often referred to as simulators because they provide software-based implementations of the hardware architecture. Types of simulator computer programs include emulators, virtual machines, models, and binary translators (including dynamic binary translators). Generally speaking, the simulator implementation may be run on a host processor 1330 that optionally runs a host operating system 1320 and supports the simulator program 1310. In some configurations, there may be multiple layers of emulation between the hardware and the instruction execution environment provided and/or multiple different instruction execution environments provided on the same host processor. Historically, powerful processors have been required to provide an emulator implementation that executes at reasonable speeds, but this approach may be justified in certain circumstances, such as when it is necessary to execute code that is native to another processor for compatibility or reuse reasons. For example, an emulator implementation may provide an instruction execution environment with additional functionality not supported by the host processor hardware, or provide an instruction execution environment that is generally associated with a different hardware architecture. An overview of simulation is given in "Some Efficient Architecture Simulation Techniques", Robert Bedichek, Winter 1990 USENIX Conference, pages 53-63.

在先前已參照特定硬體架構或特徵來描述實施例之情況下,在一模擬實施例中,可藉由合適的軟體架構或特徵提供等效功能。例如,可在模擬實施例中將特定電路系統實施為電腦程式邏輯。在顯示於圖11中的實例中,提供指令提取程式邏輯1340,其提供與先前實例之指令提取電路系統相同的功能性。額外地,提供處理程式邏輯1350,其提供與上述處理電路系統相同的功能性,及提供記憶體安全程式邏輯1360,其提供上述實例中的記憶體安全電路系統的功能性。類似地,記憶體硬體(諸如暫存器或快取)可在模擬實施例中實施為軟體資料結構。於先前描述實施例中提及的硬體元件的一或多者存在於主機硬體(例如,主機處理器1330)上的配置中,一些模擬實施例可在適當時利用主機硬體。Where an embodiment has been previously described with reference to a particular hardware architecture or feature, in a simulated embodiment, equivalent functionality may be provided by an appropriate software architecture or feature. For example, a particular circuit system may be implemented as computer program logic in a simulated embodiment. In the example shown in FIG. 11 , instruction fetch program logic 1340 is provided that provides the same functionality as the instruction fetch circuit system of the previous example. Additionally, processing program logic 1350 is provided that provides the same functionality as the processing circuit system described above, and memory security program logic 1360 is provided that provides the functionality of the memory security circuit system in the above-described example. Similarly, memory hardware (such as registers or caches) may be implemented as software data structures in emulated embodiments. In configurations where one or more of the hardware elements mentioned in the previously described embodiments reside on host hardware (e.g., host processor 1330), some emulated embodiments may utilize host hardware when appropriate.

模擬器程式1310可儲存在電腦可讀儲存媒體(其可係非暫時性媒體)上,並提供程式介面(指令執行環境)給目標碼1300(其可包括應用程式、作業系統、及超管理器),該程式介面與藉由模擬器程式1310模型化之硬體架構的介面相同。因此,目標碼1300之包括如上文描述之需要發布記憶體存取請求的指令、分支指令、函數呼叫指令、及函數返回指令的程式指令可在指令執行環境內使用模擬器程式1310執行,使得實際上不具有上文討論之設備100的硬體特徵的主機電腦1330可仿真此等特徵。The emulator program 1310 may be stored on a computer-readable storage medium (which may be a non-transitory medium) and provides a programming interface (instruction execution environment) to the object code 1300 (which may include an application, an operating system, and a hypervisor), the programming interface being the same as the interface of the hardware architecture modeled by the emulator program 1310. Therefore, program instructions of the object code 1300 including instructions that require issuing memory access requests, branch instructions, function call instructions, and function return instructions as described above may be executed using the emulator program 1310 within the instruction execution environment, so that a host computer 1330 that does not actually have the hardware features of the device 100 discussed above may emulate such features.

在本申請案中,用語「經組態以...(configured to...)」係用以意指一設備的一元件具有能夠實行該經定義作業的一組態。在此上下文中,「組態(configuration)」意指硬體或軟體之互連的配置或方式。例如,該設備可具有專用硬體,其提供經定義的作業,或者一處理器或其他處理裝置可經程式化以執行該功能。「經組態以(configured to)」並不意味著設備元件需要以任何方式改變以提供所定義的作業。In this application, the phrase "configured to..." is used to mean that a component of a device has a configuration that enables it to perform the defined operation. In this context, "configuration" means the arrangement or manner in which hardware or software is interconnected. For example, the device may have dedicated hardware that provides the defined operation, or a processor or other processing device may be programmed to perform the function. "Configured to" does not mean that the device component needs to be changed in any way to provide the defined operation.

進一步地,詞「包含…中之至少一者(comprising at least one of…)」在本申請案中係用以意指包括以下選項的任一者或以下選項的任何組合。例如,「下列中之至少一者:A;B;及C」意圖意指A或B或C或A、B、及C的任何組合(例如,A及B或A及C或B及C)。Furthermore, the term "comprising at least one of..." is used in this application to mean including any one of the following options or any combination of the following options. For example, "at least one of the following: A; B; and C" is intended to mean A or B or C or any combination of A, B, and C (e.g., A and B or A and C or B and C).

雖然本文已參照附圖詳細地描述本發明的說明性實施例,應瞭解本發明不限於該等精確實施例,且所屬技術領域中具有通常知識者可於其中實行各種變化與修改,而不脫離如隨附申請專利範圍所定義的本發明的範圍。Although illustrative embodiments of the present invention have been described in detail with reference to the accompanying drawings, it should be understood that the present invention is not limited to those precise embodiments and that a person skilled in the art may implement various changes and modifications therein without departing from the scope of the present invention as defined by the appended claims.

100:資料處理設備;設備 105:指令提取電路系統;提取電路系統 110:程式計數器(PC)暫存器 115:暫存器;暫存器檔案 120:指令解碼電路系統 125:處理電路系統 130:時間區域識別符暫存器;時間識別符暫存器 135:記憶體安全電路系統 200:位址空間 400:狀態;PC位元暫存器 500:組;SRegionID暫存器 505:基底位址暫存器 510:大小暫存器 600:表存取電路系統;SRegionID表存取電路系統 605:記憶體 610:表 800:權限表存取電路系統 805:權限表 810:暫存器 815:暫存器 820:權限表快取記憶體 900:步驟 905:步驟 910:步驟 915:步驟 920:步驟 925:步驟 1000:步驟 1005:步驟 1010:設定 1300:目標碼 1310:模擬器程式 1320:主機作業系統 1330:主機處理器;主機電腦 1340:指令提取程式邏輯 1350:處理程式邏輯 1360:記憶體安全程式邏輯 A:實例 B:實例 C:實例 D:實例 100: data processing device; device 105: instruction fetch circuitry; fetch circuitry 110: program counter (PC) register 115: register; register file 120: instruction decoding circuitry 125: processing circuitry 130: time region identifier register; time identifier register 135: memory security circuitry 200: address space 400: status; PC bit register 500: group; SRegionID register 505: base address register 510: size register 600: table access circuitry; SRegionID table access circuitry 605: memory 610: table 800: permission table access circuitry 805: permission table 810: register 815: register 820: permission table cache 900: step 905: step 910: step 915: step 920: step 925: step 1000: step 1005: step 1010: setup 1300: target code 1310: simulator program 1320: host operating system 1330: host processor; host computer 1340: instruction fetch program logic 1350: processor logic 1360: Memory Security Program Logic A: Instance B: Instance C: Instance D: Instance

本技術的進一步態樣、特徵、及優點將由於結合附圖閱讀的以下實例描述而顯而易見,在該等附圖中: 〔圖1〕示意地繪示一資料處理設備; 〔圖2A〕及〔圖2B〕繪示針對特定位址空間定義之權限的實例; 〔圖3A〕及〔圖3B〕顯示可如何執行不同碼區中之指令的實例; 〔圖4〕至〔圖6〕顯示基於指令提取位址判定空間區域識別符(SRegionID)的各種實例; 〔圖7〕顯示讀取、寫入、及執行權限可如何定義在權限表中的實例; 〔圖8〕顯示可用以識別及存取一或多個權限表的電路系統的實例; 〔圖9〕係繪示可回應於所發布之記憶體存取請求而執行之方法的實例的流程圖; 〔圖10〕係繪示資料處理設備可如何對一些分支指令的執行作出回應的實例的流程圖;及 〔圖11〕繪示可使用的模擬器實施方案。 Further aspects, features, and advantages of the present technology will become apparent from the following example descriptions read in conjunction with the accompanying drawings, in which: [FIG. 1] schematically illustrates a data processing device; [FIG. 2A] and [FIG. 2B] illustrate examples of permissions defined for a particular address space; [FIG. 3A] and [FIG. 3B] show examples of how instructions in different code regions may be executed; [FIG. 4] to [FIG. 6] show various examples of determining a space region identifier (SRegionID) based on an instruction fetch address; [FIG. 7] shows an example of how read, write, and execute permissions may be defined in a permission table; [FIG. 8] shows an example of a circuit system that may be used to identify and access one or more permission tables; [Figure 9] is a flow chart illustrating an example of a method that may be performed in response to an issued memory access request; [Figure 10] is a flow chart illustrating an example of how a data processing device may respond to the execution of some branch instructions; and [Figure 11] illustrates an emulator implementation that may be used.

135:記憶體安全電路系統 135:Memory security circuit system

400:狀態;PC位元暫存器 400: Status; PC bit register

A:實例 A: Example

B:實例 B: Example

C:實例 C: Example

D:實例 D: Example

Claims (18)

一種設備,其包含: 指令提取電路系統,其回應一指令提取位址而提取與該指令提取位址關聯的一指令; 處理電路系統,其回應該指令而在該指令包含指定一目標記憶體位址的一請求且指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作;及 記憶體安全電路系統,其在該指令包含指定該目標記憶體位址的該請求時: 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而對該處理電路系統發布指示該請求經禁止的一回應。 A device comprising: an instruction fetch circuit system that fetches an instruction associated with an instruction fetch address in response to an instruction fetch address; a processing circuit system that performs an operation depending on a target memory address in response to the instruction when the instruction includes a request to specify a target memory address and the request to specify the target memory address is permitted; and a memory security circuit system that, when the instruction includes the request to specify the target memory address: determines a current region identifier based on a predetermined slice of the instruction fetch address; identifies permission information of a request issued in response to an instruction associated with the current region identifier based on the current region identifier; determines whether to prohibit the request based on the permission information; and In response to determining that the request is prohibited, issuing a response to the processing circuit system indicating that the request is prohibited. 如請求項1之設備,其中 該記憶體安全電路系統經組態以: 基於從與該目標記憶體位址關聯的一頁表項導出的頁表存取權限資訊判定是否禁止該請求;及 回應於基於該權限資訊及該頁表權限資訊之至少一者判定該請求經禁止而發布指示該請求經禁止的該回應。 The device of claim 1, wherein the memory security circuit system is configured to: determine whether to prohibit the request based on page table access permission information derived from a page table entry associated with the target memory address; and issue the response indicating that the request is prohibited in response to determining that the request is prohibited based on at least one of the permission information and the page table permission information. 如請求項1或請求項2之設備,其中 該記憶體安全電路系統經組態以基於該指令提取位址的該預定切片判定對應於儲存該指令的一記憶體區域的一來源區域識別符,且取決於該來源區域識別符判定該目前區域識別符。 The device of claim 1 or claim 2, wherein the memory security circuit system is configured to determine a source region identifier corresponding to a memory region storing the instruction based on the predetermined slice of the instruction fetch address, and determine the current region identifier based on the source region identifier. 如請求項3之設備,其中 該處理電路系統回應識別一目的地暫存器的一返回空間識別符指令而判定一目前來源區域識別符並將該目前來源區域識別符儲存在該目的地暫存器中。 The apparatus of claim 3, wherein the processing circuit system determines a current source region identifier in response to a return space identifier instruction identifying a destination register and stores the current source region identifier in the destination register. 如請求項3或請求項4之設備,其包含 一暫存器,其用以儲存一目前時間識別符, 其中該記憶體安全電路系統經組態以取決於該來源區域識別符及該目前時間識別符而判定該目前區域識別符,該目前時間識別符與該指令提取位址無關地查找;且 該處理電路系統回應偵測到具有與一先前指令關聯的一來源區域識別符不同的一給定來源區域識別符的一指令而將該目前時間識別符設定成一預定值。 A device as claimed in claim 3 or claim 4, comprising: a register for storing a current time identifier, wherein the memory security circuit system is configured to determine the current region identifier based on the source region identifier and the current time identifier, the current time identifier being looked up independently of the instruction fetch address; and the processing circuit system sets the current time identifier to a predetermined value in response to detecting an instruction having a given source region identifier that is different from a source region identifier associated with a previous instruction. 如前述請求項中任一項之設備,其包含 一組態暫存器,其用以儲存指示該指令提取位址的該預定切片的切片識別資訊。 A device as claimed in any of the preceding claims, comprising: a configuration register for storing slice identification information indicating the predetermined slice of the instruction fetch address. 如前述請求項中任一項之設備,其中 該記憶體安全電路系統回應判定該指令提取位址的一進一步切片具有與一預定值不同的一值而判定該來源區域識別符係一預設來源區域識別符。 A device as in any of the preceding claims, wherein the memory security circuit system determines that the source region identifier is a default source region identifier in response to determining that a further slice of the instruction fetch address has a value different from a predetermined value. 如前述請求項中任一項之設備,其中: 該指令提取位址包含一虛擬位址; 該指令提取電路系統經組態以取決於該指令提取位址的一給定部分提取該指令,該指令提取位址的該給定部分指示該指令在記憶體中所儲存的一位置;及 該指令提取位址的該給定部分及該指令提取位址的該預定切片以至少一個位元重疊。 A device as in any of the preceding claims, wherein: the instruction fetch address comprises a virtual address; the instruction fetch circuitry is configured to fetch the instruction depending on a given portion of the instruction fetch address, the given portion of the instruction fetch address indicating a location in memory where the instruction is stored; and the given portion of the instruction fetch address and the predetermined slice of the instruction fetch address overlap by at least one bit. 如前述請求項中任一項之設備,其中 該記憶體安全電路系統經組態以基於識別下列之至少一者的該權限資訊而判定是否禁止該請求: 讀取存取權限; 寫入存取權限; 執行分支的權限;及 執行分支而不導致儲存一返回位址的權限。 A device as in any of the preceding claims, wherein the memory security circuit system is configured to determine whether to prohibit the request based on the permission information identifying at least one of the following: read access permission; write access permission; permission to execute a branch; and permission to execute a branch without causing a return address to be stored. 如前述請求項中任一項之設備,其中: 該記憶體安全電路系統經組態以基於該目標記憶體位址判定一目的地區域識別符; 該記憶體安全電路系統包含表存取電路系統以基於該目前區域識別符及該目的地區域識別符查找記憶體中的一權限表,該權限表定義該權限資訊;及 該表存取電路系統經組態以支援該權限表的至少一種編碼,其中不同的權限資訊係針對該目前區域識別符與不同目的地區域識別符的不同組合定義。 A device as in any of the preceding claims, wherein: the memory security circuitry is configured to determine a destination region identifier based on the target memory address; the memory security circuitry includes table access circuitry to search a permission table in memory based on the current region identifier and the destination region identifier, the permission table defining the permission information; and the table access circuitry is configured to support at least one encoding of the permission table, wherein different permission information is defined for different combinations of the current region identifier and different destination region identifiers. 如前述請求項中任一項之設備,其中: 該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表;及 該設備包含一表識別暫存器以儲存指示該權限表在記憶體中的一位置的位址資訊。 A device as in any of the preceding claims, wherein: the memory security circuitry includes a table access circuitry to access a permission table in memory that defines the permission information; and the device includes a table identification register to store address information indicating a location of the permission table in memory. 如請求項11之設備,其中: 該設備經配置以在複數個特權等級的一者中操作;及 該設備包含: 複數個暫存器,其各經組態以儲存指示一對應權限表在記憶體中的一位置的位址資訊;及 暫存器選擇電路系統,其用以基於一目前特權等級將該複數個暫存器的一者選擇為該權限表識別暫存器。 The device of claim 11, wherein: the device is configured to operate in one of a plurality of privilege levels; and the device comprises: a plurality of registers, each of which is configured to store address information indicating a location of a corresponding permission table in memory; and a register selection circuit system for selecting one of the plurality of registers as the permission table identification register based on a current privilege level. 如前述請求項中任一項之設備,其中: 該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表;且 該設備包含一暫存器以儲存指示定義在該目前區域識別符之該權限表中之該權限資訊的一組目前權限;且 該表存取電路系統回應判定該目前區域識別符已改變至一新區域識別符而基於該新區域識別符查找該權限表以識別待儲存在該暫存器中的一組經更新權限。 A device as in any of the preceding claims, wherein: the memory security circuitry includes table access circuitry to access a permission table in memory defining the permission information; and the device includes a register to store a set of current permissions indicating the permission information in the permission table defined in the current region identifier; and the table access circuitry searches the permission table based on the new region identifier to identify a set of updated permissions to be stored in the register in response to determining that the current region identifier has changed to a new region identifier. 如前述請求項中任一項之設備,其中: 該記憶體安全電路系統包含表存取電路系統以存取記憶體中之定義該權限資訊的一權限表; 該設備包含一快取記憶體以儲存定義在該權限表中之該等權限的一子集; 該設備經組態以在各與一上下文識別符關聯的複數個上下文的一者中操作;且 該快取記憶體包含各與一對應上下文識別符關聯的複數個項。 A device as in any of the preceding claims, wherein: the memory security circuitry includes table access circuitry to access a permission table in memory defining the permission information; the device includes a cache to store a subset of the permissions defined in the permission table; the device is configured to operate in one of a plurality of contexts each associated with a context identifier; and the cache includes a plurality of entries each associated with a corresponding context identifier. 如前述請求項中任一項之設備,其包含 複數個暫存器,其包含針對複數個目前區域識別符之各者的一暫存器以儲存指示該目前區域識別符之權限資訊的一組權限。 A device as in any of the preceding claims, comprising a plurality of registers, including a register for each of a plurality of current locale identifiers to store a set of permissions indicating permission information of the current locale identifier. 一種方法,其包含 回應於一指令提取位址而提取與該指令提取位址關聯的一指令;及 在該指令包含指定一目標記憶體位址的一請求時: 回應於該指令而在指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作; 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而發布指示該請求經禁止的一回應。 A method comprising: responsive to an instruction fetch address, fetching an instruction associated with the instruction fetch address; and when the instruction includes a request specifying a target memory address: responsive to the instruction, when the request specifying the target memory address is permitted, performing an operation depending on the target memory address; determining a current region identifier based on a predetermined slice of the instruction fetch address; based on the current region identifier, identifying permission information for a request issued in response to the instruction associated with the current region identifier; determining whether the request is prohibited based on the permission information; and responsive to determining that the request is prohibited, issuing a response indicating that the request is prohibited. 一種電腦程式,當其在一電腦上執行時導致該電腦提供: 指令提取程式邏輯,其回應一指令提取位址而提取與該指令提取位址關聯的一指令; 處理程式邏輯,其回應該指令而在該指令包含指定一目標記憶體位址的一請求且指定該目標記憶體位址的該請求經允許時,取決於該目標記憶體位址執行一操作;及 記憶體安全程式邏輯,其在該指令包含指定該目標記憶體位址的該請求時: 基於該指令提取位址的一預定切片判定一目前區域識別符; 基於該目前區域識別符,識別回應於與該目前區域識別符關聯之指令而發布之請求的權限資訊; 基於該權限資訊判定是否禁止該請求;及 回應於判定該請求經禁止而對該處理程式邏輯發布指示該請求經禁止的一回應。 A computer program that, when executed on a computer, causes the computer to provide: instruction fetch program logic that, in response to an instruction fetch address, fetches an instruction associated with the instruction fetch address; processing program logic that, in response to the instruction, performs an operation dependent on the target memory address when the instruction includes a request to specify a target memory address and the request to specify the target memory address is permitted; and memory security program logic that, when the instruction includes the request to specify the target memory address: determines a current region identifier based on a predetermined slice of the instruction fetch address; identifies permission information for requests issued in response to instructions associated with the current region identifier based on the current region identifier; Determining whether the request is prohibited based on the permission information; and In response to determining that the request is prohibited, issuing a response to the processing program logic indicating that the request is prohibited. 一種電腦可讀儲存媒體,其用以儲存如請求項17之電腦程式。A computer-readable storage medium for storing a computer program as claimed in claim 17.
TW112138906A 2022-11-02 2023-10-12 Region identifier based on instruction fetch address TW202420076A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
GB2216292.9 2022-11-02
GB2216292.9A GB2623986B (en) 2022-11-02 2022-11-02 Region identifier based on instruction fetch address

Publications (1)

Publication Number Publication Date
TW202420076A true TW202420076A (en) 2024-05-16

Family

ID=84369814

Family Applications (1)

Application Number Title Priority Date Filing Date
TW112138906A TW202420076A (en) 2022-11-02 2023-10-12 Region identifier based on instruction fetch address

Country Status (8)

Country Link
EP (1) EP4612585A1 (en)
JP (1) JP2025538937A (en)
KR (1) KR20250100654A (en)
CN (1) CN120077368A (en)
GB (1) GB2623986B (en)
IL (1) IL320127A (en)
TW (1) TW202420076A (en)
WO (1) WO2024094956A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20260079852A1 (en) * 2024-09-18 2026-03-19 Apple Inc. Controlling access to memory locations
WO2026062366A1 (en) * 2024-09-18 2026-03-26 Apple Inc. Controlling access to memory locations
CN121635965A (en) * 2026-02-04 2026-03-10 此芯科技(武汉)有限公司 Instruction prediction method, device, electronic equipment, storage medium and product

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7111145B1 (en) * 2003-03-25 2006-09-19 Vmware, Inc. TLB miss fault handler and method for accessing multiple page tables
GB2569358B (en) * 2017-12-15 2020-01-29 Advanced Risc Mach Ltd Code realms
GB2570474B (en) * 2018-01-26 2020-04-15 Advanced Risc Mach Ltd Region fusing
GB2578135B (en) * 2018-10-18 2020-10-21 Advanced Risc Mach Ltd Range checking instruction

Also Published As

Publication number Publication date
GB202216292D0 (en) 2022-12-14
GB2623986A (en) 2024-05-08
KR20250100654A (en) 2025-07-03
WO2024094956A1 (en) 2024-05-10
GB2623986B (en) 2024-10-30
IL320127A (en) 2025-06-01
EP4612585A1 (en) 2025-09-10
JP2025538937A (en) 2025-12-03
CN120077368A (en) 2025-05-30

Similar Documents

Publication Publication Date Title
TWI835856B (en) Apparatus, method, computer program, and computer-readable storage medium for range checking instruction
US7213125B2 (en) Method for patching virtually aliased pages by a virtual-machine monitor
KR101799261B1 (en) Restricting memory areas for an instruction read in dependence upon a hardware mode and a security flag
TW202420076A (en) Region identifier based on instruction fetch address
JP7445431B2 (en) Apparatus and method for controlling execution of instructions
JP2022505011A (en) Devices and methods for controlling memory access
JP7425786B2 (en) memory access control
JP7801251B2 (en) Tag checking device and method
JP2024545406A (en) Two-Stage Address Translation
JP2023038361A (en) Apparatus and method for controlling changes in instruction sets
JP7719863B2 (en) Techniques for constraining access to memory using capabilities
KR20240004738A (en) Techniques for restricting access to memory using capabilities
TW202435061A (en) Address-dependent check
US12373611B2 (en) Key capability storage
JP7369720B2 (en) Apparatus and method for triggering actions
TW202319913A (en) Technique for constraining access to memory using capabilities
TW202340955A (en) Technique for constraining access to memory using capabilities
TW202427202A (en) Apparatus, method and computer program, for performing translation table entry load/store operation
KR20250002607A (en) Memory Management