GBase 8s Database Out-of-Bounds Location Method and System

By adjusting the memory allocator of the GBase8s database and optimizing the memory management strategy, the ASAN memory error checker works in concert with the GBase8s database, solving the problem that the ASAN memory error checker cannot be directly introduced, and the effective out-of-bounds positioning of the GBase8s database is achieved, and the stability and reliability of the database are improved.

CN120029859BActive Publication Date: 2025-07-08TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510512121.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-07-08
Estimated Expiration
2045-04-23

AI Technical Summary

Technical Problem

The existing ASAN memory error checker cannot be directly introduced into the GBase8s database system, resulting in the inability to effectively locate memory out-of-bounds problems, affecting the stability and reliability of the database.

Method used

By adjusting the memory allocator of the GBase8s database, especially the pool memory allocator and heap memory allocator, the memory management strategy is optimized, so that it works in conjunction with the ASAN memory error checker, the shared memory space is used for out-of-bounds detection, ensuring that the data memory segment is accessible, other memory segments are inaccessible, and the out-of-bounds detection is achieved through the address mapping table.

Benefits of technology

The ASAN memory error checker works in collaboration with the GBase8s database, improves the stability and reliability of the database, can effectively locate memory out-of-bounds problems, and reduces unnecessary alarm information caused by too strict detection rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029859B_ABST
    Figure CN120029859B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for out-of-bounds positioning of a GBase8s database, including: applying for an allocatable memory space from the segment memory space of the GBase8s database, and applying for a target memory space for a specified program from the allocatable memory space; using the allocatable memory space and / or the target memory space as the memory space to be checked, and performing protection processing on the memory space to be checked; mapping the shared memory space of the GBase8s database to the corresponding shadow memory space of the memory space to be checked; if an access request is received, detecting whether there is an out-of-bounds problem with the access request based on the shared memory space through an ASAN memory error checker to obtain an out-of-bounds detection result. The present invention can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database and achieve collaborative work between the two.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and in particular, to a method and system for out-of-bounds positioning of GBase8s databases. Background Art

[0002] During the operation of a database, memory errors are a common and troublesome problem, and out-of-bounds problems are particularly prominent. In traditional database systems, when dealing with a large amount of data and complex business logic, due to improper memory management, pointer operation errors, etc., out-of-bounds memory access is likely to occur. Such memory errors not only lead to serious consequences such as data loss and system crashes, but also, due to their randomness and concealment, it is often difficult to quickly and accurately locate the root cause of the problem. Some existing debugging methods and tools have limited effects when facing complex database memory errors and cannot effectively help developers and operators discover and solve out-of-bounds problems in a timely manner, posing a huge challenge to the stable operation and maintenance of database systems.

[0003] To solve the problems existing in the process of database out-of-bounds positioning, related technologies have proposed the ASAN (AddressSanitizer) memory error checker. However, when introducing the ASAN memory error checker into the GBase8s database system, there is a problem of model mismatch, resulting in the inability to directly introduce the ASAN memory error checker, that is, the ASAN memory error checker cannot be used to locate out-of-bounds problems for the GBase8s database system. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method and system for out-of-bounds positioning of GBase8s databases, which can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database, realize the collaborative work between the two, and then effectively use the ASAN memory error checker to perform out-of-bounds positioning on the GBase8s database, improving the stability and reliability of the GBase8s database.

[0005] In a first aspect, the present invention provides a method for out-of-bounds positioning of a GBase8s database. The method is applied to a GBase8s database and includes:

[0006] Apply for an allocatable memory space from the segment memory space of the GBase8s database, and apply for a target memory space for a specified program from the allocatable memory space;

[0007] Use the allocatable memory space and / or the target memory space as the memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment in the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state;

[0008] Map the shared memory space of the GBase8s database to the corresponding shadow memory space of the memory space to be checked. The shadow memory space represents the accessible status of each memory address in the memory space to be checked through tags;

[0009] If an access request for the data memory segment in the memory space to be checked is received, use the ASAN memory error checker to detect whether there is an out-of-bounds problem with the access request based on the shared memory space, and obtain an out-of-bounds detection result.

[0010] In one implementation, a pool memory allocator is configured in the GBase8s database;

[0011] Apply for an allocable memory space from the segment memory space of the GBase8s database, including:

[0012] Receive a memory application request sent by a specified program through the pool memory allocator, and apply for an allocable memory space from the segment memory space of the GBase8s database;

[0013] Perform protection processing on the memory space to be checked, including:

[0014] Execute the following operations through the pool memory allocator: perform a filling operation on each memory segment in the allocable memory space to make each memory segment in the allocable memory space in an inaccessible state; perform a recovery operation on the data memory segment in the allocable memory space to make the data memory segment in the allocable memory space in an accessible state.

[0015] In one implementation, a heap memory allocator is configured in the GBase8s database;

[0016] Apply for a target memory space for a specified program from the allocable memory space, including:

[0017] Apply for a target memory space for a specified program from the allocable memory space through the heap memory allocator. The size of the data memory segment in the target memory space is the same as the memory size carried in the memory application request;

[0018] Perform protection processing on the memory space to be checked, including:

[0019] Perform the following operations through the heap memory allocator: fill each memory segment in the target memory space so that each memory segment in the target memory space is in an inaccessible state; determine the actual memory size to be allocated according to the memory size carried in the memory application request, where the actual memory size to be allocated includes the size of the data memory segment and the size of the protection memory segment; divide the data memory segment and the protection memory segment from the target memory space according to the size of the data memory segment and the size of the protection memory segment; perform a recovery operation on the data memory segment in the target memory space so that the data memory segment in the target memory space is in an accessible state.

[0020] In one implementation, mapping the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked includes:

[0021] Determine the starting memory address of the shared memory space and the memory size of the shared memory space from the high memory space of the ASAN memory error checker;

[0022] Create a shared memory space in the high memory space based on the starting memory address and the memory size of the shared memory space;

