# US 2009/0222792 A1 · Automatic modification of executable code

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

- Number: US 2009/0222792 A1
- Document ID: US20090222792A1
- Status: Published application
- Kind: A1
- Application number: 12/039,486
- Filed: 2008-02-28
- Published: 2009-09-03
- Earliest claimed: 2008-02-28
- Assignees: Intel Corporation
- Inventors: Vedvyas Shanbhogue; Ravi L. Sahita; Uday R. Savagaonkar
- Web page: https://patentgrep.com/patent/US20090222792A1

## CPC

- G06F 9/4484: {Executing subprograms}
- G06F 2209/542: Intercept
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for automatically modifying an executable file for a software agent is provided. The method comprises detecting original static entry and exit points in the executable file and generating corresponding transformed points; modifying the executable file by linking the executable file to the integrity services environment and embedding a signed agent manifest; loading the modified executable file into memory and registering a target list with the software agent's hypervisor, wherein the target list provides mappings between protected and active page tables; detecting dynamic entry and exit points in the executable file and generating corresponding transformed points; switching to a protected context, in response to a transformed exit point being invoked, and switching to an active context, in response a transformed entry point being invoked; and de-registering the software agent with the memory protection module, in response to the software agent being unloaded.

## Claims

### Claim 1

A method for automatically modifying an executable file for a software agent to be compatible with an integrity services environment, the method comprising:
detecting one or more first static entry and exit points in the executable file;
generating one or more second entry and exit points corresponding to the first entry and exit points;
modifying the executable file to link to the integrity services environment;
embedding an agent manifest into the modified executable file;
loading the modified executable file into a first memory location referred to by a first page table;
registering the software agent with a memory protection module, in response to successfully verifying the executable file's integrity;
registering a target list with a hypervisor for the software agent, wherein the target list provides mappings between the first page table and a second page table;
detecting one or more third dynamic entry and exit points in the executable file;
generating one or more fourth entry and exit points corresponding to the third entry and exit points;
switching to a first mode, in response to a second or fourth exit point being invoked, wherein the first mode protects the software agent from memory attacks;
switching to a second mode, in response to a second or fourth entry point being invoked, wherein the second mode does not protect the software agent from memory attacks; and
de-registering the software agent with the memory protection module, in response to the software agent being unloaded.

### Claim 2 (depends on 1)

The method of claim 1, wherein detecting the first entry and exit points comprises searching import or export tables in the executable file.

### Claim 3 (depends on 1)

The method of claim 1, wherein the first page table is associated with the first mode.

### Claim 4 (depends on 1)

The method of claim 1, wherein the second page table is associated with the second mode.

### Claim 5 (depends on 1)

The method of claim 1, wherein registering the software agent with the memory protection module comprises:
loading the executable file into a second memory location referred to by the second page table,
wherein the memory protection module enforces the second memory location as read-only except through the second and fourth entry and exit points.

### Claim 6 (depends on 1)

The method of claim 1, wherein switching to the first mode comprises:
identifying a processor that is executing the executable file;
searching the target list for a mapping that provides a location for the first page table;
generating a hyper call into the hypervisor, in response to failing to find the mapping;
creating the mapping in the target list, in response to failing to find the mapping; and
loading a first pointer in the processor with the location of the first page table.

### Claim 7 (depends on 1)

The method of claim 1, wherein switching to the second mode comprises:
identifying a processor that is executing the executable file;
searching the target list for a valid mapping that provides a location for the second page table;
generating a hyper call into the hypervisor, in response to failing to find the mapping;
creating the mapping in the target list, in response to failing to find the mapping; and
loading a first pointer in the processor with the location of the second page table.

### Claim 8

A system for automatically modifying an executable file for a software agent to be compatible with integrity services environment, the system comprising:
a logic unit for detecting one or more first static entry and exit points in the executable file;
a logic unit for generating one or more second entry and exit points corresponding to the first entry and exit points;
a logic unit for modifying the executable file to link to the integrity services environment;
a logic unit for embedding a signed agent manifest into the modified executable file;
a logic unit for loading the modified executable file into a first memory location referred to by a first page table;
a logic unit for registering the software agent with a memory protection module, in response to successfully verifying the executable file's integrity;
a logic unit for registering a target list with a hypervisor for the software agent, wherein the target list provides mappings between the first page table and a second page table;
a logic unit for detecting one or more third dynamic entry and exit points in the executable file;
a logic unit for generating one or more fourth entry and exit points corresponding to the third entry and exit points;
a logic unit for switching to a first mode, in response to a second or fourth exit point being invoked, wherein the first mode protects the software agent from memory attacks;
a logic unit for switching to a second mode, in response to a second or fourth entry point being invoked, wherein the second mode does not protect the software agent from memory attacks; and
a logic unit for de-registering the software agent with the memory protection module, in response to the software agent being unloaded.

### Claim 9 (depends on 7)

The system of claim 7, wherein the logic unit for detecting the first entry and exit points comprises a logic unit for searching import or export tables in the executable file.

### Claim 10 (depends on 8)

The system of claim 8, wherein the first page table is associated with the first mode.

### Claim 11 (depends on 8)

The system of claim 8, wherein the second page table is associated with the second mode.

### Claim 12 (depends on 8)

The system of claim 8, wherein the logic unit for registering the software agent with the memory protection module comprises:
a logic unit for loading the executable file into a second memory location referred to by the second page table,
wherein the memory protection module enforces the second memory location as read-only from outside except through the second and fourth entry and exit points.

### Claim 13 (depends on 8)

The system of claim 8, wherein the logic unit for switching to the first mode comprises:
a logic unit for identifying a processor that is executing the executable file;
a logic unit for searching the target list for a mapping that provides a location for the first page table;
a logic unit for generating a hyper call into the hypervisor, in response to failing to find the mapping;
a logic unit for creating the mapping in the target list, in response to failing to find the mapping; and
a logic unit for loading a first pointer in the processor with the location of the first page table.

### Claim 14 (depends on 8)

The system of claim 8, wherein the logic unit for switching to the second mode comprises:
a logic unit for identifying a processor that is executing the executable file;
a logic unit for searching the target list for a mapping that provides a location for the second page table;
a logic unit for generating a hyper call into the hypervisor, in response to failing to find the mapping;
a logic unit for creating the mapping in the target list, in response to failing to find the mapping; and
a logic unit for loading a first pointer in the processor with the location of the second page table.

### Claim 15

A computer program product for automatically modifying an executable file for a software agent to be compatible with an integrity services environment, wherein the computer readable program when executed on a computer causes the computer to:
detect one or more first static entry and exit points in the executable file;
generate one or more second entry and exit points corresponding to the first entry and exit points;
modify the executable file to link to the integrity services environment;
embed an agent manifest into the modified executable file;
load the modified executable file into a first memory location referred to by a first page table;
register the software agent with a memory protection module, in response to successfully verifying the executable file's integrity;
register a target list with a hypervisor for the software agent, wherein the target list provides mappings between the first page table and a second page table;
detect one or more third dynamic entry and exit points in the executable file;
generate one or more fourth entry and exit points corresponding to the third entry and exit points;
switch to a first mode, in response to a second or fourth exit point being invoked, wherein the first mode protects the software agent from memory attacks;
switch to a second mode, in response to a second or fourth entry point being invoked, wherein the second mode does not protect the software agent from memory attacks; and
de-register the software agent with the memory protection module, in response to the software agent being unloaded.
