Isolated kernel, process running method and device and computer storage medium

By designing an isolated kernel in container technology, adding an independent mapping area and an independent system call table, the problem of security escape caused by processes sharing the kernel is solved, and process security isolation and system call efficiency are improved.

CN119003186AInactive Publication Date: 2024-11-22ZHEJIANG DAHUA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411481324.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2024-11-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In existing container technologies, the sharing of the kernel by processes leads to security escape issues. The kernel and address space design of existing operating systems cause processes to map their kernel space to the same physical memory, resulting in a lack of security isolation.

Method used

Design an isolated kernel that adds an independent mapping region for each process, allowing its kernel space to be independently mapped to physical memory. It also uses a page table pointer array to quickly obtain virtual address mapping relationships and combines this with an independent system call table to restrict system call interfaces and improve security.

Benefits of technology

It enables each process to operate in an independent space within the kernel, thereby improving system security, reducing the kernel exposure surface, preventing security escapes, and improving system call efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003186A_ABST
    Figure CN119003186A_ABST
Patent Text Reader

Abstract

The invention provides an isolated kernel, a process running method, a process running device and a computer storage medium. The isolated kernel comprises a physical memory space; the virtual address space of each process comprises a user space and a kernel space, and the user space and the kernel space are respectively mapped to the physical memory space; wherein the kernel space comprises an independent mapping area, the independent mapping area of each process is mapped to an independent physical memory of the physical memory space, and the independent mapping area is used for storing independent information of process operation. According to the isolated kernel, an independent mapping area is added to the kernel, so that each process has an independent space in a kernel mode, kernel resources are conveniently isolated, and the safety of a system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to an isolated kernel, a process running method, a process running device, and a computer storage medium. Background Art

[0002] Container technology is the mainstream technology of cloud computing at present, which mainly provides a unified environment for cloud computing deployment. Compared with virtual machines, it is very lightweight, but it can also provide a relatively independent environment for each application. For example, independent root file system, independent network environment, independent process space, independent CPU (Central Processing Unit), memory resources, etc. Since the current containers all share the host kernel, it is possible for the container to affect the host or even other containers on the same host through the shared kernel. That is, security escape occurs.

[0003] In the kernel and address space design of existing operating systems, each process has its own independent virtual address space. The entire virtual address space is divided into two parts, one for user space and one for kernel space. In a 32-bit system (the following examples are all based on 32-bit systems, and 64-bit systems are similar), the user space occupies the low address segment of 0-3G, while the kernel space occupies the high address segment of 3G-4G. Although from the perspective of address space, these two parts are independently owned by each process, in fact, when they are finally mapped to physical memory, the kernel space of all processes is consistently mapped to the same physical memory space.‌ Summary of the invention

[0004] In order to solve the above technical problems, the present application proposes an isolated kernel, a process running method, a process running device and a computer storage medium.

[0005] In order to solve the above technical problems, the present application proposes an isolated core, which includes: Physical memory space; A virtual address space of each process, wherein the virtual address space includes a user space and a kernel space, and the user space and the kernel space are respectively mapped to the physical memory space; The kernel space includes an independent mapping area, and the independent mapping area of ​​each process is mapped to an independent physical memory of the physical memory space, and the independent mapping area is used to store independent information of the process running.

[0006] Wherein, the kernel space includes a shared mapping area, and the shared mapping area of ​​the kernel space of each process is mapped to the same shared mapping area of ​​the physical memory space; The shared mapping area of ​​the kernel space is used to store a process page table pointer array, and the page table pointer in the process page table pointer array is used to obtain the virtual address mapping relationship of the process.

[0007] The position of the independent mapping area in the kernel space is located after the position of the shared mapping area.

[0008] The offset of the independent mapping area is determined by the size of the shared mapping area.

[0009] Wherein, the shared mapping area includes a dynamic mapping area and a direct mapping area; Wherein, the process page table pointer array is stored in the dynamic mapping area and / or the direct mapping area.