[0023] For any memory address in the shared memory space, determine the memory address that has a mapping relationship with this memory address from the shadow memory space corresponding to the memory space to be checked, so as to determine the address mapping table between the shared memory space and the shadow memory space.

[0024] In one implementation, record the memory address in the shared memory space as the shared memory address, and record the memory address in the shadow memory space as the shadow memory address; through the ASAN memory error checker, detect whether there is an out-of-bounds problem with the access request based on the shared memory space, and obtain the out-of-bounds detection result, including:

[0025] Perform the following operations on any memory address to be accessed within the memory range to be accessed carried in the access request:

[0026] Through the ASAN memory error checker, access the target shared memory address corresponding to this memory address to be accessed based on the address mapping table, determine multiple target shadow memory addresses that have a mapping relationship with the target shared memory address based on the address mapping table, and detect whether there is an out-of-bounds problem with this memory address to be accessed according to the marks of the target shadow memory addresses.

[0027] In one embodiment, the allocatable memory space includes a plurality of allocatable sub - memory spaces, and each allocatable sub - memory space is divided into a Block header memory segment, a data memory segment, and an Align Padding memory segment; detecting whether there is an out - of - bounds problem for the to - be - accessed memory address according to the mark of the target shadow memory address includes:

[0028] If, according to the mark of the target shadow memory address, it is determined that the Block header memory segment within the corresponding allocatable sub - memory space of the to - be - accessed memory range is accessed, then it is determined that there is an out - of - bounds problem for the to - be - accessed memory address;

[0029] If, according to the mark of the target shadow memory address, it is determined that the Align Padding memory segment within the corresponding allocatable sub - memory space of the to - be - accessed memory range is accessed, or the Block header memory segment within the adjacent next allocatable sub - memory space is accessed, then it is determined that there is an out - of - bounds problem for the to - be - accessed memory address.

[0030] In one embodiment, the target memory space includes a plurality of target sub - memory spaces. The target sub - memory space at the head includes a heap memory segment, a data memory segment, an Align Padding memory segment, and a protection memory segment, and the other target sub - memory spaces all include a data memory segment, an Align Padding memory segment, and a protection memory segment; detecting whether there is an out - of - bounds problem for the to - be - accessed memory address according to the mark of the target shadow memory address further includes:

[0031] If, according to the mark of the target shadow memory address, it is determined that the heap memory segment within the corresponding target sub - memory space of the to - be - accessed memory range is accessed, or the protection memory segment within the adjacent previous target sub - memory space is accessed, then it is determined that there is an out - of - bounds problem for the to - be - accessed memory address;

[0032] If, according to the mark of the target shadow memory address, it is determined that the Align Padding memory segment or the protection memory segment within the corresponding target sub - memory space of the to - be - accessed memory range is accessed, then it is determined that there is an out - of - bounds problem for the to - be - accessed memory address.

[0033] In a second aspect, the present invention further provides a GBase8s database out - of - bounds location system. The system is applied to the GBase8s database, and the system includes:

[0034] A memory application module, configured to apply for an allocatable memory space from the segment memory space of the GBase8s database, and apply for a target memory space for a specified program from the allocatable memory space;

[0035] A memory processing module, configured to use an allocable memory space and / or a target memory space as a memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment in the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state;

[0036] A memory mapping module, configured to map the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked, and the shadow memory space represents the accessible state of each memory address in the memory space to be checked through tags;

[0037] An out-of-bounds location module, configured to, if an access request for the data memory segment in the memory space to be checked is received, detect whether there is an out-of-bounds problem with the access request based on the shared memory space through an ASAN memory error checker, and obtain an out-of-bounds detection result.

[0038] In a third aspect, the present invention further provides a server, including a processor and a memory, where the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method according to any one of the first aspect.

[0039] In a fourth aspect, the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method according to any one of the first aspect.

[0040] A method and system for out-of-bounds location of GBase8s database provided by the present invention. First, allocate available memory space from the segment memory space of the GBase8s database, and allocate target memory space for a specified program from the available memory space. Then, use the available memory space and / or the target memory space as the memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment in the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state. Next, map the shared memory space of the GBase8s database to the corresponding shadow memory space of the memory space to be checked, and the shadow memory space represents the accessible state of each memory address in the memory space to be checked through tags. Finally, if an access request for the data memory segment in the memory space to be checked is received, use the ASAN memory error checker to detect whether there is an out-of-bounds problem with the access request based on the shared memory space, and obtain an out-of-bounds detection result. The above method adjusts and optimizes the memory allocator of the GBase8s database. After applying for the available memory space and the target memory space, protection processing is performed on the available memory space and / or the target memory space, so that the data memory segment in it is in an accessible state and other data memory segments are in an inaccessible state. On this basis, the shared memory space is mapped to its corresponding shadow memory space, so that the ASAN memory error checker can detect whether there is an out-of-bounds problem with the access request by accessing the shared memory space. The present invention can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database, realize collaborative work between the two, and then effectively use the ASAN memory error checker to perform out-of-bounds location on the GBase8s database, improving the stability and reliability of the GBase8s database.

[0041] Other features and advantages of the present invention will be described in the following specification, and in part will be obvious from the specification, or understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification, claims and drawings.

[0042] To make the above objectives, features and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. Brief Description of the Drawings

[0043] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0044] Figure 1 It is a schematic flowchart of a method for locating GBase8s database out-of-bounds provided by an embodiment of the present invention;

[0045] Figure 2 It is a schematic diagram of an allocable memory space provided by an embodiment of the present invention;

[0046] Figure 3 It is a schematic diagram of a target memory space provided by an embodiment of the present invention;

[0047] Figure 4 It is a schematic diagram of mapping the shared memory space of the GBase8s database to the shadow memory space provided by an embodiment of the present invention;

[0048] Figure 5 It is a schematic structural diagram of a GBase8s database out-of-bounds location system provided by an embodiment of the present invention;

[0049] Figure 6 It is a schematic structural diagram of a server provided by an embodiment of the present invention. Specific Embodiments

