# US 2017/0255781 A1 · Methods and apparatus for packet-based validation of control-flow transfers for hardware control-flow enforcement

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

- Number: US 2017/0255781 A1
- Document ID: US20170255781A1
- Status: Published application
- Kind: A1
- Application number: 15/060,274
- Filed: 2016-03-03
- Published: 2017-09-07
- Earliest claimed: 2016-03-03
- Assignees: QUALCOMM Incorporated
- Applicants: QUALCOMM Incorporated
- Inventors: Daniel Godas-Lopez
- Web page: https://patentgrep.com/patent/US20170255781A1

## CPC

- G06F 21/577: {Assessing vulnerabilities and evaluating computer system security}
- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 2221/033: Test or assess software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Disclosed are methods and apparatus for packet based validation of control flow transfers for hardware control-flow enforcement. The methods and apparatus achieve control-flow validation through the determination of a first identifier for a source packet that implements a jump, where the determination is based on a computation using contents within the source packet itself. Similarly, a second identifier is determined for a target packet to which the source packet is directed based on a computation using contents of the target packet. The identifiers may be predetermined based on the packet contents, and may also involve insertion of No Operation instructions to ensure the computations based on the packet contents yield the desired identifiers. The identifiers may then be compared to determine whether they match or are compatible, and an invalid control flow can be detected if they are not compatible.

## Claims

### Claim 1

A method for control-flow validation comprising:
determining a first identifier for a source packet based on a computation using contents of the source packet;
determining a second identifier for a target packet to which the source packet is directed based on a computation using contents of the target packet; and
comparing the first identifier and the second identifier and determining an invalid control flow when the first and second identifiers are determined from comparing to not be compatible.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first identifier is predetermined through at least one or more of setting a predetermined value based on the source packet contents and/or adjusting the contents of the source packet such that the first identifier will be determined as the result of the computation based on the source packet contents.

### Claim 3 (depends on 2)

The method of claim 2, wherein the second identifier is predetermined to be compatible with the first identifier through at least adjusting the contents of the target packet such that the second identifier in the target packet will be determined as a result of the computation based on the target packet contents.

### Claim 4 (depends on 1)

The method of claim 1, wherein at least one of the first and second identifiers are configured as a predefined instruction insertable in a packet and configured to not affect operation of a processing unit executing the packet.

### Claim 5 (depends on 4)

The method of claim 4, wherein the predefined instruction is placed as a first instruction in a target packet.

### Claim 6 (depends on 4)

The method of claim 4, wherein the predefined instruction is a No Operation (NOP) instruction having a predefined number of bits according to an Instruction Set Architecture.

### Claim 7 (depends on 6)

The method of claim 6, wherein the predefined number of bits correspond to one or more free bits within the NOP instruction.

### Claim 8 (depends on 6)

The method of claim 6, where the comparison to determine compatibility of the first and second identifiers includes determining at least one of (1) if the first instruction in target packet is a NOP instruction and (2) if the first and second identifiers in the NOP instructions are compatible.

### Claim 9 (depends on 1)

The method of claim 1, wherein compatibility may be determined through a predetermined verification function configured to determine the compatibility of the first and second identifiers.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
determining whether the source packet is one of a control-flow transfer packet or an indirect control flowtransfer packet; and
determining the first identifier when the source packet is either a control-flow transfer packet or an indirect control flowtransfer packet.

### Claim 11 (depends on 1)

The method of claim 1, further comprising:
determining when a plurality of source packets call a given target packet,
reading a new packet that has been inserted before the target packet that only contains a No Operation (NOP) instruction and force at least one of the plurality of source packets to use the new packet as its target.

### Claim 12

An apparatus for control-flow validation comprising:
means for determining a first identifier for a source packet based on a computation using contents of the source packet;
means for determining a second identifier for a target packet to which the source packet is directed based on a computation using contents of the target packet; and
means for comparing the first identifier and the second identifier and determining an invalid control flow when the first and second identifiers are determined by comparing to not be compatible.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the first identifier is predetermined through at least one or more of setting a predetermined value based on the source packet contents and/or adjusting the contents of the source packet such that the first identifier will be determined as the result of the computation based on the source packet contents.

### Claim 14 (depends on 12)

The apparatus of claim 12, wherein the second identifier is predetermined to be compatible with the first identifier through at least adjusting the contents of the target packet such that the second identifier in the target packet will be determined as a result of the computation based on the target packet contents.

### Claim 15 (depends on 12)

The apparatus of claim 12, wherein at least one of the first and second identifiers are configured as a predefined instruction insertable in a packet and configured to not affect operation of a processing unit executing the packet.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the predefined instruction is placed as a first instruction in a target packet.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the predefined instruction is a No Operation (NOP) instruction having a predetermined number of bits according to an Instruction Set Architecture.

### Claim 18 (depends on 17)

The apparatus of claim 17, wherein the predefined number of bits corresponds to one or more free bits within the NOP instruction.

### Claim 19 (depends on 17)

The apparatus of claim 17, where the means for comparing to determine compatibility of the first and second identifiers includes:
means for determining at least one of (1) if the first instruction in target packet is a NOP instruction and (2) if the first and second identifiers in the NOP instructions are compatible.

### Claim 20 (depends on 12)

The apparatus of claim 12, wherein means for comparing to determined compatibility further comprises a predetermined verification function configured to determine the compatibility of the first and second identifiers.

