Memory security management device and management method for operating system

By introducing memory security management devices into the operating system, including memory management, data security and permission management modules, the problem of lack of data checks and permission control in the existing technology is solved, and higher memory security is achieved.

CN119902996AActive Publication Date: 2025-04-29GUANGZHOU JINQILI INFORMATION TECH CO LTD
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202411964297.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-29
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

The memory management mechanism of existing operating systems lacks effective data checksum permission control, resulting in a high risk of memory damage.

Method used

It provides a memory security management device for an operating system, including a memory management module, a data security module and a permission management module. The memory management module records information by allocating space, including memory security information and permission information. The data security module uses a hash algorithm to generate a unique data signature for verification. The permission management module sets different levels of permissions to prevent out-of-bounds access.

Benefits of technology

Through data checksum permission control, abnormal memory access and out-of-bounds access are effectively avoided, and the security of memory protection is improved.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention relates to the technical field of memory management, in particular to a memory security management device and management method for an operating system. The device comprises a memory management module, a data security module, an authority management module, a log system module and an exception handling module. When the memory management module allocates a memory for a program, space record information is allocated, and the space record information comprises data verification information; after data writing is completed, the data security module verifies the data of the whole memory to generate a data unique signature, and writes the signature into data verification information; when the memory data is accessed, the data security module generates a unique signature for the memory data and compares the unique signature with the signature in the data verification information; if the signatures are consistent, memory access can be normally carried out; if the signatures are inconsistent, the memory access is terminated, and the exception handling module is notified. Abnormal access of the memory can be avoided, and the hidden danger of memory protection is solved. The memory cross-border access is avoided, and the security of memory protection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of memory management, and in particular to a memory security management device and management method for an operating system. Background Art

[0002] The existing operating system's memory management mechanism allows users to flexibly use and manipulate memory. While this mechanism brings convenience to users, it also brings great security risks. With the rapid development of technology, the complexity of software has gradually increased, which has led to a significant increase in the randomness of memory use and a greatly increased risk of memory being damaged, which requires a memory protection mechanism.

[0003] The existing memory protection mechanism usually uses MPU (memory protection unit) to configure memory access rights and boundaries through hardware, uses the built-in mechanism of programming language to prevent cross-boundary access, and manually adds boundary checks. The existing memory protection mechanism can solve some memory risks to a certain extent, but it still lacks memory data verification and permission control. Summary of the invention

[0004] In order to solve the above technical problems existing in the prior art, the present invention provides a memory security management device and management method for an operating system.

[0005] To achieve the above object, the technical solution of the present invention is as follows:

[0006] In a first aspect, the present invention provides a memory security management device for an operating system, comprising a memory management module, a data security module, and an exception handling module; when the memory management module allocates memory for a program, it also allocates space recording information, wherein the space recording information includes memory security information; the memory security information includes data verification information;

[0007] After writing data into the memory, the data security module verifies the data of the entire memory to generate a unique signature for the data, and writes the signature into the data verification information;

[0008] When accessing memory data, the data security module generates a unique signature for the memory data and compares it with the signature in the data verification information;

[0009] If the signatures are consistent, the memory data has not been tampered with and the memory can be accessed normally;

[0010] If the signatures are inconsistent, the memory data has been tampered with, the memory access is terminated, the memory data is discarded, and the exception handling module is notified.

[0011] Furthermore, the data security module uses a data verification algorithm to verify the data in the entire memory to generate a unique data signature, and the data verification algorithm uses a hash algorithm.

[0012] Furthermore, the memory security information also includes a key, an encryption algorithm, and a decryption algorithm.

[0013] Furthermore, when writing data into the memory, the data is encrypted using the encryption algorithm and then written.

[0014] Furthermore, the memory management module divides the memory into a private area and a shared area. The memory applied for in the private area is only accessible to the owner's program, and the memory applied for in the shared area can be given access rights to other programs through an authorization code.

[0015] Furthermore, the memory management module creates a memory address mapping table for each program separately, and maps the memory address into a random virtual memory address when allocating memory, hiding the real memory address.

[0016] Furthermore, the space record information also includes basic memory information, and the basic memory information includes a real memory address and a memory size.

[0017] Furthermore, the memory management module sets memory boundaries through virtual memory addresses and memory sizes to prevent programs from accessing beyond the boundaries.

[0018] Furthermore, the space record information also includes memory permission information, and the memory security management system also includes a permission management module, and the permission management module is used to record and manage the memory permission information; the memory permission information includes owner information and authorization information;

[0019] The authorization information includes: program ID, thread ID, authorization code, permission bit mask, and program startup time;

[0020] The permission bit mask is used to define different access permissions:

[0021] 0b0001: read only,