[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0051] Currently, when introducing the ASAN memory error checker into the GBase8s database system, there is a problem of model mismatch. Specifically, the GBase8s database is a database management system designed with a process + shared memory model, and it has unique settings in aspects such as memory management, program execution flow, and the way of interacting with hardware. The ASAN memory error checker, as a general memory error detection tool, although it has a powerful ability to detect memory out-of-bounds problems, its native design initializes and maps the entire shadow memory space. Since the shadow memory space belongs to private memory and is only valid within the process space, when the shadow memory is on private memory, the shadow memory content seen by different processes of the database is inconsistent. At the same time, when the ASAN memory error checker debugs heap memory problems, it needs to replace the malloc / free memory allocator, but the GBase8s database has its own memory manager, which also makes it impossible to directly introduce the ASAN memory error checker.

[0052] Based on this, the embodiments of the present invention provide a method and system for out-of-bounds location in the GBase8s database, which can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database, realize the collaborative work between the two, and then effectively use the ASAN memory error checker to perform out-of-bounds location on the GBase8s database, improving the stability and reliability of the GBase8s database.

[0053] For the convenience of understanding this embodiment, first, a method for out-of-bounds location in the GBase8s database disclosed in the embodiments of the present invention will be introduced in detail. This method is applied to the GBase8s database. Refer to Figure 1 the schematic flowchart of a method for out-of-bounds location in the GBase8s database shown in

[0054] Step S102, apply for an allocable memory space from the segment memory space of the GBase8s database, and apply for a target memory space for a specified program from the allocable memory space.

[0055] Among them, the GBase8s database is configured with a pool memory allocator and a heap memory allocator. The pool memory allocator is used to apply for an allocable memory space (also called the pool memory space) from the segment memory space, and the heap memory allocator is used to continue to apply for a target memory space from the allocable memory space applied by the pool memory allocator and return it to the program for use. This process is a top-down logic.

[0056] In one example, when the memory space stored in the free list of the Pool memory allocator is insufficient, memory space will be requested from the segment memory manager (this memory space is the allocable memory space), and the segment memory manager can allocate the corresponding allocable memory space according to the memory request; when memory needs to be allocated for a specified program, the heap memory allocator requests the pool memory allocator to allocate memory space (this memory space is the target memory space), and allocates the obtained memory space to the program for use.

[0057] Step S104: Use the allocable memory space and / or the target memory space as the memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment in the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state.

[0058] In one example, for the allocable memory space, the pool memory allocator can perform a filling operation on all memory segments in the allocable memory space, and then perform a recovery operation on the data memory segment therein, so that the data memory segment in the allocable memory space is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state.

[0059] In one example, for the target memory space, the heap memory allocator can perform a filling operation on all memory segments in the target memory space, then allocate a data memory segment with a protected area from the target memory space, and then perform a recovery operation on the data memory segment, so that the data memory segment in the target memory space is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state.

[0060] The embodiments of the present invention adjust and optimize the pool memory allocator and the heap memory allocator, so that the subsequent ASAN memory error checker can locate out-of-bounds accesses to the GBase8s database without using the malloc / free memory allocator.

[0061] Step S106: Map the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked.

[0062] Among them, the shadow memory space represents the accessible status of each memory address in the memory space to be inspected through tags. For example, "0" indicates that the memory address is in an accessible state (i.e., the memory address is within the data memory segment), and "-1" indicates that the memory address is in an inaccessible state (i.e., the memory address is outside the data memory segment). In one example, a shared memory space can be allocated from the high memory area of the ASAN memory error checker, and the shared memory space is mapped to the shadow memory space according to a predefined ratio to obtain an address mapping table between the shared memory space and the shadow memory space. This address mapping table can describe the mapping relationship between the memory addresses in the shared memory space and the memory addresses in the shadow memory space.

[0063] Step S108, if an access request for the data memory segment in the memory space to be inspected is received, the ASAN memory error checker is used to detect whether there is an out-of-bounds problem with the access request based on the shared memory space, and an out-of-bounds detection result is obtained.

[0064] Among them, the out-of-bounds detection result is used to describe whether there is an out-of-bounds problem with the access request, and in the case where there is an out-of-bounds problem with the access request, it locates whether the access request is forward out-of-bounds or backward out-of-bounds. In one implementation, the ASAN memory error checker accesses the corresponding shared memory address in the shared memory space based on the memory access range carried by the access request, determines the shadow memory address mapped to the memory address according to the aforementioned address mapping table, and detects whether there is an out-of-bounds in the memory access range based on the tag of the shadow memory address. Compared with the problem that the shadow memory content seen by different processes in the existing ASAN memory error checker's database is inconsistent when directly using the shadow memory to locate out-of-bounds, the embodiment of the present invention places the shadow memory on the shared memory, so that the shadow memory content accessed by all processes of the database is consistent, thereby significantly improving the above problem.

[0065] The GBase8s database out-of-bounds location method provided by the embodiments of the present invention adjusts and optimizes the memory allocator of the GBase8s database. After applying for an allocable memory space and a target memory space, protection processing is performed on the allocable memory space and / or the target memory space, so that the data memory segments therein are in an accessible state and other data memory segments are in an inaccessible state. On this basis, the shared memory space is mapped to its corresponding shadow memory space, so that the ASAN memory error checker detects whether there is an out-of-bounds problem with the access request by accessing the shared memory space. The present invention can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database, realize the collaborative work between the two, and then effectively locate the out-of-bounds of the GBase8s database by using the ASAN memory error checker, improving the stability and reliability of the GBase8s database.

[0066] For ease of understanding, the embodiments of the present invention provide a specific implementation manner of a GBase8s database out-of-bounds location method.

[0067] The embodiments of the present invention have adjusted and optimized the memory management module of the GBase8s database, enabling it to better cooperate with the ASAN memory error checker. This includes redesigning the memory allocation and release strategies to ensure that the ASAN memory error checker can accurately monitor the memory operation conditions of the GBase8s database system.

[0068] Specifically, the embodiments of the present invention implement the detection of heap memory by transforming the pool memory allocator and the heap memory allocator.

