# US 2022/0292182 A1 · Method for the execution of a binary code of a computer program by a microprocessor

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

- Number: US 2022/0292182 A1
- Document ID: US20220292182A1
- Status: Published application
- Kind: A1
- Application number: 17/650,885
- Filed: 2022-02-14
- Published: 2022-09-15
- Earliest claimed: 2021-03-09
- Assignees: Commissariat A L'energie Atomique Et Aux Energies Alternatives
- Applicants: Commissariat à l'Energie Atomique et aux Energies Alternatives
- Inventors: Olivier SAVRY; Thomas HISCOCK
- Web page: https://patentgrep.com/patent/US20220292182A1

## CPC

- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 21/54: by adding security routines or objects to programs
- G06F 8/434: {Pointers; Aliasing}
- G06F 8/53: Decompilation; Disassembly
- G06F 2221/033: Test or assess software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for the execution of a binary code defining a data structure including a particular field to be read using a pointer, this method including writing, to the main memory, the value of the particular field associated with a first identifier of a pointer that points directly to this particular field, this identifier being determined from an identifier of the particular field that differs for all of the fields of the data structure that are adjacent to the particular field, and then constructing a pointer that points directly to this particular field, this construction including determining an identifier of this constructed pointer, and then checking that the identifier constructed in step b) corresponds to the identifier associated with this particular field in step a), and when these pointer identifiers do not match, triggering the signaling of an execution fault.

## Claims

### Claim 1

A method for the execution of a binary code of a computer program by a microprocessor, said binary code defining a data structure comprising multiple fields able to be accessed independently of one another including at least one particular field to be read using a pointer, said method comprising the following steps:
a) writing, to the main memory, the value of the particular field associated with a first field pointer identifier, said first field pointer identifier identifying the field pointer to be used to read the value of said particular field, and then
b) reading the value of said particular field of the data structure from the main memory, said reading step comprising the following operations:
b1) obtaining a data structure pointer that points to the start of the data structure, said data structure pointer containing:
a first range of bits containing the starting address of the data structure in the address space of the computer program, and
a second, different range of bits containing a data structure pointer identifier, said data structure pointer identifier making it possible to uniquely identify said data structure pointer among a set containing multiple different data structure pointers implemented in the same execution of the binary code by said microprocessor, and then
b2) constructing a field pointer that points directly to the particular field of the data structure to be read, said field pointer containing:
a first range of bits containing the starting address of the particular field in the address space of the computer program, and
a second range of bits containing a second field pointer identifier,
said construction operation comprising the following sub-operations:
b2.1) determining the starting address of the particular field from the address contained in the first range of bits of the data structure pointer and the position of the particular field with respect to the start of the data structure, and
b2.2) determining the second field pointer identifier from the data structure pointer identifier contained in the second range of bits of the data structure pointer obtained in operation b1), and then
b3) loading, from the main memory, the value of the particular field using the address contained in the first range of bits of the field pointer constructed in operation b2), and then
b4) checking that the second field identifier contained in the second range of bits of the field pointer constructed in operation b2) corresponds to the first field pointer identifier associated with said same particular field when said value is written to the main memory, and when the first and second field pointer identifiers do not match, triggering the signalling of an execution fault and, in the opposite case, suppressing the triggering of the signalling of an execution fault and processing, with the microprocessor, the loaded value of the particular field,
wherein:
in step a), the first field pointer identifier associated with the particular field is determined from the data structure pointer identifier and from an identifier of the particular field that differs for all of the fields of the data structure that are adjacent to the particular field to be read, and
in operation b2), the second field pointer identifier is additionally determined from the same identifier of the particular field in order to obtain a second field pointer identifier that systematically corresponds to the first field pointer identifier when the identifier of the data structure pointer is identical to the one used to determine the first field pointer identifier.

### Claim 2 (depends on 1)

The method according to claim 1, wherein:
the structures of the data structure pointer and of the field pointers are identical, and
the locations of the first and second ranges of bits in the data structure pointer and in the field pointers are identical.

### Claim 3 (depends on 2)

