Authority control method, authority control device and computer storage medium
By generating independent system call tables and independent mapping areas for each process, the existing operating system permission control vulnerability is solved, and higher security and attack difficulty is achieved to prevent hackers from elevating rights.
Patent Information
- Application Number
- CN202411481321.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-10-23
AI Technical Summary
There are vulnerabilities in the permission control of existing operating systems, and hackers can increase their authority through these vulnerabilities, obtain the highest authority, and threaten the system security.
Generate an independent system call table for each process, exposing only the system call interfaces known in the compilation stage, and implementing permission control through the independent mapping area and process control block of the kernel, reducing kernel exposure.
By generating a minimized system call table, the difficulty of hacker attacks is improved, the security of the system is improved, and the security of the system is prevented from secure escape and overall system attacks.
Smart Images

Figure CN119004420A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of operating system kernel design, and in particular to a permission control method, a permission control device and a computer storage medium. Background Art
[0002] The existing process permission control is mainly based on user permissions. Root has the highest permissions, and other users will have limited permissions, so when executing certain advanced instructions, "Permission denied" will be prompted. The legitimacy of the current operation can be judged by the ownership information of the file, whether it has execution permissions, whether certain operations require root permissions, etc.
[0003] Although Linux's permission management is relatively mature, in actual use, hackers are still found to use certain vulnerabilities to elevate privileges, thereby obtaining the highest privileges of the target system and controlling the entire system, causing a great threat to the security of the kernel. Summary of the invention
[0004] In order to solve the above technical problems, the present application proposes a permission control method, a permission control device and a computer storage medium.
[0005] In order to solve the above technical problems, the present application proposes a permission control method, which includes: In response to the execution instruction of the process, executing the program of the process; Reading an independent system call table corresponding to the program, wherein an independent system call table is generated corresponding to each process; The system call interface of the kernel is called based on the independent system call table to implement the business function of the process.
[0006] Wherein, the reading of the independent system call table corresponding to the program includes: Reading a process control block corresponding to the program; The independent system call table is obtained through the process control block.
[0007] The system call interface of calling the kernel based on the independent system call table includes: Obtaining a function pointer in the independent system call table; According to the physical address pointed to by the function pointer, the corresponding system call interface is called from the kernel.
[0008] Wherein, the permission control method further includes: In response to the compilation instruction of the process, obtaining the system call interface required by the process to implement the business function; Based on the required system call interface, obtain the system call number and generate a system call number table; The system call number table is written into the header of the program.
[0009] Wherein, the permission control method further includes: In response to a start instruction of the process, the independent system call table is generated based on the system call number table.
[0010] The independent system call table is stored in the process control block or independent memory space of the program.
[0011] Wherein, the independent system call table is a pointer array; Wherein, the pointer array includes the sequence number of the system call interface required by the process and its function pointer; Alternatively, the pointer array includes serial numbers of all system call interfaces and function pointers corresponding to the serial numbers of the system call interfaces required by the process, and the serial numbers of the system call interfaces not required by the process record null pointers.
[0012] The address space of the kernel opens up an independent mapping area for each process, and the independent mapping area for each process stores an independent system call table for each process; The reading of the independent system call table corresponding to the program includes: In the independent mapping area of the program, extracting the logical address of the independent system call table in the kernel; Converting the logical address to a physical address of the kernel through a memory management unit of the kernel; The physical memory of the kernel is accessed according to the physical address, and the independent system call table of the program is extracted.
[0013] To solve the above technical problems, the present application also proposes a permission control 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 permission control 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 permission control method.
[0015] Compared with the prior art, the beneficial effects of the present application are: the permission control device responds to the running instruction of the process and runs the program of the process; reads the independent system call table corresponding to the program, wherein each process generates an independent system call table; based on the independent system call table, the system call interface of the kernel is called to realize the business function of the process. Through the above permission control method, a minimized system call table is generated for each process, so that the process can only access the kernel through these system call interfaces known in the compilation stage, reducing the exposure of the kernel and increasing the difficulty for hackers to attack. 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 flowchart of an embodiment of a permission control method provided by the present application; Figure 2 It is a schematic diagram of the overall process of system call clipping in the compilation stage and the running stage provided by this application; Figure 3 It is a schematic diagram of a scheme for making a system call through a process control block provided by the present application; Figure 4 yes Figure 1 The specific flow chart of step S12 of the permission control method shown; Figure 5 This is a schematic diagram of a process accessing a kernel scenario provided by this application; Figure 6 It is a schematic diagram of the kernel address space provided by this application; Figure 7 It is a schematic diagram of the scenario of the page table pointer array provided by this application; Figure 8 This is a schematic diagram of the memory application and release scenario provided by this application; Fig. 9 It is a flowchart of another embodiment of the permission control method provided by the present application; Fig.10 It is a structural diagram of an embodiment of a permission control device provided by the present application; Fig.11 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 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 security 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.
[0020] 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.
[0021] Please refer to Figure 1 and Figure 2 , Figure 1 is a flowchart of an embodiment of a permission control method provided by the present application. Figure 2 It is a schematic diagram of the overall process of system call clipping in the compilation stage and the running stage provided by this application.
[0022] like Figure 2As shown, with the assistance of the two links of compilation and running, this application realizes the control of the 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.
[0023] The permission control method of the present application is applied to a permission control device, wherein the permission control 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 permission control device, such as various units, subunits, modules, and submodules, 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.
[0024] 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.
[0025] like Figure 1 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.
[0026] In the embodiments of the present application, Figure 2 In the running phase shown, in response to the running instruction of the target process, the permission control device runs the program of the process.
[0027] Step S12: Reading an independent system call table corresponding to the program, wherein an independent system call table is generated corresponding to each process.
[0028] In the embodiment of the present application, the permission control 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, so that each process has a corresponding independent system call table.
[0029] 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.
[0030] In a specific implementation scheme, when a system call occurs, the permission control device finds the data structure corresponding to the process, finds the system call table, and completes the system call according to the system call table.
[0031] Specifically, see Figure 3 , Figure 3 Schematic diagram of the scheme for making system calls through process control blocks provided by this application. In the kernel, process 1 has independent and shared data structures, such as Figure 3 The process control block (PCB) 1 in the process is used to store the system call table unique to process 1. Figure 3 It can be seen that the independent system call table of PCB1 of process 1 includes system call interfaces such as system call 1, system call 3, system call 6, system call 11, system call 16, etc., while the independent system call table of PCB2 of process 2 includes system call interfaces such as system call 1, system call 6, system call 9, system call 12, system call 15, etc. By comparison, it can be seen that the independent system call table of each process does not need to record all interfaces provided by the system, but only needs to record the interfaces used to implement the functions required by the process tasks. By limiting the number of interfaces exposed by the kernel to the process when executing the process, the kernel space can be effectively protected.
[0032] Furthermore, a specific implementation form of the system call table of the present application is a function pointer array, which is expressed as follows:
[0033] Another representation of the function pointer array of this application is as follows:
[0034] For system call interfaces that are not needed by the process, the corresponding pointers are set to null pointers.
[0035] Each system call number has a corresponding function pointer, and the function pointer indicates the address mapping relationship of the system call interface corresponding to the system call number. Therefore, the permission control device can search for the physical address of the system call interface in the kernel according to the virtual address of the system call table and the address mapping relationship in the function pointer, thereby completing the call to the system call interface.
[0036] Furthermore, since data structures such as process control blocks may contain other information, such as information related to the process, such as process ID, process status, physical address of the process, scheduling information of the process, etc. Therefore, in order to improve the efficiency of interface calls, the present application can also set pointers in fixed fields of data structures, and search the specific location of the system call table in the process control block through pointers. The search method using pointers is also applicable to system call tables of different sizes. Since the number of interfaces required to be called by each process may be different, the size of the system call table may also be different. Using the starting position and end position specified by the pointer can improve the search efficiency of the system call table.
[0037] In the implementation of the above solution, since each process can see the same kernel space, each process can still read the system call table of other processes and use the system call table of other processes to execute the corresponding system call.
[0038] Therefore, this application further proposes another implementation scheme, please refer to Figure 4 and Figure 5 , Figure 4 yes Figure 1 The specific flow chart of step S12 of the permission control method is shown in FIG. Figure 5 This is a schematic diagram of a scenario in which a process accesses a kernel provided by this application.
[0039] like Figure 4 As shown, the specific steps are as follows: Step S121: In the independent mapping area of the program, extract the logical address of the independent system call table in the kernel.
[0040] In the embodiments of the present application, Figure 5 As shown, this application opens up a separate mapping area for each process in the kernel address space, namely Figure 5 An area for storing independent system call tables. The independent mapping area is characterized in that although the logical addresses of each process are the same, the physical addresses of their mappings are different. Therefore, the present application can uniformly store the system call tables of each process after clipping at the same address of the independent mapping area.
[0041] Step S122: Access the physical memory of the kernel according to the logical address, and extract the independent system call table of the program.
[0042] In an embodiment of the present application, 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.
[0043] 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.
[0044] 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.
[0045] 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.
[0046] Please refer to Figure 6 , Figure 6 This is a schematic diagram of the kernel address space provided by this application. Figure 6 As shown in the figure, since each process has an independent kernel mapping area, many original independent information of the process 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 creates a process page table pointer array in the kernel direct mapping area, such as Figure 7 As shown, Figure 7 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.
[0047] 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 different kernels, this value can be adjusted according to the size of the public mapping area, which is suitable for different business scenarios.
[0048] 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.
[0049] For example, Figure 6 The 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 non-independent mapping area needs to be synchronized. For details, please refer to Figure 8 , Figure 8 This is a schematic diagram of the memory application and release scenario provided by this application. Independent mapping areas also need to be completed by new application and release functions (imalloc, ifree). Unlike vmalloc, the address mapping relationship of its memory application is only written to the independent mapping area of the corresponding process, thereby maintaining the independence of the memory in this 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.
[0050] 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.
[0051] Step S13: calling the kernel's system call interface based on the independent system call table to implement the business functions of the process.
[0052] In an embodiment of the present application, the present application utilizes an independent system call table to call the kernel's system call interface, thereby realizing the business functions of the process.
[0053] In the present application, the permission control device responds to the running instruction of the process, runs the program of the process; reads the independent system call table corresponding to the program, wherein each process generates an independent system call table; based on the independent system call table, calls the system call interface of the kernel to implement the business function of the process. Through the above permission control method, a minimized system call table is generated for each process, so that the process can only access the kernel through these system call interfaces known in the compilation stage, reducing the exposure of the kernel and increasing the difficulty for hackers to attack.
[0054] 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.
[0055] This application adds an independent mapping area to the kernel, so that each process has an independent space in the kernel state, which facilitates the isolation of some kernel resources and improves the security of the system.
[0056] Please continue reading Figure 2 and Fig. 9 , Fig. 9 It is a flowchart of another embodiment of the permission control method provided by the present application.
[0057] like Fig. 9 As shown, the specific steps are as follows: Step S21: In response to the compilation instruction of the process, a system call interface required by the process to implement a business function is obtained.
[0058] Step S22: Based on the required system call interface, obtain the system call number and generate a system call number table.
[0059] Step S23: Write the system call number table into the program header.
[0060] In the embodiment of the present application, during the process of compiling the process, the permission control device collects the system call number of the required system interface by analyzing the function of the process, thereby generating an independent system call number table for each process and writing it into the header of the program of the process. Those skilled in the art can understand that in the above method of the specific implementation, the writing order of each step does not mean a strict execution order and constitutes any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0061] Furthermore, during the startup or loading phase of the process, the kernel generates an independent system call table for the program (process) based on the system call number table formed during the program compilation phase.
[0062] In order to implement the above-mentioned permission control method, this application also proposes a permission control device, please refer to Fig.10 , Fig.10 It is a structural diagram of an embodiment of a permission control device provided in this application.
[0063] The authority control device 400 of this embodiment includes a processor 41 , a memory 42 , an input / output device 43 , and a bus 44 .
[0064] 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, and the processor 41 is used to execute the program data to implement the permission control method described in the above embodiment.
[0065] 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.
[0066] This application also provides a computer storage medium, please continue to refer to Fig.11 , Fig.11 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 permission control method of the above embodiment.
[0067] 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.
[0068] 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. A permission control method, characterized in that: The permission control method comprises: In response to the execution instruction of the process, executing the program of the process; Reading an independent system call table corresponding to the program, wherein an independent system call table is generated corresponding to each process; The system call interface of the kernel is called based on the independent system call table to implement the business function of the process.
2. The permission control method according to claim 1, characterized in that: The reading of the independent system call table corresponding to the program includes: Reading a process control block corresponding to the program; The independent system call table is obtained through the process control block.
3. The permission control method according to claim 2, characterized in that: The system call interface for calling the kernel based on the independent system call table includes: Obtaining a function pointer in the independent system call table; According to the physical address pointed to by the function pointer, the corresponding system call interface is called from the kernel.
4. The permission control method according to claim 1, characterized in that: The permission control method further includes: In response to the compilation instruction of the process, obtaining the system call interface required by the process to implement the business function; Based on the required system call interface, obtain the system call number and generate a system call number table; The system call number table is written into the header of the program.
5. The permission control method according to claim 4, characterized in that: The permission control method further includes: In response to a start instruction of the process, the independent system call table is generated based on the system call number table.
6. The permission control method according to claim 5, characterized in that: The independent system call table is stored in the process control block or independent memory space of the program.
7. The permission control method according to claim 5 or 6, characterized in that: The independent system call table is a pointer array; Wherein, the pointer array includes the sequence number of the system call interface required by the process and its function pointer; Alternatively, the pointer array includes serial numbers of all system call interfaces and function pointers corresponding to the serial numbers of the system call interfaces required by the process, and the serial numbers of the system call interfaces not required by the process record null pointers.
8. The permission control method according to claim 6, characterized in that: The address space of the kernel opens up an independent mapping area for each process, and the independent mapping area for each process stores an independent system call table for each process; The reading of the independent system call table corresponding to the program includes: In the independent mapping area of the program, extracting the logical address of the independent system call table in the kernel; Converting the logical address to a physical address of the kernel through a memory management unit of the kernel; The physical memory of the kernel is accessed according to the physical address, and the independent system call table of the program is extracted.
9. A permission control device, characterized in that: The authority control 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 permission control method as described in any one of claims 1 to 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 permission control method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
File protection method and apparatus
CN105653937A
Executing system calls in isolated address space in operating system kernel
CN113711182A
Printer watermark adding method and device based on Linux kernel management and control
CN116483294A
Resource access method and device
CN118069386A
Managing Memory
US20110125812A1
