# US 2020/0401439 A1 · System and method for trapping system calls for remote execution

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

- Number: US 2020/0401439 A1
- Document ID: US20200401439A1
- Status: Published application
- Kind: A1
- Application number: 17/013,455
- Filed: 2020-09-04
- Published: 2020-12-24
- Earliest claimed: 2018-05-23
- Assignees: Parallels International GrnbH
- Applicants: Parallels International GrnbH
- Inventors: Andrey Naenko; Alexey Koryakin; Nikolay Dobrovolskiy; Serguei M. Beloussov
- Web page: https://patentgrep.com/patent/US20200401439A1

## CPC

- G06F 9/45545: {Guest-host, i.e. hypervisor is an application program itself, e.g. VirtualBox}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 9/4812: {by interrupt, e.g. masked}
- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F 2009/45591: {Monitoring or debugging support}
- G06F 2009/45595: {Network integration; Enabling network access in virtual machine instances}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Disclosed are systems and methods for executing system calls in a virtualized environment. A method includes executing, on a host, a host process corresponding to a guest process executing within a virtual machine and having an associated guest-process virtual address space, the host process having an associated host-process virtual address space. The method also includes mapping the host-process virtual address space and the guest-process virtual address space to a host physical memory, trapping a system call invoked by the guest process, and performing the trapped system call using the host process, wherein state changes in the host-process virtual address space caused by the trapped system call are reflected in the guest-process virtual address space. The method further includes causing execution of the guest process to be resumed after performing the trapped system call.

## Claims

### Claim 1

A method for executing system calls in a virtualized environment, wherein the method comprises:
executing, on a host, a host process corresponding to a guest process executing within a virtual machine and having an associated guest-process virtual address space, the host process having an associated host-process virtual address space;
mapping the host-process virtual address space and the guest-process virtual address space to a host physical memory;
trapping a system call invoked by the guest process;
performing the trapped system call using the host process, wherein state changes in the host-process virtual address space caused by the trapped system call are reflected in the guest-process virtual address space; and
causing execution of the guest process to be resumed after performing the trapped system call.

### Claim 2 (depends on 1)

The method of claim 1, wherein trapping the system call invoked by the guest process further comprises:
protecting a model-specific register associated with a system-call target address from at least one of read access or write access; and
catching a general protection exception caused by the guest process attempting to read the protected model-specific register associated with the system-call target address.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
responsive to determining the general protection exception is associated with an emulated system call, extracting a system call number and one or more system-call arguments associated with the trapped system call.

### Claim 4 (depends on 1)

The method of claim 1, wherein mapping the host-process virtual address space and the guest-process virtual address space to the host physical memory further comprises:
intercepting a memory-management system call to modify a memory mapping of the guest-process virtual address space; and
performing the modification of the memory mapping on both the guest-process virtual address space and the host-process virtual address space.

### Claim 5 (depends on 1)

The method of claim 1, wherein mapping the host-process virtual address space and the guest-process virtual address space to the host physical memory further comprises:
invoking a memory mapping application programming interface (API) call to map at least a portion of a guest virtual address space range to a context of the host process.

### Claim 6 (depends on 1)

The method of claim 1, wherein performing the trapped system call using the host process further comprises:
modifying access protection of the host-process virtual address space to protect the host-process virtual address space from access; and
in responsive to a protection fault caused by the system call attempting to access a portion of the host-process virtual address space, mapping a new guest page to the accessed portion and release protection of the accessed portion.

### Claim 7 (depends on 1)

The method of claim 1, wherein performing the trapped system call using the host process further comprises:
responsive to determining that the trapped system call includes a guest data pointer referencing a portion of the guest-process virtual address space, substituting the guest data pointer with a host data pointer referencing the same portion of the guest-process virtual address space.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
responsive to determining that the trapped system call is suitable for the guest process, forwarding the trapped system call through a virtualization stack of the virtual machine for handling.

### Claim 9