[0010] The process running includes a process control block, process resource information, and / or an independent system call table.

[0011] The independent information of the process running also includes the user group of the process, the mounted file system, and / or network information.

[0012] In order to solve the above technical problems, the present application also proposes a process running method, which is applied to the above isolated kernel, and the process running method includes: In response to the execution instruction of the process, executing the program of the process; Obtaining a page table pointer array from a shared mapping area, wherein a page table pointer in the page table pointer array is used to obtain a virtual address mapping relationship of a process; According to the physical memory space pointed to by the page table pointer of the page table pointer array, obtaining the independent information stored in the independent mapping area; The process is run based on the independent information of the process running to realize the business function of the process.

[0013] In order to solve the above technical problems, the present application also proposes a process running device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the process running method as described above.

[0014] In order to solve the above technical problems, the present application also proposes a computer storage medium, which is used to store program data. When the program data is executed by a computer, it is used to implement the above process running method.

[0015] Compared with the prior art, the beneficial effects of the present application are as follows: the isolated kernel of the present application includes: physical memory space; virtual address space of each process, wherein the virtual address space includes user space and kernel space, and the user space and the kernel space are respectively mapped to the physical memory space; wherein the kernel space includes an independent mapping area, and the independent mapping area of ​​each process is mapped to the independent physical memory of the physical memory space, and the independent mapping area is used to store independent information of the process operation. Through the above-mentioned isolated kernel, an independent mapping area is added to the kernel, so that each process has an independent space in the kernel state, thereby facilitating the isolation of kernel resources and improving the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them: Figure 1 It is a schematic diagram of an embodiment of a kernel space provided by the prior art; Figure 2 It is a schematic diagram of the framework of an embodiment of an isolated core provided by the present application; Figure 3 It is a schematic diagram of the scenario of the page table pointer array provided by this application; Figure 4 This is a schematic diagram of the memory application and release scenario provided by this application; Figure 5 It is a flowchart of an embodiment of a process running method provided by the present application; Figure 6 It is a structural diagram of an embodiment of a process running device provided by the present application; Figure 7 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0018] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0019] This application first splits the complete 1G space inside the kernel space of the prior art to obtain the following Figure 1 A schematic diagram of an embodiment of kernel space is shown.

[0020] like Figure 1 As shown in the figure, all the mappings from virtual addresses to physical addresses in kernel space are completed by the page table, which completely records the mapping relationship between the 4K page in each virtual address and the 4K page in physical memory. Therefore, each process has an independent page table, which is also the basis for each process to have an independent virtual space. The page table can also be divided into two parts, one part is the user space part independent of each process, and the other part is the kernel space part that is the same for all processes and copied from the same main kernel page table.

[0021] In order to solve the problem of easy container escape caused by a fully shared kernel, this application redesigns the address space mode and adds a kernel process independent mapping area to the kernel space. The address space in this area is different from other spaces. Each process not only has an independent address space, but also this part of the address space of each process is independently mapped to different physical memory. Thus, an independent kernel space for each process is obtained.

[0022] In this regard, this application proposes a high-security isolated core, please refer to Figure 2 , Figure 2 It is a schematic diagram of the framework of an embodiment of an isolated core provided by the present application.

[0023] like Figure 2As shown, the isolated kernel designed in this application specifically includes a physical memory space and a virtual address space for each process. Among them, the virtual address space includes a user space and a kernel space, and the user space and the kernel space are respectively mapped to the physical memory space. This application adds an independent mapping area in the kernel space so that the independent mapping area of ​​each process is mapped to the independent physical memory of the physical memory space, and the independent mapping area is used to store independent information of the process running.

[0024] During the use of kernel space, since the independent information required for the operation of each process is stored in an independent mapping area and mapped to the independent physical memory of the physical memory space, when other processes are running, there is no need to access the independent mapping area and independent physical memory of other processes. As a result, each process has an independent space in the kernel state, which facilitates the isolation of kernel resources and improves the security of the system.

