# US 12,008,374 B2 · Cryptographic enforcement of borrow checking

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

- Number: US 12,008,374 B2
- Document ID: US12008374B2
- Status: Granted
- Kind: B2
- Application number: 17/696,153
- Filed: 2022-03-16
- Published: 2022-06-30
- Granted: 2024-06-11
- Earliest claimed: 2022-03-16
- Assignees: Intel Corporation
- Applicants: Intel Corporation
- Inventors: Michael LeMay; Peiming Liu; David M. Durham; Scott Constable; Kshitij Arun Doshi
- Web page: https://patentgrep.com/patent/US12008374B2

## CPC

- G06F 9/30178: {of compressed or encrypted instructions}
- G06F 21/54: by adding security routines or objects to programs
- G06F 8/437: {Type checking}
- G06F 9/3004: {to perform operations on memory}
- G06F 9/5016: {the resource being the memory}
- G06F 11/3612: {by runtime analysis (performance monitoring G06F11/3466)}
- G06F 21/602: {Providing cryptographic facilities or services}
- G06F 21/79: in semiconductor storage media, e.g. directly-addressable memories
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The technology includes allocating an object in a memory and setting an ownership identifier (ID) in the allocated object, the allocated object being associated with a first variable in a program and setting a matching ownership ID in a pointer to the allocated object. When the allocated object is accessed during execution of the program by a processor, an exception is generated when the ownership ID in the allocated object does not match the ownership ID in the pointer, and execution of the program is continued when the ownership ID in the allocated object does match the ownership ID in the pointer.

## Claims

### Claim 1

An apparatus comprising:
a memory to store an object; and
a processor to
allocate the object in the memory and set an ownership identifier (ID) in the allocated object, the allocated object being associated with a first variable in a program;
set a matching ownership ID in a pointer to the allocated object;
when the allocated object is accessed during execution of the program, generate an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continue execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer;
when the allocated object is associated with a second variable in the program, update the ownership ID in the allocated object and set a matching updated ownership ID in the pointer to the allocated object; and
when the allocated object is accessed during execution of the program, generate an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continue execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer.

### Claim 2 (depends on 1)

The apparatus of claim 1, comprising the processor to update the ownership ID in the allocated object by executing a transfer ownership instruction.

### Claim 3 (depends on 1)

The apparatus of claim 1, comprising the processor to set the matching updated ownership ID in the pointer to the allocated object by executing a transfer ownership instruction.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein the processor implements the transfer ownership instruction by randomizing the ownership ID for the allocated object and generating a new pointer with the updated ownership ID after checking that a pointer as an operand to the transfer ownership instruction has an ownership ID matching the allocated object.

### Claim 5 (depends on 1)

The apparatus of claim 1, comprising the processor to set the matching ownership ID in the pointer to the allocated object by executing an encrypt pointer instruction.

### Claim 6 (depends on 1)

The apparatus of claim 1, wherein the matching ownership ID is stored in a tag field in the pointer.

### Claim 7 (depends on 1)

The apparatus of claim 1, wherein the allocated object is immutable.

### Claim 8 (depends on 7)

The apparatus of claim 7, comprising the processor to set the allocated object as immutable by executing a mark immutable instruction.

### Claim 9 (depends on 8)

The apparatus of claim 8, comprising the processor to set an immutable flag in metadata of the allocated object during executing the mark immutable instruction.

### Claim 10 (depends on 7)

The apparatus of claim 7, comprising the processor to determine if the allocated object is immutable by executing an assert immutable instruction.

### Claim 11 (depends on 1)

The apparatus of claim 1, wherein the allocated object is allocated in the memory to a best-fitting, power-of-two-aligned slot.

### Claim 12 (depends on 1)

The apparatus of claim 1, wherein the ownership ID of the allocated object is stored in metadata inline with the allocated object.

### Claim 13 (depends on 1)

The apparatus of claim 1, comprising the processor to locate the ownership ID in constant time.

### Claim 14

A method comprising:
allocating an object in a memory and setting an ownership identifier (ID) in the allocated object, the allocated object being associated with a first variable in a program;
setting a matching ownership ID in a pointer to the allocated object;
when the allocated object is accessed during execution of the program by a processor, generating an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continuing execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer;
when the allocated object is associated with a second variable in the program, updating the ownership ID in the allocated object and setting a matching updated ownership ID in the pointer to the allocated object; and
when the allocated object is accessed during execution of the program, generating an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continuing execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer.

### Claim 15 (depends on 14)

The method of claim 14, comprising updating the ownership ID in the allocated object is performed by executing a transfer ownership instruction by the processor.

### Claim 16 (depends on 14)

The method of claim 14, comprising setting the matching updated ownership ID in the pointer to the allocated object by executing a transfer ownership instruction by the processor.

### Claim 17 (depends on 16)

The method of claim 16, wherein the transfer ownership instruction is implemented by randomizing the ownership ID for the allocated object and generating a new pointer with the updated ownership ID after checking that a pointer as an operand to the transfer ownership instruction has an ownership ID matching the allocated object.

### Claim 18 (depends on 14)

The method of claim 14, comprising setting the matching ownership ID in the pointer to the allocated object by executing an encrypt pointer instruction by the processor.

### Claim 19 (depends on 14)

The method of claim 14, wherein the matching ownership ID is stored in a tag field in the pointer.

### Claim 20 (depends on 14)

The method of claim 14, wherein the allocated object is immutable.

### Claim 21 (depends on 20)

The method of claim 20, comprising setting the allocated object as immutable by executing a mark immutable instruction by the processor.

### Claim 22 (depends on 21)

The method of claim 21, comprising setting an immutable flag in metadata of the allocated object during executing the mark immutable instruction.

### Claim 23

At least one non-transitory machine-readable storage medium comprising instructions that, when executed, cause a processor to at least:
allocate an object in a memory and set an ownership identifier (ID) in the allocated object, the allocated object being associated with a first variable in a program;
set a matching ownership ID in a pointer to the allocated object;
when the allocated object is accessed during execution of the program, generate an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continue execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer;
when the allocated object is associated with a second variable in the program, update the ownership ID in the allocated object and set a matching updated ownership ID in the pointer to the allocated object; and
when the allocated object is accessed during execution of the program, generate an exception when the ownership ID in the allocated object does not match the ownership ID in the pointer, and continue execution of the program when the ownership ID in the allocated object does match the ownership ID in the pointer.

### Claim 24 (depends on 23)

The at least one non-transitory machine-readable storage medium of claim 23, comprising instructions for the processor to update the ownership ID in the allocated object by executing a transfer ownership instruction.

### Claim 25 (depends on 23)

The at least one non-transitory machine-readable storage medium of claim 23, comprising instructions for the processor to set the matching updated ownership ID in the pointer to the allocated object by executing a transfer ownership instruction.

### Claim 26 (depends on 25)

The at least one non-transitory machine-readable storage medium of claim 25, comprising instructions to implement the transfer ownership instruction by randomizing the ownership ID for the allocated object and generating a new pointer with the updated ownership ID after checking that a pointer as an operand to the transfer ownership instruction has an ownership ID matching the allocated object.

### Claim 27 (depends on 23)

The at least one non-transitory machine-readable storage medium of claim 23, comprising instructions for the processor to set the matching ownership ID in the pointer to the allocated object by executing an encrypt pointer instruction.