[0069] (1) Pool memory allocator: When the memory space stored in the free list of the Pool memory allocator is insufficient and a large block of memory (i.e., an allocable memory space) is applied for from the segment memory manager, the pool memory allocator will perform the following operations:

[0070] (1.1) Memory application: Apply for an allocable memory space from the segment memory space of the GBase8s database.

[0071] In one implementation, the pool memory allocator applies for an allocable memory space from the segment memory space of the GBase8s database, cuts it into multiple small memory spaces for use by the heap memory allocator, and the memory spaces not provided to the heap memory allocator will be stored in the free list.

[0072] (1.2) Poison processing: Fill each memory segment in the allocable memory space to make each memory segment in the allocable memory space in an inaccessible state.

[0073] In specific implementation, before returning the address of the allocable memory space to the program, the GBase8s database performs a poison (fill) operation on the content of the allocable memory space. The specific poison content is f7 (in the computer field, f7 usually represents "Poisoned by user", that is, the area marked as damaged or protected by the user), so as to mark the allocable memory space as a special protected area to prevent unauthorized access and data tampering.

[0074] (1.3)unpoison operation: Perform a recovery operation on the data memory segment within the allocable memory space, so that the data memory segment within the allocable memory space is in an accessible state.

[0075] In one implementation, refer to Figure 2 As shown in the schematic diagram of an allocable memory space, the allocable memory space includes multiple allocable sub-memory spaces, and each allocable sub-memory space is divided into a Block header memory segment, a Data area (that is, the data memory segment), and an Align Padding memory segment. The gray-filled area represents that this part of the shadow memory space (including the Block header memory segment and the Align Padding memory segment) is poisoned and inaccessible; the unfilled area represents that this part of the shadow memory space (including the Data area) is not poisoned and is accessible.

[0076] In specific implementation, before returning the address of the allocable memory space through the mt_malloc function (a memory allocation function for a multi-threaded environment), perform an Unpoison operation on the Data area (that is, the data memory segment) within the allocable memory space, that is, restore the memory content of the Data area to the normal state. The size of the unpoison operation is the size of the applied memory (that is, the size parameter), so as to ensure that the Data area can store and use data normally in subsequent program operations.

[0077] Furthermore, although the unpoison operation is performed on the Data area, the Block header memory segment still retains the poison state of f7. The Block header memory segment acts as the function of the protected area, used to identify the boundary and status information of the entire memory block, and prevent illegal access and tampering of the Block header area, thereby further enhancing the security of the memory.

[0078] (2) Heap Memory Allocator: The heap memory manager is responsible for allocating and managing heap memory. Since the memory allocated by the heap memory manager is stored continuously (there will be a padding area when the size is not aligned), there are certain security risks. Therefore, to protect the heap memory, an 8-byte protection area needs to be added. The heap memory allocator will perform the following operations:

[0079] (2.1) Obtain a large block of memory (i.e., the target memory space) from the pool memory manager: Request the target memory space for a specified program from the allocable memory space. The size of the data memory segment within the target memory space is the same as the memory size carried by the memory application request. In one implementation, when memory needs to be allocated, the heap memory manager first obtains a large block of memory (i.e., the target memory space) from the pool memory manager. This large block of memory is the basic resource for subsequent allocation to various programs or processes.

[0080] (2.2) Poison the large block of memory (i.e., the target memory space): Perform a filling operation on each memory segment within the target memory space to make each memory segment within the target memory space in an inaccessible state. In one example, after obtaining the large block of memory (i.e., the target memory space), the heap memory manager will perform a poison (filling) operation on the entire large block of memory (i.e., the target memory space). The poison operation here is to set the memory content to a specific value, such as f7. This specific value is used to mark this memory area as a special state, indicating that it may contain sensitive information or requires special protection to prevent unauthorized access and data tampering.

[0081] (2.3) Calculate the actual memory size to be allocated: Determine the actual memory size to be allocated according to the memory size carried by the memory application request. The actual memory size to be allocated includes the size of the data memory segment and the size of the protection memory segment. In one example, when the chkralloc function is called to allocate memory, it will first calculate according to the memory size carried by the memory application request (i.e., the size parameter). The calculation method is to use ALIGN(size, 8) + 8, where ALIGN(size, 8) means aligning the size parameter up to a multiple of 8. The total size calculated in this way is the actual memory size to be allocated, including the size of the s data memory segment requested by the user and the size of the additional protection memory segment.

[0082] (2.4) Allocate memory with a protected area: Divide the data memory segment and the protected memory segment from the target memory space according to the size of the data memory segment and the size of the protected memory segment. In one example, according to the calculated sizes of the data memory segment and the protected memory segment, allocate the corresponding memory space from the heap memory manager. This memory space contains the data memory segment required by the user and an additional protected memory segment.

[0083] Specifically, at the end of the data memory segment, there is an additional 8-byte space, which serves as the protected memory segment. The memory content of the protected memory segment is reserved as f7 and set to an inaccessible state. This can prevent the program from accidentally accessing or maliciously tampering with the data in the protected area, ensuring the security and stability of the memory.

[0084] (2.5) Perform an unpoison operation on the Data area: Perform a recovery operation on the data memory segment within the target memory space, so that the data memory segment within the target memory space is in an accessible state. In one example, after the allocation is completed, perform an unpoison operation on the returned data memory segment. The size of the unpoison operation is the original size parameter requested by the user. Through this operation, the memory content of the data memory segment is restored to the normal readable and writable state, so that the user program can normally use this part of the memory to store and process data.

[0085] In one implementation, referring to Figure 3 the schematic diagram of a target memory space shown, the target memory space includes multiple target sub-memory spaces. The target sub-memory space at the head includes a heap memory segment, a data memory segment (i.e., the Data area), an Align Padding memory segment, and a protected memory segment (Protect bytes (8 bytes)). All other target sub-memory spaces include a data memory segment (i.e., the Data area), an Align Padding memory segment, and a protected memory segment (Protect bytes (8 bytes)). The gray-filled area represents that this part of the shadow memory space (including the heap memory segment, the AlignPadding memory segment, and the protected memory segment) is poisoned and inaccessible; the unfilled area represents that this part of the shadow memory space (including the Data area) is not poisoned and is accessible.

