IP Library Granted Patent US 12,008,372
Granted Patent B2
US 12,008,372 · App. 17/870,651 · Granted Jun 11, 2024

Techniques for reducing CPU privilege boundary crossings

Inventors: Frederick Joseph Jacobs (Los Gatos, CA); Sam Scalise (San Jose, CA); Martim Carbone (Sunnyvale, CA)
Assignee: VMware LLC
G06F9/30145G06F9/45533G06F9/545
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,008,372
App. No.
17/870,651
Granted
Jun 11, 2024
Kind
B2
Abstract

In one set of embodiments, an operating system (OS) kernel of a computer system can receive an invocation of a system call by a user program running on the computer system. The OS kernel can further fetch a plurality of subsequent instructions that will be executed by the user program after the invocation of the system call and decode the plurality of subsequent instructions into a plurality of decoded instructions. The OS kernel can then analyze whether the plurality of decoded instructions include an additional system call invocation and whether other decoded instructions that appear between the invocation of the system call and the additional system call invocation are viable for emulation by the OS kernel.

Claims (76)

1. A method comprising:

receiving, by an operating system (OS) kernel of a computer system, an invocation of a system call by a user program running on the computer system;

fetching, by the OS kernel, a plurality of subsequent instructions that will be executed by the user program after the invocation of the system call;

decoding, by the OS kernel, the plurality of subsequent instructions into a plurality of decoded instructions; and

analyzing, by the OS kernel, whether:

the plurality of decoded instructions includes an additional system call invocation; and

all other decoded instructions that appear in the plurality of decoded instructions between the invocation of the system call and the additional system call invocation are viable for emulation by the OS kernel.

2. The method of claim 1 further comprising, if the plurality of decoded instructions includes the additional system call invocation and the other decoded instructions are viable for emulation by the OS kernel:

emulating, by the OS kernel, the other decoded instructions;

executing, by the OS kernel, the additional system call invocation; and

returning control to the user program at a next instruction in an instruction stream of the user program that follows the additional system call invocation.

3. The method of claim 1 further comprising, if the plurality of decoded instructions does not include the additional system call invocation or the other decoded instructions are not viable for emulation by the OS kernel:

executing, by the OS kernel, the system call; and

returning control to the user program at a next instruction in an instruction stream of the user program that follows the invocation of the system call.

4. The method of claim 2 wherein the OS kernel runs in a kernel mode of a central processing unit (CPU) of the computer system, wherein the user program runs in a user mode of the CPU, and wherein the emulating of the other decoded instructions eliminates CPU privilege boundary crossings caused by the additional system call invocation.

5. The method of claim 2 wherein the emulating comprises:

translating the other decoded instructions into a stream of kernel instructions; and

executing the stream of kernel instructions.

6. The method of claim 5 further comprising:

caching the stream of kernel instructions; and

upon fetching the plurality of subsequent instructions again, directly executing the stream of kernel instructions without performing the decoding and the analyzing.

7. The method of claim 1 further comprising:

caching the plurality of decoded instructions; and

upon fetching an instruction in the plurality of subsequent instructions again, retrieving a decoded version of the instruction from the cached plurality of decoded instructions.

8. A non-transitory computer readable storage medium having stored thereon program code executable by an operating system (OS) kernel of a computer system, the program code embodying a method comprising:

receiving an invocation of a system call by a user program running on the computer system;

fetching a plurality of subsequent instructions that will be executed by the user program after the invocation of the system call;

decoding the plurality of subsequent instructions into a plurality of decoded instructions; and

analyzing whether:

the plurality of decoded instructions includes an additional system call invocation; and

all other decoded instructions that appear in the plurality of decoded instructions between the invocation of the system call and the additional system call invocation are viable for emulation by the OS kernel.

9. The non-transitory computer readable storage medium of claim 8 wherein the method further comprises, if the plurality of decoded instructions includes the additional system call invocation and the other decoded instructions are viable for emulation by the OS kernel:

emulating, by the OS kernel, the other decoded instructions;

