Memory read-write border crossing detection method, device and equipment for intelligent automobile operation system
By obtaining the executable file and preset environment variables of the target user, determining the out-of-bounds detection mode and generating the target protection page, the problem of the inability to capture the first out-of-bounds scene and the user's inability to customize the detection range in the prior art is solved, and precise positioning and efficient detection of memory out-of-bounds are achieved.
Patent Information
- Application Number
- CN202411954623.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art cannot capture the first out-of-bounds scene when detecting memory out-of-bounds, and the user cannot customize the range of memory out-of-bounds detection, and has poor flexibility.
By obtaining the target user's executable file and preset environment variables, the out-of-bounds detection mode is determined, and a target protection page is generated to detect whether there is out-of-bounds in memory read and write. This method can flexibly arrange the memory detection starting position and customize the out-of-bounds detection range.
Accurate positioning of memory out-of-bounds problem is achieved, the reliability and efficiency of out-of-bounds positioning results are improved, and the positioning method is simplified.
Smart Images

Figure CN119883703A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer processing technology, and in particular to a memory read / write out-of-bounds detection method, device and equipment for an intelligent automobile operating system. Background Art
[0002] Memory, also known as main memory, is used to store the calculation data in the CPU (Central Processing Unit) and the data exchanged by external storage devices such as hard disks. It is a storage space that can be directly addressed by the CPU. In most programming languages, memory is managed in the form of an array, where each element occupies a certain continuous space in the memory; when a data element needs to be accessed, the program will calculate the memory address to be accessed based on the index and read or write the value at the corresponding position.
[0003] When a program accesses a location beyond the memory range it is allocated, a memory out-of-bounds situation occurs; memory out-of-bounds is a common programming error that may lead to program crashes, undefined behavior, data corruption, and security vulnerabilities. In the prior art, tools such as memwatch, dmalloc, and glibc-mcheck can detect whether a memory out-of-bounds problem exists; among them, the implementation mechanism of memwatch, dmalloc, and glibc-mcheck is to intercept the allocation and release of memory by overloading (malloc, free, etc.), and at the same time add an additional protection area before and after each allocated memory block, which is filled with some special characters. When the memory is accessed out of bounds, the content of the above memory area will be destroyed, so when the memory is released or the memory detection interface is actively called, if it is found that the content of the protection area is not the special filling character content, an error message will be reported.
[0004] However, when a process uses this method, it needs to link its dynamic library or static library. Therefore, the memory allocation and release methods provided by it will be used throughout the entire cycle of the process. Users cannot customize the scope of memory out-of-bounds detection, and its flexibility is poor. By detecting the filling characters of the protection area in free or actively calling the memory detection interface method, the first out-of-bounds scene cannot be captured, so that it can only be known that there is a memory out-of-bounds, but the location where the problem occurs cannot be located. Summary of the invention
[0005] The present application provides a memory read / write out-of-bounds detection method, device and equipment for an intelligent automobile operating system, which is used to solve the defects that when a memory out-of-bounds problem occurs, the first out-of-bounds scene cannot be captured and the user cannot customize the memory out-of-bounds detection range.
[0006] In a first aspect, the present application provides a memory read / write cross-bounds detection method for an intelligent automobile operating system, comprising:
[0007] Get the target user's executable files and preset environment variables;
[0008] Determine the cross-border detection mode of the executable file according to the preset environment variable, and generate a target protection page corresponding to the executable file according to the cross-border detection mode, wherein the target protection page is used to detect whether there is cross-border in memory reading and writing;
[0009] Determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file;
[0010] The target executable file is stored in the target memory space, and a detection is performed to determine whether there is a memory read / write cross-boundary error in the target executable file.
[0011] Optionally, determining the cross-border detection mode of the executable file according to the preset environment variable, and generating a target protection page corresponding to the executable file according to the cross-border detection mode includes:
[0012] Determining whether the preset environment variable satisfies the overflow environment variable;
[0013] If the preset environment variable satisfies the overflow environment variable, determining that the cross-border detection mode of the executable file is an overflow detection mode, the overflow detection mode is used to indicate that the protection page is set before the executable file;
[0014] generating an overflow protection page corresponding to the executable file according to the overflow detection mode, and determining the overflow protection page as a target protection page;
[0015] If the preset environment variable does not satisfy the overflow environment variable, determining that the cross-bounds detection mode of the executable file is an underflow detection mode, the underflow detection mode is used to indicate that the protection page is set after the executable file;
[0016] An underflow protection page corresponding to the executable file is generated according to the underflow detection mode, and the underflow protection page is determined as a target protection page.
[0017] Optionally, before obtaining the executable file and preset environment variables of the target user, the method further includes:
[0018] Obtaining available memory space, where the available memory space is used to indicate the space available for file storage by the operating system;
[0019] Allocating the available memory space to obtain a memory management space and a memory allocation space, wherein the memory management space is used to store a memory address and size of a corresponding file, and the memory allocation interval is used to store an executable file of the target user;
[0020] The memory management space is divided to obtain a plurality of memory information subspaces, and the plurality of memory information subspaces are marked. The memory information subspaces are used to store memory addresses and sizes of different executable files.
[0021] Optionally, determining a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file includes:
[0022] According to the executable file, determining a target file size and target storage content corresponding to the executable file;
[0023] Determining the memory storage space required for the executable file according to the target file size and the target protection page;
[0024] Determining a target executable file of the target user according to the target storage content and the target protection page;
[0025] According to the memory storage space, a target memory space corresponding to the target executable file is determined.
[0026] Optionally, before storing the target executable file in the target memory space, the method further includes:
[0027] Respectively obtain the marking information of the plurality of memory information subspaces, the marking information comprising: idle information;
[0028] Filtering the plurality of memory information subspaces according to the idle information to obtain a target memory information subspace;
[0029] Determining the storage address of the target executable file according to the target memory information subspace, and generating target storage information corresponding to the target executable file;
[0030] The target storage information is stored in the target memory information subspace.
[0031] Optionally, the method further includes:
[0032] Re-acquire the target user's executable file, and determine a new target executable file and a new target storage space based on the new executable file;
[0033] Respectively obtaining marking information of the plurality of memory information subspaces, and analyzing and processing the marking information;
[0034] If there is no target memory information subspace whose mark information is the free information, determining a new memory management space according to the memory allocation space, and sending the storage information corresponding to the memory management space to the new memory management space;
[0035] Determine a new target memory information subspace according to the new target executable file and the new memory management space;
[0036] Storing the storage information of the new executable file according to the new target memory information subspace;
[0037] The method further comprises:
[0038] Re-acquire the target user's executable file, and determine a new target executable file based on the new executable file;
[0039] If the memory allocation space cannot satisfy the storage of the new target executable file, reacquire the available memory space and determine a new target storage space corresponding to the new target executable file;
[0040] The new target executable file is stored in the new target storage space.
[0041] Optionally, the detecting whether there is a memory read / write cross-bounds error in the target executable file includes:
[0042] Performing real-time detection on a target protection page of the target executable file;
[0043] Acquire the access status of the target protection page in real time, wherein the access status includes: not accessed and accessed;
[0044] If the access status of the target protection page is not accessed, it is determined that there is no memory read / write cross-bounds in the target executable file;
[0045] If the access status of the target protection page is accessed, it is determined that the target executable file has a memory read / write cross-boundary error.
[0046] In a second aspect, the present application provides a memory read / write cross-bounds detection device for an intelligent automobile operating system, comprising:
[0047] The acquisition module is used to obtain the target user's executable files and preset environment variables.
[0048] A determination module is used to determine the cross-border detection mode of the executable file according to the preset environment variable.
[0049] A generation module is used to generate a target protection page corresponding to the executable file according to the cross-border detection mode, and the target protection page is used to detect whether there is cross-border in memory reading and writing.
[0050] The determination module is further used to determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file.
[0051] The processing module is used to store the target executable file in the target memory space and detect whether there is any memory read / write cross-boundary in the target executable file.
[0052] Optionally, the memory read / write cross-boundary detection device of the intelligent automobile operating system further includes: a judgment module.
[0053] The judgment module is used to judge whether the preset environment variable satisfies the overflow environment variable.
[0054] If the preset environment variable satisfies the overflow environment variable, the determination module is further used to determine that the cross-boundary detection mode of the executable file is an overflow detection mode, and the overflow detection mode is used to indicate that the protection page is set before the executable file.
[0055] The generating module is further configured to generate an overflow protection page corresponding to the executable file according to the overflow detection mode.
[0056] The determination module is further configured to determine the overflow protection page as a target protection page.
[0057] If the preset environment variable does not satisfy the overflow environment variable, the determination module is further used to determine that the cross-boundary detection mode of the executable file is an underflow detection mode, and the underflow detection mode is used to indicate that the protection page is set after the executable file.
[0058] The generating module is further configured to generate an underflow protection page corresponding to the executable file according to the underflow detection mode.
[0059] The determination module is further configured to determine the underflow protection page as a target protection page.
[0060] Optionally, the acquisition module is further used to acquire available memory space, where the available memory space is used to indicate the space available for file storage by the operating system.
[0061] The processing module is further used to allocate the available memory space to obtain a memory management space and a memory allocation space, wherein the memory management space is used to store the memory address and size of the corresponding file, and the memory allocation interval is used to store the executable file of the target user.
[0062] The processing module is further used to divide the memory management space to obtain multiple memory information subspaces, and mark the multiple memory information subspaces, where the memory information subspaces are used to store memory addresses and sizes of different executable files.
[0063] Optionally, the determination module is further used to determine, based on the executable file, a target file size and target storage content corresponding to the executable file.
[0064] The determination module is further used to determine the memory storage space required by the executable file according to the target file size and the target protection page.
[0065] The determination module is further used to determine the target executable file of the target user according to the target storage content and the target protection page.
[0066] The determination module is further used to determine the target memory space corresponding to the target executable file according to the memory storage space.
[0067] Optionally, the acquisition module is further used to respectively acquire marking information of the multiple memory information subspaces, and the marking information includes: idle information.
[0068] The processing module is further used to filter and process the multiple memory information subspaces according to the idle information to obtain a target memory information subspace.
[0069] The determination module is further used to determine the storage address of the target executable file according to the target memory information subspace.
[0070] The generating module is further used to generate target storage information corresponding to the target executable file.
[0071] The processing module is further used to store the target storage information into the target memory information subspace.
[0072] Optionally, the acquisition module is also used to re-acquire the executable file of the target user.
[0073] The determination module is further used to determine a new target executable file and a new target storage space according to the new executable file.
[0074] The acquisition module is further used to respectively acquire the marking information of the multiple memory information subspaces.
[0075] The processing module is also used to analyze and process the marking information.
[0076] If there is no target memory information subspace whose marking information is the free information, the determining module is further used to determine a new memory management space according to the memory allocation space.
[0077] The processing module is further used to send the storage information corresponding to the memory management space to the new memory management space.
[0078] The determination module is further used to determine a new target memory information subspace according to the new target executable file and the new memory management space.
[0079] The processing module is further used to store the storage information of the new executable file according to the new target memory information subspace.
[0080] The determination module is further used to determine a new target executable file according to the new executable file.
[0081] If the memory allocation space cannot satisfy the storage of the new target executable file, the acquisition module is further used to reacquire available memory space.
[0082] The determination module is further used to determine a new target storage space corresponding to the new target executable file.
[0083] The processing module is further used to store the new target executable file in the new target storage space.
[0084] Optionally, the processing module is further used to perform real-time detection on the target protection page of the target executable file.
[0085] The acquisition module is also used to acquire the access status of the target protection page in real time, and the access status includes: not accessed and accessed.
[0086] If the access status of the target protection page is no access, the determination module is further used to determine that there is no memory read / write cross-boundary in the target executable file.
[0087] If the access status of the target protection page is that it has been accessed, the determination module is further used to determine that the target executable file has a memory read / write cross-boundary error.
[0088] In a third aspect, the present application provides a memory read / write cross-bounds detection device for an intelligent automobile operating system, comprising:
[0089] Memory;
[0090] processor;
[0091] Wherein, the memory stores computer-executable instructions;
[0092] The processor executes the computer-executable instructions stored in the memory to implement the memory read-write cross-boundary detection method of the intelligent automobile operating system as described in the first aspect and various possible implementation methods of the first aspect.
[0093] In a fourth aspect, the present application provides a computer storage medium having computer execution instructions stored thereon, wherein the computer execution instructions are executed by a processor to implement the memory read and write out-of-bounds detection method of an intelligent automobile operating system as described in the first aspect and various possible implementation methods of the first aspect.
[0094] The memory read and write out-of-bounds detection method of the intelligent automobile operating system provided by the present application obtains the executable file and preset environment variables of the target user, determines the out-of-bounds detection mode of the executable file currently performing memory allocation according to the preset environment variables, and generates the target protection page corresponding to the executable file according to the out-of-bounds detection mode; determines the target executable file and the target memory space corresponding to the target executable file according to the currently determined target protection page and executable file, stores the target executable file in the corresponding target memory space, and detects whether the target executable file has memory read and write out-of-bounds. This method can flexibly arrange the starting position of the memory detection, thereby realizing a custom memory out-of-bounds detection range, improving the reliability of the memory out-of-bounds positioning results, realizing the precise positioning of the memory out-of-bounds problem, simplifying the positioning method of the memory out-of-bounds problem, and improving the positioning efficiency of the memory out-of-bounds problem. BRIEF DESCRIPTION OF THE DRAWINGS
[0095] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0096] Figure 1 Schematic diagram of the process of the memory read and write cross-boundary detection method of the intelligent automobile operating system provided in this application Figure 1 ;
[0097] Figure 2 Schematic diagram of the process of the memory read and write cross-boundary detection method of the intelligent automobile operating system provided in this application Figure 2 ;
[0098] Figure 3 A schematic diagram of the structure of the memory read / write cross-bounds detection device for the intelligent automobile operating system provided by the present application;
[0099] Figure 4 A structural diagram of the memory read and write out-of-bounds detection device for the smart car operating system provided in this application.
[0100] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0101] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0102] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein, for example.
[0103] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0104] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0105] First, the terms involved in this application are explained.
[0106] Real-time operating system: Real-time operating system, referred to as RTOS, is an operating system that can accept and process external events or data at a fast enough speed when they occur, and the processing results can control the production process or respond quickly to the processing system within the specified time, and control all real-time tasks to run in a coordinated and consistent manner; therefore, providing timely response and high reliability are its main characteristics.
[0107] Mmap: It is a method of memory mapping files, that is, mapping a file or other object to the address space of a process, realizing a one-to-one mapping relationship between the file disk address and a virtual address in the process virtual address space; after realizing such a mapping relationship, the process can use pointers to read and write this memory segment.
[0108] musl-libc: is a lightweight, fast, and portable C standard library that is used to replace the traditional glibc and other C standard libraries; it is mainly used in embedded systems and small systems, aiming to provide high performance and low memory usage.
[0109] malloc: malloc is a library function in C language, which is used to allocate memory dynamically; it will find enough continuous memory space in the heap and allocate it to the program for use.
[0110] free: free is a library function in C language, which is used to release dynamic memory allocated by functions such as malloc.
[0111] Memory out of bounds: Memory out of bounds refers to a program accessing a location outside the memory space allocated by an array or pointer; a memory out of bounds occurs when a program attempts to read or write a location outside the allocated memory range.
[0112] Page protection: Linux page protection is an operating system-level memory protection mechanism used to control access rights and behaviors to memory pages. The page protection mechanism can set a page to read-only or read-write mode. If a page is set to read-only, a memory access exception will be generated when an attempt is made to write to the page memory, thereby terminating the process.
[0113] Memory, also known as main memory, is used to store the calculation data in the CPU (Central Processing Unit) and the data exchanged by external storage devices such as hard disks. It is a storage space that can be directly addressed by the CPU. In most programming languages, memory is managed in the form of an array, where each element occupies a certain continuous space in the memory; when a data element needs to be accessed, the program will calculate the memory address to be accessed based on the index and read or write the value at the corresponding position.
[0114] When a program accesses a location beyond the range of its allocated memory, a memory out-of-bounds situation occurs; memory out-of-bounds is a common programming error that can lead to program crashes, undefined behavior, data corruption, and security vulnerabilities. Heap memory read and write out-of-bounds problems are common memory out-of-bounds problems in C and C++ languages, which can lead to program instability, crashes, and security vulnerabilities.
[0115] In the prior art, tools such as memwatch, dmalloc, and glibc-mcheck can all detect whether a memory out-of-bounds problem exists; among them, the implementation mechanism of memwatch, dmalloc, and glibc-mcheck is to intercept the allocation and release of memory by overloading (malloc, free, etc.), and at the same time add an additional protection area before and after each allocated memory block, and the area is filled with some special characters. When the memory is accessed out of bounds, the content of the above memory area will be destroyed, so when the memory is released or the memory detection interface is actively called, if it is found that the content of the protection area is not the special filling character content, an error message will be reported.
[0116] However, when using the above-mentioned memory out-of-bounds detection method, it is necessary to link its dynamic library or static library. Therefore, the memory allocation and release methods provided by it will be used throughout the entire cycle of the process operation. Users cannot customize the scope of memory out-of-bounds detection, and its flexibility is poor. By detecting the filling characters of the protection area in free or actively calling the memory detection interface method, the first out-of-bounds scene cannot be captured, so that only the memory out-of-bounds is known, but the location where the problem occurs cannot be located.
[0117] Secondly, the implementation scenarios involved in this application are explained.
[0118] Memory is one of the most important components in a computer. It is a bridge for communication with the CPU. All programs in a computer run in memory, so the performance of memory has a great impact on the computer. Memory is also called internal storage. Its function is to temporarily store the calculation data in the CPU and the data exchanged with external storage such as hard disk. As long as the computer is running, the CPU will transfer the data to be calculated to the memory for calculation. When the calculation is completed, the CPU will transmit the result. The operation of the memory also determines the stable operation of the computer. The memory is composed of memory chips, circuit boards, gold fingers and other parts.
[0119] When a user applies to use a certain size of memory to store corresponding files, the corresponding files can be stored through a real-time operating system, which can be, for example, a smart car real-time operating system. This application does not impose any special restrictions on the type of operating system.
[0120] For example, when a user uses in-vehicle software and has file storage needs, the in-vehicle software can be used to initiate a memory storage request to the smart car real-time operating system, and the smart car real-time operating system will allocate memory for the executable file; at this time, in order to accurately locate the memory out-of-bounds problem, the operating system calls the corresponding protection page setting interface and generates a protection page corresponding to the file currently being stored, thereby performing real-time detection of whether a memory out-of-bounds problem exists, and accurately locating the memory out-of-bounds problem after it occurs.
[0121] The present application provides a memory read and write out-of-bounds detection method for an intelligent automobile operating system. By obtaining the target user's memory application requirements and the currently set environment variables, the current memory out-of-bounds detection mode is determined based on the environment variables, and the application is controlled to call the corresponding protection page setting interface to generate the corresponding protection page; according to the currently determined memory out-of-bounds detection mode, the protection page is set before or after the actual memory allocation, and the page is set to be unreadable and unwritable. When a memory out-of-bounds occurs, the kernel can generate a segmentation error, thereby accurately locating the memory out-of-bounds address. This method can flexibly arrange the starting position of the memory detection, thereby realizing a custom memory out-of-bounds detection range, improving the reliability of the memory out-of-bounds positioning results, realizing the accurate positioning of the memory out-of-bounds problem, simplifying the positioning method of the memory out-of-bounds problem, and improving the positioning efficiency of the memory out-of-bounds problem.
[0122] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0123] Figure 1 Schematic diagram of the process of the memory read and write cross-boundary detection method of the intelligent automobile operating system provided in the embodiment of the present application Figure 1 The execution subject of this embodiment may be, for example, a real-time operating system for an intelligent vehicle. Figure 1 As shown, the memory read / write cross-bounds detection method of the intelligent automobile operating system provided in this embodiment includes:
[0124] S101: Obtain the target user's executable file and preset environment variables.
[0125] The executable file is used to indicate the program file that the target user is going to run at that time, and the preset environment variables are used to distinguish the mode of memory read and write cross-bounds detection performed by the operating system at that time.
[0126] It can be understood that the target user initiates a memory storage request to the real-time operating system, and the real-time operating system allocates the corresponding memory space according to the current storage request; memory read-write out-of-bounds generally occurs when the real-time operating system reads or writes the corresponding memory space according to the needs of the target user, that is, when the memory space read or written by the real-time operating system exceeds the originally allocated memory space, the memory out-of-bounds problem occurs in the corresponding memory space; at this time, the real-time operating system resets the memory space where the current memory out-of-bounds occurs, reallocates the executable file of the target user, and sets the corresponding memory read-write out-of-bounds detection mode; wherein, the value of the environment variable determines the detection mode of the current memory read-write out-of-bounds, and the environment variable is pre-set by the real-time operating system.
[0127] When the real-time operating system obtains the memory storage application of the target user, it analyzes and processes the memory storage application, determines the executable file to be stored at that time, and obtains the currently set preset environment variables.
[0128] For example, the smart car real-time operating system obtains the storage application of the current user and analyzes and processes the application, and can obtain that the executable file currently being stored is: file A; the preset environment variable is pre-set, and after obtaining the currently stored file A, the preset environment variable that determines the current memory read and write cross-bounds detection mode is obtained, and the preset environment variable can be environment variable A. This application does not impose special restrictions on the preset environment variable.
[0129] S102: Determine an out-of-bounds detection mode for the executable file according to a preset environment variable, and generate a target protection page corresponding to the executable file according to the out-of-bounds detection mode.
[0130] The protection page is used to detect whether there is an out-of-bounds error in memory reading and writing, and the out-of-bounds detection mode is used to indicate the setting form of the current protection page relative to the executable file.
[0131] It can be understood that different types of real-time operating systems have different settable environment variables, which determine the out-of-bounds detection mode of the executable file at the time, and different out-of-bounds detection modes also determine the setting form of the target protection page generated at the time; different out-of-bounds detection modes correspond to different environment variables; after obtaining the preset environment variables set at the time, the preset environment variables are compared with the environment variables corresponding to different out-of-bounds detection modes, so as to determine the out-of-bounds detection mode corresponding to the executable file at the time; the executable file is set with a protection page according to different out-of-bounds detection modes, and the protection page can be set before the executable file or after the executable file, and the protection page does not contain any data information, and is only used to detect memory read and write out-of-bounds problems, that is, the essence of the protection page is to set a certain size of memory space corresponding to the executable file according to the currently determined out-of-bounds detection mode, and set the corresponding memory space to be unreadable and unwritable. When a memory out-of-bounds occurs, the kernel can generate a segmentation error, thereby accurately locating the memory out-of-bounds address.
[0132] According to the currently acquired preset environment variables, the preset environment variables are analyzed and processed to determine the cross-border detection mode of the executable file; according to the currently determined cross-border detection mode, a protection page corresponding to the executable file, that is, a target protection page, is generated.
[0133] For example, the real-time operating system of a smart car currently has two detection modes, namely the first detection mode and the second detection mode, and the corresponding environment variables are environment variable A and environment variable B respectively; if the preset environment variable currently obtained is environment variable A, the preset environment variable is compared with the environment variable corresponding to the detection mode pre-set by the real-time operating system, and the preset environment variable is consistent with the environment variable corresponding to the first detection mode, then it can be determined that the current out-of-bounds detection mode is the first detection mode; at this time, based on the mprotect mechanism, file A is expanded according to the first detection mode, and the expanded part is the target protection page; wherein, the mprotect mechanism also uses the mprotect function to set the protection page, and the mprotect function can modify the protection attributes of the memory page of the calling process. If the calling process attempts to access the memory in a way that violates the protection attributes, the kernel will send a corresponding signal to the process, thereby realizing the detection of memory read and write out-of-bounds problems.
[0134] S103: Determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file.
[0135] S104: storing the target executable file in the target memory space, and detecting whether there is any memory read / write cross-boundary in the target executable file.
[0136] The target executable file is used to indicate the file with a protection area set that the target user currently applies to store, and the target memory space is used to indicate the memory space allocated by the real-time operating system to the target executable file.
[0137] According to the currently generated target protection page and executable file, the target protection page is merged with the corresponding executable file according to the currently determined out-of-bounds detection mode setting to obtain the target executable file; according to the currently obtained target executable file, the real-time operating system allocates memory for the target executable file, and the memory space obtained by this allocation is the target memory space corresponding to the target executable file; at this time, the target executable file is stored in the target memory space, and the target executable file is detected to see if there is a memory read and write out-of-bounds.
[0138] It can be understood that according to the current out-of-bounds detection mode, a protection area has been set for the file stored at the time. When memory reading or writing involves this protection area, it can be determined that a memory out-of-bounds problem has occurred in the executable file; that is, by checking whether the target protection page corresponding to the executable file is read or written, it is possible to detect whether there is a memory read or write out-of-bounds problem in the target executable file.
[0139] The memory read / write cross-bounds detection method of the smart car operating system provided in this embodiment obtains the executable file and preset environment variables of the target user, determines the cross-bounds detection mode of the executable file currently performing memory allocation according to the preset environment variables, and generates the target protection page corresponding to the executable file according to the cross-bounds detection mode; determines the target executable file and the target memory space corresponding to the target executable file according to the currently determined target protection page and executable file, stores the target executable file in the corresponding target memory space, and detects whether the target executable file has memory read / write cross-bounds. This method can flexibly arrange the starting position of the memory detection, thereby realizing a custom memory cross-bounds detection range, improving the reliability of the memory cross-bounds positioning result, and improving the efficiency of locating the memory cross-bounds problem.
[0140] Figure 2 Schematic diagram of the process of the memory read and write cross-boundary detection method of the intelligent automobile operating system provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, a memory read / write cross-bounds detection method of an intelligent automobile operating system is described in detail. The memory read / write cross-bounds detection method of an intelligent automobile operating system shown in this embodiment includes:
[0141] S201: Obtain available memory space.
[0142] S202: Allocate available memory space to obtain memory management space and memory allocation space.
[0143] S203: Divide the memory management space to obtain a plurality of memory information subspaces, and mark the plurality of memory information subspaces.
[0144] Among them, the available memory space is used to indicate the space available for file storage in the operating system, the memory management space is used to store the memory address and size of the corresponding file, the memory allocation interval is used to store the executable file of the target user, and the memory information subspace is used to store the memory address and size of different executable files.
[0145] The currently allocated available memory space is obtained, and the available memory space is allocated to obtain a memory management space and a memory allocation space; the currently obtained memory management space is then divided to obtain a plurality of memory information subspaces, and the plurality of memory information subspaces are marked, so that the use status of different memory information sub-controls can be determined; wherein different memory information subspaces are used to store file addresses and address sizes of different executable files, and any memory information subspace has a one-to-one correspondence with the file actually stored in the memory allocation space.
[0146] It can be understood that the memory space is composed of a memory management space and a memory allocation space. The memory management space is used to store the address information corresponding to the actual executable file in the memory allocation space. When storing the corresponding address information, the memory management space stores the address information corresponding to different executable files in different memory information subspaces, and the memory information subspaces are a plurality of information storage spaces that are pre-divided and set. Different memory information subspaces are marked according to their usage to distinguish between used and unused memory information subspaces.
[0147] For example, the smart car real-time operating system allocates suitable memory space for the current user's storage application, that is, the available memory space, and then uses the mmap method to allocate the currently available memory space. The available space can be allocated as a memory interval of 256 pages, where the memory management space can also be the first page of the currently allocated memory interval of 256 pages, and the corresponding memory information subspace can be the drawer. That is to say, the first page of the memory interval is allocated to the drawer, and the drawer is used to manage the memory information allocated to the user, including the internal memory address and address size, the memory address and address size for the user, etc.; the last 255 pages of the memory interval are used to allocate malloc memory to the user.
[0148] S204: Obtain the target user's executable file and preset environment variables.
[0149] Step S204 is similar to the above step S101 and will not be described again.
[0150] S205: Determine whether the preset environment variable satisfies the overflow environment variable; if so, execute step S206; if not, execute step S208.
[0151] Among them, the overflow environment variable is used to indicate that memory read and write out-of-bounds detection is performed before the memory space where the executable file is located, the overflow detection mode is used to indicate that the protection page is set before the executable file, and the underflow detection mode is used to indicate that the protection page is set after the executable file.
[0152] The purpose of this step of judging whether the preset environment variables satisfy the overflow environment variables is to determine the detection mode of the current memory out-of-bounds problem.
[0153] According to the currently acquired preset environment variable, the preset environment variable is compared with the overflow environment variable to determine the current cross-border detection mode.
[0154] It is understandable that different environment variables determine different detection modes for memory out-of-bounds problems. The environment variables involved in this embodiment include but are not limited to: overflow environment variables and underflow environment variables; the current preset environment variable is compared with the overflow environment variable and the next environment variable respectively, so as to determine the environment variable consistent therewith; when judging whether the preset environment variable satisfies the overflow environment variable, if the preset environment variable does not satisfy the overflow environment variable, it indicates that the preset environment variable satisfies the underflow environment variable; and vice versa. This application does not impose any special restrictions on the type of environment variables.
[0155] If the preset environment variable satisfies the overflow environment variable, it indicates that the preset environment variable is consistent with the overflow environment variable. At this time, the out-of-bounds detection mode corresponding to the executable file stored by the target user at that time is determined as the overflow detection mode, and the overflow protection page corresponding to the executable file is generated according to the overflow detection mode, and the overflow protection page is determined as the target protection page; wherein, the overflow protection page refers to the protection area set before the memory interval corresponding to the executable file.
[0156] If the preset environment variable satisfies the underflow environment variable, it indicates that the preset environment variable is consistent with the underflow environment variable. At this time, the out-of-bounds detection mode corresponding to the executable file stored by the target user is determined as the underflow detection mode, and an underflow protection page corresponding to the executable file is generated according to the underflow detection mode, and the underflow protection page is determined as the target protection page; wherein, the underflow protection page refers to a protection area set after the memory interval corresponding to the executable file.
[0157] S206: Determine that the cross-bounds detection mode of the executable file is an overflow detection mode.
[0158] S207: Generate an overflow protection page corresponding to the executable file according to the overflow detection mode, and determine the overflow protection page as a target protection page.
[0159] S208: Determine that the cross-bounds detection mode of the executable file is an underflow detection mode.
[0160] S209: Generate an underflow protection page corresponding to the executable file according to the underflow detection mode, and determine the underflow protection page as a target protection page.
[0161] S210: According to the executable file, determine the target file size and target storage content corresponding to the executable file.
[0162] The target file size is used to indicate the size of the memory space occupied by the executable file, and the target storage content is used to indicate the specific file content corresponding to the executable file.
[0163] The currently acquired executable file is analyzed and processed, and based on the result of the analysis and processing, the size of the memory space occupied by the storage corresponding to the executable file and the specific file content, that is, the target file size and the target storage content, can be determined.
[0164] For example, if the currently acquired executable file is "file A", analysis and processing of file A may reveal that the corresponding file size is 20 bytes, and the corresponding target storage content may be web page download content A.
[0165] S211: Determine the memory storage space required for the executable file according to the target file size and the target protection page.
[0166] The memory storage space is used to indicate the size of the storage space actually required by the executable file after the protection page is set.
[0167] It can be understood that the out-of-bounds detection mode is achieved by setting a corresponding protection page before or after the memory space corresponding to the specific storage of the executable file, and setting the protection page to be unreadable and unwritable, so as to implement detection of whether there is a memory read-write out-of-bounds problem for the executable file; therefore, when the executable file is stored, the required memory space also includes the memory space of the corresponding protection page.
[0168] For example, if the current cross-bounds detection mode is overflow detection mode, and the target file size is 20 bytes, in order to ensure overflow detection, 20 bytes of memory need to be followed by 1 page of memory size, so a total of 4096+20=4116 (bytes) of memory size is required. However, since the starting address of mprotect needs to ensure page alignment, the total size of the allocated memory must be an integer multiple of the page, totalSize=(4096+20)+(4096-(4096+20) / 4096)≈8192 (bytes), then the memory storage space determined at this time is 8192 bytes; if the current cross-bounds detection mode is underflow detection mode, the target file size is 20 bytes. The target file size is 20 bytes. In order to ensure underflow detection, 1 page of memory size needs to follow the 20 bytes of memory, so a total of 4096+20=4116 (bytes) of memory size is required. However, since the starting address of mprotect needs to ensure page alignment, the total size of the allocated memory must be an integer multiple of the page, totalSize=(4096+20)+(4096-(4096+20) / 4096)≈8192 (bytes), so the memory storage space determined at this time is 8192 bytes; that is, when the size of the executable file is certain, the memory storage space required for the out-of-bounds detection mode is also certain.
[0169] S212: Determine a target executable file of a target user according to the target storage content and the target protection page.
[0170] S213: Determine the target memory space corresponding to the target executable file according to the memory storage space.
[0171] S214: Store the target executable file into the target memory space.
[0172] The target executable file is used to indicate an executable file with a protection area set, and the target memory space is used to indicate a memory interval in the memory allocation space used to store the target executable file.
[0173] According to the currently generated target protection page and target storage content, the target protection page is merged with the corresponding target storage content according to the currently determined out-of-bounds detection mode setting to obtain the target executable file; the memory allocation space is matched with the memory storage space required for the current storage of the currently determined target executable file, the memory space corresponding to the memory storage space is determined, and the memory space is determined as the target memory space; after the memory space where the executable file is stored, the target storage space with the target protection page is stored in the target memory space.
[0174] Optionally, before storing the target executable file in the target memory space, the method further includes:
[0175] Respectively obtain marking information of multiple memory information subspaces, the marking information including: free information; filter and process the multiple memory information subspaces according to the free information to obtain a target memory information subspace; determine the storage address of the target executable file according to the target memory information subspace, and generate target storage information corresponding to the target executable file; store the target storage information in the target memory information subspace.
[0176] The free information is used to indicate that the corresponding file is not stored in the memory information subspace, and the target storage information is used to indicate the memory address and address size of the target executable file.
[0177] Before storing the target executable file in the target memory space, the corresponding memory management space also needs to store the memory address and address size of the target executable file to be stored at this time. At this time, the marking information of multiple memory information subspaces is obtained respectively, and the marking information includes: free information; the multiple memory information subspaces are screened and processed according to the free information to obtain the target memory information subspace, that is, the currently unused memory information subspaces are screened, and the memory information subspace with the memory space size suitable for the current storage is determined, and the memory information subspace is determined as the target memory information subspace; according to the target memory information subspace and the file size of the target executable file to be stored at this time, the storage address of the target executable file can be determined, thereby generating the target storage information corresponding to the target executable file, and storing the target storage information in the target memory information subspace.
[0178] It can be understood that the currently available memory space is not fixed when executing an executable file. According to the needs of the target user, the required files can be stored, or the unnecessary files can be deleted, that is, the corresponding memory space is released, so that the appropriate files can be stored again; because in the process of using the memory allocation space, the memory information subspace and the memory space actually used for file storage in the memory allocation space are one-to-one corresponding, the memory space size corresponding to each memory information subspace will vary according to the actual size of the executable file at that time. Therefore, when storing the target executable file, it is necessary to match the file size stored at that time with the memory information subspace whose current mark information is free information, so as to determine the appropriate memory information subspace.
[0179] For example, if the user is performing initial storage, it indicates that the memory allocation space has not yet been allocated. At this time, when storing the target file, the file can be stored in the order of the drawers. If the user is not performing initial storage, it indicates that the memory allocation space has been allocated. There is a memory size limit on the storage space. At this time, it is necessary to first match the file size 8192 bytes stored at this time with the corresponding free drawer to determine the appropriate storage location. If the memory size corresponding to the currently obtained drawer[2] is 8251 bytes and the memory size corresponding to drawer[5] is 4096 bytes, then drawer[2] is selected to store the target executable file. At this time, the storage address corresponding to drawer[2] is the storage address of the target executable file.
[0180] Optionally, the method further includes:
[0181] Re-acquire the executable file of the target user, and determine a new target executable file and a new target storage space based on the new executable file; respectively obtain the marking information of multiple memory information subspaces, and analyze and process the marking information; if there is no target memory information subspace whose marking information is free information, determine a new memory management space based on the memory allocation space, and send the storage information corresponding to the memory management space to the new memory management space; determine a new target memory information subspace based on the new target executable file and the new memory management space; store the storage information of the new executable file according to the new target memory information subspace.
[0182] It can be understood that the tag information is used to distinguish the usage status of the memory information subspace. When the memory information subspace is used, the corresponding tag information can be the corresponding memory address; when the memory information subspace has not been used, the corresponding tag information can be, for example, IDLE; when the memory information subspace has been used and has been released, the corresponding tag information can be, for example, FREED.
[0183] When the target user needs to store a file again, the file being stored is obtained, and a new target executable file and a new target storage space are determined based on the new executable file; at this time, the marking information of multiple memory information subspaces is obtained respectively, and the marking information is analyzed and processed to determine the memory information subspace in an idle state, and the marking information of the memory information subspace may be, for example, IDLE or FREED; if there is no target memory information subspace marked as idle information, it indicates that the memory address and size of the current executable file are insufficient, that is, the memory management space is insufficient, and the memory management space needs to be managed. The expansion can determine a new memory management space based on the memory interval of the non-executable file in the memory allocation space, and the size of the new memory management space can be, for example, twice the size of the original memory management space; after the new memory management space is determined, the storage information corresponding to the original memory management space is sent to the new memory management space, the original memory management space is released, and stored in the storage form of the original memory management space; then, based on the new target executable file and the new memory management space, a new target memory information subspace is determined, and the memory address and address size of the new executable file are stored according to the new target memory information subspace.
[0184] Optionally, the method further includes:
[0185] Re-acquire the target user's executable file, and determine a new target executable file based on the new executable file; if the memory allocation space cannot meet the storage of the new target executable file, re-acquire the available memory space and determine a new target storage space corresponding to the new target executable file; store the new target executable file in the new target storage space.
[0186] When the target user needs to store a file again, the file being stored is obtained, and a new target executable file and a new target storage space are determined based on the new executable file; if the existing memory allocation space cannot meet the new target storage space, that is, the target executable file cannot be stored at this time, then it indicates that the storable memory interval of the current memory allocation space is insufficient, and the memory allocation space needs to be expanded at this time, that is, the available memory space is re-acquired, and an association relationship between the new available memory space and the memory management space in the original memory space is established, so as to obtain a new memory allocation space; based on the new memory allocation space, a new target storage space corresponding to the new target executable file is determined, and the new target executable file is stored in the new target storage space.
[0187] S215: Perform real-time detection on the target protection page of the target executable file.
[0188] S216: Obtain access status of the target protection page in real time, where the access status includes: not accessed and accessed.
[0189] S217: If the access status of the target protection page is not accessed, it is determined that there is no memory read / write cross-bounds in the target executable file.
[0190] S218: If the access status of the target protection page is already accessed, it is determined that the target executable file has a memory read / write out-of-bounds error.
[0191] Among them, not accessed means that the target protection page of the current target executable file has not been read or written, and accessed means that the target protection page of the current target executable file has been read or written.
[0192] It can be understood that the access situation indicates whether the protection page corresponding to the current executable file is read or written, thereby indicating whether the executable file has a memory read-write cross-bounds problem.
[0193] The target protection page of the target executable file is detected in real time, and the access status of the target protection page is obtained in real time; if the access status of the target protection page is not accessed, it indicates that the protection area in the memory allocation space corresponding to the target protection page has not been read or written, and it can be determined that the target executable file does not have a memory read-write out-of-bounds problem; if the access status of the target protection page is accessed, it indicates that the protection area in the memory allocation space corresponding to the target protection page has been read or written, and it can be determined that the target executable file has a memory read-write out-of-bounds problem.
[0194] The memory read and write out-of-bounds detection method for the intelligent automobile operating system provided in this implementation obtains the currently available memory space of the operating system, and allocates the available memory space to obtain the memory management space and the memory allocation space; then divides the memory management space to obtain multiple memory information subspaces, and marks the multiple memory information subspaces; obtains the executable file and preset environment variables of the target user, and determines whether the preset environment variables satisfy the overflow environment variables; determines the corresponding memory out-of-bounds detection mode according to the judgment result, and generates the corresponding target protection page according to the currently determined memory out-of-bounds detection mode; determines the target file size and target storage content corresponding to the executable file according to the executable file obtained this time , and then determine the memory storage space required for the executable file according to the target file size and the target protection page, determine the target executable file actually stored by the target user according to the target storage content and the target protection page, and determine the target memory space corresponding to the target executable file according to the memory storage space and the target storage content, and store the target executable file in the target memory space; perform real-time detection on the target protection page of the target executable file, and obtain the access status of the target protection page in real time, the access status includes: not accessed and accessed; if the access status of the target protection page is not accessed, it is determined that the target executable file does not have memory read and write out-of-bounds; if the access status of the target protection page is accessed, it is determined that the target executable file has memory read and write out-of-bounds. This method can flexibly arrange the starting position of memory detection, thereby realizing a custom memory out-of-bounds detection range, improving the reliability of memory out-of-bounds positioning results, realizing accurate positioning of memory out-of-bounds problems, simplifying the positioning method of memory out-of-bounds problems, and improving the positioning efficiency of memory out-of-bounds problems.
[0195] Figure 3 This is a schematic diagram of the structure of the memory read / write cross-boundary detection device of the intelligent automobile operating system provided by this application. Figure 3 As shown, the present application provides a memory read / write cross-bounds detection device for an intelligent automobile operating system, and the memory read / write cross-bounds detection device 300 for an intelligent automobile operating system includes:
[0196] The acquisition module 301 is used to acquire the executable file and preset environment variables of the target user.
[0197] The determination module 302 is used to determine the cross-border detection mode of the executable file according to the preset environment variable.
[0198] The generating module 303 is used to generate a target protection page corresponding to the executable file according to the cross-border detection mode, and the target protection page is used to detect whether there is cross-border in memory reading and writing.
[0199] The determination module 302 is further configured to determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file.
[0200] The processing module 304 is used to store the target executable file in the target memory space and detect whether there is any memory read / write cross-boundary error in the target executable file.
[0201] Optionally, the memory read / write cross-boundary detection device of the intelligent automobile operating system further includes: a judgment module 305.
[0202] The judging module 305 is used to judge whether the preset environment variable satisfies the overflow environment variable.
[0203] If the preset environment variable satisfies the overflow environment variable, the determination module 302 is further used to determine that the cross-boundary detection mode of the executable file is an overflow detection mode, and the overflow detection mode is used to indicate that the protection page is set before the executable file.
[0204] The generating module 303 is further configured to generate an overflow protection page corresponding to the executable file according to the overflow detection mode.
[0205] The determination module 302 is further configured to determine the overflow protection page as a target protection page.
[0206] If the preset environment variable does not satisfy the overflow environment variable, the determination module 302 is further used to determine that the cross-bounds detection mode of the executable file is an underflow detection mode, and the underflow detection mode is used to indicate that the protection page is set after the executable file.
[0207] The generating module 303 is further configured to generate an underflow protection page corresponding to the executable file according to the underflow detection mode.
[0208] The determination module 302 is further configured to determine the underflow protection page as a target protection page.
[0209] Optionally, the acquisition module 301 is further used to acquire available memory space, where the available memory space is used to indicate the space available for file storage by the operating system.
[0210] The processing module 304 is further used to allocate the available memory space to obtain a memory management space and a memory allocation space, wherein the memory management space is used to store the memory address and size of the corresponding file, and the memory allocation interval is used to store the executable file of the target user.
[0211] The processing module 304 is further used to divide the memory management space to obtain multiple memory information subspaces, and mark the multiple memory information subspaces, where the memory information subspaces are used to store memory addresses and sizes of different executable files.
[0212] Optionally, the determination module 302 is further configured to determine, based on the executable file, a target file size and target storage content corresponding to the executable file.
[0213] The determination module 302 is further configured to determine the memory storage space required by the executable file according to the target file size and the target protection page.
[0214] The determination module 302 is further configured to determine a target executable file of the target user according to the target storage content and the target protection page.
[0215] The determination module 302 is further configured to determine a target memory space corresponding to the target executable file according to the memory storage space.
[0216] Optionally, the acquisition module 301 is further used to respectively acquire marking information of the multiple memory information subspaces, and the marking information includes: idle information.
[0217] The processing module 304 is further configured to filter the multiple memory information subspaces according to the idle information to obtain a target memory information subspace.
[0218] The determination module 302 is further configured to determine a storage address of the target executable file according to the target memory information subspace.
[0219] The generating module 303 is further configured to generate target storage information corresponding to the target executable file.
[0220] The processing module 304 is further configured to store the target storage information into the target memory information subspace.
[0221] Optionally, the acquisition module 301 is further used to reacquire the executable file of the target user.
[0222] The determination module 302 is further configured to determine a new target executable file and a new target storage space according to the new executable file.
[0223] The acquisition module 301 is further used to respectively acquire the marking information of the multiple memory information subspaces.
[0224] The processing module 304 is further configured to analyze and process the marking information.
[0225] If there is no target memory information subspace whose marking information is the free information, the determining module 302 is further configured to determine a new memory management space according to the memory allocation space.
[0226] The processing module 304 is further configured to send the storage information corresponding to the memory management space to the new memory management space.
[0227] The determination module 302 is further configured to determine a new target memory information subspace according to the new target executable file and the new memory management space.
[0228] The processing module 304 is further configured to store the storage information of the new executable file according to the new target memory information subspace.
[0229] The determination module 302 is further configured to determine a new target executable file according to the new executable file.
[0230] If the memory allocation space cannot satisfy the storage of the new target executable file, the acquisition module 301 is further used to reacquire available memory space.
[0231] The determination module 302 is further configured to determine a new target storage space corresponding to the new target executable file.
[0232] The processing module 304 is further configured to store the new target executable file in the new target storage space.
[0233] Optionally, the processing module 304 is further configured to perform real-time detection on the target protection page of the target executable file.
[0234] The acquisition module 301 is also used to acquire the access status of the target protection page in real time, and the access status includes: not accessed and accessed.
[0235] If the access status of the target protection page is no access, the determination module 302 is further used to determine that there is no memory read / write cross-boundary in the target executable file.
[0236] If the access status of the target protection page is already accessed, the determination module 302 is further used to determine whether the target executable file has a memory read / write cross-boundary error.
[0237] Figure 4 This is a schematic diagram of the structure of the memory read / write cross-bounds detection device of the intelligent automobile operating system provided by this application. Figure 4As shown, the present application provides a memory read / write out-of-bounds detection device for an intelligent automobile operating system. The memory read / write out-of-bounds detection device 400 for the intelligent automobile operating system includes: a receiver 401 , a transmitter 402 , a processor 403 and a memory 404 .
[0238] Receiver 401, used for receiving instructions and data;
[0239] A transmitter 402, used for sending instructions and data;
[0240] Memory 404, for storing computer-executable instructions;
[0241] The processor 403 is used to execute the computer-executable instructions stored in the memory 404 to implement the various steps executed by the memory read / write cross-bounds detection method of the intelligent automobile operating system in the above embodiment. For details, please refer to the relevant description in the embodiment of the memory read / write cross-bounds detection method of the intelligent automobile operating system.
[0242] Optionally, the memory 404 may be independent or integrated with the processor 403 .
[0243] When the memory 404 is independently provided, the electronic device further includes a bus for connecting the memory 404 and the processor 403 .
[0244] The present application also provides a computer-readable storage medium, which stores computer execution instructions. When the processor executes the computer execution instructions, it implements the memory read and write out-of-bounds detection method of the intelligent vehicle operating system as executed by the memory read and write out-of-bounds detection device of the intelligent vehicle operating system mentioned above.
[0245] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0246] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0247] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0248] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0249] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0250] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solution of the present application rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A memory read / write cross-bounds detection method for an intelligent automobile operating system, characterized in that: The method comprises: Get the target user's executable files and preset environment variables; Determine the cross-border detection mode of the executable file according to the preset environment variable, and generate a target protection page corresponding to the executable file according to the cross-border detection mode, wherein the target protection page is used to detect whether there is cross-border in memory reading and writing; Determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file; The target executable file is stored in the target memory space, and whether there is a memory read / write cross-boundary in the target executable file is detected.
2. The method according to claim 1, characterized in that The determining, according to the preset environment variable, a cross-border detection mode of the executable file, and generating a target protection page corresponding to the executable file according to the cross-border detection mode, includes: Determining whether the preset environment variable satisfies the overflow environment variable; If the preset environment variable satisfies the overflow environment variable, determining that the cross-bounds detection mode of the executable file is an overflow detection mode, the overflow detection mode is used to indicate that the protection page is set before the executable file; generating an overflow protection page corresponding to the executable file according to the overflow detection mode, and determining the overflow protection page as a target protection page; If the preset environment variable does not satisfy the overflow environment variable, determining that the cross-bounds detection mode of the executable file is an underflow detection mode, the underflow detection mode is used to indicate that the protection page is set after the executable file; An underflow protection page corresponding to the executable file is generated according to the underflow detection mode, and the underflow protection page is determined as a target protection page.
3. The method according to claim 2, characterized in that Before obtaining the target user's executable file and preset environment variables, the method further includes: Obtaining available memory space, where the available memory space is used to indicate the space available for file storage by the operating system; Allocating the available memory space to obtain a memory management space and a memory allocation space, wherein the memory management space is used to store a memory address and size of a corresponding file, and the memory allocation interval is used to store an executable file of the target user; The memory management space is divided to obtain a plurality of memory information subspaces, and the plurality of memory information subspaces are marked. The memory information subspaces are used to store memory addresses and sizes of different executable files.
4. The method according to claim 3, characterized in that The step of determining a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file includes: According to the executable file, determining a target file size and target storage content corresponding to the executable file; Determining the memory storage space required for the executable file according to the target file size and the target protection page; Determining a target executable file of the target user according to the target storage content and the target protection page; According to the memory storage space, a target memory space corresponding to the target executable file is determined.
5. The method according to claim 4, characterized in that Before storing the target executable file in the target memory space, the method further includes: Respectively obtain the marking information of the plurality of memory information subspaces, the marking information comprising: idle information; Filtering the plurality of memory information subspaces according to the idle information to obtain a target memory information subspace; Determining the storage address of the target executable file according to the target memory information subspace, and generating target storage information corresponding to the target executable file; The target storage information is stored in the target memory information subspace.
6. The method according to claim 5, characterized in that The method further comprises: Re-acquire the target user's executable file, and determine a new target executable file and a new target storage space based on the new executable file; Respectively obtaining marking information of the plurality of memory information subspaces, and analyzing and processing the marking information; If there is no target memory information subspace whose mark information is the free information, determining a new memory management space according to the memory allocation space, and sending the storage information corresponding to the memory management space to the new memory management space; Determine a new target memory information subspace according to the new target executable file and the new memory management space; Storing the storage information of the new executable file according to the new target memory information subspace; The method further comprises: Re-acquire the target user's executable file, and determine a new target executable file based on the new executable file; If the memory allocation space cannot satisfy the storage of the new target executable file, reacquire the available memory space and determine a new target storage space corresponding to the new target executable file; The new target executable file is stored in the new target storage space.
7. The method according to claim 6, characterized in that The detecting whether the target executable file has memory read / write cross-bounds includes: Performing real-time detection on a target protection page of the target executable file; Acquire the access status of the target protection page in real time, wherein the access status includes: not accessed and accessed; If the access status of the target protection page is not accessed, it is determined that there is no memory read / write cross-bounds in the target executable file; If the access status of the target protection page is accessed, it is determined that the target executable file has a memory read / write cross-boundary error.
8. A memory read / write cross-bounds detection device for an intelligent automobile operating system, characterized in that: The device comprises: The acquisition module is used to obtain the target user's executable files and preset environment variables; A determination module, used to determine the cross-border detection mode of the executable file according to the preset environment variable; A generation module, used to generate a target protection page corresponding to the executable file according to the cross-border detection mode, wherein the target protection page is used to detect whether there is a cross-border in memory reading and writing; The determination module is further used to determine a target executable file and a target memory space corresponding to the target executable file according to the target protection page and the executable file; The processing module is used to store the target executable file in the target memory space and detect whether there is any memory read / write cross-boundary in the target executable file.
9. A memory read / write cross-bounds detection device for an intelligent automobile operating system, characterized in that: include: Memory; processor; Wherein, the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the memory read-write cross-boundary detection method of the intelligent automobile operating system 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, which, when executed by a processor, are used to implement the memory read-write out-of-bounds detection method for an intelligent automobile operating system as described in any one of claims 1 to 7.