### Claim 21 (depends on 12)

The apparatus of claim 12, further comprising:
means for determining whether the source packet is one of a control-flow transfer packet or an indirect control flowtransfer packet; and
means for determining the first identifier when the source packet is either a control-flow transfer packet or an indirect control flowtransfer packet.

### Claim 22 (depends on 12)

The apparatus of claim 12, further comprising:
means for determining when a plurality of source packets call a given target packet;
means for reading a new packet that has been inserted before the target packet that only contains a No Operation (NOP) instruction and force at least one of the plurality of source packets to use the new packet as its target.

### Claim 23

An apparatus for control-flow validation comprising:
processing circuitry configured for:
determining a first identifier for a source packet based on a computation using contents of the source packet;
determining a second identifier for a target packet to which the source packet is directed based on a computation using contents of the target packet; and
comparing the first identifier and the second identifier and determining an invalid control flow when the first and second identifiers are determined from comparing to not be compatible.

### Claim 24 (depends on 23)

The apparatus of claim 23, wherein the first identifier is predetermined through at least one or more of setting a predetermined value based on the source packet contents and/or adjusting the contents of the source packet such that the first identifier will be determined as the result of the computation based on the source packet contents.

### Claim 25 (depends on 23)

The apparatus of claim 23, wherein the second identifier is predetermined to be compatible with the first identifier through at least adjusting the contents of the target packet such that the second identifier in the target packet will be determined as a result of the computation based on the target packet contents.

### Claim 26 (depends on 23)

The apparatus of claim 23, wherein the first and second identifiers are configured as a predefined No Operation (NOP) instruction that is configured to not affect operation of the processing circuitry when placed within a packet.

### Claim 27 (depends on 26)

The apparatus of claim 26, wherein the predefined NOP instruction is placed as a first instruction in a target packet.

### Claim 28 (depends on 26)

The apparatus of claim 26, where the processing circuitry is further configured to perform comparison to determine compatibility of the first and second identifiers through determining at least one of (1) if the first instruction in target packet is a NOP instruction and (2) if the first and second identifiers in the NOP instructions are compatible.

### Claim 29 (depends on 23)

The apparatus of claim 23, wherein compatibility may be determined through an exact match of the first and second identifiers or through a determination that one identifier is a multiple of the other identifier.

### Claim 30 (depends on 23)

The apparatus of claim 23, the processing circuitry further configured for:
determining when a plurality of source packets call a given target packet;
reading a new packet that has been inserted before the target packet that only contains a No Operation (NOP) instruction and force at least one of the plurality of source packets to use the new packet as its target.

### Claim 31

A processor-readable storage medium having one or more instructions which, when executed by at least one processing circuit, cause the at least one processing circuit to:
determine a first identifier for a source packet based on a computation using contents of the source packet;
determine a second identifier for a target packet to which the source packet is directed based on a computation using contents of the target packet; and
compare the first identifier and the second identifier and determining an invalid control flow when the first and second identifiers are determined from comparing to not be compatible.

### Claim 32 (depends on 31)

The processor-readable storage medium of claim 31, wherein the first identifier is predetermined through at least one or more of setting a predetermined value based on the source packet contents and/or adjusting the contents of the source packet such that the first identifier will be determined as the result of the computation based on the source packet contents.

### Claim 33 (depends on 31)

The processor-readable storage medium of claim 31, wherein the second identifier is predetermined to be compatible with the first identifier through at least adjusting the contents of the target packet such that the second identifier in the target packet will be determined as a result of the computation based on the target packet contents.

### Claim 34 (depends on 31)

The processor-readable storage medium of claim 31, wherein at least one of the first and second identifiers are configured as a predefined instruction insertable in a packet and configured to not affect operation of a processing unit executing the packet.

### Claim 35 (depends on 34)

The processor-readable storage medium of claim 34, wherein the predefined instruction is placed as a first instruction in a target packet.

### Claim 36 (depends on 34)

The processor-readable storage medium of claim 34, wherein the predefined instruction is a No Operation (NOP) instruction having a predetermined number of bits according to an Instruction Set Architecture.

### Claim 37 (depends on 36)

The processor-readable storage medium of claim 36, wherein the predefined number of bits correspond to one or more free bits within the NOP instruction.

### Claim 38

The processor-readable storage medium of 36, where the comparison to determine compatibility of the first and second identifiers includes determining at least one of (1) if the first instruction in target packet is a NOP instruction and (2) if the first and second identifiers in the NOP instructions are compatible.

### Claim 39 (depends on 31)

The processor-readable storage medium of claim 31, wherein compatibility may be determined through a predetermined verification function configured to determine the compatibility of the first and second identifiers.

### Claim 40 (depends on 31)

The processor-readable storage medium of claim 31, the one or more instructions further causing the at least one processing circuit to:
determine whether the source packet is one of a control-flow transfer packet or an indirect control flowtransfer packet; and
determine the first identifier when the source packet is either a control-flow transfer packet or an indirect control flowtransfer packet.

### Claim 41 (depends on 31)

The processor-readable storage medium of claim 31, the one or more instructions further causing the at least one processing circuit to:
determine when a plurality of source packets call a given target packet;
insert a new packet before the target that only contains a No Operation (NOP) instruction and force at least one of the plurality of source packets to use the new packet as its target.
