# US 2019/0243965 A1 · Compilation-time checks to secure processes from speculative rogue cache loads

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

- Number: US 2019/0243965 A1
- Document ID: US20190243965A1
- Status: Published application
- Kind: A1
- Application number: 16/004,180
- Filed: 2018-06-08
- Published: 2019-08-08
- Earliest claimed: 2018-02-06
- Assignees: VMware, Inc.
- Applicants: VMware, Inc.
- Inventors: Michael Wei; Dan Tsafrir; Nadav Amit
- Web page: https://patentgrep.com/patent/US20190243965A1

## CPC

- G06F 21/54: by adding security routines or objects to programs
- G06F 9/461: {Saving or restoring of program or task context}
- G06F 12/0615: {Address space extension}
- G06F 12/1009: using page tables, e.g. page table structures
- G06F 12/1036: for multiple virtual address spaces, e.g. segmentation (G06F12/1045 takes precedence)
- G06F 12/1441: {for a range}
- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 21/577: {Assessing vulnerabilities and evaluating computer system security}
- G06F 21/74: operating in dual or compartmented mode, i.e. at least one secure mode
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/1052: Security improvement
- G06F 2212/151: Emulated environment, e.g. virtual machine
- G06F 2212/502: using adaptive policy
- G06F 2212/657: Virtual address space management
- G06F 2221/034: Test or assess a computer or a system
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In accordance with embodiments of the present disclosure, a compiler can compile source code to produce binary code that includes address shifting code inserted with memory operations. The address shifting code can shift addresses of memory operations that access locations in the kernel address space into address locations in the user space, thus avoiding speculative access into the kernel address space.

## Claims

### Claim 1

A method for generating computer executable machine instructions, the method comprising:
receiving source code representative of a program expressed in a programming language different from the computer executable machine instructions;
scanning the source code to generate a plurality of tokens;
generating intermediate code from the plurality of tokens; and
generating the computer executable machine instructions from the intermediate code, including:
identifying a plurality of memory operations among the computer executable machine instructions; and
for each memory operation in the plurality of memory operations, inserting address shifting code prior in sequence to that memory operation.

### Claim 2 (depends on 1)

The method of claim 1, further comprising generating a digital signature that is derived from the computer executable machine instructions and combining the digital signature with the computer executable machine instructions to produce an executable application.

### Claim 3 (depends on 2)

The method of claim 2, further comprising executing the executable application, including:
using PTI-disabled process page tables when the digital signature is authentic;
using PTI-enabled process page tables when the digital signature is not authentic; and
when switching from user mode to kernel mode during execution of the executable application, performing a context switch only when the executable application is using PTI-enabled process page tables.

### Claim 4 (depends on 1)

The method of claim 1, further comprising, for each memory operation in the plurality of memory operations, inserting the address shifting code immediately prior in sequence to that memory operation.

### Claim 5 (depends on 1)

The method of claim 1, wherein, for each memory operation in the plurality of memory operations, the address shifting code masks out a range of addresses that belong to a kernel address space in a virtual address space of the computer executable machine instructions to prevent access to a kernel address space in a virtual address space of the computer executable machine instructions by that memory operation.

### Claim 6 (depends on 1)

The method of claim 1, wherein the memory operations are identified in the intermediate code.

### Claim 7 (depends on 1)

The method of claim 1, wherein the memory operations are identified in the computer executable machine instructions.

### Claim 8

A non-transitory computer-readable storage medium having stored thereon computer executable instructions, which when executed by a computer device, cause the computer device to:
receive source code representative of a program expressed in a programming language different from the computer executable machine instructions;
scan the source code to generate a plurality of tokens;
generate intermediate code from the plurality of tokens; and
generate the computer executable machine instructions from the intermediate code, including:
identify a plurality of memory operations among the computer executable machine instructions; and
for each memory operation in the plurality of memory operations, insert address shifting code prior in sequence to that memory operation.

### Claim 9 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the computer executable instructions, which when executed by the computer device, further cause the computer device to generate a digital signature that is derived from the computer executable machine instructions and combine the digital signature with the computer executable machine instructions to produce an executable application.

### Claim 10 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the computer executable instructions, which when executed by the computer device, further cause the computer device to execute the executable application, including:
defining a virtual address space for the executable application using PTI-disabled process page tables that map an entire kernel address space of an operating system when the digital signature is authentic; and
defining a virtual address space for the executable application using PTI-enabled process page tables that map at most only a portion of the kernel address space of the operating system when the digital signature is not authentic,
wherein accessing the kernel address space during execution of the executable application includes performing a context switch when the digital signature is not authentic and does not include performing a context switch when the digital signature is authentic.

### Claim 11 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the computer executable instructions, which when executed by the computer device, further cause the computer device to insert, for each memory operation in the plurality of memory operations, the address shifting code immediately prior in sequence to that memory operation.

### Claim 12 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein, for each memory operation in the plurality of memory operations, the address shifting code masks out a range of addresses that belong to a kernel address space in a virtual address space of the computer executable machine instructions to prevent access to a kernel address space in a virtual address space of the computer executable machine instructions by that memory operation.

### Claim 13 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the memory operations are identified in the intermediate code.

### Claim 14 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein the memory operations are identified in the computer executable machine instructions.

### Claim 15

An apparatus comprising:
one or more computer processors; and
a computer-readable storage medium comprising instructions for controlling the one or more computer processors to be operable to:
receive source code representative of a program expressed in a programming language different from the computer executable machine instructions;
scan the source code to generate a plurality of tokens;
generate intermediate code from the plurality of tokens; and
generate the computer executable machine instructions from the intermediate code, including:
identify a plurality of memory operations among the computer executable machine instructions; and
for each memory operation in the plurality of memory operations, insert address shifting code prior in sequence to that memory operation.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the computer-readable storage medium further comprises instructions for controlling the one or more computer processors to be operable to generate a digital signature that is derived from the computer executable machine instructions and combine the digital signature with the computer executable machine instructions to produce an executable application.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the computer-readable storage medium further comprises instructions for controlling the one or more computer processors to be operable to execute the executable application, including:
defining a virtual address space for the executable application using PTI-disabled process page tables that map an entire kernel address space of an operating system when the digital signature is authentic; and
defining a virtual address space for the executable application using PTI-enabled process page tables that map at most only a portion of the kernel address space of the operating system when the digital signature is not authentic,
wherein accessing the kernel address space during execution of the executable application includes performing a context switch when the digital signature is not authentic and does not include performing a context switch when the digital signature is authentic.

### Claim 18 (depends on 15)

The apparatus of claim 15, wherein the computer-readable storage medium further comprises instructions for controlling the one or more computer processors to be operable to insert, for each memory operation in the plurality of memory operations, the address shifting code immediately prior in sequence to that memory operation.

### Claim 19 (depends on 15)

The apparatus of claim 15, wherein, for each memory operation in the plurality of memory operations, the address shifting code masks out a range of addresses that belong to a kernel address space in a virtual address space of the computer executable machine instructions to prevent access to a kernel address space in a virtual address space of the computer executable machine instructions by that memory operation.

### Claim 20 (depends on 15)

The apparatus of claim 15, wherein the memory operations are identified in the intermediate code or the computer executable machine instructions.