[0022] 0b0010: writable,

[0023] 0b0100: executable,

[0024] 0b1000: Administrator privileges;

[0025] When a program requests to access memory data, the authorization information is verified first. If the request information matches the authorization information, the operation is allowed.

[0026] If there is a mismatch, the memory access is terminated and the exception handling module is notified.

[0027] Furthermore, the administrator rights include:

[0028] Set the read, write, and execute permissions of the child thread. The child thread does not inherit permissions by default and needs to be set by the main thread when creating the child thread;

[0029] Randomly generate a unique authorization code to authorize third-party programs to read, write, and execute shared memory;

[0030] Cancel the authorization code of the third-party program.

[0031] Furthermore, after the third-party program obtains the authorization of the shared memory through the authorization code, it automatically obtains the administrator privileges, and only has the privileges to set the read, write, and execute privileges of the child threads in the administrator privileges.

[0032] Furthermore, the owner information includes: program ID, main thread ID, parent program ID, owner ID, group ID, and program start time.

[0033] Furthermore, the memory security management system also includes a log system module, which is used to create a log file, and the log file records the memory information requested by the program and the memory usage log information.

[0034] Furthermore, the content in the log file is encrypted by a data security module and then saved in the log file.

[0035] In a second aspect, the present invention provides a memory security management method, which is managed using the above-mentioned memory security management system, and the memory security management method includes:

[0036] Assume that program B wants to access some memory information in program A.

[0037] First, program A generates an authorization code. During the process of generating the authorization code, the characteristic information of program B is specified internally and the authorization code is saved on the server. The characteristic information is the memory permission information.

[0038] Then, when program B wants to access, the server will extract the feature information of program B, compare it with the internal information of the authorization code generated by program A, verify whether authorization is required, and grant the corresponding permissions;

[0039] If the verification is successful, program B can access program A. During the data access process, the memory management module is used to allocate memory, and the data security module is used to ensure data security during the memory data access process.

[0040] During the entire access process, the abnormal data module performs full-cycle monitoring.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] The memory security management device and management method of the operating system provided by the present invention provide security protection for the data access process through a data security module. When writing data, the data security module generates a unique signature for the memory data. When accessing data, a unique signature is also generated and compared with the signature recorded in the memory. If the signatures are consistent, normal access is possible. Therefore, the memory security management system provided by the present invention has a data verification step, which can avoid abnormal memory access and solve the hidden dangers of memory protection.

[0043] In addition, the present invention sets different levels of permissions through a permission management module to avoid out-of-bounds access to memory and improve the security of memory protection. DETAILED DESCRIPTION

[0044] The technical solution of the present invention will be clearly described below. Obviously, the described embodiments are not all embodiments of the present invention. All other embodiments obtained by ordinary technicians in this field without making creative work are within the protection scope of the present invention.

[0045] It should be noted that, unless otherwise specifically stated, the relative arrangements of components and steps, and numerical expressions set forth in these embodiments should not be construed as limiting the scope of the present invention.

[0046] The following description of the exemplary embodiments is merely illustrative and is not intended to limit the present invention and its application or use in any sense. Techniques, methods and devices known to ordinary technicians in the relevant field may not be discussed in detail here, but where applicable, these techniques, methods and devices should be considered as part of this specification.

[0047] Embodiment 1

[0048] This embodiment provides a memory security management device for an operating system, including a memory management module, a data security module, a permission management module, a log system module and an exception handling module.

[0049] Memory management module

[0050] The memory management module divides the memory into two areas, a private area and a shared area. The memory management module creates a memory address mapping table for each program separately. When allocating memory from the private area or the shared area, the memory address is mapped into a random virtual memory address to hide the real memory address; wherein the memory address mapping table records the mapping relationship between the virtual memory address and the real memory address.

[0051] After the memory is allocated, the owner is the main thread of the program that applies for the memory. The memory applied for in the privacy area is only accessible to the owner's program. The memory applied for in the shared area can be given access rights to other programs through the authorization code.

[0052] Each time memory is allocated, additional memory information of the space record is allocated, which can be called space record information, including basic memory information, memory security information, and memory permission information; the basic memory information includes the real memory address and memory size.

[0053] In addition, the memory management module sets memory boundaries through virtual memory addresses and memory sizes to prevent programs from accessing beyond the boundaries.

[0054] When the program actively releases memory or the program exits normally, the memory management module cleans up the memory requested by the program and the memory information, including basic memory information, memory security information and memory permission information.

[0055] Data security module