A system for executing system calls in a virtualized environment, wherein the system comprises:
a physical memory device; and
a processor configured to:
execute a host process corresponding to a guest process executing within a virtual machine and having an associated guest-process virtual address space, the host process having an associated host-process virtual address space;
map the host-process virtual address space and the guest-process virtual address space to a host physical memory;
trap a system call invoked by the guest process;
perform the trapped system call using the host process, wherein state changes in the host-process virtual address space caused by the trapped system call are reflected in the guest-process virtual address space; and
cause execution of the guest process to be resumed after performing the trapped system call.

### Claim 10 (depends on 9)

The system of claim 9, wherein to trap the system call invoked by the guest process is further, the processor is further configured to:
protect a model-specific register associated with a system-call target address from at least one of read access and write access; and
catch a general protection exception caused by the guest process attempting to read the protected model-specific register associated with the system-call target address.

### Claim 11 (depends on 10)

The system of claim 10, wherein the processor is further configured to:
responsive to determining the general protection exception is associated with an emulated system call, extract a system call number and one or more system-call arguments associated with the trapped system call.

### Claim 12 (depends on 9)

The system of claim 9, wherein to map the host-process virtual address space and the guest-process virtual address space to the host physical memory, the processor is further configured to:
intercept a memory-management system call to modify a memory mapping of the guest-process virtual address space; and
perform the modification of the memory mapping on both the guest-process virtual address space and the host-process virtual address space.

### Claim 13 (depends on 9)

The system of claim 9, wherein to map the host-process virtual address space and the guest-process virtual address space to the host physical memory, the processor is further configured to:
invoke a memory mapping API call to map at least a portion of a guest virtual address space range to a context of the host process.

### Claim 14 (depends on 9)

The system of claim 9, wherein to perform the trapped system call using the host process, the processor is further configured to:
modify access protection of the host-process virtual address space to protect the host-process virtual address space from access; and
in responsive to a protection fault caused by the system call attempting to access a portion of the host-process virtual address space, map a new guest page to the accessed portion and release protection of the accessed portion.

### Claim 15 (depends on 9)

The system of claim 9, wherein to perform the trapped system call using the host process, the processor is further configured to:
responsive to determining that the trapped system call includes a guest data pointer referencing a portion of the guest-process virtual address space, substitute the guest data pointer with a host data pointer referencing the same portion of the guest-process virtual address space.

### Claim 16 (depends on 9)

The system of claim 9, wherein the processor is further configured to:
responsive to determining that the trapped system call is suitable for the guest process, forward the trapped system call through a virtualization stack of the virtual machine for handling.

### Claim 17

A non-transitory computer readable medium comprising computer executable instructions, which when executed by a processor, cause the processor to perform operations to execute system calls in a virtualized environment, the operations comprising:
executing, on a host, a host process corresponding to a guest process executing within a virtual machine and having an associated guest-process virtual address space, the host process having an associated host-process virtual address space;
mapping the host-process virtual address space and the guest-process virtual address space to a host physical memory;
trapping a system call invoked by the guest process;
performing the trapped system call using the host process, wherein state changes in the host-process virtual address space caused by the trapped system call are reflected in the guest-process virtual address space; and
causing execution of the guest process to be resumed after performing the trapped system call.

### Claim 18 (depends on 17)

The non-transitory computer readable medium of claim 17, wherein trapping the system call invoked by the guest process further comprises:
protecting a model-specific register associated with a system-call target address from at least one of read access and write access;
catching a general protection exception caused by the guest process attempting to read the protected model-specific register associated with the system-call target address; and
responsive to determining the general protection exception is associated with an emulated system call, extracting a system call number and one or more system-call arguments associated with the trapped system call.

### Claim 19 (depends on 17)

The non-transitory computer readable medium of claim 17, wherein mapping the host-process virtual address space and the guest-process virtual address space to the host physical memory further comprises:
intercepting a memory-management system call to modify a memory mapping of the guest-process virtual address space; and
performing the modification of the memory mapping on both the guest-process virtual address space and the host-process virtual address space.

### Claim 20 (depends on 17)

The non-transitory computer readable medium of claim 17, wherein performing the trapped system call using the host process further comprises:
modifying access protection of the host-process virtual address space to protect the host-process virtual address space from access; and
in responsive to a protection fault caused by the system call attempting to access a portion of the host-process virtual address space, mapping a new guest page to the accessed portion and release protection of the accessed portion.