The method according to claim 2, wherein:
the data structure said to be of higher rank is embedded within a data structure said to be of lower rank, said data structure of higher rank corresponding to a first particular field of the data structure of lower rank and the data structure of higher rank comprising a second particular field to be read using a pointer,
operations b1) and b2) are executed a first time for the data structure of lower rank and for said first particular field in order to obtain a first field pointer that points directly to the start of the first field, and then operations b1) and b2) are executed a second time for the data structure of higher rank and for the second particular field in order to obtain a second field pointer that points directly to the start of the second field,
in the first execution of operation b1), it is the data structure pointer that points to the start of the data structure of lower rank that is obtained,
in the first execution of operation b2), it is a first identifier of the first field that is used to construct the first field pointer,
in the second execution of operation b1) for the data structure of lower rank, the data structure pointer that is obtained is the same as the first field pointer constructed in the first execution of operation b2),
in the second execution of operation b2), it is a second identifier of the second field that is used to construct the second field pointer, and then
operations b3) and b4) are executed using the address and the identifier contained, respectively, in the first and second ranges of bits of the second field pointer constructed in the second execution of operation b2).

### Claim 4 (depends on 1)

The method according to claim 1, wherein sub-operation b2.2) comprises determining the second field identifier from the position of the particular field with respect to the start of the data structure.

### Claim 5 (depends on 4)

The method according to claim 4, wherein, when the particular field is the first field of the data structure, the second identifier of said particular field is systematically zero, such that the field pointer identifier constructed for said particular field is the same as the data structure pointer identifier contained in the second range of bits of the data structure pointer.

### Claim 6 (depends on 1)

The method according to claim 1, wherein step a) comprises the following operations:
a1) obtaining the data structure pointer that points to the start of the data structure, and then
a2) determining the first field pointer identifier from:
the identifier of the data structure pointer contained in the second range of bits of the data structure pointer obtained in operation a1), and
the identifier of the particular field, and then
a3) storing, in the main memory, the value of the particular field associated with the first field pointer identifier determined in operation a2).

### Claim 7 (depends on 6)

The method according to claim 6, wherein operation a1) comprises:
the microprocessor executing an instruction to dynamically allocate a memory area in order to store the data structure therein, said allocation instruction being contained in the binary code of the computer program, and then
in response:
reserving, in the address space of the computer program, a memory area of a size equal to the size of the data structure, to and from which the microprocessor is able to write and read the values of the fields of said data structure, and
generating the data structure pointer that contains, in its first range of bits,
the starting address of the reserved memory area and, in its second range of bits, the data structure pointer identifier.

### Claim 8 (depends on 6)

The method according to claim 6, wherein:
step a) comprises:
constructing one or more cryptograms from the value of the particular field to be written,
computing one or more first tags for checking the integrity of each of the constructed cryptograms, said first tag being computed from the constructed cryptogram and using the first field pointer identifier in order to form the association between said particular field and said first field pointer identifier, and
storing, in the main memory, the one or more constructed cryptograms and the one or more computed tags at locations associated with one another,
operation b3) comprises, for each cryptogram stored in step a), loading said cryptogram and the first integrity tag associated with said cryptogram from the main memory using the address contained in the first range of bits of the field pointer constructed in operation b2),
operation b4) comprises checking the integrity of each loaded cryptogram, said check comprising:
constructing a second integrity tag from the loaded cryptogram and the field pointer identifier contained in the second range of bits of the field pointer constructed in operation b2), and then
comparing said second integrity tag with the loaded first integrity tag, and then
when the second integrity tag does not correspond to the first integrity tag, that is to say that the check on the integrity of the loaded cryptogram fails, the microprocessor systematically triggers the signalling of an execution fault, and when the second integrity tag corresponds to the first integrity tag, that is to say that the loaded cryptogram exhibits integrity, the loaded cryptogram is decrypted in order to obtain the cleartext value of the field and the triggering of an execution fault is suppressed.

### Claim 9 (depends on 6)

