Data processing apparatus and data processing method

By using capability registers and address calculation instructions, fine-grained memory access control is achieved, solving the memory error problem in memory-unsafe languages, improving security and performance, and supporting compatibility with legacy code.

CN115151893BActive Publication Date: 2026-11-27ARM LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180015150.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-02-17
Filing Date
2021-01-07
Publication Date
2026-11-27
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

In existing technologies, memory errors caused by memory-unsafe programming languages ​​are easily exploited maliciously, and existing memory protection technologies are coarse-grained and cannot provide fine-grained access control.

Method used

It uses capability registers to store pointers and constraint metadata, and generates address calculation instructions by capability and non-capability generation to achieve fine-grained control over the address space, supporting multiple instantiations and secure isolation of position-independent executable components within the address space.

Benefits of technology

It improves memory access security, prevents memory errors from being exploited, supports backward compatibility with legacy code, and enhances processor security and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115151893B_ABST
    Figure CN115151893B_ABST
Patent Text Reader

Abstract

An apparatus has processing circuitry; an instruction decoder; and capability registers, each capability register to store a capability comprising a pointer and constraint metadata to constrain valid use of the pointer / capability. Responsive to a capability generation address compute instruction specifying an offset value, a reference capability register is selected to be one of a program counter capability register and a further capability register. A result capability is generated, the pointer of the result capability indicating a window address identifying a selected window within an address space, the selected window being offset from a reference window by a number of windows determined based on the offset value of the capability generation address compute instruction. The reference window comprises a window containing an address indicated by the pointer of the reference capability register.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This technology relates to the field of data processing.

[0002] Software to be executed by a data processing device is typically written in a high-level programming language and then compiled into code according to the instruction set architecture supported by the device on which the software will be executed. For example, the software may initially be written in a higher-level language such as Java. ® Written in C or C++, and then compiled to natively supported instruction set architectures, such as those by Arm. ® Provided x86 or AArch64.

[0003] Some higher-level programming languages, such as Java, are considered memory-safe languages ​​because they include runtime error detection checks to check for certain errors related to memory access. In contrast, memory-unsafe languages, such as C and C++, do not include such runtime error checks. The enduring popularity of memory-unsafe languages ​​means that a large number of memory-related errors can exist in compiled code based on a given instruction set architecture, such as boundary violations (where an array index provided by the code exceeds the legal boundaries of the array); use-after-free errors (where a memory location is accessed after it has been deallocated or freed for another purpose); use-after-return (where the address of a variable used within a function is accessed after the function has been returned from), and so on. Such errors can be easily exploited by malicious actors or can cause programs to fail in unpredictable ways.

[0004] Current memory protection technologies are often relatively coarse-grained because access permissions to the corresponding memory regions are usually limited at the level of individual processes or threads accessing virtual memory pages, rather than being related to specific accesses to code or data objects executed within a thread or process.

[0005] In a capability-based architecture, capability registers can be provided to store capabilities, where capabilities include pointers and constraint metadata that constrains the valid use of the pointers or capabilities. This approach means that when a specific pointer to a capability is referenced to access specific data or instructions, the associated metadata constraining that access is provided within the capability itself. Different accesses to the same address by different instructions within the same process can reference different capabilities and are therefore subject to different constraints. This allows for finer-grained partitioning of the software running on the processing circuitry, making it more difficult for attackers to exploit memory usage errors.

[0006] At least some examples provide an apparatus comprising: processing circuitry for performing data processing; an instruction decoder for decoding instructions to control the processing circuitry to perform the data processing; and a plurality of capability registers, each capability register for storing capabilities, the capabilities including pointers and constraint metadata for constraining the valid use of the pointers or the capabilities, the capability registers including a program counter capability register, the pointer to the program counter capability register indicating a program counter address indicating the current program flow point; wherein: in response to a capability generation address calculation instruction with a specified offset value, the instruction decoder is configured to control the processing circuitry to: select a reference capability register as one of the program counter capability register and other capability registers; and write a result capability to a result capability register, the pointer of the result capability indicating a window address identifying a selected window within an address space, wherein the window comprises a contiguous block of addresses of a predetermined size, the selected window being offset from the reference window by a number of windows determined based on the offset value specified by the capability generation address calculation instruction, and the reference window comprising a window containing the address indicated by the pointer of the reference capability register.

[0007] At least some examples provide a data processing method for an apparatus including processing circuitry and a plurality of capability registers, each capability register storing a capability including a pointer and constraint metadata for constraining the valid use of the pointer or the capability, the capability registers including a program counter capability register, the pointer of which indicates a program counter address indicating the current program flow point; the method comprising: controlling the processing circuitry in response to a capability generation address calculation instruction with a specified offset value: selecting a reference capability register as one of the program counter capability register and other capability registers; and writing a result capability to a result capability register, the pointer of which indicates a window address identifying a selected window within an address space, wherein the window comprises a contiguous block of addresses of a predetermined size, the selected window being offset from a reference window by a number of windows determined based on the offset value specified by the capability generation address calculation instruction, and the reference window comprising a window containing the address indicated by the pointer of the reference capability register.

[0008] At least some examples provide a computer program for controlling a host data processing device to provide an instruction execution environment for executing target code. The computer program includes: instruction decoding program logic for decoding instructions of the target code to control the host data processing device to perform data processing; and register maintenance program logic for maintaining a data structure representing a plurality of capability registers, each capability register storing a capability, the capability including a pointer and constraint metadata for constraining the valid use of the pointer or the capability, the capability registers including a program counter capability register, the pointer indicating the current program counter capability register. The program counter address of the sequence flow point; wherein: in response to a capability generation address calculation instruction with a specified offset value, the instruction decoding program logic is configured to control the host data processing device to: select a reference capability register as one of the program counter capability register and another capability register; and write a result capability to a result capability register, the pointer of which indicates the window address of a selected window in the address space, wherein the window comprises a contiguous block of addresses of a predetermined size, the selected window being offset from the reference window by a number of windows determined based on the offset value specified by the capability generation address calculation instruction, and the reference window comprising a window containing the address indicated by the pointer of the reference capability register.

[0009] Computer programs may be stored on computer-readable storage media. The storage media may be transient or non-transitory.

[0010] Further aspects, features, and advantages of this technology will become apparent from the following description, which is taken in conjunction with the accompanying drawings, in which: Figure 1 An example of a data processing device is shown schematically; Figure 2 An example of a device's registers, including a capability register, is shown; Figure 3 An example of the encoding and function of address calculation instructions is shown; Figure 4 This illustrates how the window address calculated by the address calculation instruction can be used by supplementary instructions to determine the full address of the data or program code to be accessed; Figure 5 The corresponding address windows within the address space can be referenced using address calculation instructions and supplementary instructions; Figure 6 An example of using address calculation instructions in a position-independent executable is shown; Figure 7An exemplary encoding of an address calculation instruction is shown, wherein a parameter in the instruction encoding specifies whether the reference capability register used to determine the window address is the program counter capability register or another capability register; Figure 8 This is a flowchart illustrating the method for processing address calculation instructions; Figure 9 This is a flowchart illustrating a method for determining which register is the reference capability register based on whether the program counter relative address is within the allowable range specified by the constraint metadata of the program counter capability register; and Figure 10 Examples of available simulators are shown.

[0011] An apparatus has processing circuitry for performing data processing and an instruction decoder for decoding instructions to control the processing circuitry to perform the data processing. A plurality of capability registers are provided, each capability register storing a capability, the capability including a pointer and associated constraint metadata for constraining the valid use of the pointer or the capability. These capability registers include a program counter capability register, the pointer to which indicates the program counter address indicating the current program flow point.

[0012] The instruction decoder and processing circuitry support capability-generating address calculation instructions with specified offset values. In response to these capability-generating address calculation instructions, the instruction decoder controls the processing circuitry to select one of the program counter capability register and another capability register as the reference capability register, and writes a result capability to the result capability register, the pointer of which indicates the window address of the selected window within the address space. Here, a "window" refers to a contiguous block of addresses with a predetermined size (e.g., 4kB, 8kB, or 16kB). The size of each window can be a fixed value hardwired for a given processor implementation, or it can be configurable based on a given processor implementation, allowing the window size to be selected based on a programmable parameter (e.g., a value in a control register). The selected window identified by the window address of the result capability can be a window offset from the reference window by the number of windows determined by the offset value specified by the capability-generating address calculation instruction. The reference window is the window that includes the address indicated by the pointer in the reference capability register. Capability-generating address calculation instructions enable location-independent addressing of executable components’ data and program code at different addresses in each address space, which supports code sharing and read-only data sharing between address spaces.

[0013] By selecting the reference capability register as the program counter capability register or another capability register, this allows the data and code components of an executable to be described by different capabilities, thus allowing data to be instantiated multiple times within the address space. Furthermore, different constraint metadata can limit the effective use of the resulting capabilities generated by address-computation instructions. For example, it might be desirable for the code components of an executable to be read-only but executable, while the data components of the executable to be writable but not executable, to preserve security. Additionally, it can be useful to allow multiple instances of a given executable's data components to be created, and this is supported by address-computation instructions because an alternative capability register can be selected to derive the resulting capability for addressing the corresponding component, rather than relying solely on the program counter capability register, which cannot be set to different values ​​for different instances of data associated with a given code slice, as this would change the current program flow point. This approach contradicts our intuition, because typically, in the case of addressing the location of code or data for a given executable component independently, it is assumed that the reference to such code or data should be determined solely by the program counter, such that if the code is moved, the data access instructions within the code will, of course, also move their relative addressing target addresses. However, the aforementioned ability to generate address calculation instructions helps support enhanced security by enabling location-independent executables to operate on multiple, securely isolated instances of their own data within the address space (a low-cost alternative to multiple address spaces), and to control memory access at the program-object granularity. Therefore, security can be improved.

[0014] In addition to capability-generating address calculation instructions, the processing circuitry and instruction decoder can also support non-capability-generating address calculation instructions. Non-capability-generating address calculation instructions allow the instruction decoder to control the processing circuitry to write an integer window address to the destination register based on an offset value specified by the non-capability-generating address calculation instruction, where the offset is applied relative to the window address of the window that includes the non-capability program counter address. Therefore, for non-capability-generating instructions, there may be no choice of which address to use as a reference for determining the window address using the offset; instead, the program counter can be used as the reference. The non-capability program counter address can be stored in a separate integer register from the program counter capability register, or alternatively, in some implementations, to reduce hardware costs, the non-capability program counter address can be stored in a portion of the program counter capability register that stores a pointer to the program counter capability register for capability-using instructions. That is, the program counter register can be the same register regardless of whether the instruction requires capability, and while for capability-related instructions, the pointer and associated constraint metadata can be referenced when accessing the program counter capability register, for instructions that do not reference capability execution, the constraint metadata can be ignored and the integer program counter value can be read from the field of the program counter capability register that provides the pointer.

[0015] In some specific implementations, the capability-generating address calculation instruction can be an instruction with a different instruction code compared to the non-capability-generating address calculation instruction.

[0016] However, in other examples, the processing circuitry may have a capability mode and a non-capability mode, and capability-generating address calculation instructions may include address calculation instructions processed by the processing circuitry in capability mode. In some examples, capability-generating address calculation instructions and non-capability-generating address calculation instructions may have the same instruction code, where the current mode specifies whether a given address calculation instruction should be considered a capability-generating address calculation instruction or a non-capability-generating address calculation instruction. For example, a value stored in a control register may specify the current mode, and certain instructions may be used to select or toggle which mode is the current mode.

[0017] In other examples, whether a given address calculation instruction is a capability-generating address calculation instruction or a non-capability-generating address calculation instruction can depend on a combination of both the instruction encoding and the current operating mode of the processing circuitry.

[0018] For capability generation address calculation instructions, the choice of whether to reference the program counter capability register or another capability register can be controlled in different ways. In one example, the instruction decoder can control the processing circuitry to select whether to use the program counter capability register or another capability register based on selection parameters specified by the instruction code of the capability generation address calculation instruction. This allows the programmer or compiler to explicitly indicate in the instruction code which of the program counter capability register and the other capability register should be used to calculate the window address of the pointer to the result capability. For example, for program code reference, the reference capability register can be the program counter capability register, while for data access, the reference capability register can be another capability register. It should be understood that the exact instance of selecting the program counter capability register or another capability register is chosen by the programmer or compiler of the software executing on the processing device, and is therefore not a feature of the processor device's hardware or instruction set architecture. From the perspective of the hardware or ISA, it is sufficient for the programmer or compiler to choose which capability register to reference. Using selection parameters specified in the instruction code to select which register is the reference capability register is more efficient in hardware implementation because the selection is based on a comparison of the selection parameters without the need to derive or compare other parameters.

[0019] Selection parameters can be encoded in a variety of different ways within the instruction encoding of the capability generation address calculation instruction. For example, in some implementations, selection parameters can be a dedicated field provided by the instruction to indicate which capability register is the reference capability register.