[0025] like Figure 2 As shown in the figure, since each process has an independent kernel mapping area, the original independent information of many processes can be stored more safely in the independent mapping area to avoid damage and tampering by other processes. However, in order for the kernel to quickly find the corresponding information when performing operations such as process scheduling and resource allocation, this application uses the shared mapping area of ​​the kernel, such as Figure 2 Create a process page table pointer array in the dynamic mapping area and / or direct mapping area, such as Figure 3 As shown, Figure 3 This is a schematic diagram of the scene of the page table pointer array provided by this application. It records the page table pointer of each process, and the virtual address mapping relationship of each process can be quickly found through the page table pointer. In this way, the relevant resources of the entire process can be quickly accessed.

[0026] For a kernel, the size of its direct mapping area and independent mapping area is basically determined, so the position that can be allocated to the independent mapping area can also be basically determined, so all processes also have the same offset of the independent mapping area. After this value is fixed, it is convenient for the kernel to quickly find the relevant variables of the kernel independent mapping area of ​​the corresponding process through the process page table pointer when needed. For kernels on different hosts, this value can be adjusted according to the size of the shared mapping area, which is suitable for different business scenarios.

[0027] In traditional kernels, the application and release of memory in the dynamic mapping area are completed by vmalloc and vfree. The mapping relationship of the applied memory will be written into the main kernel page table. When other processes access it, if it is not found in the kernel area of ​​the process page table, the latest main kernel page table will be automatically copied to complete the synchronization of the kernel page table.

[0028] For example, Figure 2The kernel space shown in the figure, first of all, due to the existence of independent mapping areas, its main kernel page table is not equivalent to the kernel area of ​​each process page table, and when synchronizing, only the shared mapping area needs to be synchronized. For details, please refer to Figure 4 , Figure 4 This is a schematic diagram of the memory application and release scenario provided by this application. The independent mapping area also needs to be completed by the new application and release functions (imalloc, ifree). Unlike vmalloc, the address mapping relationship of the memory application is only written to the independent mapping area of ​​the corresponding process page table, thereby maintaining the independence of the memory of this independent mapping area. Other processes cannot know the mapping relationship of the independent mapping area, and thus cannot access the content of the independent mapping area. When writing a kernel module, the staff determines whether to use imalloc or vmalloc based on the accessible range of the memory application.

[0029] The independent mapping area can store, for example, the process control block (PCB), process resource information, etc. At the same time, in the container environment, in order to further ensure isolation, the user group, mounted file system, and network information of each process can also be stored independently in an independent mapping area to avoid being accessed by other processes, and to prevent the process from accessing the relevant information of other processes through the kernel state, thereby causing container escape.

[0030] The isolated kernel of the present application includes: physical memory space; virtual address space of each process, wherein the virtual address space includes user space and kernel space, and the user space and the kernel space are respectively mapped to the physical memory space; wherein the kernel space includes an independent mapping area, and the independent mapping area of ​​each process is mapped to the independent physical memory of the physical memory space, and the independent mapping area is used to store independent information of the process operation. Through the above-mentioned isolated kernel, an independent mapping area is added to the kernel, so that each process has an independent space in the kernel state, thereby facilitating the isolation of kernel resources and improving the security of the system.

[0031] Based on the above isolated kernel, this application also provides a process running method, please refer to Figure 5 , Figure 5 It is a flowchart of an embodiment of a process running method provided by the present application.

[0032] The process running method of the present application is applied to a process running device, wherein the process running device of the present application can be a server, a terminal device, or a system in which a server and a terminal device cooperate with each other. Accordingly, the various parts included in the process running device, such as various units, sub-units, modules, and sub-modules, can all be set in the server, can all be set in the terminal device, or can be set in the server and the terminal device respectively.

[0033] Furthermore, the above-mentioned server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, such as software or software modules used to provide distributed servers, or it can be implemented as a single software or software module, which is not specifically limited here.