executing, by the OS kernel, the additional system call invocation; and

returning control to the user program at a next instruction in an instruction stream of the user program that follows the additional system call invocation.

10. The non-transitory computer readable storage medium of claim 8 wherein the method further comprises, if the plurality of decoded instructions does not include the additional system call invocation or the other decoded instructions are not viable for emulation by the OS kernel:

executing the system call; and

returning control to the user program at a next instruction in an instruction stream of the user program that follows the invocation of the system call.

11. The non-transitory computer readable storage medium of claim 9 wherein the OS kernel runs in a kernel mode of a central processing unit (CPU) of the computer system, wherein the user program runs in a user mode of the CPU, and wherein the emulating of the other decoded instructions eliminates CPU privilege boundary crossings caused by the one or more additional system call invocations.

12. The non-transitory computer readable storage medium of claim 9 wherein the emulating comprises:

translating the other decoded instructions into a stream of kernel instructions; and

executing the stream of kernel instructions.

13. The non-transitory computer readable storage medium of claim 12 wherein the method further comprises:

caching the stream of kernel instructions; and

upon fetching the plurality of subsequent instructions again, directly executing the stream of kernel instructions without performing the decoding and the analyzing.

14. The non-transitory computer readable storage medium of claim 8 wherein the method further comprises:

caching the plurality of decoded instructions; and

upon fetching an instruction in the plurality of subsequent instructions again, retrieving a decoded version of the instruction from the cached plurality of decoded instructions.

15. A computer system comprising:

a central processing unit (CPU);

an operating system (OS) kernel;

and

a non-transitory computer readable medium having stored thereon program code that causes the OS kernel to:

receive an invocation of a system call by a user program running on the computer system;

fetch a plurality of subsequent instructions that will be executed by the user program after the invocation of the system call;

decode the plurality of subsequent instructions into a plurality of decoded instructions; and

analyze whether:

the plurality of decoded instructions includes an additional system call invocation; and

all other decoded instructions that appear in the plurality of decoded instructions between the invocation of the system call and the additional system call invocation are viable for emulation by the OS kernel.

16. The computer system of claim 15 wherein the program code further causes the OS kernel to, if the plurality of decoded instructions includes the additional system call invocation and the other decoded instructions are viable for emulation by the OS kernel:

emulate the other decoded instructions; and

execute the additional system call invocation; and

return control to the user program at a next instruction in an instruction stream of the user program that follows the additional system call invocation.

17. The computer system of claim 15 wherein the program code further causes the OS kernel to, if the plurality of decoded instructions does not include the additional system call invocation or the other decoded instructions are not viable for emulation by the OS kernel:

execute the system call; and

return control to the user program at a next instruction in an instruction stream of the user program that follows the invocation of the system call.

18. The computer system of claim 16 wherein the OS kernel runs in a kernel mode of the CPU, wherein the user program runs in a user mode of the CPU, and wherein the emulating of the other decoded instructions eliminates CPU privilege boundary crossings caused by the one or more additional system call invocations.

19. The computer system of claim 16 wherein the emulating comprises:

translating the other decoded instructions into a stream of kernel instructions; and

executing the stream of kernel instructions.

20. The computer system of claim 19 wherein the program code further causes the OS kernel to:

cache the stream of kernel instructions; and

upon fetching the plurality of subsequent instructions again, directly execute the stream of kernel instructions without performing the decoding and the analyzing.

21. The computer system of claim 15 wherein the program code further causes the OS kernel to:

cache the plurality of decoded instructions; and

upon fetching an instruction in the plurality of subsequent instructions again, retrieve a decoded version of the instruction from the cached plurality of decoded instructions.

Assignments (2)
CHANGE OF NAME Recorded Feb 27, 2024
From: VMWARE, INC.
To: VMWARE LLC
Reel/Frame 066692/0103 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 26, 2022
From: JACOBS, FREDERICK JOSEPH; SCALISE, SAM; CARBONE, MARTIM
To: VMWARE, INC.
Reel/Frame 060630/0026 →