[0020] However, in examples using a modal approach to distinguish between capability-generated and non-capability-generated address calculation instructions, the address calculation instruction may have an encoding that can also be used in non-capability mode (a mode that does not use capability-based protection). Some legacy code written for processors that do not support capability modes may already include address calculation instructions specifying offset values. It may be desirable to allow such legacy code to still function correctly in non-capability mode, which could mean that there may be no unused values ​​in the instruction encoding to specify additional selection parameters that specify which register should be considered the reference capability register. Therefore, one approach to support better compatibility with legacy code is to encode the selection parameters using bits (e.g., the most significant bit) that represent a portion of the offset value in non-capability mode from the instruction encoding of the address calculation instruction. While this reduces the maximum size of the offset value that can be encoded in the address calculation instruction, by analyzing actual program code using the address calculation instruction as a non-capability-generated instruction, the inventors found that actual program code typically does not use the full range that can be represented in the offset field, and no instances of existing code requiring the full range of the offset field have been found. Therefore, there is at least one spare bit that can be re-encoded to represent other information without limiting the utility of the instruction. Thus, by reusing the bit representing the most significant bit of the offset value encoded in the instruction to be interpreted as a selection parameter in capability mode, it is expected that legacy code will still function correctly even when executed in capability mode, since the legacy code would never use that most significant bit of the offset value anyway. Therefore, this approach improves backward compatibility.

[0021] Alternatively, another way to control the selection of the reference capability register is to make the selection independent of any explicit selection parameters specified by the instruction code of the capability-generating address calculation instruction, and instead select which of the program counter capability registers and another capability registers is the reference capability register based on a determination of whether the program counter relative address is within the allowable range specified by the constraint metadata of the program counter capability register. This program counter relative address may correspond to the result of applying the offset value of the address calculation instruction to a pointer stored in the program counter capability register. When the program counter relative address is within the allowable range, the program counter capability register is selected, and when the program counter relative address is outside the allowable range, another capability register is selected. This approach again benefits backward compatibility because it means that it is not necessary to indicate which register to use in the instruction code itself, but rather this can be inferred from the offset value specified by the instruction and the constraint metadata in the program counter capability register. This means that legacy code written without considering capability-based processing can still function as capability-generating address calculation instructions without modification (when executed in capability mode). This means that even if not explicitly written to include the selection parameters discussed above, legacy code can still benefit from protection provided by implementing different capabilities for different parts of the same executable and by defining different capabilities based on multiple instantiations of its own data. This can improve the security of legacy code.

[0022] In any case, even for new code written to support a system, using a comparison between the program counter relative address and the allowed range in the constraint metadata of the program counter capability register to select which reference capability register to use, while reserving additional bits of the instruction coding space for other purposes, can still be a valid architectural design choice. Therefore, even in examples where capability-generating address instructions have different dedicated instruction codes than non-capability-generating address instructions, this method of comparing the program counter relative address with the allowed range can still be used.

[0023] In some implementations, one can first determine which register should be the reference capability register based on a comparison of the program counter relative address with the allowable range specified by the constraint metadata of the program counter capability register. Then, the window address of the resulting capability is calculated by applying an offset to the pointer of any register selected as the reference capability register. However, this second calculation may be redundant if the reference capability register is the program counter capability register, because the program counter relative address used to determine which register should be selected as the reference capability register may already effectively indicate the result that would occur if the reference capability register were the program counter capability register.

[0024] Therefore, a more efficient approach could be as follows: In response to a capability generation address calculation instruction, the instruction decoder controls the processing circuitry to determine the program counter relative address; compare the program counter relative address with the allowable range specified by the constraint metadata of the program counter capability register; when the program counter relative address is within the allowable range specified by the constraint metadata of the program counter capability register, return the program counter relative address as a pointer to the resulting capability; and when the program counter relative address exceeds the allowable range specified by the constraint metadata of the program counter capability register, return a pointer corresponding to P + B – U – C as a pointer to the resulting capability, where P is the program counter relative address, B is the base address of the allowable range specified by the constraint metadata of another capability register, U is the upper limit address of the allowable range specified by the constraint metadata of the program counter capability register, and C is a constant value. C can be any constant chosen for a given ISA. For example, C can be zero.

[0025] Using this method, if the program counter relative address is found to be outside the range allowed by program counter compatibility constraints, it can be assumed that the window address should be calculated relative to a pointer of another compatibility. Therefore, adjustments can be applied to convert the program counter relative address into the window address to be returned as the result capability pointer. This avoids exhausting instruction code space to explicitly indicate which reference capability register should be used, and means that legacy code (which cannot use instruction code to indicate reference capability registers) can still use other capability registers as reference capability registers.

[0026] It should be understood that in some specific implementations, the two alternative methods for selecting the reference capability register described above can be implemented using different operating modes (or different sub-modes of the capability mode), parameters specified in the instruction encoding of the address calculation instruction, or another control parameter to select which method to use. Therefore, in the first variant of the capability generation address calculation instruction and / or capability mode, the reference capability register can be selected based on the selection parameter, and in the second variant of the capability generation address calculation instruction and / or capability mode, the reference capability register can be selected based on a comparison of the program counter relative address with the allowed range in the program counter capability register. Supporting both methods can be useful for testing and also allows for configuration to determine whether more performance-intensive operations are triggered, such as checking the program counter relative address against the allowed range, subsequently calculating the window address based on the base address of another capability register, and, if necessary, based on whether the executed code supports the instruction form that explicitly indicates which reference capability register is required using the selection parameter.

[0027] Other specific implementations may support only one or another of these methods for selecting the reference capability register.

[0028] For capability control instructions (e.g., instructions executed in capability mode and / or instructions with encoding indicating they are capability control instructions), the target addresses for instruction fetching and data access can be checked against the allowable range information specified in the constraint metadata of at least one capability register. The instruction fetch address can be checked against the allowable range indicated by the constraint metadata of the program counter capability register. For data access instructions that explicitly refer to the capability of a specific capability register, the capability in that register can be used to check whether the data access is performed on a target address within the allowable range.

[0029] However, it is also possible that some data access instructions without an explicit reference capability register can be executed as capability control instructions, for example, legacy code written for devices that do not support capabilities. Therefore, for at least one type of capability control data access instruction (e.g., a data access instruction of a type without an explicit reference capability register), the instruction decoder can control the processing circuitry to trigger a fault signaling when the target address determined based on at least one parameter of the data access instruction exceeds both the allowed range indicated by the constraint metadata of the program counter capability register and the allowed range indicated by the constraint metadata of another capability register.

[0030] It should be understood that not all capability control instructions require checking the target address against both the range of the program counter capability and the range of another capability register. Other capability control instructions (or instructions that execute under other variants of capability mode) may also be supported, such as variants that calculate all window addresses relative to the program counter capability register in response to address calculation instructions. In such cases, it may not be necessary to check data access against the constraint metadata of another capability register.

[0031] In response to a capability-controlled data access instruction that uses relative addressing to specify a target capability register and an offset within the window, the instruction decoder can execute data access to a target address determined by adding the offset within the window to a pointer stored in the target capability register. Therefore, two instructions can be combined to obtain the address of the actual data or code to be accessed in memory: first, a capability-generating address calculation instruction to determine the window address identifying the address space in which the code or data resides; and second, a subsequent capability-controlled data access instruction that uses relative addressing to determine the address of the actual code or data by adding the offset within the window to a pointer to the resulting capability generated by the capability-generating address calculation instruction. Typically, an executable may need to access multiple different pieces of data or code within the same window of the address space. Therefore, by using the address calculation instruction to calculate the window address identifying the window, multiple subsequent data access instructions can each refer to the same resulting capability generated by the address calculation instruction, avoiding the overhead of a full address calculation operation for each data access. Separating address generation into two instructions helps support offsets larger than those that could be encoded for a single instruction.

[0032] The constraint metadata of a given capability can specify access permissions for controlling the use of the capability's pointer. For example, access permissions can specify at least one of the following: a read permission value indicating whether read permission is granted to provide permission to use the capability to control access to read data; a write permission value indicating whether write permission is granted to provide permission to use the capability to control access to write data; and an execute permission value indicating whether execute permission is granted to provide permission to use the capability to determine a branch target address or control the fetching of an execution instruction. It should be understood that in some implementations, access permissions can also specify other types of permissions besides read, write, or execute permissions. Therefore, when using a given capability, processing circuitry can check the permissions specified in that capability to determine whether the current operation (e.g., a read operation, a write operation, an attempt to fetch an instruction, or an attempt to set a program counter capability based on the address indicated by the capability's pointer) is permitted.

[0033] What can be useful is that, in response to a capability generation address calculation instruction, the processing circuitry sets different access permissions for the resulting capability depending on whether the reference capability register is the program counter capability register or another capability register. This can help reduce the likelihood of needing to execute additional instructions to set access permissions after the address calculation instruction, thereby improving code density and performance.

[0034] More specifically, in capability mode, in response to an address calculation instruction, when the reference capability register is the program counter capability register, the processing circuitry is configured to copy the read and execute permission values ​​specified in the constraint metadata of the program counter capability to the constraint metadata of the result capability, and set the write permission value of the result capability to indicate that write permission is not granted; and when the reference capability register is another capability register, the processing circuitry is configured to copy the read and write permission values ​​specified in the constraint metadata of the other capability register to the constraint metadata of the result capability, and set the execute permission value of the result capability to indicate that execute permission is not granted. Therefore, for code components of the executable body that may reference the program counter capability register when executing address calculation instructions, read and execute permissions can be granted (if the program counter capability register has already been granted), but write permission is not granted to the result capability by default (even if the program counter capability is granted), which is more suitable for program code components. For data components of the executable body that are more likely to reference other capability registers, the access permissions of the result can be set to specify: grant read and write permissions (if the other capability has already been granted), but not grant execute permission, to prevent inappropriate operations caused by attempting to decode data into instructions. This means that granting a process both write and execute permissions to the same region of memory can be dangerous in some cases, as it can lead to vulnerabilities that attackers could exploit to manipulate program flow, allowing access to inappropriate data. Therefore, setting access permissions for result capabilities in the manner discussed above improves security. Copying read / execute permissions for the program counter capability and read / write permissions for other capabilities ensures that the permissions of the result capability are the same as or fewer than those of the reference capability, preventing permissions from increasing simply because the execution capability generates address calculation instructions (which may be a desirable constraint for providing security).

[0035] It may be expected, and not always expected, to grant read access when the program counter capability register is the reference capability register, or to grant write access when the reference capability register is another capability register. However, in practice, it has been recognized that in these cases, capability-generating address calculation instructions can be followed by subsequent instructions that narrow the granted access permissions to exclude unwanted permissions, so this is not a problem in practice. Further analysis is presented below to explain why granting redundant read or write permissions in response to address calculation instructions is not a problem.

[0036] In one example, the processor architecture may define (within the capability register) a default data capability register that stores default data capabilities used to constrain the use of pointers represented by non-capability operands of instructions executed as capability control instructions. For example, the default data capability register is particularly useful for handling legacy code written for systems that do not support capabilities. When such legacy code executes in capability mode, the capabilities defined in the default data capability register can be used to regulate references to pointers made by the legacy code.

[0037] In some implementations, in response to at least one type of capability-controlled data access instruction, the instruction decoder can control the processing circuitry to perform data access to a target address determined by at least one capability operand of the data access instruction, without needing to relocate the target address based on capabilities stored in the default data capability register. This avoids the need to refer to the default data capability register for every data access.

[0038] An alternative approach to providing the ability to select which reference capability register to use in response to a capability generation address calculation instruction is to always use the program counter capability register as the reference capability register when executing the capability generation address calculation instruction. However, when performing subsequent data accesses using the window address calculated from the program counter capability register, additional offsets can be applied based on range information specified in the default data capability register to allow for separate relocation of the data components and code components of the executable. However, the inventors recognize that in practice, the window address calculated by the capability generation address calculation instruction can be used multiple times to control several different data accesses to corresponding data addresses within the same window. Therefore, in practice, subsequent data accesses using the result of the capability generation address calculation instruction can be performed more frequently for each instance of execution of the capability generation address calculation instruction. Consequently, due to the relative frequency of data access instructions compared to address calculation instructions, relocating the target address based on the capability stored in the default data capability register at each data access may degrade performance in practice to a greater extent than the performance cost of providing additional checks to select which reference capability register for the capability generation address calculation instruction. Even in examples like the one where the reference capability register is selected based on a comparison of the program counter's relative address with the allowed range in the program counter capability register, these operations are relatively slow for capability generation address calculation instructions. Therefore, contrary to our intuition, even though the exemplary operations discussed above for capability generation address calculation instructions are relatively slow (especially in implementations where the range information for a given capability is not directly encoded in the constraint metadata but is represented in a compressed form that needs to be decompressed before use), the added latency of selecting the reference capability register in response to capability generation address calculation instructions can surprisingly improve overall processing performance when handling the actual program code. Although these operations appear to introduce added latency for capability generation address calculation instructions, the overall performance can be better because there is no need to relocate each data access based on the default data capability register when executing data access instructions.

