Method and apparatus for implementing batch system call
Abstract
A method and a related apparatus for implementing a batch system call are disclosed. The method includes: loading an executable program to a user-mode virtual address space, where the executable program is obtained by compiling source code of the batch system call, and includes abstract syntax tree (AST) data of the batch system call; and invoking a first instruction to invoke a kernel to generate, based on the AST data in the user-mode virtual address space, binary code that is used to implement the batch system call. Because there is difficulty in inserting malicious data into a data structure like the AST, it is difficult to insert malicious code into the binary code of the batch system call, so as to avoid an error or an excessively long delay caused by the malicious code when the kernel runs the binary code of the batch system call, thereby improving security of the batch system call.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 12 · Forward citations: 0.
Claims (8)
- Claim 1Independent Claim
A method for implementing a batch system call, comprising: loading an executable program to a user-mode virtual address space, wherein the executable program is obtained by compiling source code of the batch system call, and the executable program comprises abstract syntax tree (AST) data of the batch system call; and invoking a first instruction, wherein the first instruction, when executed, causes a kernel to read the AST data from the user-mode virtual address space, and generate, based on the AST data, binary code for implementing the batch system call, the binary code being stored in a kernel-mode virtual address space.
- Claim 2Depends on #1
The method according to claim 1, wherein the executable program further comprises call stub code of the batch system call, and the method further comprises: invoking a second instruction when the call stub code of the batch system call is executed, wherein the second instruction, when executed, causes the kernel to execute the binary code to implement the batch system call.
- Claim 3Depends on #2
The method according to claim 2, wherein after the invoking of the first instruction, the method further comprises: receiving an invoking result of the first instruction, wherein the invoking result comprises an identifier of the binary code for implementing the batch system call, wherein the second instruction carries the identifier, and the second instruction, when executed, causes the kernel to execute the binary code corresponding to the identifier to implement the batch system call.
- Claim 4Depends on #1
The method according to claim 1, wherein the source code of the batch system call comprises delay information of the batch system call, and the AST data comprises the delay information of the batch system call; and the first instruction, when executed, further causes the kernel to calculate a worst-case execution time of the batch system call based on the delay information in the AST data.
- Claim 5Depends on #4
The method according to claim 4, wherein the first instruction, when executed, further causes the kernel to store the worst-case execution time into the kernel-mode virtual address space.
- Claim 6Independent Claim
An apparatus for implementing a batch system call, comprising at least one memory and at least one processor, wherein the at least one memory is configured to store a computer program, and the at least one processor is configured to invoke the computer program from the at least one memory and run the computer program to perform operations comprising: loading an executable program to a user-mode virtual address space, wherein the executable program is obtained by compiling source code of the batch system call, and the executable program comprises abstract syntax tree (AST) data of the batch system call; and invoking a first instruction, wherein the first instruction, when executed, causes a kernel to read the AST data from the user-mode virtual address space, and generate, based on the AST data, binary code for implementing the batch system call, the binary code being stored in a kernel-mode virtual address space.
- Claim 7Depends on #6
The apparatus according to claim 6, wherein the executable program further comprises call stub code of the batch system call, and the operations further comprise: invoking a second instruction when the call stub code of the batch system call is executed, wherein the second instruction, when executed, cause the kernel to execute the binary code to implement the batch system call.
- Claim 8Depends on #7
The apparatus according to claim 7, wherein after the invoking of the first instruction, the operations further comprise: receiving an invoking result of the first instruction, wherein the invoking result comprises an identifier of the binary code for implementing the batch system call, wherein the second instruction carries the identifier, and the second instruction, when executed, causes the kernel to execute the binary code corresponding the identifier to implement the batch system call.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of International Application No. PCT/CN 2022/071747, filed on Jan. 13, 2022, which claims priority to Chinese Patent Application No. 202110163179.2, filed on Feb. 5, 2021. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD Embodiments of this disclosure relate to the field of operating system technologies, and in particular, to a method and an apparatus for implementing a batch system call. BACKGROUND Microkernel is a kernel architecture widely used currently in the field of real-time operating systems. The microkernel features low complexity, high security, and real-time performance. In a microkernel architecture, similar to an application, a system program also runs in a user mode. Therefore, the application running in the user mode needs to invoke, through inter-process communication (IPC), the system program running in the user mode. In a running process, the application usually invokes, for a plurality of times, the system program running in the user mode, and the plurality of system program calls cause frequent context switching, resulting in performance deterioration of an operating system. Currently, a main solution is to package a plurality of system calls into a batch system call, and implement the plurality of system calls at a time through the batch system call, thereby reducing a number of IPCs and improving the performance of the operating system. To implement the batch system call, in the solution, binary code for implementing the batch system call is first registered with the kernel. When the batch system call needs to be performed, the kernel executes the binary code. Malicious code is prone to be inserted into the binary code, and consequently, the security is poor. SUMMARY Embodiments of this disclosure provide a method and a related apparatus for implementing a batch system call. The method can impro
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (12)
| Patent | Title | Year | Citations |
|---|---|---|---|
| CN 107,729,159 A | The address mapping method and device of a kind of shared drive | — | 0 |
Non-Patent Literature (1)
- International Search Report and Written Opinion issued in PCT/CN2022/071747, dated Apr. 13, 2022, 10 pages.