The method according to claim 6, wherein:
step a) comprises storing, in the main memory, one or more blocks of encrypted and authenticated data containing the value of the particular field, each block of encrypted and authenticated data containing:
a cryptogram of all of the data of said block, said cryptogram having to be decrypted in its entirety to obtain a block of cleartext data,
an authentication code computed from the cryptogram of the block of cleartext data, and
metadata, these metadata comprising the first field pointer identifier associated with the particular field,
operation b3) comprises loading, from the main memory, each block of encrypted and authenticated data containing the value of the particular field using the address contained in the first range of bits of the field pointer constructed in operation b2),
operation b4) comprises, for each block loaded in operation b3), checking that the second field pointer identifier contained in the second range of bits of the field pointer constructed in operation b2) corresponds to the first field pointer identifier associated with the value of the particular field and contained in the metadata of the loaded block, and when the first and second field pointer identifiers do not match, triggering the signalling of an execution fault and, in the opposite case, suppressing the triggering of the signalling of an execution fault and processing, with the microprocessor, the loaded value of the particular field.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the sizes of the data structure pointer and of each field pointer, in number of bits, are equal to the maximum number of bits able to be contained by an address transferred from the microprocessor to the main memory with an address bus.

### Claim 11 (depends on 1)

A binary code of a computer program able to be executed by a microprocessor, wherein said binary code comprises instructions for executing the steps of an execution method according to claim 1, when these instructions are executed by a microprocessor.

### Claim 12 (depends on 11)

An information recording medium able to be read by a microprocessor, wherein said information recording medium contains a binary code according to claim 11.

### Claim 13 (depends on 1)

A microprocessor for implementing a method according to claim 1, said microprocessor being able to execute a binary code of a computer program, said binary code defining a data structure comprising multiple fields able to be accessed independently of one another including at least one particular field to be read using a pointer, said microprocessor being configured so as to execute the following steps:
a) writing, to the main memory, the value of the particular field associated with a first field pointer identifier, said first field pointer identifier identifying the field pointer to be used to read the value of said particular field, and then
b) reading the value of said particular field of the data structure from the main memory, said reading step comprising the following operations:
b1) obtaining a data structure pointer that points to the start of the data structure, said data structure pointer containing:
a first range of bits containing the starting address of the data structure in the address space of the computer program, and
a second, different range of bits containing a data structure pointer identifier, said data structure pointer identifier making it possible to uniquely identify said data structure pointer among a set containing multiple different data structure pointers implemented in the same execution of the binary code by said microprocessor, and then
b2) constructing a field pointer that points directly to the particular field of the data structure to be read, said field pointer containing:
a first range of bits containing the starting address of the particular field in the address space of the computer program, and
a second range of bits containing a second field pointer identifier,
said construction operation comprising the following sub-operations:
b2.1) determining the starting address of the particular field from the address contained in the first range of bits of the data structure pointer and the position of the particular field with respect to the start of the data structure, and
b2.2) determining the second field pointer identifier from the data structure pointer identifier contained in the second range of bits of the data structure pointer obtained in operation b1), and then
b3) loading, from the main memory, the value of the particular field using the address contained in the first range of bits of the field pointer constructed in operation b2), and then
b4) checking that the second field identifier contained in the second range of bits of the field pointer constructed in operation b2) corresponds to the first field pointer identifier associated with said same particular field when its value is written to the main memory,
and when the first and second field pointer identifiers do not match, triggering the signalling of an execution fault and, in the opposite case, suppressing the triggering of the signalling of an execution fault and processing, with the microprocessor, the loaded value of the particular field,
wherein said microprocessor is also configured such that:
in step a), the first field pointer identifier associated with the particular field is determined from the data structure pointer identifier and from an identifier of the particular field that differs for all of the fields of the data structure that are adjacent to the particular field to be read, and
in operation b2), the second field pointer identifier is additionally determined from the same identifier of the particular field in order to obtain a second field pointer identifier that systematically corresponds to the first field pointer identifier when the identifier of the data structure pointer is identical to the one used to determine the first field pointer identifier.

### Claim 14 (depends on 13)

The microprocessor according to claim 13, wherein the set of instructions of the microprocessor contains an instruction that, when it is executed by an arithmetic logic unit of the microprocessor, stores, in the second range of bits of a pointer, the result of an “exclusive or” between the bits of said second range of bits and a pointer identifier passed as operand of said instruction.

### Claim 15 (depends on 11)

A compiler able to automatically transform a source code of a computer program into a binary code of said computer program, said source code defining a data structure comprising multiple fields able to be accessed independently of one another including at least one particular field to be read using a pointer, wherein the compiler is able to automatically transform the source code into a binary code according to claim 11.
