# US 2017/0286278 A1 · Trusted execution of called function

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

- Number: US 2017/0286278 A1
- Document ID: US20170286278A1
- Status: Published application
- Kind: A1
- Application number: 15/087,647
- Filed: 2016-03-31
- Published: 2017-10-05
- Earliest claimed: 2016-03-31
- Assignees: Intel Corporation
- Applicants: Intel Corporation
- Inventors: Ramesh Thomas; Manohar R. Castelino
- Web page: https://patentgrep.com/patent/US20170286278A1

## CPC

- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 8/70: Software maintenance or management
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/45587: {Isolation or security of virtual machine instances}
- G06F 2221/033: Test or assess software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A copy is made of at least a part a stack. A caller return address of a calling function in the stack is verified as trusted. A caller return address of a called function in the stack is verified as matching a source address of the calling function in the copy of the stack. If verification is affirmative, then the called function may be executed in a trusted domain.

## Claims

### Claim 1

An apparatus for computing, comprising:
a computer processor and a memory coupled with the computer processor;
a function branch recording module, a function monitor module, and a trust domain switching module, which modules are to be loaded into the memory to be operated by the computer processor;
wherein the function branch recording module is to make a copy of at least a part a stack to a branch record in a control register of the computer processor;
wherein the function monitor module is to verify that a caller return address of a calling function in the stack is trusted and that a caller return address of a called function in the stack matches a source address of the calling function in the copy of at least part of the stack, wherein to verify that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack comprises to follow an entry pointing to the branch record to determine that the source address of the calling function in the branch record matches the caller return address of the called function in the stack; and,
wherein, the trust domain switching module is to switch execution of the called function to a trusted domain following the verification.

### Claim 2 (depends on 1)

The apparatus according to claim 1, wherein the control register is a Model-Specific Register (“MSR”) of the computer processor and wherein the branch record is a Last Branch Record (“LBR”) in the MSR.

### Claim 3 (depends on 2)

The apparatus according to claim 2, wherein the entry pointing to the branch is a Top-of-Stack (“TOS”) entry pointing to the LBR.

### Claim 4 (depends on 1)

The apparatus according to claim 1, wherein the function monitor module is further to save an interrupt state for the calling function and is to hold interrupts for the calling function pending verification that the caller return address of the calling function in the stack is trusted and is to restore the saved interrupt state for the calling function after switching execution of the called function to the trusted domain.

### Claim 5 (depends on 1)

The apparatus according to claim 1, wherein the function monitor module is further to make a virtual machine call to a hypervisor to stop recording the copy of at least part of the stack before the function monitor module is to verify that the caller return address of the calling function in the stack is trusted.

### Claim 6 (depends on 1)

The apparatus according to claim 1, further comprising a virtual machine monitor and a virtual machine to be operated by the computer processor, wherein the virtual machine monitor and/or the virtual machine comprises the function monitor module and wherein a setup module is to insert into an entry point for the calling function in the virtual machine a stub code comprising the function monitor module.

### Claim 7

A computer implemented method for computing comprising:
making a copy of at least a part of a stack (“copy of at least part of the stack”) to a branch record in a control register of a computer processor;
verifying that a caller return address of a calling function in the stack is trusted and that a caller return address of a called function in the stack matches a source address of the calling function in the copy of at least part of the stack, wherein verifying that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack comprises following an entry pointing to the branch record and determining that the source address of the calling function in the branch record matches the caller return address of the called function in the stack; and, following such verification,
switching execution of the called function by a computer processor to a trusted domain.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the control register is a Model-Specific Register (“MSR”) of the computer processor and wherein the branch record is a Last Branch Record (“LBR”) in the MSR.

### Claim 9 (depends on 8)

The method according to claim 8, wherein the entry pointing to the branch is a TOS entry pointing to the LBR.

### Claim 10 (depends on 7)

The method according to claim 7, further comprising saving an interrupt state for the calling function and holding interrupts for the calling function pending verification that the caller return address of the calling function in the stack is trusted, and restoring the saved interrupt state for the calling function after switching execution of the called function to the trusted domain.

### Claim 11 (depends on 7)