[0056] The data security module records memory security information for each allocated memory block, and the memory security information includes: data verification information, key, encryption algorithm, and decryption algorithm; when allocating memory, the data security module writes the encryption / decryption algorithm and the generated key into the memory security information, and the subsequent data encryption / decryption is completed by the key and encryption / decryption algorithm. Among them, the encryption / decryption algorithm can select an existing mainstream algorithm or a custom algorithm.

[0057] When writing data to the memory, the data security module encrypts the data before writing it. After the data is written, the data verification algorithm is used to verify the data in the entire memory to generate a unique signature for the data, and the signature is written into the data verification information; the data verification algorithm preferably uses a hash algorithm, such as the SHA-256 algorithm, which can quickly generate a unique signature.

[0058] When accessing memory data, a unique signature is generated for the memory data through a data verification algorithm and compared with the signature of the data verification information. If the signatures are consistent, the memory data has not been tampered with and memory access can be performed normally; if the signatures are inconsistent, the memory data has been tampered with, memory access is terminated, the memory data is discarded, and the exception handling module is notified.

[0059] Permission management module

[0060] The permission management module records memory permission information for each block of allocated memory, and the memory permission information includes owner information and authorization information; the owner information includes: program ID, main thread ID, parent program ID, owner ID, group ID, and program start time; the permission management module creates a permission table for each block of allocated memory to record the memory authorization information; each piece of permission information in the permission table includes: program ID, thread ID, authorization code, permission bit mask, and program start time.

[0061] The permission bits use bit masks to define different access permissions:

[0062] 0b0001: Read only

[0063] 0b0010: Writable

[0064] 0b0100: executable

[0065] 0b1000: Administrator privileges

[0066] The corresponding data position 1 indicates that the permission is possessed;

[0067] Administrator privileges are exclusive to the main thread of the program, and administrator privileges have three privileges:

[0068] (1) Set the read / write / execute permissions of the child thread. The child thread does not inherit permissions by default and needs to be set by the main thread when creating the child thread;

[0069] (2) Randomly generate a unique authorization code to authorize the third-party program to read / write / execute shared memory;

[0070] (3) Cancel the authorization code of the third-party program;

[0071] After the third-party program obtains the authorization of the shared memory through the authorization code, it automatically obtains the administrator's privileges and has the first privilege of the administrator, but cannot have other privileges of the administrator.

[0072] When the main thread authorizes the child thread to share memory, it cannot exceed its own permissions. For example, the main thread has read permission and can only authorize read permission for the child thread, but cannot authorize other permissions.

[0073] When a program requests to access memory data, it first checks the information in the memory permission table. The operation is allowed only when the request information matches the information in the memory permission table. If they do not match, the memory access is terminated and the exception handling module is notified.

[0074] Log system module

[0075] The log system module creates a log file based on the program, and records the memory information requested by the program and the memory usage log information; wherein the log content is encrypted by the data security module and then saved in the log file.

[0076] Exception handling module

[0077] The exception handling module monitors the entire life cycle of each memory block from allocation to release;

[0078] The exception handling module has a program blacklist. When it detects abnormal access such as memory out-of-bounds access and unauthorized access, it will record the information of the program that made the abnormal access on the blacklist. All programs on the blacklist are prohibited from accessing memory data.

[0079] When the program exits, the exception handling module notifies other modules to clean up the memory; when the program exits abnormally, the memory data is dumped and saved to a file before cleaning up the memory. The log file and memory data dump file can be decrypted later to analyze the cause of the program exception.

[0080] Embodiment 2

[0081] This embodiment provides a memory security management method for an operating system, which is managed using the memory security management device provided in the first embodiment. The memory security management method includes:

[0082] Assume that program B wants to access some memory information in program A.

[0083] First, program A generates an authorization code. During the process of generating the authorization code, the characteristic information of program B will be specified internally, and the authorization code will be saved on the server. The characteristic information is the memory permission information, including: owner information, authorization information; the owner information includes: program ID, main thread ID, parent program ID, owner ID, group ID, and program startup time; when program A generates the authorization code, preliminary permission information will be generated, which can be modified and adjusted according to actual conditions later.

[0084] Then, when program B wants to access, the server will extract the characteristic information of program B and compare it with the internal information of the authorization code generated by program A to verify whether authorization is required and grant the corresponding permissions. The permission bits use bit masks to define different access permissions:

[0085] 0b0001: Read only

[0086] 0b0010: Writable

[0087] 0b0100: executable

[0088] 0b1000: Administrator privileges

[0089] The corresponding data position 1 indicates that the permission is possessed.