[0086] Compared with the existing ASAN memory error checker that directly uses shadow memory to locate out-of-bounds and has problems such as inconsistent shadow memory content seen by different processes in the database, the embodiment of the present invention uses the ASAN memory error checker to locate out-of-bounds based on the shared memory space, so that the shadow memory content accessed by all processes of the database is consistent, thus significantly improving the above problems.

[0087] Furthermore, in the embodiments of the present invention, by mapping the shared memory space to the Shadow memory space, the user thread scheduling mechanism of the GBase8s database is supported, so that the content of the Shadow memory space seen by each user thread on each vp (virtual server) is consistent. Specifically, refer to Figure 4 the schematic diagram of mapping the shared memory space of the GBase8s database to the shadow memory space as shown below. The mapping process is as follows:

[0088] Step 1: Determine the starting memory address of the shared memory space and the memory size of the shared memory space from the high memory space of the ASAN memory error checker. Among them, for the principle of ASAN, it supports shadow mapping of high and low memory areas. However, due to the difference in the allocable memory size of high and low memory areas for different system architectures and the size of the shared memory space required by the database, the embodiments of the present invention choose to use the ASAN high memory space scheme.

[0089] First, it can be planned to allocate the starting memory address (0x10007fff8000) of the High memory space of the ASAN memory error checker for the database shared memory. This involves modifying the SHMBASE related configuration item in the onconfig file of the gbase8s database, that is, specifying the starting address as 0x10007fff8000.

[0090] Then, the size of the shared memory space can be determined. For example, the maximum use of the shared memory space is 24G. On this basis, the size of the Shadow memory space can be calculated and set, which can be configured according to the ratio of 8:1 according to the actual memory requirements. For example, if the maximum use of the shared memory space is 24G, the Shadow memory space can be allocated 3G.

[0091] Step 2: Create a shared memory space in the high memory space based on the starting memory address and memory size of the shared memory space. In one example, first create a shared memory space with 24G memory starting from the starting memory address (0x02008fff7000) of the Highmemory space through the mumap command (delete the object mapping of a specific address area).

[0092] Step 3: For any memory address in the shared memory space, determine the memory address in the corresponding shadow memory space of the memory space to be checked that has a mapping relationship with this memory address, so as to determine the address mapping table between the shared memory space and the shadow memory space. For example, starting from the starting memory address (0x10007fff8000) of the shared memory space, determine the starting memory address in the corresponding shadow memory space of this starting memory address, and repeat this process until the last memory address of the shared memory space or the shadow memory space is traversed, then stop, and obtain the address mapping table used to describe the mapping relationship between the memory addresses of the shared memory space and the memory addresses of the shadow memory space.

[0093] After the modification according to the above steps, the corresponding Shadow memory space of the memory space to be checked is all on the shared memory space and can be accessed by all VPs. Please continue to refer to Figure 4 , in the modified address mapping table, the diagonal shaded area represents the shared memory space of the database, and the grid shaded area represents the Shadow memory space corresponding to the shared memory space.

[0094] In one example, the memory address in the shared memory space is denoted as the shared memory address, and the memory address in the shadow memory space is denoted as the shadow memory address. Based on the foregoing transformation of the memory allocator and mapping of the shadow memory space, the embodiments of the present invention further provide an implementation manner of detecting whether there is an out-of-bounds problem with respect to an access request (or memory read / write operation) based on the shared memory space through an ASAN memory error checker, and obtaining an out-of-bounds detection result. The following operations are performed on any to-be-accessed memory address within the to-be-accessed memory range carried by the access request:

[0095] Through the ASAN memory error checker, access the target shared memory address corresponding to this to-be-accessed memory address based on the address mapping table, determine multiple target shadow memory addresses that have a mapping relationship with the target shared memory address based on the address mapping table, and detect whether there is an out-of-bounds problem with this to-be-accessed memory address according to the markings of the target shadow memory addresses. In the embodiments of the present invention, first, the target shared memory address corresponding to each to-be-accessed memory address within the to-be-accessed memory range is determined through the address mapping table, and then the target shared memory address is accessed through the ASAN memory error checker. Next, according to the address mapping table, the markings of multiple target shadow memory addresses corresponding to the target shared memory address are obtained to detect whether there is an out-of-bounds problem with the to-be-accessed memory range.

[0096] Among them, the specific logic for the ASAN memory error checker to perform out-of-bounds location is as follows: During compilation, the ASAN memory error checker instruments memory operations in the code. Specifically, it inserts check code before each access operation to determine whether the memory address to be accessed has been "poisoned" (i.e., whether it is in an inaccessible state). If a memory access error is detected, the error reporting mechanism will be triggered to prompt the user that there is an out-of-bounds problem with this access operation.

[0097] The embodiments of the present invention further provide specific implementation manners for out-of-bounds location for the aforementioned allocable memory space and target memory space respectively:

[0098] (a) Allocable memory space: Please continue to refer to Figure 2 , the allocable memory space includes multiple allocable sub-memory spaces, and each allocable sub-memory space is divided into a Block header memory segment, a Data memory segment, and an AlignPadding memory segment. On this basis, the process of out-of-bounds location for the allocable memory space is as follows:

[0099] In one example, if it is determined, according to the mark of the target shadow memory address, that the Block header memory segment within the allocable sub-memory space corresponding to the memory range to be accessed is accessed, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

[0100] In another example, if it is determined, according to the mark of the target shadow memory address, that the Align Padding memory segment within the allocable sub-memory space corresponding to the memory range to be accessed is accessed, or the Block header memory segment within the adjacent next allocable sub-memory space is accessed, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

[0101] Exemplarily, Figure 2 shows two allocable sub-memory spaces (which can be multiple in actual applications). Assume that the user needs to access the Data memory segment within the first allocable sub-memory space and issues a corresponding access request, and determines the target shadow memory address of the memory range to be accessed according to the aforementioned process; for any target shadow memory address, determine whether the target shadow memory address is within the Data memory segment. If it is within the Data memory segment within the first allocable sub-memory space, it can be determined that there is no out-of-bounds for this access request; if it is within the Block header memory segment within the first allocable sub-memory space, then this access request is out-of-bounds forward and an error is triggered; if it is within the Align Padding memory segment within the first allocable sub-memory space, or within the Block header memory segment within the second allocable sub-memory space, then this access request is out-of-bounds backward and an error is triggered.

[0102] Further, when releasing the entire allocable memory space, poison its shadow memory space and no longer allow access. If an access request is received at this time, it can be determined that there is an out-of-bounds access.

[0103] (b) Target memory space: Please continue to refer to Figure 3 , the target memory space includes multiple target sub-memory spaces. The head target sub-memory space includes a heap memory segment, a data memory segment (i.e., the Data area), an Align Padding memory segment, and a protection memory segment (Protect bytes (8 bytes)). All other target sub-memory spaces include a data memory segment (i.e., the Data area), an Align Padding memory segment, and a protection memory segment (Protect bytes (8 bytes)). Based on this, the process of locating an out-of-bounds access to the allocable memory space is as follows:

[0104] In one example, if it is determined according to the mark of the target shadow memory address that the access reaches the heap memory segment in the target sub-memory space corresponding to the memory range to be accessed, or reaches the protection memory segment in the adjacent previous target sub-memory space, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

[0105] In another example, if it is determined according to the mark of the target shadow memory address that the access reaches the Align Padding memory segment or the protection memory segment in the target sub-memory space corresponding to the memory range to be accessed, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

[0106] Exemplarily, Figure 3 Two target sub-memory spaces are shown (there can be multiple in actual applications). Assume that the user needs to access the data memory segment in the first target sub-memory space and issues a corresponding access request. The target shadow memory address of the memory range to be accessed is determined according to the foregoing process. For any target shadow memory address, determine whether the target shadow memory address is located in the data memory segment. If it is located in the data memory segment of the second target sub-memory space, it can be determined that the access request does not go out of bounds this time; if it is located in the heap memory segment of the second target sub-memory space, or in the protection memory segment of the first target sub-memory space, or in the heap management structure, then the access request goes out of bounds forward and an error is triggered; if it is located in the Align Padding or protection memory segment of the second target sub-memory space, then the access request goes out of bounds backward and an error is triggered.

[0107] Further, when releasing the entire target memory space, poison its shadow memory space and no longer allow access. If an access request is received at this time, it can be determined that there is an out-of-bounds access.

[0108] Further, according to the business logic and data processing characteristics of the GBase8s database, the monitoring rules of the ASAN memory error checker are customized. By deeply analyzing the core functions and key business processes of the database system, it is determined which memory operations are normal and legal, and which are potential risk points that need to be focused on and detected, thus avoiding a large number of unnecessary warning messages caused by the overly strict detection rules of the ASAN memory error checker.

[0109] Further, the integration method of the ASAN memory error checker and the GBase8s database is optimized. A more flexible and efficient interface design is adopted, reducing the coupling degree between the two and improving the overall stability and compatibility of the system.

[0110] In summary, the GBase8s database out-of-bounds location method provided by the embodiments of the present invention can effectively solve the problem that it is difficult to locate the out-of-bounds memory errors in the existing technology, providing a strong guarantee for the stable operation and maintenance of the database system, and having significant practicality and promotion value.

[0111] Based on the foregoing embodiments, the embodiments of the present invention provide a GBase8s database out-of-bounds location system, which is applied to the GBase8s database. Refer to Figure 5 the structural schematic diagram of a GBase8s database out-of-bounds location system shown. The system mainly includes the following parts:

[0112] A memory application module 502, which is used to apply for an allocable memory space from the segment memory space of the GBase8s database, and apply for a target memory space for a specified program from the allocable memory space;

[0113] A memory processing module 504, which is used to use the allocable memory space and / or the target memory space as the memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment in the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state;

[0114] A memory mapping module 506, which is used to map the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked. The shadow memory space represents the accessible state of each memory address in the memory space to be checked through tags;

[0115] An out-of-bounds positioning module 508, which is used to detect whether there is an out-of-bounds problem with an access request based on a shared memory space through an ASAN memory error checker if an access request for a data memory segment within a memory space to be checked is received, and obtain an out-of-bounds detection result.

[0116] The GBase8s database out-of-bounds positioning system provided by the embodiments of the present invention adjusts and optimizes the memory allocator of the GBase8s database, so that after applying for an allocable memory space and a target memory space, protection processing is performed on the allocable memory space and / or the target memory space, so that the data memory segments therein are in an accessible state and other data memory segments are in an inaccessible state. On this basis, the shared memory space is mapped to its corresponding shadow memory space, and then the ASAN memory error checker detects whether there is an out-of-bounds problem with the access request by accessing the shared memory space. The present invention can solve the problem of mismatch between the ASAN memory error checker and the GBase8s database, realize the collaborative work between the two, and then effectively perform out-of-bounds positioning on the GBase8s database by using the ASAN memory error checker, improving the stability and reliability of the GBase8s database.

[0117] In one implementation, a pool memory allocator is configured in the GBase8s database; the memory application module 502 is specifically used for:

[0118] Receiving a memory application request sent by a specified program through the pool memory allocator, and applying for an allocable memory space from the segment memory space of the GBase8s database;

[0119] In one implementation, the memory processing module 504 is specifically used for:

[0120] Performing the following operations through the pool memory allocator: filling each memory segment in the allocable memory space to make each memory segment in the allocable memory space in an inaccessible state; performing a recovery operation on the data memory segment in the allocable memory space to make the data memory segment in the allocable memory space in an accessible state.

[0121] In one implementation, a heap memory allocator is configured in the GBase8s database; the memory application module 502 is specifically used for:

[0122] Applying for a target memory space for a specified program from the allocable memory space through the heap memory allocator, and the size of the data memory segment in the target memory space is the same as the memory size carried in the memory application request;

[0123] In one implementation, the memory processing module 504 is specifically used for:

[0124] Perform the following operations through the heap memory allocator: fill each memory segment in the target memory space so that each memory segment in the target memory space is in an inaccessible state; determine the actual memory size to be allocated according to the memory size carried in the memory application request, where the actual memory size to be allocated includes the size of the data memory segment and the size of the protection memory segment; divide the data memory segment and the protection memory segment from the target memory space according to the size of the data memory segment and the size of the protection memory segment; perform a recovery operation on the data memory segment in the target memory space so that the data memory segment in the target memory space is in an accessible state.

[0125] In one implementation, the memory mapping module 506 is specifically configured to:

[0126] Determine the starting memory address of the shared memory space from the high memory space of the ASAN memory error checker, and determine the memory size of the shared memory space;

[0127] Create a shared memory space in the high memory space based on the starting memory address and memory size of the shared memory space;

[0128] For any memory address in the shared memory space, determine the memory address that has a mapping relationship with this memory address from the shadow memory space corresponding to the memory space to be checked, so as to determine the address mapping table between the shared memory space and the shadow memory space.

[0129] In one implementation, the memory address in the shared memory space is denoted as the shared memory address, and the memory address in the shadow memory space is denoted as the shadow memory address; the out-of-bounds location module 508 is specifically configured to:

[0130] Perform the following operations on any memory address to be accessed within the memory range to be accessed carried in the access request:

[0131] Through the ASAN memory error checker, access the target shared memory address corresponding to this memory address to be accessed based on the address mapping table, determine multiple target shadow memory addresses that have a mapping relationship with the target shared memory address based on the address mapping table, and detect whether there is an out-of-bounds problem for this memory address to be accessed according to the marks of the target shadow memory addresses.

[0132] In one implementation, the allocable memory space includes multiple allocable sub-memory spaces, and each allocable sub-memory space is divided into a Block header memory segment, a data memory segment, and an Align Padding memory segment; the out-of-bounds location module 508 is specifically configured to:

[0133] If, according to the tag of the target shadow memory address, it is determined that the access reaches the Block header memory segment within the allocable sub-memory space corresponding to the memory range to be accessed, it is determined that there is an out-of-bounds problem for the memory address to be accessed;

[0134] If, according to the tag of the target shadow memory address, it is determined that the access reaches the Align Padding memory segment within the allocable sub-memory space corresponding to the memory range to be accessed, or reaches the Block header memory segment within the adjacent next allocable sub-memory space, it is determined that there is an out-of-bounds problem for the memory address to be accessed.

[0135] In one implementation, the target memory space includes multiple target sub-memory spaces. The head target sub-memory space includes a heap memory segment, a data memory segment, an Align Padding memory segment, and a protection memory segment. All other target sub-memory spaces include a data memory segment, an Align Padding memory segment, and a protection memory segment. The out-of-bounds positioning module 508 is specifically configured to:

[0136] If, according to the tag of the target shadow memory address, it is determined that the access reaches the heap memory segment within the target sub-memory space corresponding to the memory range to be accessed, or reaches the protection memory segment within the adjacent previous target sub-memory space, it is determined that there is an out-of-bounds problem for the memory address to be accessed;

[0137] If, according to the tag of the target shadow memory address, it is determined that the access reaches the Align Padding memory segment or the protection memory segment within the target sub-memory space corresponding to the memory range to be accessed, it is determined that there is an out-of-bounds problem for the memory address to be accessed.

[0138] The device provided by the embodiments of the present invention has the same implementation principle and the same technical effects as those of the foregoing method embodiments. For the sake of brief description, for the parts not mentioned in the device embodiments, reference may be made to the corresponding content in the foregoing method embodiments.

[0139] The embodiments of the present invention provide a server. Specifically, the server includes a processor and a storage device; a computer program is stored on the storage device, and the computer program, when run by the processor, executes the method according to any one of the foregoing implementation manners.

[0140] Figure 6 FIG. 22 is a schematic structural diagram of a server provided by an embodiment of the present invention. The server 100 includes: a processor 60, a memory 61, a bus 62, and a communication interface 63. The processor 60, the communication interface 63, and the memory 61 are connected through the bus 62. The processor 60 is configured to execute an executable module stored in the memory 61, such as a computer program.

[0141] Among them, the memory 61 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0142] The bus 62 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 6 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0143] Among them, the memory 61 is used to store a program. After receiving an execution instruction, the processor 60 executes the program. The methods executed by the devices defined by the flow processes disclosed in any of the foregoing embodiments of the present invention can be applied to or implemented by the processor 60.

[0144] The processor 60 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by the integrated logic circuit in the hardware of the processor 60 or the instructions in software form. The above-mentioned processor 60 can be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it can also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register, etc. This storage medium is located in the memory 61, and the processor 60 reads the information in the memory 61 and combines its hardware to complete the steps of the above method.

[0145] The computer program product of the readable storage medium provided by the embodiments of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, reference can be made to the foregoing method embodiments, which will not be elaborated herein.

[0146] If the above functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program code, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0147] Finally, it should be noted that the above embodiments are only specific implementation manners of the present invention, used to illustrate the technical solutions of the present invention, and are not intended to limit them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions described in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A method for locating out-of-bounds in a GBase8s database, characterized in that, The method is applied to the GBase8s database, and the method includes: Apply for allocatable memory space from the segment memory space of the GBase8s database, and apply for target memory space for a specified program from the allocatable memory space; Use the allocatable memory space and / or the target memory space as the memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segments in the memory space to be checked are in an accessible state, and other memory segments except the data memory segments are in an inaccessible state; Map the shared memory space of the GBase8s database to the corresponding shadow memory space of the memory space to be checked, and the shadow memory space represents the accessible state of each memory address in the memory space to be checked through marks; If an access request for the data memory segment in the memory space to be checked is received, use the ASAN memory error checker to detect whether there is an out-of-bounds problem with the access request based on the shared memory space, and obtain an out-of-bounds detection result.