[0039] Additional capability registers can be implemented in different ways. In one example, the default data capability register mentioned above can be used as an additional capability register, which can be selected as the reference capability register for capability generation address calculation instructions. This can be useful because it means that for legacy code, there is consistency between the capability used to generate the relative address of the window containing the data component based on the reference capability register in response to address calculation instructions and the data capability register that will be targeted to check subsequent accesses. Furthermore, for newer code that is written to explicitly support capability modes, where data access to memory can explicitly reference the specific capability controlling its access, the default data capability register can be effectively unused. Therefore, by reusing this register as an alternative reference capability register that can be selected by capability generation address calculation instructions, this avoids the need to exhaust additional general-purpose capability registers to provide alternative reference addresses in place of the program counter capability, thus saving hardware and reducing register pressure. Therefore, for both legacy and newer code, having the default data capability register as an additional capability register can be particularly useful.

[0040] However, in another example, the capability register may include multiple general capability registers that can be accessed by capability-specifying instructions in capability mode, and additional capability registers may be predetermined general capability registers among those general capability registers.

[0041] In other examples, the additional capability register can be a different type of register than the default data capability register or the general-purpose capability register. For example, a system register or control register can be allocated to provide an alternative reference capability for address calculation instructions.

[0042] The window address generated in response to a capability-generating address calculation instruction can be represented in different ways. In some cases, the window address can be the absolute address that directly identifies the selected window. This approach makes subsequent data / instruction access using the address less complex.

[0043] On the other hand, in other implementations, the capability-generating address calculation instruction can return a resulting capability in which the pointer limits the window address to a relative address relative to a base address within the allowed range specified by the constraint metadata of the program counter capability register. In this case, when a capability-controlled data access instruction performs a relative addressing memory access in response to a capability control instruction specifying a target capability register and an offset within the window, the instruction decoder can control the processing circuitry to perform a data access to a target address determined by adding the offset within the window and the base address within the allowed range specified by the constraint metadata of the program counter capability to the pointer stored in the target capability register. Therefore, data access may be slightly slower using this method because each subsequent data access using the result of the address calculation instruction requires additional relocation based on the base address of the program counter capability register. However, this method has the advantage that the executable code does not see the absolute address of the referenced data or instruction, resulting in less information about the memory layout on a particular device, which contributes to improved security.

[0044] Whether a given processor implementation generates window addresses as absolute or relative addresses can be a design choice for that specific system implementation, and some microarchitecture implementations may only support one or the other of these methods.

[0045] Alternatively, some systems may support different variants of the capability generation address calculation instruction (or different variants of the capability mode), including a variant in which the capability generation address calculation instruction generates the window address of the resulting capability as an absolute address, and another variant in which the window address is generated as a relative address relative to the base address in the program counter capability register.

[0046] The techniques discussed above can be implemented in a hardware device having circuit hardware that implements the aforementioned instruction decoder and processing circuitry, the hardware device supporting the ability to generate address calculation instructions as part of a local instruction set architecture supported by the instruction decoder and processing circuitry.

[0047] However, in another example, the same technique can be implemented in a computer program (e.g., an architecture simulator or model) that can be provided to control a host data processing device to provide an instruction execution environment for executing instructions from the target code. This computer program may include instruction decoding logic for decoding instructions from the target code to control the host data processing device to perform data processing. Thus, the instruction decoding logic simulates the functionality of the instruction decoder of the hardware device discussed above. Furthermore, the program may include register maintenance logic that maintains data structures (within the host device's memory) representing the registers of the instruction set architecture simulated by the (simulation) program. The simulated registers may include the capability registers described above. The instruction decoding logic includes support for generating address calculation instructions with the same functionality described above for the hardware example. Therefore, such a simulator computer program can present an instruction environment similar to that provided by an actual hardware device for target code executed on the simulator computer program, even if no actual hardware providing these features may be available in the host computer executing the simulator program. This can be useful for executing code written for an instruction set architecture on a host platform that does not actually support the architecture. Emulators can also be useful during software development for a new version of the instruction set architecture, when software development is performed in parallel with the development of hardware devices that support the new architecture. This allows software to be developed and tested on an emulator, enabling software development to begin before hardware devices supporting the new architecture are ready.

[0048] The specific examples described with reference to the accompanying figures use a modal method for determining whether a given address computation instruction is a capability-generating address computation instruction or a non-capability-generating address computation instruction. It should be understood that this is not necessary, and other examples may use different instruction encodings to distinguish between capability-generating address computation instructions and non-capability-generating address computation instructions (or between capability control instructions and non-capability control instructions).

[0049] Figure 1An example of a data processing apparatus 2 is illustrated schematically. The data processing apparatus has a processing pipeline 4 comprising multiple pipeline stages. In this example, the pipeline stages include: a fetch stage 6 for fetching instructions from an instruction cache 8; a decode stage 10 for decoding the fetched program instructions to generate micro-operations to be processed by the remaining stages of the pipeline; an issue stage 12 for checking whether the operands required for the micro-operation are available in a register file 14, and issuing the micro-operation for execution once the operands required for a given micro-operation are available; an execution stage 16 for performing a data processing operation corresponding to the micro-operation by processing the operands read from the register file 14 to generate a result value; and a write-back stage 18 for writing the processed result back to the register file 14. It should be understood that this is merely one example of a possible pipeline architecture, and other systems may have additional stages or different stage configurations. For example, in an out-of-order processor, a register renaming stage may be included, which maps the architecture registers specified by program instructions or micro-operations to physical register specifiers in the identifier register file 14.

[0050] Execution phase 16 includes multiple processing units for performing different types of processing operations. For example, the execution units may include a scalar arithmetic / logic unit (ALU) 20 for performing arithmetic or logical operations on scalar operands read from register 14; a floating-point unit 22 for performing operations on floating-point values; a branching unit 24 for evaluating the results of branching operations and adjusting the program counter representing the current execution point accordingly; and a load / store unit 26 for performing load / store operations to access data in memory systems 8, 30, 32, and 34. A memory management unit (MMU) 28 is provided for performing address translation between the virtual address specified by the load / store unit 26 based on the operand of the data access instruction and the physical address identifying the storage location of the data in the memory system. The MMU has a Translation Lookahead (TLB) 29, which caches address translation data from page tables stored in the memory system. Page table entries define address translation mappings and specify access permissions that control whether a given process executing in the pipeline is allowed to read, write, or execute instructions for a given memory region. Access permissions specified in page tables accessed by the MMU 28 can be relatively coarse-grained because they can specify permissions for a specific memory region that apply as a whole to the entire software process. This makes it inefficient to use page tables to provide different levels of access permissions for different sub-sections of instructions within a software process.

[0051] In this example, the memory system includes a Level 1 data cache 30, a Level 1 instruction cache 8, a shared Level 2 cache 32, and main system memory 34. It should be understood that this is merely one example of a possible memory hierarchy, and other cache arrangements are also possible. The specific types of processing units 20 to 26 shown in execution phase 16 are only one example, and other implementations may have a different set of processing units or may include multiple instances of the same type of processing units, allowing multiple micro-operations of the same type to be processed in parallel. It should be understood that... Figure 1 This is merely a simplified representation of some components of a possible processor pipeline architecture, and the processor may include many other elements not shown for the sake of simplicity.

[0052] Figure 2 Examples of some registers in register 14 of processing device 2 are shown. It should be understood that... Figure 2 Not all available registers are shown, and additional registers may exist.

[0053] The registers may include a set of general-purpose integer registers 50 for storing integer operands and the results of processing operations performed in response to integer processing instructions, and a set of floating-point registers 52 for storing floating-point operands or results. Some implementations may not support floating-point processing, in which case the floating-point registers may be omitted. Furthermore, the registers include a plurality of control registers 54 that define various control parameters that control the processing pipeline's handling of instructions. For example, control registers 54 may include mode indicator values ​​specifying the current operating mode of the system, control registers for determining whether certain optional architectural features are implemented, and condition status flags that are set in response to the results of processing operations and can be tested by conditional instructions to determine whether to perform conditional operations.

[0054] Although control register 54 will store various types of information, a specific control status item may be a capability / non-capability mode indicator 56, which specifies whether the processing pipeline is currently operating in a capability mode or a non-capability mode. The capability mode is supported by several architectural features that allow access to memory (data access in response to load / store instructions or instruction access initiated by fetch stage 6) to undergo additional security checks based on constraints specified in association with the pointer used to access that memory.

[0055] In capability mode, the processing pipeline has access to a set of capability registers 60 that include pointers 62 that can be used to form addresses for data or instruction memory accesses, and a set of associated constraint metadata 64 that restricts the valid use of the pointers 62 that are permitted. Capability registers 60 include a set of general-purpose capability registers 66, which can typically be referenced by instructions processed by the pipeline in capability mode, serving as source or destination registers for processing operations. Capability registers 66 also include several special-purpose capability registers, including a program counter capability (PCC) register 68 and a default data capability (DDC) register 70. The PCC register 68 provides a program counter value 72 in its pointer field, which in capability mode represents the instruction address at the current execution point reached by the pipeline. The associated constraint metadata 64 can be used to check whether instruction fetching from an address derived from the program counter is permitted (or whether updating the PCC 68 is permitted after a branch or other program flow change operation). DDC register 70 defines constraint metadata 64, which can be imposed on memory accesses executed in response to non-capability memory access instructions that do not directly identify that they will use capabilities, but instead reference integer register 50 used to form their address operands. This can be useful for allowing legacy code written for systems that do not support capability modes to have memory accesses triggered by that legacy code protected by the provided capability mechanism.

[0056] For each capability in the corresponding capability register 60, constraint metadata 64 can specify boundary information 74 and permissions 76.

[0057] Boundary information 74 defines the allowed range of pointer 62 in the corresponding capability. Boundary information 74 may specify a base address defining the lower boundary of the allowed range of pointer 62 and an upper address defining the upper boundary of the allowed range of pointer 62. In some implementations, boundary information 74 may be compressed so that instead of explicitly identifying the base and upper addresses as full addresses with the same number of bits as the pointer itself, boundary 74 may require a less-bit encoded form for storage. For example, each of the upper and lower boundaries may be represented in a floating-point-like format using a boundary value indicating the effective bits of the upper or lower boundary address and an exponent indicating the number of bits the boundary value should be shifted to arrive at the actual lower / upper address (the upper and lower boundaries may share the same exponent value). While this may reduce the precision available for defining the allowed range, by compressing the boundary information, this significantly reduces the storage overhead of the capability register, which would otherwise be at least three times the size of the integer register storing the addresses, in full address form in addition to the pointer itself. Examples of encoding schemes that can be used for boundary information are described in Woodruff et al., “CHERI Concentrate: Practical Compressed Capabilities”, IEEE Transactions on Computers 68.10 (2019): 1455-1469. However, it should be understood that other encoding schemes can also be used.

[0058] Permission 76 for a given capability defines whether the use of the corresponding pointer 62 is granted one or more types of access rights. For example, a permission could indicate whether read permission is granted to provide the pointer with control over reading (loading) data, write permission to provide the pointer with control over writing (storing) data, and execute permission to provide the pointer with control over determining a branch target address or controlling the extraction of execution instructions. In one example, separate permission flags could indicate whether each type of permission is granted or denied. Alternatively, a combination encoding of permission field 76 could be provided, selecting one of multiple permission states, where each permission state corresponds to a different combination of whether read, write, and / or execute permissions are granted. Therefore, it is not necessary to provide separate flags for each type of permission; instead, a common state value can indicate which permission combination is allowed or not allowed for the use of the corresponding pointer 62.

[0059] Therefore, by defining the constraint metadata 64 associated with a given pointer 62, attempts to fetch instructions from an address defined by the pointer or attempts to access data based on an address derived from a specified capability register can be checked against the corresponding constraint metadata 64 to determine if memory access is permitted. If the boundary 74 is stored in compressed form, such checks may require the stored boundary value to be decompressed to allow comparison between pointer 62 and boundary 74. Therefore, if an attempt to fetch instructions based on PCC 68 exists, but the program counter value exceeds the valid boundary 74 specified by PCC, or permission 76 indicates that there is no execution permission using that program counter value, a failure may be triggered. Furthermore, if the executed load / store instruction uses a reference to a specific capability register to specify its address, a failure may occur if the instruction is a load instruction and there is no read permission indicated by permission 76, or if the instruction is a store instruction and there is no write permission, and also if pointer 62 (or the address calculated relative to the pointer) exceeds the valid boundary 74 of the capability.

[0060] Unlike MMU 28, where access permissions are typically defined coarsely by process, the use of capabilities allows for finer-grained control over memory access because program instructions specifying particular capability registers provide an indication of the intent behind those instructions (since the intent is to access finite memory regions within certain boundaries and restrictions based on how the region is used). Different instructions at different parts of a given software process's program code can specify different capability registers and thus be subject to a different set of permissions without needing to separate that part of the code into different software processes (which might be necessary in situations where only MMU 28 controls different levels of access control). This capability approach simplifies the division of access rights to different sandboxed components within a software process. This can help improve security and prevent attackers from exploiting memory-related usage errors that could otherwise allow access to data that should not be accessible.

[0061] In addition to checking capability permissions or boundaries when accessing memory, some instructions can also check capability constraint metadata at other times. For example, some instructions that set a pointer 62 to a given capability register can trigger a check to see if the pointer is within the corresponding boundary 74, but this is not necessary (because this check on setting the pointer may be redundant if the check is performed when the pointer is subsequently used to control memory access).

[0062] It should be understood that Figure 2 An architectural view of the registers is shown, which are accessible to instructions processed by pipeline 4. However, the physical registers implemented in the hardware to provide the data values ​​associated with these architectural registers can be... Figure 2The layouts shown are different. For example, in an out-of-order processor, register file 14 may have a larger number of physical registers than the number of architecture registers specified in one of the integer register set 50, capability register set 60, or floating-point register set 52, and register renaming may be used to map architecture register designators to physical registers provided in the hardware.

[0063] Furthermore, while capability register 60 is shown as separate from integer register 50 from an architectural perspective, in some hardware implementations, the pointer field 62 of some capability registers 60 may actually share the same hardware storage element as the corresponding integer register 50. For example, the program counter pointer field 72 of PCC register 68 in capability mode can be reused in non-capability mode to provide an integer program counter, which indicates the address of the instruction representing the current execution point reached in non-capability mode. During non-capability mode, constraint fields 74 and 76 of PCC 68 can be ignored.

[0064] Figure 3 An example of an address calculation instruction is shown, which can be used to calculate the address of data or instructions in memory that subsequent instructions can then use to access memory. The address calculation instruction itself does not trigger a memory access; instead, it causes the calculated address to be stored in a register. This instruction can be particularly useful for providing position-independent executables. When the program code of a given executable is set on a given processing platform, it can be allocated to any part of the memory address space. To facilitate code sharing between processes, it is desirable that the program code of an executable be written in such a way that the reference to the data accessed by the code can be the same regardless of where the code is installed in the address space. This characteristic is called position independence and means that it can be useful to define the address relative to the address of the code itself. While a single instruction may be able to define the offset to be added to the value in the program counter register and trigger a memory access to the resulting address, the number of offset bits available for encoding as an immediate value in instruction encoding may be limited (e.g., as few as 12 bits), which may limit the maximum size of the offset that can be referenced relative to the address of the currently executing instruction within an instruction. To enable more flexible relocation of data components of a given executable, it can be useful to split the address calculation operation into two instructions: the first being as follows: Figure 3 The address calculation instruction shown generates a window address that identifies a contiguous address window in the address space, followed by... Figure 4The second instruction shown adds the window address and the immediate offset to generate a full address, which can be used to directly perform a memory access or stored in a register for later use. By using two instructions, the effective offset between the program counter address and the address of the data to be accessed can be greater than the effective offset when using a single instruction.

[0065] like Figure 3 As shown, the encoding of the Address Calculation (ADRP) instruction 310 includes the opcode (op) identifying the address calculation instruction, the destination register Rd to which the window address calculated in response to the instruction is to be written, and the offset value specified as an immediate value in the instruction encoding. In this example, for compatibility with legacy instructions, the immediate offset value is actually specified in two separate offset fields, labeled immlo and immhi, where immlo represents the lower two bits of the offset and immhi represents the higher 19 bits of the offset, so that concatenating these fields provides a 21-bit offset. It should be understood that the offset can use different encodings; for example, in other examples, a single consecutive field can be used to represent the offset.

[0066] The function of ADRP instruction 310 is... Figure 3 The diagram illustrates this schematically. In response to the decoding of the ADRP instruction in decoding stage 10, decoding stage 10 generates control signals to control ALU 20 in execution stage 16 to read the current value in program counter register 350 (which, as discussed above, can be a register in integer register 50 or the program counter pointer portion 72 of PCC register 68) and clear the lower portion 362 of the program counter value to 0. In this example, the lower portion 362 includes the lower 12 bits of the program counter value (the number of bits selected to be cleared corresponds to the size of the address window). The result of clearing the lower bits of the program counter is that the resulting reference address 360 represents the reference window address, which identifies an address window of a given size including the address indicated by the program counter. Since the lower portion has 12 bits in this example, the window size is 4kB for this particular implementation. It should be understood that other architectures may choose a different window size or support configuring the window size using a value specified in the instruction code of the ADRP instruction or in a control register in control register 54.

[0067] Furthermore, in response to the decoding of ADRP instruction 310, decoding stage 10 controls execution stage 16 to generate window offset value 320 based on the instruction-encoded offset field 312. Window offset value 320 represents the number of windows corresponding to the value indicated in offset field 312, which is to be shifted by adding to reference address 360. Therefore, the 21 bits of offset field 312 are left-shifted by 12 bits, making all bits in the lower part 324 of window offset value 320 0, and thus offset value 326 is aligned with the least significant non-clear bit of the program counter within reference window address 360. The remaining bits at the most significant end of window offset value 320 are generated based on the sign extension of the higher bits of offset value 326.

[0068] In response to ADRP instruction 310, adder 370 in ALU 20 adds reference window address 360 to window offset value 320 and writes the result to destination register Rd. This result represents a partial address result because additional offsets are expected to be added to this partial address result to generate the actual address of the data to be accessed in memory. The result of the ADRP instruction is the window address identifying a selected window within the address space, where the window comprises a contiguous block of addresses of a predetermined size (4kB in this example), and the selected window is offset from the reference window (identified by reference address 360) by the number of windows determined based on the offset value specified by ADRP instruction 310. The reference window is the window that includes the address indicated by the reference address (in this case, program counter address 350).

[0069] like Figure 4 As shown, a supplementary instruction is provided that specifies an immediate field 422 with the same number of bits as the lower portions 362 and 324 that are cleared to 0 in reference window address 360, and adds the window offset value 320 to the window address result 410 previously generated by the ADRP instruction. Supplementary instruction 420 specifies the source register Rn to store the window address result 410. When the supplementary instruction is executed after the earlier ADRP instruction, the register number set for Rn is expected to match the register number set for Rd in the earlier ADRP instruction. In response to supplementary instruction 410, the resulting full address can be used to control memory access or can be written to a register. Figure 4An example is shown where supplementary instruction 420 is an addition instruction. Therefore, the result of adding the immediate offset 422 specified by supplementary instruction 410 and the window address result 410 is written as the full address 420 to the destination register Rb, which can then be used by subsequent instructions to control memory access. Alternatively, if a different opcode value op is specified in supplementary instruction 420, the instruction can be a load instruction (LDR) or store instruction (STR) as a relative addressing type data access instruction that uses relative addressing to specify the target address of the load / store operation based on the immediate value 422 specified in the instruction encoding. If instruction 420 is a load instruction (LDR), the decoding stage 10 controls the load / store unit 26 to load a data value from the memory address resulting from adding the window address result 410 and the immediate offset 422, and stores the loaded value in the destination register Rb. If instruction 420 is a store instruction, the current value stored in the source register Rb is written to a memory address in memory, which is obtained by adding the immediate offset value 422 to the window address result 410 stored in the source register Rn.

[0070] Figure 5 The functionality of the ADRP instruction and supplementary instruction 420 is illustrated schematically. The ADRP instruction 310 is stored at address 212 in the memory address space, which is located at... Figure 5 The address of window P is marked as 210. The base address of window P is marked as 214. When ADRP instruction 310 is executed, Figure 3 The window reference address 360 corresponds to Figure 5 The window P base address 214 is shown, and the window offset value 320 corresponds to an offset equal to the offset value encoded in the offset field 312 multiplied by a multiple corresponding to the window size (4kB in this example). Therefore, the window address result 410 generated by the ADRP instruction is the window D base address 224, which indicates... Figure 5 The address of window D is marked at the beginning of window 220.

[0071] The address of a data value X that the code within window P, labeled 222, wants to access is located at an offset of 226 relative to the base address 224 of window D. Therefore, this offset 226 is specified as the immediate value 422 in the subsequent supplementary instruction 420 that accesses the data value X. The same ADRP instruction 310 can be shared among multiple supplementary instructions. For example, if there are multiple different data values ​​to be accessed within window D, a single ADRP instruction can place the base address 224 of window D in a register, and then multiple different supplementary instructions specifying different values ​​for offset 226 can be executed to trigger memory accesses to the corresponding data variables.

[0072] This approach means that even if code is relocated to a different part of the address space, when an ADRP instruction is encountered within the relocated code, the value of the offset field in the ADRP instruction (which can be fixed at link time when the relative positions of the corresponding code and data components in the memory address space are fixed) can still be used to access the appropriate data variables without changing the underlying program code.

[0073] This can be useful for supporting location-independent executables, which may be based on, for example, Dynamically Shared Objects (DSOs) used in Linux-based systems. In DSOs (… Figure 6 In the diagram, program code 450, read-only (RO) data 452, dynamically relocated read-only (RELRO) data 454 (this data may need to be updated if the code is relocated, but is not expected to change while the DSO remains in a specific part of the address space), data 456 (this data can be readable or writable), and zero-initialized data (BSS) 458 are laid out consecutively in ascending address order. The layout is not necessarily contiguous. To support changes in virtual memory (VM) page protection attributes after relocation, RELRO should end at page (e.g., 4KiB, 16KiB, or 64KiB) address boundaries. Typically, this results in a gap between the end of RO data 452 and the beginning of RELRO data 454. VM pages containing RELRO data 454 are initially writable (to allow dynamic relocation) and become read-only by the dynamic linker after they are relocated.

[0074] To support Data Execution Protection (DEP or W^X)—the principle that a given address should not simultaneously have write and execute access—a VM page boundary must exist between the code and the RELRO. Therefore, the minimum size of a DSO is three VM pages, with corresponding permissions RX (for the page containing code), RW which changes to R (for the page containing the RELRO) and RW (for the page containing data) upon relocation. Here, R indicates granting read permission, RX indicates granting both read and execute permissions, and RW indicates granting both read and write permissions.

[0075] To support the relocation of data components independent of code components, ADRP instructions within the code section can reference data L within different 4kB pages, where the ADRP instruction specifies the offset to the page containing "L"—this offset can be fixed by the linker after relocation.

[0076] For non-capability modes, the ADRP instruction is as follows: Figure 3 It works as shown and does not require any checks on the constraint metadata associated with the capability register.

[0077] If the ADRP instruction is executed in capability mode, it may be expected, rather than referenced, as... Figure 3 The program counter 350 shown is not the ADRP instruction; instead, it should simply refer to the pointer portion 72 of the PCC register 68 to determine the window address result 410 to be written to the destination register, and the destination register should be a capability register rather than an integer register. However, this view may be oversimplified because if the program counter register is always referenced as the source providing the reference address for ADRP instructions in capability mode, the associated permissions and boundaries defined by the PCC metadata 64 are mapped to the resulting capability including the window address 410 generated in response to the ADRP instruction. This would mean that any relative access triggered by an ADRP instruction in capability mode within a position-independent executable should be defined with the same set of boundaries and permissions. This may be undesirable because permissions suitable for referencing the code component 450 or read-only data component 452 of the DSO may not be suitable for the data component 456 of the DSO. For example, it might be desirable to enforce no write permissions to regions of the address space containing the code 450 of the executable and no execute permissions to regions of the address space containing the data 456 of the executable. Furthermore, it may be desirable to support multiple instances of binary file data 456, 456', so that multiple instances running the same code (e.g., two or more instances running a graphics decoding component for decoding images represented in formats such as png) can share the same program instructions located at a single location in memory, even if they need to reference different data.

[0078] To support this, when the ADRP instruction is executed in capability mode, the instruction decoder 10 controls execution stage 16 to select which capability register to use as the reference capability register to provide a pointer as a reference address 350, while simultaneously calculating the window address result 410 and writing the resulting window address result to the pointer field of the destination capability register. The reference capability register can be selected as either the PCC register 68 or the Component Data Capability (CDC), which is an additional capability register that can be used to describe the binary component data 456, 456' of a given location-independent executable. Which capability register is the CDC register can vary depending on the specific implementation. For example, DDC 70 can be used as the CDC, which can be selected as an additional capability register for the ADRP instruction. Alternatively, the CDC can be a designated general-purpose capability register in the general-purpose capability register 66, such as capability register C29, to select any example. Alternatively, a special system register can be specifically allocated for reference as an additional capability register when processing the ADRP instruction. Either way, by supporting the flexibility of selecting different reference capabilities to generate the window address of the ADRP instruction in capability mode, this means that... Figure 6As shown, the data components of an executable can be assigned different access permissions and boundaries compared to the code components. Furthermore, different instances of data associated with the same code can reside at different locations in the address space because the offset to L is calculated relative to different values ​​in other capability registers (earlier instructions may set the reference pointer in another capability register as needed for which data instance 456, 456').

[0079] Figure 7 The encoding of ADRP instruction 310 and supplementary instruction 420 in capable and non-capable modes is shown. The encoding of supplementary instruction 420 is... Figure 4 The second register Rb / Cb of the supplementary instruction 420 is the same as in the non-capability mode, except that in capability mode, the source register field 500 is interpreted as referring to the capability register (Cn) instead of the integer register (Rn). For load / store instructions, the second register Rb / Cb of the supplementary instruction 420 can be either an integer register or a capability register: for load instructions, it indicates the destination register to which data loaded from memory is to be written, and for store instructions, it indicates the source register from which data will be stored in memory. Whether the second register Rb / Cb is an integer register or a capability register can be fixed by design for a specific instruction set architecture, or it can vary based on any one or more of the following: parameters in the instruction code; control values ​​in the control register; and / or the current operating submode (in examples where there are multiple capability mode subvariants). If the supplementary instruction is an addition instruction, the second register is the destination capability register Cb used to store the address result, so that subsequent instructions that use the result address to control memory access can be governed based on the constraint metadata of the destination register Cb (which, when the supplementary instruction is executed in capability mode, can be set to match the constraints in the source register Cn).

[0080] For ADRP instructions, the encoding in capability mode can be the same as the encoding in non-capability mode, or it can have a different encoding specifying additional selection parameter 502, which controls which register is selected as the reference capability register. The method used depends on the specific architecture implementation chosen for a given architecture.

[0081] Therefore, in some implementations, the selection of the reference capability register as PCC register 68 or another capability register (CDC register) depends on the selection parameter 502 explicitly encoded in the instruction code. To support backward compatibility with legacy code written for non-capability-supported systems, it is assumed that... Figure 3The encoding shown, using the bit representing the most significant offset of the ADRP instruction 210

[23] to encode the selection parameter can be useful. This is because in practice it has been found that real code often does not use the full range of offset values ​​supported by the ADRP instruction, making it difficult to find instances in existing code within a typical executable that require large offsets such that bit 23 of the ADRP instruction has a different value than bit 22. That is, if the window offset value does not use the full range of supported values, bits 22 and 23 are expected to have the same value. In practice, it has been found that the difference between the maximum size of the window offset value existing in actual code and the range supported by the instruction is 1 / 32 to 1 / 64 of the range supported by the ADRP instruction, making the effective unused bits of the offset value at least 5 or 6 bits. Therefore, the loss of bit 23, which indicates a portion of the immediate offset, can be permissible without losing functionality in the actual code.

[0082] Therefore, to ensure backward compatibility for code written for legacy systems, it can be useful to encode the selection parameter such that if bit 23 equals bit 22, then PCC register 68 is selected as the reference capability register, and if bit 23 has a different bit value than bit 22, then another (CDC) capability register is selected as the reference capability register. This will tend to ensure that legacy code will operate correctly, while newer code written to support capability functionality can explicitly select which capability register to reference when generating window addresses, such that, for example, data components can use an ADRP instruction that specifies selection parameter 502 to select CDC as the reference capability register, and code components can use an ADRP instruction with selection parameter 502 set to select PCC.

[0083] However, other implementations may encode the selection parameters in different ways (e.g., the high offset bit may indicate PCC with a value (0 or 1) and CDC with the opposite value (0 or 1), regardless of the comparison with the next highest bit).

[0084] Alternatively, another architectural approach could be that the ADRP instruction has exactly the same encoding regardless of whether it is in non-capability mode or capability mode, and that there is no parameter in the instruction indicating which register will be used as the reference capability register. In this case, then, as in non-capability mode, for capability mode, the high bit of the offset field

[23] still indicates the most significant bit of the 21-bit offset value. Using this approach, the selection of which capability register to use as the reference capability register can be based on comparing the relative address of the program counter, which is the result of adding the window offset value 320 to the cleared program counter value 360, to the allowed range specified in the boundary 74 of the PCC register 68. This can assume that a valid result of the ADRP instruction should be within the boundary of the PCC or within the boundary of the CDC, so if the valid result is not within the boundary of the PCC, then the window address result 410 of the ADRP instruction should be calculated relative to the CDC instead. This avoids the need for instructions to explicitly encode the selection, resulting in less modification to existing code. However, this may slow down the processing of ADRP instructions because it may be necessary to decompress the boundaries 74 in the PCC so that these boundaries can be compared with the result of adding the offset to the window address of the window that includes the program counter.

[0085] Then, if it is subsequently found that the obtained program counter relative address is not within the boundaries of the PCC register, additional operations are required to adjust the result so that it is generated relative to the CDC. While this operation may be relatively slow and incur a performance penalty in the processing of the ADRP instruction, in practice, because ADRP can be executed once and then shared among multiple supplementary instructions accessing different variables within the same window of the address space, this overhead can be amortized among more memory accesses, making it not a problem. Furthermore, this approach recognizes that while it may incur a slight performance penalty to the ADRP instruction, it avoids having to relocate pointers in the component data capabilities for every data access performed in response to load / store instructions. This would be another approach to support separate relocation of different instances of data components from shared code capability components. Therefore, by avoiding the need to relocate every data access based on component data capabilities, this can speed up memory accesses themselves, which can be executed more frequently than ADRP instructions, thus improving overall performance.

[0086] Although Figure 7 An example is shown where non-capability generation instructions and capability generation instructions have the same opcode and a mode indicator 56 that indicates whether the current mode is non-capability mode or capability mode to distinguish between non-capability generation instructions and capability generation instructions. However, other examples may use different instruction opcodes or another field in the instruction encoding to distinguish between non-capability generation instructions and capability generation instructions.

[0087] Figure 8 A method for processing an Address Calculation Instruction (ADRP instruction) is illustrated schematically. At step 600, decoding stage 10 identifies the next instruction to be processed as an ADRP instruction and generates control signals to control the remaining pipeline stages to perform the corresponding operation. At step 602, it is determined whether the ADRP instruction is a capability-generated ADRP instruction or a non-capability-generated ADRP instruction (e.g., based on instruction encoding and / or the current operating mode). If the instruction is a non-capability-generated ADRP instruction, then at step 604, the control signals control execution stage 16 to determine the integer window address 410 relative to the window in the address space including the program counter value 350, based on the offset value 312 specified by the ADRP instruction. At step 606, the window address is written to the destination register Rd specified by the ADRP instruction 310. The processing at steps 604 and 606 is equivalent to... Figure 3 The processing shown.

[0088] On the other hand, if the instruction is a capability generation ADRP instruction, then at step 608, the control signal generated in response to the ADRP instruction controls execution phase 16 to select a reference capability register, either the PCC register 68 or another capability register (such as the CDC register discussed above). This selection can be based on, for example... Figure 7 The explicit selection parameter 502 shown can be used, or it can be based on the following text. Figure 9 The comparison between the program counter relative address and the allowed range defined in PCC register 68 is further described in the description.

[0089] At step 610, the control signal generated by the instruction decoder 10 controls execution phase 16 to determine the window address 410 of the selected window in the address space based on the offset value 312 specified by the ADRP instruction. This offset value is applied relative to the reference window address of the reference window, which includes the pointer in the reference capability register selected at step 608. Note that when using at step 608... Figure 9 In the case of selecting PCC register 68 as the reference capability register, the window address required at step 610 may already be available, thus eliminating the need for additional calculations beyond those required at step 608 for selecting the reference capability register. However, in other implementations, some additional calculations may be required after the reference capability register has been selected. Regardless of the approach, step 610 performs an equivalent of... Figure 3 The processing shown includes some operations, but uses pointers within the reference capability register (PCC or CDC) instead of... Figure 3 The example shows the application of an integer program counter 350.

[0090] At step 612, in response to the control signal generated by the ADRP instruction, the execution phase also selects a set of access permissions based on whether the reference capability register is PCC register 68 or another capability register (CDC). If the PCC register is the reference capability register, the read / execute permission value is copied from the PCC register to the result capability (so that the result capability specifies the same read / execute permissions as the PCC), but no write permission is granted to the result capability regardless of the write permission value specified in PCC register 68. This may be more suitable for referencing program code, which is more likely to be referenced when PCC register 68 is the reference capability register. If another capability register is selected, the read / write permissions are copied from the other capability register to the result capability, but no execute permission is granted to the result capability regardless of the current execute permission value in the other capability register. This method avoids granting write and execute permissions simultaneously, which could pose a security risk.

[0091] While it is possible that this approach might unintentionally grant redundant permissions in some cases, such as unnecessarily read permissions to regions containing code that should not be readable, or unnecessarily execute permissions to read-only data accessed within the same address range protected by PCC 68, these redundant permissions can be removed by subsequent instructions if necessary. Therefore, it is preferable to simplify access permission settings when processing ADRP instructions by not introducing additional configuration options for selecting specific access permissions, but instead defaulting to read / execute permissions when PCC68 is the reference capability and read / write permissions when another capability register is selected.

[0092] Other implementations may choose to provide alternative methods for selecting access permissions, which in some implementations may be based on additional selection parameters specified by the ADRP directive. For example, an additional offset field used in non-capability mode may be assigned to indicate which access permissions to select. Figure 7 The 22nd bit of the encoding shown can be used to select between alternative access permissions for each option of the reference capability register. For example, for an ADRP instruction using the PCC as the reference capability register, the additional selection bit can choose between granting both execute and read permissions and granting only read permission; while for an ADRP instruction using a different capability register as the reference, the additional selection bit can choose between granting only read permission and granting both read and write permission. Similarly, this additional selection bit can be encoded with a bit value that explicitly indicates one option using 0 and another using 1, or alternatively, the bit can be encoded such that the information depends on whether the selection bit has the same value as the sign bit of a smaller offset value.

[0093] exist Figure 8 At step 614, the boundary of the result capability of the ADRP instruction is selected based on the boundary specified in the reference capability register. The boundary specified in the reference capability register can be simply mapped to the unchanged result boundary.

[0094] At step 616, the resulting capability is written to the destination capability register specified by the ADRP instruction in capability mode. The resulting capability includes the window address determined at step 610 as its pointer 62, the boundary selected at step 614 as its boundary 74, and the selected permission chosen at step 612 as its permission 76. This resulting capability can then be referenced by subsequent relative-addressing data access instructions to control access to memory, or it can be used by branch instructions to control a branch to the pointer specified in the resulting capability, thereby controlling subsequent instruction fetching from that address. Therefore, the permission assigned at step 612 controls whether such data access is likely to succeed during instruction fetching.

[0095] Figure 9 The instruction encoding of ADRP instruction 310 itself, excluding [the following details], is shown in more detail. Figure 7 The implementation of selection parameter 502 shown illustrates the operation of step 608 for selecting the reference capability register. This approach can be used for legacy code written without considering capability support, or even for newer code in implementations of architectures that do not provide selection parameter 502.

[0096] At step 630, the control signal generated by the decoding stage 10 controls the execution stage 16 to apply the offset value 312 of the ADRP instruction to the pointer currently stored in the PCC register 68 (e.g., Figure 3 The clearing of the lower byte 362 of the pointer shown determines the relative address of the program counter. Therefore, this will calculate the window address 224, representing the address of the window that includes the current program counter value, as... Figure 5 As shown. At step 632, execution phase 16 compares the program counter relative address generated at step 630 with the allowed range defined by the boundary information 74 in PCC register 68. If the boundary is stored in compressed form, this may need to be decompressed before comparing the boundary with the address generated at step 630. If the program counter relative address is within the allowed range of the PCC register, then at step 634, the reference capability register is selected as PCC register 68, and the program counter relative address determined at step 630 can be returned as the window address determined at step 610, which will be set as a pointer to the resulting capability to be written to the destination capability register in response to the ADRP instruction.

[0097] However, if the address determined at step 630 is not within the allowed range defined by boundary 74 in PCC register 68, it can be assumed that the address should instead be calculated relative to an additional capability register. Therefore, at step 636, the additional capability register (CDC) is selected as the reference capability register. Although pointer 62 can subsequently be obtained from the additional capability register, and then repeated using the offset value from the ADRP instruction... Figure 3 The operation shown is similar, but since the program counter relative address determined at step 630 has already been aligned with the address window boundary and shifted based on the offset, the window address can be generated more simply at step 610 by applying an additional shift to the program counter relative address based on information from the PCC68 and the additional capability registers. Specifically, the window address is determined at step 610 according to the formula P+BUC, where P is the program counter relative address determined at step 630, B is the base address that limits the lower bound of the allowed range of the additional capability registers, U is the upper bound of the allowed range of the PCC68, and C is a constant that can take any value chosen for a given architecture implementation. The constant C can be, for example, 0. The derivation of this expression for calculating the window address when the additional capability registers are selected is described below. It should be understood that when the additional capability registers are selected, other ways of calculating the window address may exist depending on the architecture implementation. By converting the program counter relative address to the result required by the ADRP instruction, this avoids the need for repetition. Figure 3 The diagram shows some operations used to clear the low-order bits and add an offset. By enabling selection between alternative reference capability registers, even if the code is written with instructions that do not explicitly indicate this selection, this allows binary code and data components compiled without considering capabilities to be relocatable in a position-independent manner, with different capabilities controlling the effective use of code and data components respectively.

[0098] Figure 10A specific implementation of a usable simulator is illustrated. While the previously described embodiments implement the invention in terms of means and methods for operating specific processing hardware supporting the technologies involved, an instruction execution environment according to the embodiments described herein can also be provided, which is implemented using a computer program. Such computer programs are generally referred to as simulators, in part because they provide a software-based implementation of a hardware architecture. Types of simulator computer programs include emulators, virtual machines, models, and binary converters, including dynamic binary converters. Typically, the simulator implementation can run on a host processor 730 supporting the simulator program 710, which optionally runs a host operating system 720. In some arrangements, multiple emulation layers may exist between the hardware and the provided instruction execution environment and / or multiple different instruction execution environments provided on the same host processor. Historically, powerful processors were required to provide simulator implementations that execute at a reasonable speed, but this approach may be reasonable in certain situations, such as when it is desirable to run code native to another processor for compatibility or reuse reasons. For example, the simulator implementation may provide additional functionality to the instruction execution environment that is not supported by the host processor hardware, or provide an instruction execution environment that is typically associated with a different hardware architecture. An overview of the simulation is given in the following literature: “Some Efficient Architecture Simulation Techniques”, Robert Bedichek, Winter 1990 USENIX Conference, pp. 53-63.

[0099] With respect to embodiments previously described with reference to specific hardware constructions or features, in simulated embodiments, equivalent functionality may be provided by suitable software constructions or features. For example, specific circuitry may be implemented as computer program logic in simulated embodiments. Similarly, memory hardware such as registers or cache memory may be implemented as software data structures in simulated embodiments. One or more hardware elements referenced in the previously described embodiments are present in an arrangement on host hardware (e.g., host processor 730), and where appropriate, some simulated embodiments may utilize the host hardware.

[0100] The simulator program 710 may be stored on a computer-readable storage medium (which may be a non-transitory medium) and provides a program interface (instruction execution environment) to the target code 700 (which may include an application program, operating system, and management program). This program interface is identical to the application interface of the hardware architecture modeled by the simulator program 710. Therefore, the simulator program 710 can be used to execute program instructions of the target code 700 (including the aforementioned ADRP instructions) from within the instruction execution environment, enabling the host computer 730, which does not actually possess the hardware features of the aforementioned device 2, to emulate these features. The simulator code 710 may include instruction decoding program logic 712, which decodes the instructions of the target code 700 and maps these instructions to corresponding instruction sets in the host processor 730's local instruction set to emulate the functionality of the aforementioned instruction decoder 10 (including implementing the aforementioned ADRP operation and capability check). The simulator program may also have program logic for controlling whether processing is executed in a capability mode or a non-capability mode. Additionally, the simulator program 710 includes register maintenance program logic 714, which maps register references (including references to capability registers) in the instructions of the target code to corresponding addresses in the register emulation data structure 716 maintained in the host address space of the host hardware 730, in order to emulate the architecture register 14 of the instruction set architecture written to the target code.

[0101] Appendix – Analysis and Derivation Taking into account the fixed literal offset during static linking, ADRP returns the address of the 4KiB addressing unit (4KiBAU) containing the target label L (e.g., Figure 5 and Figure 6 (As shown). The offset is measured in 4 KiB units from the 4 KiBAU base of the ADRP instruction. The returned address does not follow the category of the addressed data (or code). For example, the address returned for a read-only data access could be an address within either code or read-only data.

[0102] The range of ADRP is ±2. 20 When compared with standard load and store instructions 2 12 When the range is combined, ±2 is provided. 32 Addressing range. Note that the maximum DSO in the AArch64 Ubuntu 14.0.3 distribution is approximately 50MB, less than 2 26 Bytes. The largest executable is less than half this size. Therefore, there are 2 bytes in ADRP addressing. 6 Safety margin factor.

[0103] The address returned by ADRP is unrestricted within the virtual address space. Code can modify this address to point to anywhere in the mapped (or on-demand mapped) virtual address space.

[0104] In a capability-based world, we want to apply and enforce: • The principle of least privilege (preferably, only the minimum privileges required to complete the task are granted).

[0105] • The "Intentionality" principle. When code accesses a portion of a memory object, it should express its intention by introducing capabilities targeting that portion of the memory object.

[0106] • Access control at any (byte) granularity, rather than at the underlying virtual memory page granularity (4KiB, 16KiB, or 64KiB).

[0107] In the capability-based system described above, whether an instruction has its legacy behavior or new capability behavior is modal (i.e., the mode indicator value 56 controls whether the instruction is executed in a non-capability mode or a capability mode).

[0108] In capability mode, ADRP should return the capability, not an integer address, but there are some issues that need to be addressed: • From which ability is the returned ability derived? • What are the boundaries of the returned capabilities? • What permissions does the returned capability have? It should be noted that the compiler can generate code to narrow down the boundaries and reduce the permissions of capabilities returned by ADRP or capabilities deduced from those capabilities.

[0109] A simple way to implement ADRP in capability mode is as follows: • The scope defined by the boundary 74 of PCC 68 is set by the software to be sufficient to cover the entire location-independent executable (DSO), including code and data.

[0110] •ADRP returns the capability derived from PCC, whose boundary is the same as that of PCC.

[0111] • The capabilities returned by the ADRP instruction in capability mode have RWX permissions.

[0112] • The code can subsequently narrow down the permissions and / or boundaries of the capabilities or further deduced capabilities.

[0113] However, this method has the following problems: • Relying on virtual memory and page-level protection to enforce data execution protection (W^X) (the principle that a given address cannot be both executable and writable, which is important for security).

[0114] • Alternatively, rely on the compiled code to appropriately reduce permissions.

[0115] • Because dynamic linking must manipulate page-level protection, W^X can be compromised by attacks that call mmap() (a Unix system call that maps a file or device into memory).

[0116] • This solution does not support runtime relocation of references to its own data.

[0117] Supports runtime relocation of its own data Basic principles To create a second instance of a binary object, copying the object is sufficient, but only its own data needs to be copied (because the code can be shared).

[0118] Since the code of a binary component is on average 5-7 times its own data, copying the entire component is inefficient and unnecessarily increases the instruction TLB pressure.

[0119] How to do it In a capability-based world, two capabilities can be used to describe a binary component, allowing one part of the binary component to be addressed separately or differently from the other: • PCC is used to describe the code and read-only data of a component. (The code and read-only data can be shared by all instances of the component.)

[0120] • Component Data Capability (CDC) is used to describe the component's own data, which can be different for each instance.

[0121] See above Figure 6 CDC can be the default data capability (DDC), or it can be another capability as discussed above.

[0122] The two options for ADRP are: 1. Relocation relative to the reference beyond the PCC boundary by the CDC (e.g., such as...) Figure 9 (As shown).

[0123] 2. Enable ADRP to select which capability to use (e.g., ... Figure 7 (See the selection parameters shown).

[0124] Using option 1, the address window boundaries (e.g., 4KiBAU boundaries) should be set below the RELO data and above the code / RO data, and the virtual memory page boundaries should be set above the RELRO (this is a feature handled in software, not enforced by the hardware of the processing device).

[0125] Option 2 simplifies the hardware but removes one bit from the ADRP offset field 312. Some example encodings can be used: • The most significant bit of immhi, the instruction bit. <23> Shift the sign bit down to the specified position. <22> .

[0126] • The least significant bit of immlo, the bit of the instruction. <29> Shift the entire offset down one bit.

[0127] Regardless of the method, the compiler and linker encode immediate offsets slightly differently, but the choice has no effect on them.

[0128] For the sake of brevity, ADRDP will be used to represent the CDC relative variant of ADRP ( ad d r ess of d (ata). It should be understood that ADRP and ADRDP are in fact the same address calculation instruction 310 as previously described, but are distinguished by the value of the selection parameter encoded in the instruction.

[0129] In terms of compatibility with legacy ADRP instructions, the sign bit is shifted to the correct position. <22> Encode other capabilities (CDC) as bits <23> !=bit <22> No special operations are required in non-capability mode, because in non-capability mode, the bit... <23> =bit <22> Unless the component spans more than 2GB. We have not seen such a component.

[0130] Returned boundaries and permissions Simply put, the boundary of the derived capability can be the boundary of the capability derived from it.

[0131] In one proposed usage model, the boundaries of the PCC, which are expected to be set by software, are boundaries on the code components (including their RO data) that contain the entry points that cause the PCC to load into the program counter via branch instructions. Again, this is a feature provided by software, rather than being architecturally enforced by hardware.

[0132] Separating the addressing of a component's data from the component's code allows the PCC boundary to be narrowed down to the function scope, but at a cost: • Inline code cannot construct function addresses—these function addresses will be loaded from the RELRO data (or from the Global Offset Table (GOT) for Linux-like systems).

[0133] • Read-only data shared between functions should be moved to the RELRO section, which may involve instantiating it multiple times or copying it across multiple functions.

[0134] When security concerns outweigh all other issues, it can be interesting to narrow down the scope of PCC.

[0135] Given that PCC encompasses both code and RO data models, the question arises regarding the permissions that should be granted for the returned capabilities. Should it have X, R, or RX permissions? If it's a code address, then X should be included, but for read-only data access, R is necessary. This means, for example, • If it is the address of the component's entry point (i.e., the address of a function within the component). • And this address will eventually be called or branched into, • This causes it to become a value in PCC. Then, the permission is RX, or the component must not contain RO data.

[0136] There are two solutions: • The additional bit of the ADRP offset indicates the intention to have RX instead of R privileges, or • Determine that RX is essentially harmless, then have the code subsequently use additional instructions following the ADRP instruction to narrow the privileges to X (where possible) or R.

[0137] This problem interacts with narrowing the boundaries of the capabilities derived from the returned capabilities. The results of ADRP are not directly available—there is another step involved in constructing a reference for data / instruction access.

[0138] Therefore, a code generator that intends to further deduce the capabilities of read-only data objects should: • Shrink XR to R, if it has not yet returned to R only.

[0139] • Narrow the boundaries of the derived capabilities to the boundaries of the data objects.

[0140] If the derived capability refers to the component entry point, then the problem persists. The addressing architecture relies on the entire singleton portion of the component being readable and executable, even if this is incorrect and unsafe. There are some alternative fixes for this.

[0141] • It relies on virtual memory page protection by setting page boundaries between code (RX or X) and RO data (R).

[0142] • Introducing a third fundamental capability (in addition to PCC and DCC).

[0143] • Move small RO data to the RELRO section and address large RO data via GOT (within the RELRO section).

[0144] The third fix allows security-sensitive code to be executed using only X privileges (without R or W) and ensures that the correct code cannot reuse RO data as gadget code.

[0145] For less sensitive code, we might argue that since we'll be relying on correct code generation anyway, why not rely on it to avoid generating executables for RO data? The code will ensure that any pointer fields to executables derived from the ADRP results point to the component's code.

[0146] For example, if the compiler can prove that the returned capability does not escape the current function and does not reach any sequence of local gadgets, then at least by using ADRP to generate subsequent derivations of common subexpressions (CSEs) for it, running with loose boundaries and more permissions than required would not be unsafe.

[0147] For example, when deriving the ability for a read-only data object to exit from this function, the compiler should generate code to: • Remove the X permission from the derived capabilities.

[0148] • Tighten the boundaries of the derived capabilities to the boundaries of the data objects.

[0149] Only the compiler can generate code to tighten boundaries—object boundaries are meaningless to the hardware, and the compiler should generate code to remove X privileges or generate ADRPs indicating that it needs R privileges but not RX privileges.

[0150] From an implementation perspective, moving the privilege reduction to ADRP seems like a good decision, as the cost of reducing privileges is a gate latency, not an additional instruction. Generally, ADRP results in CSE cases where the derived executable capability and the derived RO data capability are both limited. As has been observed, only the code generator can appropriately reduce the boundaries.

[0151] ADRDP results derived from CDC A similar issue exists when deriving capabilities from CDC using ADRDP. The result should have read (R) and / or write (W) permissions.

[0152] Subsequent direct use (through loading and storing) should follow boundaries and permissions (we rely on the code generator to ensure that code using literal offsets follows boundaries and permissions).

[0153] Subsequent derivations of the ability to construct data objects should appropriately narrow the boundaries and reduce permissions. Retaining RW capabilities for a portion of the RELRO component would be insecure.

[0154] Similarly, code generators can be used to generate code for narrowing permissions, but it's more intentional to express in the ADRDP instructions whether the capability should be used for RELRO or for writable data. Therefore, some implementations may prefer to provide additional selection parameters for choosing whether the capability access permission should be R or RW.

[0155] The boundary can only be narrowed by the generated code using additional instructions.

[0156] An overview of a possible specific implementation of ADRP : In capability mode, ADR[D]P generates capability results as follows.

[0157] • Range ADR[D]P (from 2) 32 Reduced to 2 31 .

[0158] • The sign bit of the immediate value is moved to the current immediate value's bit position. <20> .

[0159] •Bit <21> The choice is whether to derive from PCC (ADRP) or CDC (ADRDP).

[0160] Optionally, the sign bit can be moved to position. <19> Furthermore, the range of immediate values ​​can be reduced to 2. 30 .

[0161] •Then position <20> Choose from the following: ○ (Derivation of ADRP from PCC) XR and R.

[0162] ○ (Derived from CDC for ADRDP) WR and R.

[0163] In both cases, the selection can be encoded as bits. <n>= 0 / 1 or encoded as bit <n>!= signbit.

[0164] However, this is not the only possible implementation. The analysis below shows that, in practice, additional selection parameters for choosing access permissions are not necessary.

[0165] Analysis of safety orientation As described in previous sections, it is generally expected that ADR[D]P will return capabilities with the following permissions: • Has {R,X} permissions relative to PCC addressing codes and read-only data segments.

[0166] • Has {R,W} permissions when addressing RELRO and writable data segments relative to CDC.

[0167] {R,X} permissions lead to two threats: • (Confidentiality) Secrets embedded in the code can be read.

[0168] • (Integrity) Code (accidentally) embedded in read-only data can be executed.

[0169] {R,W} permissions lead to a threat: • (Integrity) should mean that read-only (RELRO) data can be written after dynamic relocation.

[0170] Unnecessary read permissions The Program Counter Capability (PCC) has {R,X} permissions, which enables the reading of code. This PCC has these permissions because the code needs to read its read-only data, and only one register addresses that segment in a position-independent manner.

[0171] There are some simple code generation mitigations for this problem that do not lead to application binary interface (ABI) incompatibility.

[0172] • Small read-only data objects can be constructed by code or moved into the RELRO segment.

[0173] Large read-only data objects can be indirectly addressed through the Global Object Table (GOT) in the RELO segment. They are stored in the ELF segment, which is instantiated only once.

[0174] This allows the restrictions describing the executable capabilities of the segment to be reduced to the end of the code, removing R from its permissions, and the execute-only value in the PCC.

[0175] Redundant execution permissions Because the Program Counter (PCC) capability necessarily has {R,X} permissions, but only one address range, it results in permissions to execute (read-only) data. In this case, the code can remove the X permission from its capabilities constructed for read-only data objects.

[0176] The capabilities returned by ADRP can be used in the following ways, and all of these ways may apply to the same value.

[0177] • An executable can be constructed by adding a 12-bit, symbolic, immediate constant to an address. If the PCC has {RX} permissions, then {RX} permissions are appropriate (see the previous section). The address is the code address obtained through construction (assuming the code generator is correct).

[0178] • The ability to construct data by adding 12-bit, symbolic, immediate constants to addresses. {R} permissions are appropriate. {X} permissions must be removed. The address is the data address obtained through construction (assuming the code generator is correct).

[0179] • This capability can be used as the base capability for load or store instructions with a 12-bit literal offset. {R} permission is required; {X} permission is ignored.

[0180] The capabilities returned by ADRP can be a common subexpression (CSE) for any / all of these cases. The CSE is actually a modified copy of the PCC with pointer fields.

[0181] From a security perspective, CES is sufficient: • Make the capability of any function derived from CSE immutable (sealed entry capability).

[0182] • Remove the {X} permission from any data capabilities derived from CSE.

[0183] • The value of the CSE capability enables "Local Security Context (..." local safe context Before escaping, remove or invalidate {X} from CSE capabilities.

[0184] How should a "local security context" be defined? Considering the ADRP instruction that returns control to the CSE, the requirement is: • There is no code path from ADRP that CSE can follow to escape functions, even against an adversary powerful enough to control all mutable data values.

[0185] • As mentioned in the first two bullet points above, the value deduced from CSE will become immutable or have the {X} permission removed before reaching any flowchart point that might cause the function to escape.

[0186] May escape It is the compiler's standard data flow analysis.

[0187] From a security perspective, May escape This includes entries left in the register file during function calls or returns, accessible portions of the stack that overflow before function calls or returns, and addresses taken. Flowchart reachability must include all paths, including so-called faulty paths, as these support speculative attacks. Paradoxically, this simplifies dataflow analysis.

[0188] Unnecessary write permissions The capabilities returned by ADRDP (ADRP relative to CDC) can be a common subexpression (CSE) of any or both of the following data objects: • The RELRO part (therefore, the derived capabilities should not have {W} permissions).

[0189] • Writable data portion (therefore the derived capabilities may have {W} permissions).

[0190] The code generator can generate code to remove the {W} permission from the deduced capabilities of a data object that is read-only at the language level, even though it is stored in the mutable data portion of the component.

[0191] From a security perspective, it is sufficient that the generated code correctly narrows the boundaries and permissions of the inferred capability before the local security context defined in the previous section is escaped, and abbreviates its own permissions to {R} or invalidates itself before CSE can escape it.

[0192] The more laborious but more secure solution mimics the solution used to remove unnecessary read permissions.

[0193] • Mutable data can only be addressed through the (immutable) Global Object Table (GOT).

[0194] • This allows the boundary of the CDC to be reduced to the boundary of the RELRO segment, and its permissions to {R}.

[0195] Therefore, any capability derived from CDC by ADRDP does not have {W} permission. Gaining the ability to write data involves loading that write data from the GOT.

[0196] Overview There are viable options for generating secure code that create binary components compatible with calls made by components that are less securely built (more reliant on correct code generation). Stronger security guarantees (e.g., code generation for minor errors) do not lead to ABI incompatibility.

[0197] Integration with legacy code The ADRP instructions in legacy code do not explicitly indicate which reference capability (PCC or CDC) to use. In this section, we explore the impact of such relocations on compliant... Figure 6 The impact of the behavior of legacy binary components on the layout described in part (a).

[0198] ADRP PCC-relative works simply because there is only one code + RO data instance. PCC-relative can be computed if (and only if) a PCC-relative relocation is subsequently applied in that execution mode. address And subtract PCC.base from it.

[0199] DDC-relative relocation Given the goal we want to achieve, let’s now derive a way to handle ADRP: the data reference becomes DDC-relative, which may allow multiple instances of component data without the component’s knowledge or consent.

[0200] The binary component containing the control is composed of a pair of capabilities, PCC and DDC. n To describe, n=0, 1, 2... indexes the possible multiple instances of its data.

[0201] Conceptually, ADRP first calculates the program counter relative capability C, which is a copy of PCC, where PCC.pointer is adjusted by a literal fixed during static linking (the literal is an offset value set by the linker for ADRP instructions; C.pointer effectively corresponds to the window address, which will be generated by ADRP instructions if PCC is used as the reference capability). C.pointer does not need to be within the boundaries of PCC. If it is not within the boundaries of PCC, then it should be within the boundaries of DDC.

[0202] Let DDC 0 This is the value of DDC assumed during static linking. For location-independent entities, DDC... 0 To enable DDC 0 .base-PCC.base = static link-time offset O 0 If the invariant does not hold, then address the DDC. 0 The scope of PC-relative is meaningless. This invariant applies to code-addressable DDCs. 0 Any component within the PC-relative scope. Note that this is corrected by construction (using tools that run no later than static-link time).

[0203] Suppose we are dealing with "exact byte address ( byte-precise addresses If the DDC fails, the relocation will proceed as follows: First compute C.pointer If C.pointer in [DDC 0 .base, DDC 0 .limit), add DDC.base - DDC 0 .base toC.pointer.

[0204] For convenience, let's use X.range to represent [X.base, X.limit].

[0205] Now, DDC.base or DDC 0 The value of .base is unknown, but (DDC) 0 .base - PCC.base) = O 0 (The constants used during linking) are known. Therefore: If C.pointer in DDC 0 .range, add (DDC.base - PCC.base - O 0 ) toC.pointer.

[0206] DDC is needed now. 0 .range C.pointer Agent and concretization of O 0 The method.

[0207] By constructing a pointer, we know whether C.pointer is in PCC.range or C.pointer is in DDC. 0 .range. For the intersection and difference of sets considered as ranges of sets, using standard set theory notation, the above re-entrancy is as follows: C.pointer in (PCC.range - DDC 0 .range) | C.pointer in (PCC.range) DDC 0 .range) | C.pointer in (DDC 0 .range - PCC.range) These three clauses apply to non-overlapping subranges, so only one clause can be true.

[0208] Now, the only condition for reliable evaluation at execution time is C.pointer in PCC.range And it requires that (C.pointer in PCC.range) C. Pointer in DDC 0 .range but: not (C.pointer in PCC.range) = not (C.pointer in (PCC.range - DDC0.range) | C.pointer in (PCC.range& DDC 0 .range)) = not not (C.pointer in (PCC.range - DDC0.range) & not C.pointer in(PCC.range & DDC 0 .range) So not (C.pointer in PCC.range) not (C.pointer in (PCC.range & DDC 0 .range)) and C.pointer in(PCC.range & DDC 0 .range).

[0209] This only applies if (PCC.range & DDC) 0 This condition is satisfied only when .range) = {}, meaning the ranges do not overlap.

[0210] Requirements (PCC.range & DDC) 0 The expression `.range) = {}` yields the following result: If C.pointer not in PCC.range, add (DDC.base - PCC.base - O 0 toC.pointer This leaves O 0 The value is pending processing. It can be placed in another environment register, or the value can be fixed in the architecture. This is because PCC.range and DDC are required. 0 The ranges are disjoint, and this is achieved by assuming ( Figure 6 (a) Part PCC.limit ≤ DDC 0 .base, therefore: DDC 0 .base = PCC.limit + architectural constant (This constant is mentioned above) Figure 9 (referred to as C in Chinese).

[0211] In practice, architectural constant It could also be zero. Therefore, O 0 = (DDC 0 .base -PCC.base) = (PCC.limit – PCC.base), ultimately yielding: If C.pointer is not in PCC.range, add (DDC.base - PCC.limit) toC.pointer.

[0212] This choice resolves how we describe legacy, location-independent binary components using PCC and DDC, at least conceptually in terms of static link time. At runtime, there is freedom to place DDC anywhere DDC.range does not overlap with PCC.range.

[0213] 4KiB Address Unit In the previous section, our analysis assumed byte precision. This is not the case with ADRP. There is at most 4 KiB of uncertainty between the pointer returned by ADRP and the location where the final access will occur.

[0214] The simplest evidence that this does not affect the validity of the evidence in the previous section is the replay parameter in units of 4 KiB, which leads to these additional validity requirements: • No 4KiB "page" in PCC.range is associated with DDC 0 Any 4KiB "pages" of the .range range overlap.

[0215] •(DDC 0 .base & 0xfff) = 0.

[0216] •(PCC.limit + 0xfff) & ~0xfff = DDC 0 .base.

[0217] That is, when measured in 4KiB blocks, PCC.range is adjacent to DCC0.range, but does not overlap with it. Legacy Linux binaries cannot violate this condition because there is always a 64KiB address boundary above code + RO and below RELRO + data + bss. This is to accommodate a binary file, regardless of the host's page size selection, and to avoid requiring RO data to always follow the code.

[0218] Address relocation The question of what address offset to apply to C.pointer in non-capability mode remains (when the ADRP result is returned as a relative address to the base address relative to the PCC / DDC reference capability). For example: PCC.base if C.pointer in PCC.range; DDC.base otherwise.

[0219] This will work for both the code address (add PCC.base when using) and storage (add DDC.base when using), but there's a problem with loading. Which base should be added to the load address? The answer to this problem is to return the offset relative to PCC.base. This requires performing a range check on the relocated address as follows.

[0220] • When transferring control, check the address against PCC.range.

[0221] • Check the storage address using DDC.range.

[0222] • Check the load address against both ranges; grant access to either one.

[0223] An implementation plan ADRP Overview and definition: If C.pointer in PCC.range, ADRP returns C.pointer – PCC.base If C.pointer not in PCC.range, ADRP returns C.pointer – PCC.limit +DDC.base – PCC.base When using it, add PCC.base to the address.

[0224] For a single-instance component, PCC.limit – DDC.base, so the expression collapses to C.pointer – PCC.base.

[0225] Package legacy programs or systems To date, our solution supports instantiation of legacy binary components under these constraints: • For each instance, PCC.range and DDC.range do not overlap.

[0226] • PCC.range contains all the code.

[0227] •DDC.range contains all data, including the stack and heap.

[0228] This solution allows a binary component to be encapsulated within a compartment. As control moves between compartments, the PCC naturally changes, but this model is only valid if the DDC also changes. Any call to or from such a compartment becomes a compartment call, not a function call.

[0229] The restriction that PCC.range includes all code but does not overlap with DDC.range excludes systems (or programs) that encapsulate multiple binary components, thus excluding this ADRP behavior in legacy non-capability mode. Therefore, to accommodate legacy non-capability code: • The arbitrary interleaving of code and its own data should be permitted.

[0230] • It does not require multiple instantiations of its own data.

[0231] • Capable of relocating the entire system within the address space.

[0232] Now let's re-examine the parameters from the previous sections under this new constraint.

[0233] Relocation and Range Check The instruction fetch is relocated relative to PCC.base and checked against PCC.range.

[0234] Logically, data access should be relocated relative to DDC.base and checked against DDC.range. However, legacy programs expect code address X to access the same location as data address X. In most execution environments, code may expect to be able to access all low addresses down to 0, regardless of the upper limit of the address space, as this is typically controlled by the execution environment. These requirements constrain the legacy program's PCC and DDC as follows.

[0235] •PCC.base = DDC.base.

[0236] • PCC.range contains all the code.

[0237] • DDC.range includes all data (and, very likely, all code as well).

[0238] However, these conditions are not the only ones that are certain. The following are also possible: • All accesses are relocated by PCC.base.

[0239] • Check all accesses against PCC.range.

[0240] • Ignore DDC.

[0241] PCC changes naturally during control transfer, therefore this solution supports: • Capability-based function calls that enter a compartment containing legacy non-capability systems.

[0242] • The function call exits the compartment via a pad similar to that of a regular PLT+PLTGOT.

[0243] • It does not change the memory safety of the non-capability system itself, although it provides isolation between the system and the capability-based compartments that interact with it.

[0244] ADRP in the whole program context In non-capability mode, ADRP returns a PC-relative address, and this is the same operation that should still be performed in capability mode, except that the address must be relative to PCC.base, as mentioned above. ADRP The single-component solution summarized in the overview definition is consistent.

[0245] Safe orientation observation One scenario is that checking data access against DDC appears to provide better memory safety than checking against PCC. This was already observed in the previous section as PCC.base = DDC.base. However, if PCC.limit < DDC.limit, then the range [PCC.limit, DDC.limit) allows data access but not execution.

[0246] In practice, W^X (also known as DEP) has already blocked such access in the underlying virtual memory (VM) system. Legacy binaries are built with full knowledge of VM page boundaries and protections, so this situation can be considered as having no memory-safe values. No data access checks are required against the DDC.

[0247] ADRP Options Therefore, taking the threats mentioned above together: • To encapsulate and relocate the entire program or system, ADRP returns the PC-relative address relative to PCC.base. DDC should be ignored.

[0248] • To encapsulate a single, position-independent binary component, and any of the following ○ Relocate its own data independently of its code ○ Instantiate its own data multiple times: As discussed above, it provides the behavior specified in the ADRP overview definition.

[0249] To support this, a system with four ADRP behavior modes can be provided: 1. Behaviors in non-ability mode, such as Figure 3 As shown, access does not perform range checks for PCC or DDC.

[0250] 2. ADRP returns the PC-relative address relative to PCC.base.

[0251] • Use PCC.range to check all memory accesses.

[0252] • When using it, add PCC.base to each memory access address.

[0253] 3. In this mode: • Check instruction retrieval against PCC.range.

[0254] • Check data access against PCC.range and DDC.range; if both checks fail, a failure has occurred.

[0255] • If ADRP refers to PCC.range, then return PC-relative address (as discussed above regarding C.pointer).

[0256] • Otherwise return PC-relative address + DDC.base – PCC.limit – Constant (although the constant may be zero for some architecture-specific implementations).

[0257] 4. As option 3, use PC-relative address – PCC.base replacement PC-relative address And when using it, PCC.base is added to all memory access addresses.

[0258] It should be understood that the analysis above describes some specific implementations, and other specific implementations are possible.

[0259] In this application, the phrase "configured as..." is used to mean that the elements of the device have a configuration capable of performing the defined operation. In this context, "configuration" means the arrangement or manner of interconnection of hardware or software. 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 as" does not mean that the elements of the device need to be changed in any way to provide the defined operation.

[0260] While exemplary embodiments of the invention have been described in detail herein with reference to the accompanying drawings, it should be understood that the invention is not limited to those precise embodiments, and various changes and modifications can be made therein by those skilled in the art without departing from the scope of the invention as defined by the appended claims.< / n> < / n>

Claims

1. A data processing apparatus, the apparatus comprising: Processing circuitry, the processing circuitry being used to perform data processing; An instruction decoder is used to decode instructions to control the processing circuitry to perform the data processing; Multiple capability registers, each storing a capability, the capability including a pointer and constraint metadata for restricting the valid use of the pointer or the capability, the capability register including a program counter capability register, the pointer representing the following address relative to the program counter capability register: the program counter address indicating the current program flow point; wherein: In response to the ability to generate address calculation instructions based on a specified offset value, the instruction decoder is configured to control the processing circuitry: Select the reference capability register as one of the program counter capability register and another capability register; as well as A result capability is written to the result capability register in the capability register, the pointer of the result capability being directed to the window address of a selected window in the identifier address space, wherein the window comprises a contiguous block of addresses of a predetermined size, the selected window being offset from a reference window by a number of windows determined based on the offset value specified by the capability generation address calculation instruction, and the reference window comprising a window containing the address indicated by the pointer of the reference capability register.

2. The apparatus of claim 1, wherein the processing circuitry has a capability mode and a non-capability mode, and The capability generation address calculation instruction includes the address calculation instruction processed by the processing circuit in the capability mode.

3. The apparatus of claim 1, wherein the instruction decoder is configured to control the processing circuitry to select, based on a selection parameter specified by the instruction encoding of the capability-generated address calculation instruction, whether the reference capability register is the program counter capability register or the other capability register.

4. The apparatus according to claim 3, wherein: The processing circuit has a capability mode and a non-capability mode. The capability generation address calculation instruction includes an address calculation instruction processed by the processing circuit in the capability mode; In response to the address calculation instruction processed by the processing circuitry in the non-capable mode, the instruction decoder is configured to control the processing circuitry to write an integer window address, determined based on the offset value, to the destination register relative to the window address of the window including the non-capable program counter address. and For the address calculation instruction processed by the processing circuitry in the capability mode, the selection parameter is encoded using bits of the instruction code of the address calculation instruction, which represent the most significant bit of the offset value in the non-capability mode.

5. The apparatus according to any one of claims 1 and 2, wherein the constraint metadata specifies the allowed range of the pointer; and In response to the capability to generate an address calculation instruction, the instruction decoder is configured to control the processing circuitry: When the program counter relative address is within the allowed range specified by the constraint metadata of the program counter capability register, the program counter capability register is selected as the reference capability register, and the program counter relative address corresponds to the result of applying the offset value to the pointer stored in the program counter capability register; and When the program counter relative address exceeds the allowed range specified by the constraint metadata of the program counter capability register, the other capability register is selected as the reference capability register.

6. The apparatus of claim 5, wherein, in response to the capability-generating address calculation instruction, the instruction decoder is configured to control the processing circuitry: Determine the relative address of the program counter; The program counter relative address is compared with the allowed range specified by the constraint metadata of the program counter capability register; When the program counter relative address is within the allowed range specified by the constraint metadata of the program counter capability register, the program counter relative address is returned as the pointer to the resulting capability; as well as When the program counter relative address exceeds the allowed range specified by the constraint metadata of the program counter capability register, the pointer as the result capability returns a pointer corresponding to P + B – U – C, where P is the program counter relative address, B is the base address of the allowed range specified by the constraint metadata of the additional capability register, U is the upper limit address of the allowed range specified by the constraint metadata of the program counter capability register, and C is a constant value.

7. The apparatus of claim 1, wherein, in response to at least one type of capability control data access instruction, the instruction decoder is configured to control the processing circuitry to trigger a fault signaling when a target address determined based on at least one parameter of the data access instruction exceeds both of the following: The allowed range indicated by the constraint metadata of the program counter capability register; and The permitted range indicated by the constraint metadata of the additional capability register.

8. The apparatus of claim 1, wherein, in response to a capability control data access instruction for relative addressing of a specified target address capability register and an in-window offset value, the instruction decoder is configured to perform data access to a target address determined by adding the in-window offset value to the pointer stored in the target capability register.

9. The apparatus of claim 1, wherein the constraint metadata specifies access permissions for using the pointer to the capability, the access permissions specifying at least one of the following: A read permission value, which indicates whether read permission is granted to provide the ability to control access to read data; A write permission value, which indicates whether write permission is granted to provide the ability to control access to written data. as well as An execution permission value, which indicates whether execution permission is granted to provide the ability to determine the branch target address or control the extraction of execution instructions.

10. The apparatus of claim 9, wherein in response to the capability generation address calculation instruction, the instruction decoder is configured to set the access permission specified in the constraint metadata of the resulting capability to indicate different access permissions depending on whether the reference capability register is the program counter capability register or the other capability register.

11. The apparatus according to any one of claims 9 and 10, wherein in response to the capability generation address calculation instruction: When the reference capability register is the program counter capability register, the processing circuitry is configured to copy the read permission value and the execute permission value specified in the constraint metadata of the program counter capability to the constraint metadata of the result capability, and set the write permission value of the result capability to indicate that write permission has not been granted; and When the reference capability register is the other capability register, the processing circuit is configured to copy the read permission value and the write permission value specified in the constraint metadata of the other capability register to the constraint metadata of the result capability, and set the execution permission value of the result capability to indicate that execution permission has not been granted.

12. The apparatus of claim 1, wherein the capability register includes a default data capability register for storing default data capabilities for constraining the use of pointers represented by non-capability operands.

13. The apparatus of claim 12, wherein in response to at least one type of capability control data access instruction, the instruction decoder is configured to control the processing circuitry to perform data access to a target address determined based on at least one capability operand of the data access instruction, without relocating the target address based on the capability stored in the default data capability register.

14. The apparatus according to any one of claims 12 and 13, wherein the additional capability register includes the default data capability register.

15. The apparatus of claim 1, wherein the plurality of capability registers comprises a plurality of general-purpose capability registers, the plurality of general-purpose capability registers being accessible by capability specification instructions in at least one configuration of the processing circuitry; and The additional capability registers include the predetermined general capability registers in the general capability registers.

16. The apparatus of claim 1, wherein the window address includes an absolute address identifying the selected window.

17. The apparatus of claim 1, wherein the constraint metadata specifies the allowed range of the pointer; The window address includes a relative address identifying the selected window relative to the base address of the allowed range specified by the constraint metadata of the program counter capability register; and In response to a capability control data access instruction that specifies a target capability register and an offset value within a window, the instruction decoder is configured to control the processing circuitry to perform data access to a target address determined by adding the base address (which is within the allowed range specified by the constraint metadata of the program counter capability register and the offset value within the window) to the pointer stored in the target capability register.

18. A data processing method for an apparatus including processing circuitry and a plurality of capability registers, each capability register storing a capability, the capability including a pointer and constraint metadata for constraining the valid use of the pointer or the capability, the capability register including a program counter capability register, the pointer representing an address in relation to the program counter capability register as: a program counter address indicating the current program flow point; The method includes: The ability to generate address calculation instructions in response to a specified offset value controls the processing circuitry. Select the reference capability register as one of the program counter capability register and another capability register; as well as A result capability is written to the result capability register in the capability register, the pointer of the result capability being directed to the window address of a selected window in the identifier address space, wherein the window comprises a contiguous block of addresses of a predetermined size, the selected window being offset from a reference window by a number of windows determined based on the offset value specified by the capability generation address calculation instruction, and the reference window comprising a window containing the address indicated by the pointer of the reference capability register.

19. A computer program product comprising a computer program, the computer program including instructions that, when executed on a host data processing device, control the host data processing device to perform the method as described in claim 18.

20. A computer-readable storage medium storing a computer program, the computer program including instructions that, when executed on a host data processing device, control the host data processing device to perform the method of claim 18.

Citation Information

Patent Citations

  • Processor with granular add immediates capability & methods

    CN104834503A

  • Microprocessor and method for safely executing instructions

    CN107102843A