[0090] Afterwards, if the verification is passed, program B can access the shared content. At this time, the memory management module allocates memory during the data access process. During the data access process, the data security module provides data security for the memory data access process, and each allocated memory records memory security information. The memory security information includes: data verification information, key, encryption / decryption algorithm. When allocating memory, the encryption / decryption algorithm and the generated key are written into the memory security information, and the subsequent data encryption / decryption is completed by the key and encryption / decryption algorithm. When writing data to the memory, the data is encrypted before writing. After the data is written, the data verification algorithm is used to verify the data of the entire memory block to generate a unique data signature, and the signature is written into the data verification information. The entire access process is monitored by the exception handling module throughout the cycle.

[0091] If the verification fails, the memory access is terminated and the exception handling module is notified.

[0092] The above specific implementation methods are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to examples, a person skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A memory security management device for an operating system, characterized in that: Including memory management module, data security module, and exception handling module; When the memory management module allocates memory for a program, it also allocates space record information, where the space record information includes memory security information; The memory security information includes data verification information; After writing data into the memory, the data security module verifies the data of the entire memory to generate a unique signature for the data, and writes the signature into the data verification information; When accessing memory data, the data security module generates a unique signature for the memory data and compares it with the signature in the data verification information; If the signatures are consistent, the memory data has not been tampered with and the memory can be accessed normally; If the signatures are inconsistent, the memory data has been tampered with, the memory access is terminated, the memory data is discarded, and the exception handling module is notified.

2. The memory security management device according to claim 1, characterized in that: The data security module uses a data verification algorithm to verify the data of the entire memory and generate a unique data signature, and the data verification algorithm uses a hash algorithm.

3. The memory security management device according to claim 1, characterized in that: The memory security information also includes keys, encryption algorithms, and decryption algorithms; When writing data into the memory, the data is encrypted using the encryption algorithm and then written.

4. The memory security management device according to claim 1, characterized in that: The memory management module divides the memory into a private area and a shared area. The memory applied for in the private area is only accessible to the owner's program, and the memory applied for in the shared area can be given access rights to other programs through an authorization code. The memory management module creates a memory address mapping table for each program separately, and maps the memory address into a random virtual memory address when allocating memory, hiding the real memory address; The space record information also includes basic memory information, and the basic memory information includes real memory address and memory size.

5. The memory security management device according to claim 1, characterized in that: The memory management module sets the memory boundary through the virtual memory address and memory size to prevent the program from accessing beyond the boundary.

6. The memory security management device according to claim 1, characterized in that: The space record information also includes memory permission information, and the memory security management system also includes a permission management module, which is used to record and manage memory permission information; the memory permission information includes owner information and authorization information; The authorization information includes: program ID, thread ID, authorization code, permission bit mask, and program startup time; The permission bit mask is used to define different access permissions: 0b0001: read only, 0b0010: writable, 0b0100: executable, 0b1000: Administrator privileges; When a program requests to access memory data, the authorization information is verified first. If the request information matches the authorization information, the operation is allowed. If there is a mismatch, the memory access is terminated and the exception handling module is notified.

7. The memory security management device according to claim 6, characterized in that: The administrator rights include: Set the read, write, and execute permissions of the child thread. The child thread does not inherit permissions by default and needs to be set by the main thread when creating the child thread; Randomly generate a unique authorization code to authorize third-party programs to read, write, and execute shared memory; Cancel the authorization code of the third-party program.

8. The memory security management device according to claim 7, characterized in that: After the third-party program obtains the authorization of the shared memory through the authorization code, it automatically obtains the administrator privileges and only has the privileges to set the read, write, and execute privileges of the child threads in the administrator privileges.

9. The memory security management device according to claim 1, characterized in that: The memory security management system also includes a log system module, which is used to create a log file, and the log file records the memory information requested by the program and the memory usage log information; The content in the log file is encrypted by the data security module and then saved in the log file.

10. A memory security management method for an operating system, using the memory security management device according to any one of claims 1 to 9 for management, characterized in that: The memory safety management method comprises: Assume that program B wants to access some memory information in program A. First, program A generates an authorization code. During the process of generating the authorization code, the characteristic information of program B is specified internally and the authorization code is saved on the server. The characteristic information is the memory permission information. Then, when program B wants to access, the server will extract the feature information of program B, compare it with the internal information of the authorization code generated by program A, verify whether authorization is required, and grant the corresponding permissions; If the verification is successful, program B can access program A. During the data access process, the memory management module is used to allocate memory, and the data security module is used to ensure data security during the memory data access process. During the entire access process, the abnormal data module performs full-cycle monitoring.

Citation Information

Patent Citations

  • Protection method for memory data in Android system

    CN102708069A

  • Method for accessing shared memory

    CN105760217A

  • Write border crossing detection method and device for heap memory

    CN110413521A

  • Shared memory permission configuration method, memory unit and system

    CN113849428A

  • Network office official document authorization approval method based on authorization code

    CN114884681A