# US 2018/0321963 A1 · Safe execution of virtual machine callbacks in a hypervisor

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

- Number: US 2018/0321963 A1
- Document ID: US20180321963A1
- Status: Published application
- Kind: A1
- Application number: 15/588,392
- Filed: 2017-05-05
- Published: 2018-11-08
- Earliest claimed: 2017-05-05
- Assignees: VMware, Inc.
- Applicants: VMware, Inc.
- Inventors: Nadav AMIT; Michael WEI; Cheng Chun TU
- Web page: https://patentgrep.com/patent/US20180321963A1

## CPC

- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F 21/60: Protecting data
- G06F 2009/45587: {Isolation or security of virtual machine instances}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A hypervisor communicates with a guest operating system running in a virtual machine supported by the hypervisor using a hyper-callback whose functions are based on the particular guest operating system running the virtual machine and are triggered by one or more events in the guest operating system. The functions are modified to make sure they are safe to execute and to allow only limited access to the guest operating system. Additionally, the functions are converted to byte code corresponding to a simplified CPU and memory model and are safety checked by the hypervisor when registered with the hypervisor. The functions are executed by the hypervisor without any context switch between the hypervisor and guest operating system, and when executed, provide information about the particular guest operating system, allowing the hypervisor to improve operations such as page reclamation, virtual CPU scheduling, I/O operations, and tracing of the guest operating system.

## Claims

### Claim 1

In a system having one or more processors and a memory coupled to the one or more processors and containing a hypervisor that supports a virtual machine running a guest operating system, a method for communicating information specific to the guest operating system to the hypervisor, said method comprising:
upon the occurrence of a specified event,
obtaining callback byte code that has been registered with the hypervisor for the specified event;
assembling the callback byte code into executable code that runs on the one or more processors; and
executing the assembled callback executable code to obtain information regarding the operating system running in the virtual machine; and
in response to executing the assembled callback executable code, obtain the information regarding the operating system running in the virtual machine.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the callback byte code is based on a simplified CPU and memory architecture.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the callback byte code is derived and prepared from one or more functions of the guest operating system.

### Claim 4 (depends on 3)

The method according to claim 3, wherein preparation of the callback byte code includes unrolling loops and removing branches in the one or more functions.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the callback byte code is registered with the hypervisor prior to the occurrence of the specified event, and the assembled callback executable code is executed without a context switch responsive the occurrence of the specified event.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the callback byte code is prepared so as to permit the hypervisor to access only a range of addresses in the guest operating system.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the range of addresses is registered with the hypervisor prior to the occurrence of the specified event.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the range of addresses registered with the hypervisor is registered as guest virtual addresses.

### Claim 9 (depends on 7)

The method according to claim 7, wherein the range of addresses registered with the hypervisor is registered as guest physical addresses.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the hypervisor is further configured to check for valid inputs in the assembled callback executable code.

### Claim 11 (depends on 1)

The method according to claim 1, wherein the hypervisor is further configured to hook in hypervisor functions to the assembled callback executable code.

### Claim 12

A non-transitory computer-readable medium comprising computer program code executable in a system having one or more processors and a memory coupled to the one or more processors and containing a hypervisor that supports a virtual machine running a guest operating system, wherein the computer program code when executed carries out a method for communicating information specific to the guest operating system to the hypervisor, said method comprising:
upon the occurrence of a specified event,
obtaining callback byte code that has been registered with the hypervisor for the specified event;
assembling the callback byte code into executable code that runs on the one or more processors; and
executing the assembled callback executable code to obtain information regarding the operating system running in the virtual machine; and
in response to executing the assembled callback executable code, obtain the information regarding the operating system running in the virtual machine.

### Claim 13 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the callback byte code is a based on a simplified CPU and memory architecture.

### Claim 14 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the callback byte code is prepared from one or more functions of the guest operating system.

### Claim 15 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the callback byte code is registered with the hypervisor prior to the occurrence of the specified event, and the assembled callback executable code is executed without a context switch responsive the occurrence of the specified event.

### Claim 16 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the callback byte code is prepared so as to permit the hypervisor to access only a range of addresses in the guest operating system.

### Claim 17 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the hypervisor is further configured to check for valid inputs in the assembled callback executable code.

### Claim 18 (depends on 12)

The non-transitory computer-readable medium according to claim 12, wherein the hypervisor is further configured to hook in hypervisor functions to the assembled callback executable code.

### Claim 19

A system comprising:
one or more processors; and
a memory coupled to the one or more processors and containing a hypervisor that supports a virtual machine running a guest operating system, wherein the hypervisor is configured to
upon the occurrence of a specified event,
obtain callback byte code that has been registered with the hypervisor for the specified event;
assemble the callback byte code into executable code that runs on the one or more processors; and
execute the assembled callback executable code to obtain information regarding the operating system running in the virtual machine; and
in response to executing the assembled callback executable code, obtain the information regarding the operating system running in the virtual machine.

### Claim 20 (depends on 19)

The system according to claim 19, wherein the callback byte code is prepared from one or more functions of the guest operating system and is registered with the hypervisor prior to the occurrence of the event.