[0034] like Figure 5 As shown, the specific steps are as follows: Step S11: In response to the running instruction of the process, the program of the process is run.

[0035] In the embodiment of the present application, in response to the running instruction of the target process, the process running device loads the program of the process.

[0036] Step S12: obtaining a page table pointer array from the shared mapping area, wherein the page table pointer in the page table pointer array is used to obtain the virtual address mapping relationship of the process.

[0037] In the embodiment of the present application, the process running device is from Figure 2 The page table pointer of the process is obtained in the direct mapping area and / or the dynamic mapping area shown, and the mapping relationship between the virtual address space of the independent mapping area and the physical memory space can be obtained according to the page table pointer.

[0038] Step S13: According to the physical memory space pointed to by the page table pointer of the page table pointer array, the independent information stored in the independent mapping area is obtained.

[0039] In the embodiment of the present application, the process running device accesses the independent information of the process running in the physical memory space according to the mapping relationship obtained in step S12.

[0040] Step S14: running the process based on the independent information of the process running to realize the business function of the process.

[0041] In an embodiment of the present application, the present application runs a process based on independent information of the process running, thereby realizing the business function of the process.

[0042] Specifically, the independent information required for the running of the process of this application includes but is not limited to: process control block, process resource information, independent system call table, user group of the process, mounted file system, and network information.

[0043] Taking the independent system call table as an example, the process operation method protected by this application is described in detail. In this regard, this application proposes a security improvement solution based on system call cutting, which reduces the services provided by the kernel to the process from another dimension, thereby limiting the possibility of hackers using the system call process to escape safely after possibly breaking into the process. The operating system kernel design provided by this application improves the security of the system by cutting system calls and shielding some unnecessary functions.

[0044] In traditional operating systems, the kernel maintains a system call table, which is a summary of all interfaces exposed by the kernel to the process. Since the traditional kernel is shared by all processes, the kernel exposes all system interfaces to each process, which also exposes the attack surface of the system. Since the system calls actually used by each process are limited, controllable, and known at the compilation stage, the system calls that the program needs to use are analyzed and counted at the compilation stage, and the differentiated system call interface exposure is completed based on the statistical information at the process startup stage.

[0045] During the compilation and running stages of system call clipping, this application implements the control of system calls that can be used by each process. Under normal circumstances, this application can fully determine which system calls the program will use when writing code, so it will not affect the normal execution of the program. Once the program is injected into other execution processes due to a vulnerability attack, since we only expose a small number of system call interfaces for this specific business, the attacker has very few attack surfaces available, and it is difficult to expand this attack to generate actual attack value. Therefore, the attacker can only keep the effect of the attack within this business and cannot affect the entire system.

[0046] In the process running stage, the process running device reads the independent system call table of the target process in the kernel. The present application changes the system call table from one table per kernel to one table per process, thereby realizing that each process has a corresponding independent system call table.

[0047] Among them, the independent system call table of each process only includes the system call interface required to implement the specific business of its own process, thereby ensuring that each process only exposes a small number of system call interfaces, which can provide greater protection for the kernel.

[0048] When a system call occurs, the present application directly initiates access to the system call table according to the logical address of the unified system call table. With the assistance of the mapping of the underlying MMU (Memory Management Unit), each process will automatically access its own system call table.

[0049] Among them, MMU is responsible for the conversion of virtual addresses to physical addresses. MMU maps the virtual addresses used by the program to the actual physical memory locations through the translation table, thus realizing dynamic management and isolation of memory.

[0050] The implementation of this solution is relatively complicated, as it modifies the kernel's address space mapping relationship, but it is more secure because, under the management of the MMU, a process cannot access the system call table of other processes, thus ensuring isolation. Secondly, since each process can directly access the system call table, it does not need to search in a bunch of data structures like the previous solution, so it is more efficient.

[0051] Furthermore, the present application redesigns the address space mode to add a kernel process independent mapping area to the kernel space. The address space in this area is different from other spaces, and each process not only has an independent address space, but also this part of the address space of each process is independently mapped to different physical memories, thereby obtaining an independent process space for each process.

