CN112541182B - Kernel VFS layer system repairing method, device, equipment and storage medium - Google Patents

Kernel VFS layer system repairing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112541182B
CN112541182B CN202011542234.0A CN202011542234A CN112541182B CN 112541182 B CN112541182 B CN 112541182B CN 202011542234 A CN202011542234 A CN 202011542234A CN 112541182 B CN112541182 B CN 112541182B
Authority
CN
China
Prior art keywords
file
accessed
modified
target
layer system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011542234.0A
Other languages
Chinese (zh)
Other versions
CN112541182A (en
Inventor
张成亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou 360 Intelligent Security Technology Co Ltd
Original Assignee
Suzhou 360 Intelligent Security Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou 360 Intelligent Security Technology Co Ltd filed Critical Suzhou 360 Intelligent Security Technology Co Ltd
Priority to CN202011542234.0A priority Critical patent/CN112541182B/en
Publication of CN112541182A publication Critical patent/CN112541182A/en
Application granted granted Critical
Publication of CN112541182B publication Critical patent/CN112541182B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of computers, and discloses a kernel VFS layer system repairing method, a kernel VFS layer system repairing device, kernel VFS layer system repairing equipment and a storage medium, wherein the kernel VFS layer system repairing device comprises the following steps: when a patch package is received, extracting a file list and diff files from the patch package, and carrying out diff on the files with the holes and the files without the holes by a server to obtain the patch package; loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file; when an access request is received, determining a file to be accessed according to the access request; when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file; and generating a target file according to the target difference file and the file to be accessed, so that the target file can be generated according to the target difference file and the file to be accessed without depending on a bottom file system, and vulnerability repair can be completed without occupying excessive memory space.

Description

Kernel VFS layer system repairing method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a kernel VFS layer system repairing method, device, equipment and storage medium.
Background
At present, when bug fixing is carried out on a Linux VFS layer, a main target of the fixing is a file, but existing bug fixing methods are complex, depend on a bottom file system, and need to occupy more memory space when bug fixing is carried out.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a kernel VFS layer system repairing method, a kernel VFS layer system repairing device, kernel VFS layer system repairing equipment and a storage medium, and aims to solve the technical problem that bug repairing depends on a bottom file system and needs to occupy more memory space in the prior art.
In order to achieve the above object, the present invention provides a kernel VFS layer system repairing method, including the following steps:
when a patch package is received, extracting a file list and diff files from the patch package, wherein the patch package is obtained by a server by diff of files with holes and files without holes;
loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file;
when an access request is received, determining a file to be accessed according to the access request;
when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file;
and generating a target file according to the target difference file and the file to be accessed.
Optionally, the loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file includes:
loading the file list into a memory, and determining modified file information according to the file list;
extracting a modified file name from the modified file information, and determining a modified file according to the modified file name;
and adding identification information according to the modified file so as to identify the modified file.
Optionally, the adding identification information according to the modified file to identify the modified file includes:
acquiring an index node corresponding to the modified file;
and adding identification information in the index node to identify the modified file.
Optionally, when receiving an access request, determining a file to be accessed according to the access request includes:
receiving an access request when the access request is detected through a hook layer;
extracting information of a file to be accessed from the access request, and extracting a name of the file to be accessed from the information of the file to be accessed;
and determining the file to be accessed according to the name of the file to be accessed.
Optionally, after determining the file to be accessed according to the name of the file to be accessed, the method further includes:
and performing hook through a hook layer and the name of the file to be accessed to acquire the file to be accessed.
Optionally, before determining the target difference file corresponding to the file to be accessed according to the file list and the diff file when the file to be accessed has the identifier, the method further includes:
and performing identification detection on the file to be accessed to judge whether the file to be accessed has an identification or not.
Optionally, the performing identifier detection on the file to be accessed to determine whether an identifier exists in the file to be accessed includes:
acquiring an index node to be detected corresponding to the file to be accessed;
detecting whether the index node to be detected has identification information or not to obtain a detection result;
and judging whether the file to be accessed has the identifier or not according to the detection result.
Optionally, after determining whether the identifier exists in the file to be accessed according to the detection result, the method further includes:
when the detection result indicates that the index node to be detected has identification information, judging that the file to be accessed has an identification;
and when the detection result indicates that the identification information does not exist in the index node to be detected, judging that the identification does not exist in the file to be accessed.
Optionally, after performing identifier detection on the file to be accessed to determine whether an identifier exists in the file to be accessed, the method further includes:
and when the file to be accessed does not have the identifier, taking the file to be accessed as a target file.
Optionally, when the to-be-accessed file has the identifier, determining the target difference file corresponding to the to-be-accessed file according to the file list and the diff file includes:
when the file to be accessed has the identifier, matching target modified file information corresponding to the file to be accessed in the file list;
and determining a target difference file corresponding to the file to be accessed according to the target modification file information and the diff file.
Optionally, after determining the target difference file corresponding to the file to be accessed according to the target modified file information and the diff file, the method further includes:
extracting a target file path from the target modification file information;
and acquiring the target difference file from the diff file according to the target file path.
Optionally, the generating a target file according to the target difference file and the file to be accessed includes:
extracting target difference data from the target difference file;
and performing data restoration on the file to be accessed according to the target difference data to generate a target file.
In addition, in order to achieve the above object, the present invention further provides a kernel VFS layer system repair device, including:
the patch package module is used for extracting a file list and diff files from the patch package when the patch package is received, wherein the patch package is obtained by a server by diff of the files with the holes and the files without the holes;
the file identification module is used for loading the file list into a memory, determining a modified file according to the file list and identifying the modified file;
the file access module is used for determining a file to be accessed according to an access request when the access request is received;
the difference file module is used for determining a target difference file corresponding to the file to be accessed according to the file list and the diff file when the file to be accessed has the identifier;
and the target file module is used for generating a target file according to the target difference file and the file to be accessed.
Optionally, the file identification module is further configured to load the file list into a memory, and determine to modify file information according to the file list; extracting a modified file name from the modified file information, and determining a modified file according to the modified file name; and adding identification information according to the modified file so as to identify the modified file.
Optionally, the file identification module is further configured to obtain an index node corresponding to the modified file; and adding identification information in the index node to identify the modified file.
Optionally, the file access module is further configured to receive the access request when the access request is detected through a hook layer; extracting information of a file to be accessed from the access request, and extracting a name of the file to be accessed from the information of the file to be accessed; and determining the file to be accessed according to the name of the file to be accessed.
Optionally, the file access module is further configured to perform hook through a hook layer and the name of the file to be accessed, so as to obtain the file to be accessed.
Optionally, the difference file module is further configured to perform identifier detection on the file to be accessed, so as to determine whether an identifier exists in the file to be accessed.
In addition, in order to achieve the above object, the present invention further provides a kernel VFS layer system repair device, where the kernel VFS layer system repair device includes: the kernel VFS layer system repairing program is stored on the memory and can run on the processor, and when being executed by the processor, the kernel VFS layer system repairing program realizes the steps of the kernel VFS layer system repairing method.
In addition, in order to achieve the above object, the present invention further provides a storage medium, where a kernel VFS layer system repair program is stored, and when executed by a processor, the kernel VFS layer system repair program implements the steps of the kernel VFS layer system repair method described above.
According to the kernel VFS layer system repairing method, when a patch package is received, a file list and diff files are extracted from the patch package, and the patch package is obtained by diff of a server on a file with a bug and a file without a hole; loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file; when an access request is received, determining a file to be accessed according to the access request; when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file; and generating a target file according to the target difference file and the file to be accessed, so that the target file can be generated according to the target difference file and the file to be accessed without depending on a bottom file system, and vulnerability repair can be completed without occupying excessive memory space.
Drawings
Fig. 1 is a schematic structural diagram of a kernel VFS layer system repair device in a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a kernel VFS layer system repair method according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a vulnerability file and a non-vulnerability file diff according to an embodiment of the kernel VFS layer system repair method;
FIG. 4 is a flowchart illustrating a kernel VFS layer system repairing method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of a file identifier according to an embodiment of a kernel VFS layer system repair method of the present invention;
FIG. 6 is a flowchart illustrating a kernel VFS layer system repairing method according to a third embodiment of the present invention;
fig. 7 is a schematic diagram illustrating the detection of the presence identifier according to an embodiment of the method for repairing the VFS layer system of the kernel of the present invention;
fig. 8 is a schematic diagram of identifier detection without an identifier according to an embodiment of the kernel VFS layer system repair method of the present invention;
fig. 9 is a schematic flowchart of a kernel VFS layer system repair method according to a fourth embodiment of the present invention;
fig. 10 is a functional block diagram of a kernel VFS layer system repair apparatus according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a kernel VFS layer system repair device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the kernel VFS layer system repair device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may comprise a Display screen (Display), an input unit such as keys, and the optional user interface 1003 may also comprise a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The Memory 1005 may be a Random Access Memory (RAM) Memory or a non-volatile Memory (e.g., a magnetic disk Memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the device architecture shown in fig. 1 does not constitute a definition of a kernel VFS layer system repair device and may include more or fewer components than shown, or some components combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a kernel VFS layer system repair program.
In the kernel VFS layer system repair device shown in fig. 1, the network interface 1004 is mainly used for connecting to an external network and performing data communication with other network devices; the user interface 1003 is mainly used for connecting a user equipment and performing data communication with the user equipment; the device calls a kernel VFS layer system repair program stored in the memory 1005 through the processor 1001, and executes the kernel VFS layer system repair method provided by the embodiment of the present invention.
Based on the hardware structure, the embodiment of the kernel VFS layer system repair method is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a kernel VFS layer system repair method according to a first embodiment of the present invention.
In a first embodiment, the kernel VFS layer system repair method includes the steps of:
and S10, when a patch package is received, extracting a file list and diff files from the patch package, wherein the server of the patch package carries out diff on the files with the vulnerabilities and the files without the vulnerabilities.
It should be noted that the execution main body in this embodiment may be a kernel VFS layer system repair device, such as a terminal device, or may also be other devices that can implement the same or similar functions.
It should be noted that the technical solution of this embodiment can be applied to a Linux System, and a VFS (virtual File System) is used to call and read different File systems located on different physical media by using a standard Linux System, so that a unified operating interface and application programming interface are provided for various File systems. The VFS is a bond layer that allows system calls such as open (), read (), write (), and the like to operate without regard to the underlying storage medium and file system type.
It should be understood that, when a server detects a file with a vulnerability, it may obtain a file without a vulnerability corresponding to the file with the vulnerability, and diff is performed on the file with the vulnerability and the file without the vulnerability to obtain a patch package. Where the diff command is in the simplest case comparing two files differently, if a "-" is used instead of a file parameter, the content to be compared comes from the standard input. The diff command compares similarities and differences of text files in a row-by-row manner, and if directories are specified to be compared, the diff command compares the text files with the same name under two directories, but does not compare sub-directories.
In a specific implementation, as shown in fig. 3, fig. 3 is a schematic diagram of a vulnerability file and a non-vulnerability file diff, and set1 is a vulnerability file, including: 1. 2, 3, 4, 5, set2 is a hole-free file, comprising: 1. 2, 3', 4, 5', it can be seen that 3, 5 in set1 are different from 3', 5' in set2 by diff of set1 and set2, and thus, the patch can be generated from 3', 5' by using 3', 5' as diff files.
It should be understood that the patch package in this embodiment is composed of a diff file and a file list, where the difference file is the content of the diff file, and the file list is a list describing the diff file, for example, file information such as a file name, a file size, and a file path of the diff file may be recorded in the file list, and other file information may also be recorded, which is not limited in this embodiment.
Therefore, after diff is carried out on the files with the bugs and the files without the holes by the server to obtain diff files, diff file information corresponding to the diff files can be obtained by the server, a file list is generated according to the diff file information, and a patch package is generated according to the diff files and the file list. As shown in fig. 3, the patch package in fig. 3 is composed of a diff file: 3', 5' and a file list.
It should be understood that, after the server generates the patch package, the server sends the patch package to the terminal device, and after receiving the patch package, the terminal device may decompress the patch package to obtain the diff file and the file list.
And step S20, loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file.
It can be understood that, after obtaining the file list, the terminal device may load the file list into the memory, determine the modified file according to the file list, and identify the modified file.
In a specific implementation, the modified file may be determined to be files 3 and 5 according to the file list, and at this time, the files 3 and 5 may be identified.
And step S30, when receiving the access request, determining the file to be accessed according to the access request.
It should be understood that when the VFS layer makes system calls such as open (), read (), write (), etc., access is made to the VFS layer, and therefore, when an access request is received, a file to be accessed can be determined from the access request.
Further, in order to more accurately detect the access request and determine the file to be accessed, the step S30 includes:
receiving an access request when the access request is detected through a hook layer; extracting information of a file to be accessed from the access request, and extracting a name of the file to be accessed from the information of the file to be accessed; and determining the file to be accessed according to the name of the file to be accessed.
It will be appreciated that upon detecting an access request by an accessing process through the hook layer, the access request may be received and the file to be accessed may be determined based on the access request. The file information to be accessed can be extracted from the access request, and the file name to be accessed can be further extracted from the file information to be accessed, and since each file has the corresponding file name, for example, the name corresponding to the file 3 is "file 3", the name corresponding to the file 4 is "file 4", and the like, after the file name to be accessed is determined, the file to be accessed can be determined according to the file name to be accessed.
Further, after determining the file to be accessed, in order to more accurately acquire the file to be accessed, after determining the file to be accessed according to the name of the file to be accessed, the method further includes:
and performing hook through a hook layer and the name of the file to be accessed to acquire the file to be accessed.
It can be understood that after the name of the file to be accessed is determined, in order to accurately acquire the file to be accessed corresponding to the name of the file to be accessed, a hook operation can be performed through a hook layer and the name of the file to be accessed, so as to acquire the file to be accessed.
And S40, when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file.
It should be understood that, since the file to be modified is already identified in the above steps, whether the file to be accessed needs to be modified can be determined by detecting whether the file to be accessed has the identification. If the file to be accessed has the identifier, the file to be accessed needs to be modified, and if the file to be accessed does not have the identifier, the file to be accessed does not need to be modified.
It can be understood that when the file to be accessed needs to be modified, the target difference file corresponding to the file to be accessed can be determined according to the file list and the diff file, and then the file to be detected is repaired according to the target difference file.
And S50, generating a target file according to the target difference file and the file to be accessed.
It should be understood that after the target difference file and the file to be accessed are determined, the file to be accessed may be processed based on the target difference file to generate the target file, so that an effect of performing bug fixing on the file to be accessed may be achieved.
It is understood that the step may specifically be: target difference data can be extracted from the target difference file, data reduction is carried out on the file to be accessed according to the target difference data to generate a target file, and the target file is fed back to the access process.
It can be understood that, in the embodiment, the capability of repairing any real file is provided by the scheme for all the file characteristics of the Linux system, and the transmission load of file transmission can be reduced because the patch package is in a compressed format. In addition, the method does not depend on a bottom file system, supports byte random access, supports synthesis while using, does not occupy excessive memory space, and repairs the vulnerability of the file when the file needs to be used, thereby avoiding resource waste.
In the embodiment, when a patch package is received, a file list and diff files are extracted from the patch package, and the patch package is obtained by diff of a vulnerability file and a non-hole leakage file through a server; loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file; when an access request is received, determining a file to be accessed according to the access request; when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file; and generating a target file according to the target difference file and the file to be accessed, so that the target file can be generated according to the target difference file and the file to be accessed without depending on a bottom file system, and vulnerability repair can be completed without occupying excessive memory space.
In an embodiment, as shown in fig. 4, a second embodiment of the kernel VFS layer system repairing method according to the present invention is proposed based on the first embodiment, where the step S20 includes:
step S201, loading the file list into a memory, and determining modified file information according to the file list.
It should be understood that the terminal device may load the file list into the memory of the kernel, so that excessive memory occupation is not increased, and the file list may be called from the memory in time when the file list needs to be used, thereby improving the bug fixing efficiency.
It can be understood that, since the file list records the file information corresponding to the diff file, the modified file information of the files needing to be modified can be determined according to the file list.
Step S202, extracting the name of the modified file from the modified file information, and determining the modified file according to the modified name.
It can be understood that, since the file information corresponding to the diff file recorded in the file list includes information such as a file name, a file size, and a file path, after obtaining the modified file information, the modified file name can be extracted from the modified file information, and the modified file can be determined according to the modified file name.
In a specific implementation, for example, when the modified file names extracted from the modified file information are "file 3" and "file 5", the modified files may be determined to be file 3 and file 5.
Step S203, adding identification information according to the modified file to identify the modified file.
It should be understood that after determining the modified file, identification information may be added according to the modified file to achieve the effect of identifying the modified file. For example, when modifying files into files 3 and 5, identification information may be added to files 3 and 5 to identify files 3 and 5.
Further, since the present solution is applied to the Linux system, in order to achieve a better identification effect, the step S203 includes:
acquiring an index node corresponding to the modified file; and adding identification information in the index node to identify the modified file.
It should be understood that each file has a corresponding inode, and an inode is a data structure in the Linux system, and is essentially a structural body, which contains some important information related to each file in the file system, when the file system is created in the Linux system, a large number of inodes will be created at the same time, usually about one percent of the disk space of the file system is allocated to the inode table, so that a large amount of time can be saved and the work efficiency can be improved by using the inode in the Linux system.
Therefore, after the modified file is determined, the index node corresponding to the modified file can be obtained, and the identification information is added to the index node corresponding to the modified file, so that the effect of identifying the modified file is achieved.
In a specific implementation, as shown in fig. 5, fig. 5 is a schematic diagram of file identification, where the modified files are a file 3 and a file 5, the inode3 corresponding to the file 3 and the inode5 corresponding to the file 5 may be respectively obtained, and then identification information is added to the inode3 and the inode5 to identify the file 3 and the file 4.
In the embodiment, the file list is loaded into a memory, and file information is determined to be modified according to the file list; extracting a modified file name from the modified file information, and determining a modified file according to the modified file name; the identification information is added according to the modified file to identify the modified file, so that the name of the modified file is determined according to the file list, the modified file is further determined, the modified file is identified by adding the identification information, whether the file needs to be repaired is judged in the subsequent steps by means of identification detection, and the detection efficiency and accuracy are improved.
In an embodiment, as shown in fig. 6, a third embodiment of the kernel VFS layer system repair method according to the present invention is proposed based on the first embodiment or the second embodiment, and in this embodiment, the description is made based on the first embodiment, before the step S40, the method further includes:
and S01, carrying out identification detection on the file to be accessed so as to judge whether the file to be accessed has an identification or not.
It should be understood that after determining the file to be accessed, the file to be accessed may be subjected to identifier detection to determine whether the file to be accessed has an identifier, where when the file to be accessed has the identifier, it indicates that the file to be accessed needs to be repaired, and when the file to be accessed does not have the identifier, it indicates that the file to be accessed does not need to be repaired, and in both cases, different codes are executed to perform different operations.
Further, in order to detect whether the file to be accessed has the identifier more accurately and improve the accuracy of the detection, the S01 includes:
acquiring an index node to be detected corresponding to the file to be accessed; detecting whether the index node to be detected has identification information or not to obtain a detection result; and judging whether the file to be accessed has an identifier or not according to the detection result.
It can be understood that the identifier detection may be to acquire an index node to be detected corresponding to the file to be accessed, and determine whether the identifier exists in the file to be accessed by detecting whether the identifier information exists in the index node.
In a specific implementation, as shown in fig. 7, fig. 7 is a schematic diagram illustrating identifier detection with an identifier, and assuming that a file to be accessed is a file 5, an inode5 to be detected corresponding to the file 5 may be obtained, whether identifier information exists in the inode5 is detected to determine whether an identifier exists in the file 5, and when identifier information exists in the inode5, it is stated that the identifier exists in the file 5, and then a target file is generated according to the file 5 and a target difference file corresponding to the file 5.
Further, since the index node records file information of a file corresponding to the index node, the index node to be detected records various file information of a node to be accessed, and the identification condition of the node to be accessed can be determined according to the file information, and after judging whether the file to be accessed has an identification according to the detection result, the method further includes:
when the detection result is that the identification information exists in the index node to be detected, judging that the identification exists in the file to be accessed; and when the detection result indicates that the identification information does not exist in the index node to be detected, judging that the identification does not exist in the file to be accessed.
It should be understood that when the detection result is that the identification information exists in the index node to be detected, it indicates that the identification exists in the file to be accessed, and when the detection result is that the identification information does not exist in the index node to be detected, it indicates that the identification does not exist in the node to be accessed.
Further, because there is also a case that there is no identifier for the file to be accessed, in this case, it is still necessary to make a response to the access request, and after performing identifier detection on the file to be accessed to determine whether there is an identifier in the file to be accessed, the method further includes:
and when the file to be accessed does not have the identifier, taking the file to be accessed as a target file.
It should be understood that when the file to be accessed does not have the identifier, it is indicated that the file to be accessed does not need to be modified, and the file to be accessed is directly fed back to the access process as the target file.
In a specific implementation, as shown in fig. 8, fig. 8 is a schematic diagram of identifier detection without an identifier, assuming that a file to be accessed is file 1, the inode1 to be detected corresponding to the file 1 may be obtained, and whether identifier information exists in the inode1 is detected to determine whether an identifier exists in the file 1, and when the identifier information does not exist in the inode5, it is stated that the identifier exists in the file 1, and then the file 1 is used as a target file.
In the embodiment, the identification of the file to be accessed is detected to judge whether the file to be accessed has the identification, and different operation strategies are adopted according to the judgment result, so that the flexibility of file access is improved.
In an embodiment, as shown in fig. 9, a fourth embodiment of the kernel VFS layer system repair method according to the present invention is proposed based on the first embodiment or the second embodiment, and in this embodiment, the description is made based on the first embodiment, where the step S40 includes:
step S401, when the file to be accessed has the identifier, matching target modified file information corresponding to the file to be accessed in the file list.
It should be understood that when the file to be accessed has the identifier, it indicates that the file to be accessed needs to be repaired, and the target modified file information corresponding to the file to be accessed may be matched in the file list.
Step S402, determining a target difference file corresponding to the file to be accessed according to the target modification file information and the diff file.
It can be understood that the target modified file name can be extracted from the target modified file information, and then the target difference file corresponding to the file to be accessed is determined according to the target modified file name and the diff file.
In a specific implementation, for example, when the file to be accessed is the file 5, the target modified file information corresponding to the file 5 may be matched in the file list, and then the target modified file name may be determined to be the file 5', and further the target difference file corresponding to the file to be accessed may be determined according to the target file name and the diff file.
Further, since a file path is recorded in the file list, the method can acquire the file path from the file list to acquire the differential file, and after determining the target differential file corresponding to the file to be accessed according to the target modified file information and the diff file, the method further includes:
extracting a target file path from the target modification file information; and acquiring the target difference file from the diff file according to the target file path.
It should be understood that, since the diff file may include a plurality of difference files, the search is complex, and in order to improve the efficiency of obtaining the difference file, after the target difference file is determined according to the name of the target modified file, the target file path may be extracted from the target modified file information, and then the target difference file may be obtained from the diff file according to the target file path.
In this embodiment, when the file to be accessed has the identifier, matching target modified file information corresponding to the file to be accessed in the file list, determining a target difference file corresponding to the file to be accessed according to the target modified file information and the diff file, and extracting a target file path from the target modified file information; and acquiring the target difference file from the diff file according to the target file path, so that the target difference file can be determined according to the file list, and the target difference file can be acquired from the diff file according to the file path information recorded in the file list, so that the target difference file can be accurately determined and acquired, and the acquisition efficiency of the target difference file is improved.
In addition, an embodiment of the present invention further provides a storage medium, where the storage medium stores a kernel VFS layer system repair program, and the kernel VFS layer system repair program, when executed by a processor, implements the steps of the kernel VFS layer system repair method described above.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
In addition, referring to fig. 10, an embodiment of the present invention further provides a kernel VFS layer system repair device, where the kernel VFS layer system repair device includes:
the patch package module 10 is configured to extract a file list and diff files from the patch package when the patch package is received, where the patch package is obtained by a server by diff processing a vulnerability file and a non-vulnerability file.
And the file identification module 20 is configured to load the file list into a memory, determine a modified file according to the file list, and identify the modified file.
The file access module 30 is configured to determine, when receiving an access request, a file to be accessed according to the access request.
And the difference file module 40 is configured to determine, when the to-be-accessed file has the identifier, a target difference file corresponding to the to-be-accessed file according to the file list and the diff file.
And an object file module 50, configured to generate an object file according to the object difference file and the file to be accessed.
In the embodiment, when a patch package is received, a file list and diff files are extracted from the patch package, and the patch package is obtained by diff of a vulnerability file and a non-vulnerability file through a server; loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file; when an access request is received, determining a file to be accessed according to the access request; when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file; and generating a target file according to the target difference file and the file to be accessed, so that the target file can be generated according to the target difference file and the file to be accessed without depending on a bottom file system, and vulnerability repair can be completed without occupying excessive memory space.
In an embodiment, the difference file module 40 is further configured to obtain an index node to be detected corresponding to the file to be accessed; detecting whether the index node to be detected has identification information or not to obtain a detection result; and judging whether the file to be accessed has an identifier or not according to the detection result.
In an embodiment, the difference file module 40 is further configured to determine that an identifier exists in the file to be accessed when the detection result indicates that the identifier information exists in the to-be-detected inode; and when the detection result indicates that the identification information does not exist in the index node to be detected, judging that the identification does not exist in the file to be accessed.
In an embodiment, the difference file module 40 is further configured to, when the file to be accessed does not have an identifier, take the file to be accessed as a target file.
In an embodiment, the differential file module 40 is further configured to, when the file to be accessed has an identifier, match target modified file information corresponding to the file to be accessed in the file list; and determining a target difference file corresponding to the file to be accessed according to the target modified file information and the diff file.
In an embodiment, the difference file module 40 is further configured to extract a target file path from the target modified file information; and acquiring the target difference file from the diff file according to the target file path.
In an embodiment, the target file module 50 is further configured to extract target difference data from the target difference file; and performing data restoration on the file to be accessed according to the target difference data to generate a target file.
For other embodiments or specific implementation methods of the kernel VFS layer system repair apparatus according to the present invention, reference may be made to the above method embodiments, and details are not described here again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) readable by an estimator, and includes several instructions for enabling a smart device (e.g. a mobile phone, an estimator, a kernel VFS layer system repair device, or a network kernel VFS layer system repair device) to execute the method according to the embodiments of the present invention.

Claims (20)

1. A kernel VFS layer system repairing method is characterized by comprising the following steps:
when a patch package is received, extracting a file list and diff files from the patch package, wherein the patch package is obtained by a server by diff of files with holes and files without holes;
loading the file list into a memory, determining a modified file according to the file list, and identifying the modified file;
when an access request is received, determining a file to be accessed according to the access request;
when the file to be accessed has the identifier, determining a target difference file corresponding to the file to be accessed according to the file list and the diff file;
and generating a target file according to the target difference file and the file to be accessed.
2. The kernel VFS layer system repair method of claim 1, wherein the loading the file list into a memory, determining a modified file from the file list, and identifying the modified file comprises:
loading the file list into a memory, and determining modified file information according to the file list;
extracting a modified file name from the modified file information, and determining a modified file according to the modified file name;
and adding identification information according to the modified file so as to identify the modified file.
3. The kernel VFS layer system repair method of claim 2, wherein the adding identification information according to the modified file to identify the modified file comprises:
acquiring an index node corresponding to the modified file;
and adding identification information in the index node to identify the modified file.
4. The kernel VFS layer system repair method of any one of claims 1 to 3, wherein the determining a file to be accessed according to an access request when the access request is received comprises:
receiving an access request when the access request is detected through a hook layer;
extracting information of a file to be accessed from the access request, and extracting a name of the file to be accessed from the information of the file to be accessed;
and determining the file to be accessed according to the name of the file to be accessed.
5. The kernel VFS layer system repair method of claim 4, wherein after determining the file to be accessed according to the file name to be accessed, further comprising:
and performing hook through a hook layer and the name of the file to be accessed to acquire the file to be accessed.
6. The kernel VFS layer system repairing method according to any one of claims 1 to 3, wherein before determining the target difference file corresponding to the file to be accessed according to the file list and the diff file when the file to be accessed has an identifier, further comprising:
and carrying out identification detection on the file to be accessed so as to judge whether the file to be accessed has an identification.
7. The kernel VFS layer system repair method of claim 6, wherein the performing identification detection on the file to be accessed to judge whether an identification exists in the file to be accessed comprises:
acquiring an index node to be detected corresponding to the file to be accessed;
detecting whether the index node to be detected has identification information or not to obtain a detection result;
and judging whether the file to be accessed has an identifier or not according to the detection result.
8. The kernel VFS layer system repairing method according to claim 7, wherein after determining whether the file to be accessed has the identifier according to the detection result, the method further comprises:
when the detection result indicates that the index node to be detected has identification information, judging that the file to be accessed has an identification;
and when the detection result indicates that the identification information does not exist in the index node to be detected, judging that the identification does not exist in the file to be accessed.
9. The kernel VFS layer system repair method of claim 6, wherein after the performing identifier detection on the file to be accessed to determine whether an identifier exists in the file to be accessed, the method further comprises:
and when the file to be accessed does not have the identifier, taking the file to be accessed as a target file.
10. The kernel VFS layer system repair method as claimed in any one of claims 1 to 3, wherein said determining a target difference file corresponding to the file to be accessed according to the file list and the diff file when the file to be accessed has an identifier comprises:
when the file to be accessed has the identifier, matching target modified file information corresponding to the file to be accessed in the file list;
and determining a target difference file corresponding to the file to be accessed according to the target modified file information and the diff file.
11. The kernel VFS layer system repair method of claim 10, wherein after determining the target diff file corresponding to the file to be accessed according to the target modified file information and the diff file, further comprising:
extracting a target file path from the target modification file information;
and acquiring the target difference file from the diff file according to the target file path.
12. The kernel VFS layer system repair method of any one of claims 1 to 3, wherein the generating a target file according to the target difference file and the file to be accessed comprises:
extracting target difference data from the target difference file;
and performing data restoration on the file to be accessed according to the target difference data to generate a target file.
13. A kernel VFS layer system repairing device is characterized by comprising:
the patch package module is used for extracting a file list and diff files from the patch package when the patch package is received, wherein the patch package is obtained by diff of the files with the vulnerabilities and the files without the holes by a server;
the file identification module is used for loading the file list into a memory, determining a modified file according to the file list and identifying the modified file;
the file access module is used for determining a file to be accessed according to an access request when the access request is received;
the difference file module is used for determining a target difference file corresponding to the file to be accessed according to the file list and the diff file when the file to be accessed has the identifier;
and the target file module is used for generating a target file according to the target difference file and the file to be accessed.
14. The kernel VFS layer system repair apparatus of claim 13, wherein the file identification module specifically includes: loading the file list into a memory, and determining modified file information according to the file list; extracting a modified file name from the modified file information, and determining a modified file according to the modified file name; and adding identification information according to the modified file so as to identify the modified file.
15. The kernel VFS layer system repair apparatus of claim 14, wherein the file identification module specifically includes: acquiring an index node corresponding to the modified file; and adding identification information in the index node to identify the modified file.
16. The kernel VFS layer system repair apparatus according to any one of claims 13 to 15, wherein the file access module specifically includes: receiving an access request when the access request is detected through a hook layer; extracting information of a file to be accessed from the access request, and extracting a name of the file to be accessed from the information of the file to be accessed; and determining the file to be accessed according to the name of the file to be accessed.
17. The kernel VFS layer system repair apparatus of claim 16, wherein the file access module is further configured to hook through a hook layer and the name of the file to be accessed to obtain the file to be accessed.
18. The kernel VFS layer system repair apparatus as claimed in any one of claims 13 to 15, wherein the difference file module is further configured to perform identifier detection on the file to be accessed to determine whether an identifier exists in the file to be accessed.
19. A kernel VFS layer system repair device is characterized by comprising: memory, a processor and a kernel VFS layer system repair program stored on the memory and executable on the processor, the kernel VFS layer system repair program being configured with steps to implement the kernel VFS layer system repair method of any one of claims 1 to 12.
20. A storage medium having stored thereon a kernel VFS layer system repair program which, when executed by a processor, implements the steps of the kernel VFS layer system repair method of any one of claims 1 to 12.
CN202011542234.0A 2020-12-23 2020-12-23 Kernel VFS layer system repairing method, device, equipment and storage medium Active CN112541182B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011542234.0A CN112541182B (en) 2020-12-23 2020-12-23 Kernel VFS layer system repairing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011542234.0A CN112541182B (en) 2020-12-23 2020-12-23 Kernel VFS layer system repairing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112541182A CN112541182A (en) 2021-03-23
CN112541182B true CN112541182B (en) 2022-11-04

Family

ID=75017176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011542234.0A Active CN112541182B (en) 2020-12-23 2020-12-23 Kernel VFS layer system repairing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112541182B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745158A (en) * 2014-01-26 2014-04-23 北京奇虎科技有限公司 Method and device for repairing system bugs
CN105160253A (en) * 2015-09-29 2015-12-16 网易(杭州)网络有限公司 Client program restoration method, apparatus and system and server
CN106921731A (en) * 2017-01-24 2017-07-04 北京奇虎科技有限公司 Leak restorative procedure and device
CN106919843A (en) * 2017-01-24 2017-07-04 北京奇虎科技有限公司 Leak repair system, method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745158A (en) * 2014-01-26 2014-04-23 北京奇虎科技有限公司 Method and device for repairing system bugs
CN105160253A (en) * 2015-09-29 2015-12-16 网易(杭州)网络有限公司 Client program restoration method, apparatus and system and server
CN106921731A (en) * 2017-01-24 2017-07-04 北京奇虎科技有限公司 Leak restorative procedure and device
CN106919843A (en) * 2017-01-24 2017-07-04 北京奇虎科技有限公司 Leak repair system, method and apparatus

Also Published As

Publication number Publication date
CN112541182A (en) 2021-03-23

Similar Documents

Publication Publication Date Title
CN108763951B (en) Data protection method and device
CN109726134B (en) Interface test method and system
CN106843947B (en) Method and device for processing code defects
CN106776105B (en) System startup file checking and compiling method
CN107341106B (en) Application compatibility detection method, development terminal and storage medium
CN113885935A (en) Resource packaging method and device, electronic equipment and computer readable storage medium
CN110059002B (en) Test data generation method, test equipment, storage medium and device
CN111782511A (en) Firmware file analysis method, equipment and storage medium
CN111124545A (en) Application program starting method and device, electronic equipment and storage medium
CN112541182B (en) Kernel VFS layer system repairing method, device, equipment and storage medium
CN112650689A (en) Test method, test device, electronic equipment and storage medium
CN108563578B (en) SDK compatibility detection method, device, equipment and readable storage medium
CN111061637A (en) Interface test method, interface test device and storage medium
CN113342660B (en) File testing method, device, system, electronic equipment and readable storage medium
CN113434582B (en) Service data processing method and device, computer equipment and storage medium
CN112579357B (en) Snapshot difference obtaining method, device, equipment and storage medium
CN111538651A (en) Interface testing method, device, server and storage medium
CN112147987A (en) Vehicle diagnosis method, vehicle diagnosis device and terminal equipment
CN111225075A (en) Configuration method and device for Internet of things directional access service
US10726109B2 (en) Method and system for identifying whether an application is genuine by means of digital watermarks
CN110955458A (en) EXT4 file system-based os rapid customization method, system, storage medium and electronic equipment
CN114648784B (en) Fingerprint verification method, device, equipment and storage medium for fingerprint library pre-matching
CN117215965B (en) Test case identification-based test method and device, electronic equipment and medium
CN117331838A (en) Penetration test method and device
CN115617675A (en) Automatic testing method, device and equipment of application program and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant