# US 2022/0012055 A1 · Apparatus, computer-readable medium, and method for reducing bounds checking overhead by instrumenting pointer arithmetic

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0012055 A1
- Document ID: US20220012055A1
- Status: Published application
- Kind: A1
- Application number: 17/485,347
- Filed: 2021-09-25
- Published: 2022-01-13
- Earliest claimed: 2021-09-25
- Assignees: Intel Corporation
- Inventors: Michael Lemay; David M. Durham
- Web page: https://patentgrep.com/patent/US20220012055A1

## CPC

- G06F 9/3004: {to perform operations on memory}
- G06F 9/30145: {Instruction analysis, e.g. decoding, instruction word fields}
- G06F 9/35: Indirect addressing
- G06F 12/023: {Free address space management}
- G06F 12/14: Protection against unauthorised use of memory {or access to memory}
- G06F 12/1425: {the protection being physical, e.g. cell, word, block}
- G06F 12/1441: {for a range}
- G06F 21/554: {involving event detection and direct action}
- G06F 12/04: Addressing variable-length words or parts of words
- G06F 2212/1024: Latency reduction
- G06F 2212/1052: Security improvement
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, apparatus, systems, and articles of manufacture are disclosed that perform bounds checking on authorized memory allocations during pointer arithmetic. In some examples, instruction decode circuitry decodes an update pointer instruction for a pointer. In some examples, bounds checking circuitry determines an authorized allocation for the pointer, determines one or more exclusion zones and poison zones for the pointer. In some examples, bounds checking circuitry updates the pointer and generates a fault if the pointer points to one of the exclusion zones and poisons the pointer if the pointer points to one of the poison zones.

## Claims

### Claim 1

An apparatus comprising:
processor circuitry including one or more of:
at least one of a central processing unit, a graphic processing unit or a digital signal processor, the at least one of the central processing unit, the graphic processing unit or the digital signal processor having control circuitry to control data movement within the processor circuitry, arithmetic and logic circuitry to perform one or more first operations corresponding to instructions, and one or more registers to store a result of the one or more first operations, the instructions in the apparatus;
a Field Programmable Gate Array (FPGA), the FPGA including logic gate circuitry, a plurality of configurable interconnections, and storage circuitry, the logic gate circuitry and interconnections to perform one or more second operations, the storage circuitry to store a result of the one or more second operations; or
an Application Specific Integrate Circuitry (ASIC) including logic gate circuitry to perform one or more third operations;
the processor circuitry to perform at least one of the one or more first operations, the one or more second operations or the one or more third operations to, in response to detecting an update pointer instruction, instantiate:
instruction decode circuitry to decode the update pointer instruction, the update pointer instruction to include at least a pointer operand to specify a pointer pointing to a first memory location in a memory, an update distance operand to specify an update distance to indicate how far to move the pointer from the first memory location, and an element size operand to specify an element size of an element of data to be stored in the memory; and
bounds checking circuitry to:
determine an authorized allocation of the memory for the pointer;
modify the pointer to point to a second memory location in the memory;
determine at least one poison zone associated with the authorized allocation; and
set a poison flag for the pointer in response to the second memory location being located in one of the at least one poison zone.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein to determine the at least one poison zone associated with the authorized allocation includes the bounds checking circuitry to determine a first set of poison memory locations associated with the authorized allocation, wherein at least a portion of an element of data of the element size stored at any one of the first set of poison memory locations is external to the authorized allocation.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein to determine the at least one poison zone associated with the authorized allocation further includes the bounds checking circuitry to determine a second set of poison memory locations associated with the authorized allocation wherein at least a portion of the element of data of the element size stored external to the authorized allocation is stored within at least one software compatibility zone.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein the bounds checking circuitry is to:
determine at least one exclusion zone associated with the authorized allocation; and
determine a set of exclusion zone memory locations associated with the authorized allocation, at least a portion of an element of data stored at any one of the exclusion zone memory locations is external to the authorized allocation and not in the first or second sets of poison memory locations.

### Claim 5 (depends on 4)

The apparatus of claim 4, wherein the bounds checking circuitry is to clear the poison flag in response to the second memory location not being located in either the at least one poison zone or in the at least one exclusion zone.

### Claim at position 6

6-9. (canceled)

### Claim 10 (depends on 1)

The apparatus of claim 1, wherein the bounds checking circuitry is to, when modifying the pointer, add the update distance to the pointer.

### Claim 11

