Apparatus, computer-readable medium, and method for reducing bounds checking overhead by instrumenting pointer arithmetic
AssigneeIntel Corporation
InventorsMichael Lemay, David M. Durham
Life of this patent
Estimating the term…
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.
Claims20
An apparatus comprising:
- interface circuitry;
- machine-readable instructions;
- and
- programmable circuitry to be programmed by the machine-readable instructions to:
- 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, 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;
- 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 by adding a metadata size to the element size, the metadata size corresponding to an amount of metadata included with a given data element;
- 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.
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, 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;
- 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 by adding a metadata size to the element size, the metadata size corresponding to an amount of metadata included with a given data element;
- 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.
An apparatus comprising
- instruction decode circuitry to:
- 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 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 one or more poison zones associated with the authorized allocation by adding a metadata size to the element size, the metadata size corresponding to an amount of metadata included with a given data element;
- 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.
Dependencies are inferred from the claim text.