[0052] This application generates a minimized system call table for each process, so that the process can only access the kernel through the system calls known at the compilation stage, thereby reducing the exposure of the kernel and increasing the difficulty for hackers to attack.

[0053] In the process of compiling the process, the process running device collects the system call number of the required system interface by analyzing the function of the process, thereby generating a call table pointer of the independent system call table of each process and writing it into the program of the process. The application opens up an independent mapping area for each process in the address space of the kernel, and the independent mapping area of ​​each process stores the independent system call table of each process, and the call table pointer points to the independent system call table of each process.

[0054] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0055] In order to implement the above process running method, this application also proposes a process running device, please refer to Figure 6 , Figure 6 It is a structural diagram of an embodiment of a process running device provided by the present application.

[0056] The process execution device 400 of this embodiment includes a processor 41 , a memory 42 , an input / output device 43 , and a bus 44 .

[0057] The processor 41 , the memory 42 , and the input / output device 43 are respectively connected to the bus 44 . The memory 42 stores program data. The processor 41 is used to execute the program data to implement the process running method described in the above embodiment.

[0058] In the embodiment of the present application, the processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip having the ability to process signals. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 41 may also be any conventional processor, etc.

[0059] This application also provides a computer storage medium, please continue to refer to Figure 7 , Figure 7 It is a structural diagram of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the process running method of the above embodiment.

[0060] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0061] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An isolated core, characterized in that: The isolated core comprises: Physical memory space; A virtual address space of each process, wherein the virtual address space includes a user space and a kernel space, and the user space and the kernel space are respectively mapped to the physical memory space; The kernel space includes an independent mapping area, and the independent mapping area of ​​each process is mapped to an independent physical memory of the physical memory space, and the independent mapping area is used to store independent information of the process running.

2. The isolated core according to claim 1, characterized in that: The kernel space includes a shared mapping area, and the shared mapping area of ​​the kernel space of each process is mapped to the same shared mapping area of ​​the physical memory space; The shared mapping area of ​​the kernel space is used to store a process page table pointer array, and the page table pointer in the process page table pointer array is used to obtain the virtual address mapping relationship of the process.

3. The isolated core according to claim 2, characterized in that: The position of the independent mapping area in the kernel space is located after the position of the shared mapping area.

4. The isolated core according to claim 3, characterized in that: The offset of the independent mapping area is determined by the size of the shared mapping area.

5. The isolated core according to claim 2, characterized in that: The shared mapping area includes a dynamic mapping area and a direct mapping area; Wherein, the process page table pointer array is stored in the dynamic mapping area and / or the direct mapping area.

6. The isolated core according to claim 1, characterized in that: The process running includes a process control block, process resource information, and / or an independent system call table.

7. The isolated core according to claim 6, characterized in that: The independent information of the process running also includes the user group of the process, the mounted file system, and / or network information.

8. A process running method, characterized in that: The process running method is applied to the isolated kernel according to any one of claims 1 to 7, and the process running method comprises: In response to the execution instruction of the process, executing the program of the process; Obtaining a page table pointer array from a shared mapping area, wherein a page table pointer in the page table pointer array is used to obtain a virtual address mapping relationship of a process; According to the physical memory space pointed to by the page table pointer of the page table pointer array, obtaining the independent information stored in the independent mapping area; The process is run based on the independent information of the process running to realize the business function of the process.

9. A process running device, characterized in that: The process running device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the process running method as described in claim 8.

10. A computer storage medium, characterized in that: The computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the process running method as claimed in claim 8.

Citation Information

Patent Citations

  • A method and system for in-process data isolation protection based on a user-level page table

    CN109002706A

  • Kernel data isolation method and system based on multi-kernel page table template

    CN118395421A

  • Object and method for providing efficient multi-user access to shared operating system kernal code using instancing

    US5913230A