A non-transitory computer-readable storage medium comprising instructions that, when executed, cause one or more processors of a machine to at least:
decode an update pointer instruction, the update pointer instruction to include at least a pointer operand to specify a pointer pointing to a first memory location in a memory, a update distance operand to specify an update distance to indicate how far to move the pointer from the first memory location, and an element size operand to specify an element size of an element of data to be stored in the memory;
determine an authorized allocation of the memory for the pointer;
modify the pointer to point to a second memory location in the memory;
determine one or more poison zones associated with the authorized allocation; and
set a poison flag for the pointer in response to the second memory location being located in one of the one or more poison zones.

### Claim 12 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein the instructions, when executed, cause the one or more processors of the machine to at least determine a first set of poison memory locations associated with the authorized allocation wherein at least a portion of an element of data of the element size stored at any one of the first set of poison memory locations is external to the authorized allocation.

### Claim 13 (depends on 12)

The non-transitory computer-readable storage medium of claim 12, wherein the instructions, when executed, cause the one or more processors of the machine to at least determine a second set of poison memory locations associated with the authorized allocation wherein all portions of the element of data of the element size stored external to the authorized allocation are stored in at least one software compatibility zone.

### Claim 14 (depends on 13)

The non-transitory computer-readable storage medium of claim 13, wherein the instructions, when executed, cause the one or more processors of the machine to at least determine a set of exclusion zone memory locations associated with the authorized allocation, at least a portion of a given element of data stored at any one of the exclusion zone memory locations is external to the authorized allocation and not in the first or second sets of poison memory locations.

### Claim 15 (depends on 14)

The non-transitory computer-readable storage medium of claim 14, wherein the instructions, when executed, cause the one or more processors of the machine to at least clear the poison flag in response to the second memory location not being located in either the one or more poison zones or in the one or more exclusion zones.

### Claim 16 (depends on 14)

The non-transitory computer-readable storage medium of claim 14, wherein the instructions, when executed, cause the one or more processors of the machine to at least generate a fault in response to at least one of the second memory location being dereferenced when the poison flag is set or the second memory location being located in at least one exclusion zone.

### Claim 17 (depends on 14)

The non-transitory computer-readable storage medium of claim 14, wherein the instructions, when executed, cause the one or more processors of the machine to at least update the element size in response to an alternate element size being specified.

### Claim 18 (depends on 13)

The non-transitory computer-readable storage medium of claim 13, wherein the instructions, when executed, cause the one or more processors of the machine to at least:
determine a compatibility distance of the second memory location beyond an end of the authorized allocation in response to the second memory location being in the second set of poison memory locations; and
save the compatibility distance with the pointer.

### Claim 19 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein the instructions, when executed, cause the one or more processors of the machine to at least add an amount of metadata size to the element size in the determination of the one or more poison zones and the one or more exclusion zones, wherein the metadata size is a size of an amount of metadata included with a given data element.

### Claim 20 (depends on 11)

The non-transitory computer-readable storage medium of claim 11, wherein the instructions, when executed, cause the one or more processors of the machine to at least modify the pointer by adding the update distance to the pointer.

### Claim 21

An apparatus comprising
instruction decode circuitry to:
detect an update pointer instruction; and
decode the update pointer instruction to extract a first memory location and a second memory location; and
bounds checking circuitry to:
determine an authorized allocation of a memory for a pointer, the pointer to point to the first memory location in the memory;
modify the pointer to point to the second memory location in the memory;
determine one or more poison zones associated with the authorized allocation;
set a poison flag for the pointer in response to the second memory location being located in one of the one or more poison zones.

### Claim 22 (depends on 21)

The apparatus of claim 21, wherein to determine one or more poison zones associated with the authorized allocation includes the bounds checking circuitry to:
determine a first set of poison memory locations associated with the authorized allocation wherein at least a portion of an element of data of an element size stored at any one of the first set of poison memory locations is external to the authorized allocation; and
determine a second set of poison memory locations associated with the authorized allocation wherein at least a portion of the element of data of the element size stored external to the authorized allocation is stored in at least one software compatibility zone.

### Claim 23 (depends on 22)

The apparatus of claim 22, wherein to determine one or more exclusion zones associated with the authorized allocation further includes the bounds checking circuitry to determine a set of exclusion zone memory locations associated with the authorized allocation, at least a portion of a given element of data stored at any one of the exclusion zone memory locations is external to the authorized allocation and not in the first or second sets of poison memory locations.

### Claim 24 (depends on 23)

The apparatus of claim 23, wherein the bounds checking circuitry is to clear the poison flag in response to the second memory location not being located in either the one or more poison zones or in the one or more exclusion zones.

### Claim at position 22

24-30. (canceled)