2. The GBase 8s database out-of-bounds positioning method according to claim 1, wherein A pool memory allocator is configured in the GBase8s database; Applying for allocatable memory space from the segment memory space of the GBase8s database includes: Receive a memory application request sent by a specified program through the pool memory allocator, and apply for allocatable memory space from the segment memory space of the GBase8s database; Performing protection processing on the memory space to be checked includes: Execute the following operations through the pool memory allocator: perform a filling operation on each memory segment in the allocatable memory space, so that each memory segment in the allocatable memory space is in an inaccessible state; perform a recovery operation on the data memory segment in the allocatable memory space, so that the data memory segment in the allocatable memory space is in an accessible state.

3. The GBase 8s database out-of-bounds positioning method according to claim 2, wherein A heap memory allocator is configured in the GBase8s database; Applying for target memory space for a specified program from the allocatable memory space includes: Apply for target memory space for a specified program from the allocatable memory space through the heap memory allocator, and the size of the data memory segment in the target memory space is the same as the memory size carried in the memory application request; Performing protection processing on the memory space to be checked includes: The following operations are performed through the heap memory allocator: filling each memory segment in the target memory space so that each memory segment in the target memory space is in an inaccessible state; determining the actual memory size to be allocated according to the memory size carried in the memory application request, where the actual memory size to be allocated includes the size of the data memory segment and the size of the protection memory segment; partitioning the data memory segment and the protection memory segment from the target memory space according to the size of the data memory segment and the size of the protection memory segment; performing a recovery operation on the data memory segment in the target memory space so that the data memory segment in the target memory space is in an accessible state.

4. The GBase8s database out-of-bounds positioning method according to claim 1, wherein Mapping the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked, including: Determining the starting memory address of the shared memory space from the high memory space of the ASAN memory error checker, and determining the memory size of the shared memory space; Creating the shared memory space in the high memory space based on the starting memory address and the memory size of the shared memory space; For any memory address in the shared memory space, determining, from the shadow memory space corresponding to the memory space to be checked, the memory address having a mapping relationship with this memory address, so as to determine the address mapping table between the shared memory space and the shadow memory space.

5. The GBase 8s database out-of-bounds positioning method according to claim 4, characterized in that, Denoting the memory address in the shared memory space as the shared memory address, and denoting the memory address in the shadow memory space as the shadow memory address; Detecting, through the ASAN memory error checker, whether there is an out-of-bounds problem with the access request based on the shared memory space, and obtaining an out-of-bounds detection result, including: Performing the following operations on any memory address to be accessed within the memory range to be accessed carried in the access request: Through the ASAN memory error checker, accessing, based on the address mapping table, the target shared memory address corresponding to this memory address to be accessed, determining, based on the address mapping table, the target shadow memory address having a mapping relationship with the target shared memory address, and detecting whether there is an out-of-bounds problem with this memory address to be accessed according to the mark of the target shadow memory address.

6. The GBase 8s database out-of-bounds positioning method according to claim 5, wherein, The allocable memory space includes a plurality of allocable sub-memory spaces, and each allocable sub-memory space is divided into a Block header memory segment, a data memory segment, and an Align Padding memory segment; Detecting whether there is an out-of-bounds problem with this memory address to be accessed according to the mark of the target shadow memory address, including: If it is determined, according to the mark of the target shadow memory address, that the Block header memory segment within the allocable sub-memory space corresponding to the memory range to be accessed is accessed, it is determined that there is an out-of-bounds problem with this memory address to be accessed; If, according to the flag of the target shadow memory address, it is determined that the access reaches the Align Padding memory segment within the allocable sub-memory space corresponding to the memory range to be accessed, or reaches the Block header memory segment within the next adjacent allocable sub-memory space, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

7. The method for locating out-of-bounds in the GBase8s database according to claim 5, wherein The target memory space includes multiple target sub-memory spaces. The target sub-memory space at the head includes a heap memory segment, a data memory segment, an Align Padding memory segment, and a protection memory segment. All other target sub-memory spaces include the data memory segment, the Align Padding memory segment, and the protection memory segment. Detecting whether there is an out-of-bounds problem with the memory address to be accessed according to the flag of the target shadow memory address further includes: If, according to the flag of the target shadow memory address, it is determined that the access reaches the heap memory segment within the target sub-memory space corresponding to the memory range to be accessed, or reaches the protection memory segment within the previous adjacent target sub-memory space, it is determined that there is an out-of-bounds problem with the memory address to be accessed. If, according to the flag of the target shadow memory address, it is determined that the access reaches the Align Padding memory segment or the protection memory segment within the target sub-memory space corresponding to the memory range to be accessed, it is determined that there is an out-of-bounds problem with the memory address to be accessed.

8. A GBase8s database out-of-bounds positioning system, characterized in that, The system is applied to the GBase8s database, and the system includes: A memory application module, configured to apply for an allocable memory space from the segment memory space of the GBase8s database, and apply for a target memory space for a specified program from the allocable memory space. A memory processing module, configured to use the allocable memory space and / or the target memory space as a memory space to be checked, and perform protection processing on the memory space to be checked, so that the data memory segment within the memory space to be checked is in an accessible state, and other memory segments except the data memory segment are in an inaccessible state. A memory mapping module, configured to map the shared memory space of the GBase8s database to the shadow memory space corresponding to the memory space to be checked, and the shadow memory space represents the accessible state of each memory address within the memory space to be checked through flags. An out-of-bounds positioning module, configured to, if receiving an access request for the data memory segment within the memory space to be checked, detect whether there is an out-of-bounds problem with the access request based on the shared memory space through an ASAN memory error checker, and obtain an out-of-bounds detection result.

9. A server, characterized in that, It includes a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when called and executed by a processor, cause the processor to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for detecting heap memory boundary crossing and computer storage medium

    CN118519919A

  • User-level exception-based invocation of software instrumentation handlers

    US20240095063A1