The method according to claim 7, further comprising making a virtual machine call to a hypervisor to stop recording the stack in the copy of at least part of the stack before verifying that the caller return address of the calling function in the stack is trusted.

### Claim 12 (depends on 7)

The method according to claim 7, further comprising inserting into an entry point for the calling function in the virtual machine a stub code for verifying that the caller return address of the calling function in the stack is trusted and that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack.

### Claim 13

An computing apparatus comprising:
means to make a copy of at least a part of a stack to a branch record in a control register of the computing apparatus;
means to verify that a caller return address of a calling function in the stack is trusted and that a caller return address of a called function in the stack matches a source address of the calling function in the copy of at least part of the stack, wherein means to verify that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack comprises means to follow an entry pointing to the branch record and means to determine that the source address of the calling function in the branch record matches the caller return address of the called function in the stack; and
means to switch execution of the called function to a trusted domain following such verification.

### Claim 14 (depends on 13)

The apparatus according to claim 13, wherein the control register is a Model-Specific Register (“MSR”) of the computing apparatus and wherein the branch record is a Last Branch Record (“LBR”) in the MSR.

### Claim 15 (depends on 14)

The apparatus according to claim 14, wherein the entry pointing to the branch is a TOS entry pointing to the LBR.

### Claim 16 (depends on 13)

The apparatus according to claim 13, further comprising means to save an interrupt state for the calling function, means to hold interrupts for the calling function pending verification that the caller return address of the calling function in the stack is trusted, and means to restore the saved interrupt state for the calling function after switching execution of the called function to the trusted domain.

### Claim 17 (depends on 13)

The apparatus according to claim 13, further comprising means to make a virtual machine call to a hypervisor to stop recording the stack in the copy of at least part of the stack before verifying that the caller return address of the calling function in the stack is trusted.

### Claim 18 (depends on 13)

The apparatus according to claim 13, wherein means to verify that the caller return address of the calling function in the stack is trusted and that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack comprise means for a virtual machine monitor.

### Claim 19 (depends on 13)

The apparatus according to claim 13, further comprising means to insert into an entry point for the calling function in a virtual machine a stub code comprising means to verify that the caller return address of the calling function in the stack is trusted.

### Claim 20

One or more non-transitory computer-readable media comprising instructions that cause a computing device, in response to execution of the instructions by one or more processors of the computing device, to:
make a copy of at least a part of a stack (“copy of at least part of the stack”) to a branch record in a control record of the one or more processors of the computing device;
verify that a caller return address of a calling function in the stack is trusted and that a caller return address of a called function in the stack matches a source address of the calling function in the copy of at least part of the stack, wherein verify that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack comprises follow an entry pointing to the branch record and determine that the source address of the calling function in the branch record matches the caller return address of the called function in the stack; and, following such verification,
switch execution of the called function to a trusted domain.

### Claim 21 (depends on 20)

The computer-readable media according to claim 20, wherein control register is a Model-Specific Register (“MSR”) of the one or more processors of the computing device and wherein the branch record is a Last Branch Record (“LBR”) in the MSR.

### Claim 22 (depends on 21)

The computer-readable media according to claim 21, wherein the entry pointing to the branch is a TOS entry pointing to the LBR.

### Claim 23 (depends on 20)

The non-transitory computer-readable media according to claim 20, further comprising save an interrupt state for the calling function, hold interrupts for the calling function pending verification that the caller return address of the calling function in the stack is trusted, and restore the saved interrupt state for the calling function after switching execution of the called function to the trusted domain.

### Claim 24 (depends on 20)

The non-transitory computer-readable media according to claim 20, further comprising make a virtual machine call to a hypervisor to stop recording the stack in the copy of at least part of the stack before verifying that the caller return address of the calling function in the stack is trusted.

### Claim 25 (depends on 20)

The non-transitory computer-readable media according to claim 20, further comprising to insert into an entry point for the calling function in a virtual machine a stub code, which stub code is to verify that the caller return address of the calling function in the stack is trusted and that the caller return address of the called function in the stack matches the source address of the calling function in the copy of at least part of the stack.
