[go: up one dir, main page]

CN113157979B - Method, system and medium for constructing kernel module relation graph based on dummy module node - Google Patents

Method, system and medium for constructing kernel module relation graph based on dummy module node Download PDF

Info

Publication number
CN113157979B
CN113157979B CN202110281352.9A CN202110281352A CN113157979B CN 113157979 B CN113157979 B CN 113157979B CN 202110281352 A CN202110281352 A CN 202110281352A CN 113157979 B CN113157979 B CN 113157979B
Authority
CN
China
Prior art keywords
module
function
node
kernel
relationship
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
CN202110281352.9A
Other languages
Chinese (zh)
Other versions
CN113157979A (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.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
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 National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN202110281352.9A priority Critical patent/CN113157979B/en
Publication of CN113157979A publication Critical patent/CN113157979A/en
Application granted granted Critical
Publication of CN113157979B publication Critical patent/CN113157979B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method, a system and a medium for constructing a kernel module relation diagram based on a dummy module node, wherein the method comprises the steps of inputting a kernel module set M; establishing a module node for each kernel module in the kernel module set M to obtain a kernel module node set { N } m N, where N m Representing an mth kernel module; introducing a dummy module node; extracting kernel module node set { N } m And establishing a reference relation between the kernel modules in the graph database based on the symbol corresponding relation between the in function and the out function, establishing the reference relation between the kernel modules based on the External data and the Export data, and recording nodes without the reference relation through dummy module nodes. The application supports the on-demand expansion and reduction of the function call relationship diagram of the kernel module and the data sharing relationship diagram of the kernel module, and has the advantages of quick and efficient reconstruction.

Description

一种基于哑模块节点的内核模块关系图构建方法、系统及 介质A method and system for constructing a kernel module relationship graph based on dumb module nodes and medium

技术领域Technical field

本发明涉及操作系统内核以及内核模块升级时的版本兼容性保证技术领域,具体涉及一种基于哑模块节点的内核模块关系图构建方法、系统及介质。The invention relates to the technical field of version compatibility assurance during operating system kernel and kernel module upgrades, and specifically relates to a method, system and medium for constructing a kernel module relationship graph based on dumb module nodes.

背景技术Background technique

在信息系统的应用过程中,存在操作系统内核的升级换代导致外围硬件和上层应用的迁移工作量大、复杂度高等问题,主要原因是升级带来了内核函数和数据结构的变化,当内核模块中的函数和数据发生改变后,调用该函数的其他操作系统组件将会受到影响,出现无法执行或者执行异常的情况,上述的情况就是内核模块兼容性问题。解决内核模块兼容性问题需要精确的厘清函数和数据变化引发的影响。由于内核模块之间基于函数调用和数据结构共享形成了错综复杂的关系图,精准计算内核模块变化带来的兼容性影响的前提就是可以描述内核模块集合之间的关系。In the application process of information systems, there are problems such as the upgrading of the operating system kernel, which leads to a heavy workload and high complexity in the migration of peripheral hardware and upper-layer applications. The main reason is that the upgrade brings about changes in kernel functions and data structures. When the kernel module After the functions and data in the function are changed, other operating system components that call the function will be affected and may fail to execute or execute abnormally. The above situation is a kernel module compatibility issue. Solving kernel module compatibility issues requires accurately clarifying the impact of function and data changes. Since kernel modules form an intricate relationship graph based on function calls and data structure sharing, the prerequisite for accurately calculating the compatibility impact of kernel module changes is to be able to describe the relationship between kernel module sets.

从实现角度看,内核由函数和数据组成,函数包含了实现功能的程序代码。为了降低单个函数实现复杂性,往往会将一个大的功能拆分成多个函数实现,主体函数调用这些函数,完成复杂功能。一个功能往往会拆分成多个函数,并且封装在多个内核模块中。因此跨模块之间的函数调用和数据共享非常普遍。From an implementation perspective, the kernel consists of functions and data, and functions contain program codes that implement functions. In order to reduce the complexity of a single function implementation, a large function is often split into multiple function implementations, and the main function calls these functions to complete complex functions. A function is often split into multiple functions and encapsulated in multiple kernel modules. Therefore function calls and data sharing across modules are very common.

在内核中函数和数据都是以符号的形式存在。按照功能的不同,内核模块中的函数包括两类,一种是内核功能函数,本文中称之为in函数(InFun),它是实现体均在内核模块中函数,它可能被其他内核模块调用;一种是内核调用函数,本文中称为out函数(CallFun),它是实现体在其他内核模块中,而被本模块中的函数调用的函数。按照作用域不同,内核模块中的数据分为局部数据、全局数据和外部数据,其中局部数据为本内核模块中私用的数据,不会被外部模块感知,不在本文讨论范围;全局数据为本模块中定义而被多个模块共享使用的数据,本文称为Export数据;外部数据为本模块中使用的外部模块中定义的数据,本文中称为External数据。Functions and data exist in the form of symbols in the kernel. According to different functions, the functions in the kernel module include two categories. One is the kernel function function, which is called in function (InFun) in this article. It is a function whose implementation body is in the kernel module. It may be called by other kernel modules. ; One is the kernel call function, called out function (CallFun) in this article, which is a function that is implemented in other kernel modules and called by functions in this module. According to different scopes, the data in the kernel module is divided into local data, global data and external data. Local data is private data in this kernel module and will not be perceived by external modules. It is not within the scope of this article; global data is the basis. The data defined in the module and shared and used by multiple modules is called Export data in this article; the external data is the data defined in the external module used in this module, and is called External data in this article.

内核模块之间存在大量的函数调用关系和数据共享关系。为了准确描述上述关系集合,通过模块之间的函数调用和数据共享关系构建模块关系图就成了首要的任务。特别值得关注的是,当内核升级时由于内核模块的增减以及内核函数的增减会引发内核模块图的变化,需要重新构建。但是,具体如何实现模块关系图构建的上述要求,则仍然是一项亟待解决的关键技术问题。There are a large number of function calling relationships and data sharing relationships between kernel modules. In order to accurately describe the above relationship set, it becomes the primary task to construct the module relationship diagram through the function calls and data sharing relationships between modules. What is particularly noteworthy is that when the kernel is upgraded, the increase or decrease in kernel modules and the increase or decrease in kernel functions will cause changes in the kernel module diagram and need to be rebuilt. However, how to specifically implement the above requirements for the construction of module relationship diagrams is still a key technical issue that needs to be solved urgently.

发明内容Contents of the invention

本发明要解决的技术问题:针对现有技术的上述问题,提供一种基于哑模块节点的内核模块关系图构建方法、系统及介质,本发明通过引入哑模块节点,支持内核模块函数调用关系图和内核模块数据共享关系图的按需扩展和缩减,具有重构快速高效的优势,本发明在根据内核以及内核模块之间的函数调用关系构建内核模块依赖有向图时,当内核模块集合发生变化时,支持基于旧版本内核模块依赖图中通过增减内核模块、函数以及共享数据符号来构建变化后的模块依赖图,提高模块依赖图的构建效率。Technical problems to be solved by the present invention: In view of the above-mentioned problems of the prior art, a method, system and medium for constructing a kernel module relationship graph based on dumb module nodes are provided. The present invention supports the kernel module function call relationship graph by introducing dumb module nodes. The on-demand expansion and reduction of the kernel module data sharing relationship graph has the advantage of fast and efficient reconstruction. When the present invention constructs a kernel module dependency directed graph based on the function call relationship between the kernel and the kernel module, when the kernel module assembly occurs When changes occur, it is supported to build a changed module dependency graph based on the old version of the kernel module dependency graph by adding or subtracting kernel modules, functions, and shared data symbols to improve the construction efficiency of the module dependency graph.

为了解决上述技术问题,本发明采用的技术方案为:In order to solve the above technical problems, the technical solution adopted by the present invention is:

一种基于哑模块节点的内核模块关系图构建方法,包括:A method for constructing a kernel module relationship graph based on dumb module nodes, including:

1)输入内核模块集合M;1) Enter the kernel module set M;

2)对内核模块集合M中的每一个内核模块建立模块节点,得到内核模块节点集合{Nm},其中Nm表示第m个内核模块;引入哑模块节点;2) Establish a module node for each kernel module in the kernel module set M, and obtain the kernel module node set {N m }, where N m represents the m-th kernel module; introduce dumb module nodes;

3)提取内核模块节点集合{Nm}中各个内核模块的in函数和out函数,得到in函数表和out函数表;根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到函数调用关系图GFdep;根据内核模块节点集合{Nm}中的External数据和Export数据建立External数据表和Export数据表,根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到数据共享关系图GDdep3) Extract the in function and out function of each kernel module in the kernel module node set {N m } to obtain the in function table and out function table; according to the symbols between any in function and out function in the in function table and out function table The correspondence relationship establishes the reference relationship between kernel modules in the graph database, and establishes the reference relationship between the dumb module node and the corresponding kernel module when the correspondence relationship between the in function and the out function cannot be established, and obtains the function call relationship graph G Fdep ; Establish External data tables and Export data tables based on the External data and Export data in the kernel module node set {N m }, and establish reference relationships between kernel modules in the graph database based on the symbolic correspondence between External data and Export data. And for the situation where the correspondence between External data and Export data cannot be established, the reference relationship between the dumb module node and the corresponding kernel module is established, and the data sharing relationship graph G Ddep is obtained;

4)将函数调用关系图GFdep和数据共享关系图GDdep构成内核模块依赖关系图GM4) Combine the function call relationship graph G Fdep and the data sharing relationship graph G Ddep to form the kernel module dependency graph G M .

可选地,步骤2)中引入的哑模块节点包括暂未发现节点和暂未使用节点,所述暂未发现节点用于存放所有暂未被定义的函数符号,所述暂未使用节点用于存放还未被引用的函数符号。Optionally, the dummy module nodes introduced in step 2) include undiscovered nodes and unused nodes. The undiscovered nodes are used to store all function symbols that have not yet been defined. The unused nodes are used to store all function symbols that have not yet been defined. Stores function symbols that have not yet been referenced.

可选地,步骤3)中根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历out函数表中的每一个out函数作为当前out函数,针对当前out函数在in函数表中寻找对应的in函数,如果找到对应的in函数,则在图数据库中建立当前out函数对应的内核模块、找到的in函数对应的内核模块之间的引用关系,否则在图数据库中建立当前out函数对应的内核模块、暂未发现节点之间的引用关系;然后,检查in函数表中是否存在未被匹配的in函数,如果存在未被匹配的in函数,则在图数据库中建立该in函数对应的内核模块、暂未使用节点之间的引用关系,从而,得到函数调用关系图GFdepOptionally, in step 3), a reference relationship between kernel modules is established in the graph database based on the symbolic correspondence between any in function and out function in the in function table and out function table, and the in function and out function cannot be established. In the case of function correspondence, the steps to establish the reference relationship between the dumb module node and the corresponding kernel module include: first, traverse each out function in the out function table as the current out function, and search for the corresponding out function in the in function table for the current out function. in function, if the corresponding in function is found, a reference relationship between the kernel module corresponding to the current out function and the kernel module corresponding to the found in function is established in the graph database; otherwise, a reference relationship between the kernel module corresponding to the current out function and the kernel module corresponding to the found in function is established in the graph database. The kernel module has not yet discovered the reference relationship between nodes; then, check whether there is an unmatched in function in the in function table. If there is an unmatched in function, create a kernel corresponding to the in function in the graph database. The reference relationship between modules and nodes is not yet used, thus obtaining the function call relationship graph G Fdep .

可选地,步骤3)中根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历External数据表中的每一个External数据作为当前External数据,针对当前External数据在Export数据表中寻找对应的Export数据,如果找到对应的Export数据,则在图数据库中建立当前External数据对应的内核模块、找到的Export数据对应的内核模块之间的引用关系,否则在图数据库中建立当前External数据对应的内核模块、暂未发现节点之间的引用关系;然后,检查Export数据表中是否存在未被匹配的Export数据,如果存在未被匹配的Export数据,则在图数据库中建立该Export数据对应的内核模块、暂未使用节点之间的引用关系,得到数据共享关系图GDdepOptionally, in step 3), establish a reference relationship between kernel modules in the graph database based on the symbolic correspondence between External data and Export data, and establish a dumb module node if the correspondence between External data and Export data cannot be established. The steps to establish a reference relationship with the corresponding kernel module include: first, traverse each External data in the External data table as the current External data, and search for the corresponding Export data in the Export data table for the current External data. If the corresponding Export is found data, then establish a reference relationship between the kernel module corresponding to the current External data and the kernel module corresponding to the found Export data in the graph database; otherwise, establish a reference relationship between the kernel module corresponding to the current External data and the yet-to-be-discovered node in the graph database. Reference relationship; then, check whether there is unmatched Export data in the Export data table. If there is unmatched Export data, establish a relationship between the kernel module corresponding to the Export data and the unused nodes in the graph database. Reference relationship, get the data sharing relationship graph G Ddep .

可选地,步骤4)之后还包括在新增内核模块时更新内核模块依赖关系图GM的步骤:Optionally, step 4) also includes the step of updating the kernel module dependency graph G M when a new kernel module is added:

A1)输入新增的内核模块m,以及待更新的内核模块依赖关系图GMA1) Enter the newly added kernel module m and the kernel module dependency graph G M to be updated;

A2)为内核模块m建立模块节点nm,并将模块节点nm加入到待更新的内核模块依赖关系图GM的模块节点集合{NM}中;A2) Establish module node n m for kernel module m, and add module node n m to the module node set {N M } of the kernel module dependency graph G M to be updated;

A3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepA3) Update the function call relationship graph G Fdep according to the in function and out function of the module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of the module node n m , get the updated data sharing relationship diagram G Ddep ;

A4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMA4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M .

可选地,步骤A3)包括:将模块节点nm的in函数更新到模块节点集合{NM}的in函数表中,将模块节点nm的out函数更新到模块节点集合{NM}的out函数表中;建立模块节点nm的out函数与{NM}的in函数表中in函数符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的in函数在暂未发现节点中存在对应的out函数,为模块节点nm和暂未发现节点中out函数对应的内核模块建立引用关系;如果模块节点nm在in函数集存在未被匹配的in函数,则在图数据库中建立未被匹配的in函数对应的内核模块、暂未使用节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据更新到模块节点集合{NM}的Export数据表中,将模块节点nm的External数据更新到模块节点集合{NM}的External数据表中;建立模块节点nm的External数据与{NM}的Export数据表中Export数据符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的Export数据在暂未发现节点中存在对应的External数据,为模块节点nm和暂未发现节点中External数据对应的内核模块建立引用关系;如果模块节点nm在Export数据集存在未被匹配的Export数据,则在图数据库中建立未被匹配的Export数据对应的内核模块、暂未使用节点之间的引用关系,得到更新后的数据共享关系图GDdepOptionally, step A3) includes: updating the in function of the module node n m to the in function table of the module node set {N M }, and updating the out function of the module node n m to the module node set {N M }. in the out function table; establish a corresponding relationship between the out function of module node n m and the in function symbol in the in function table of {N M }, and establish a reference relationship between modules in the graph database; if the in function of module node n m is temporarily No corresponding out function is found in the node, and a reference relationship is established between the module node n m and the kernel module corresponding to the out function in the node that has not yet been discovered; if the module node n m has an unmatched in function in the in function set, then in Establish a reference relationship between the kernel module corresponding to the unmatched in function and the unused node in the graph database, and obtain the updated function call relationship graph G Fdep ; update the Export data of module node n m to the module node set { In the Export data table of N M }, update the External data of module node n m to the External data table of module node set {N M }; establish the External data of module node n m and the Export data table of {N M } Export data symbol correspondence relationship, establish a reference relationship between modules in the graph database; if the Export data of module node n m has corresponding External data in the yet-to-be-discovered node, it is the External data in module node n m and the yet-to-be-discovered node. The corresponding kernel module establishes a reference relationship; if the module node n m has unmatched Export data in the Export data set, a reference between the kernel module corresponding to the unmatched Export data and the unused node is established in the graph database. relationship, and obtain the updated data sharing relationship graph G Ddep .

可选地,步骤4)之后还包括在删除内核模块时更新内核模块依赖关系图GM的步骤:Optionally, step 4) also includes the step of updating the kernel module dependency graph G M when the kernel module is deleted:

B1)输入待删除的内核模块m,以及待更新的内核模块依赖关系图GMB1) Enter the kernel module m to be deleted and the kernel module dependency graph G M to be updated;

B2)从待更新的内核模块依赖关系图GM的模块节点集合{NM}中删除内核模块m对应的模块节点nmB2) Delete the module node n m corresponding to the kernel module m from the module node set {N M } of the kernel module dependency graph G M to be updated;

B3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepB3) Update the function call relationship graph G Fdep according to the in function and out function of module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of module node n m , get the updated data sharing relationship diagram G Ddep ;

B4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMB4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M .

可选地,步骤B3)包括:将模块节点nm的in函数从模块节点集合{NM}的in函数表中移除,将模块节点nm的out函数从模块节点集合{NM}的out函数表中移除;针对暂未使用节点中对应模块节点nm包含的in函数,若该in函数未被使用,则直接将其从暂未使用节点中删除,否则针对使用该in函数的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据从模块节点集合{NM}的Export数据表中移除,将模块节点nm的External数据从模块节点集合{NM}的External数据表中移除;针对暂未使用节点中对应模块节点nm包含的Export数据,若该Export数据未被使用,则直接将其从暂未使用节点中删除,否则针对使用该Export数据的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的数据共享关系图GDdepOptionally, step B3) includes: removing the in function of the module node n m from the in function table of the module node set {N M }, and removing the out function of the module node n m from the module node set {N M }. Removed from the out function table; for the in function contained in the corresponding module node n m in the unused node, if the in function is not used, it is directly deleted from the unused node, otherwise for the in function that uses the in function For any other kernel module j, modify the reference relationship between kernel module j and module node n m in the graph database to the reference relationship between kernel module j and no nodes yet found, and obtain the updated function call relationship graph G Fdep ; Remove the Export data of module node n m from the Export data table of module node set {N M }, and remove the External data of module node n m from the External data table of module node set {N M }; for The Export data contained in the corresponding module node n m in the unused node is not used yet. If the Export data is not used, it is directly deleted from the unused node. Otherwise, for any other kernel module j that uses the Export data, in the figure In the database, the reference relationship between kernel module j and module node n m is modified to the reference relationship between kernel module j and undiscovered nodes, and the updated data sharing relationship graph G Ddep is obtained.

此外,本发明还提供一种基于哑模块节点的内核模块关系图构建系统,包括相互连接的微处理器和存储器,所述微处理器被编程或配置以执行所述基于哑模块节点的内核模块关系图构建方法的步骤。In addition, the present invention also provides a system for building a kernel module relationship graph based on dumb module nodes, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the kernel module based on dumb module nodes. Steps of the relationship diagram construction method.

此外,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有被编程或配置以执行所述基于哑模块节点的内核模块关系图构建方法的计算机程序。In addition, the present invention also provides a computer-readable storage medium in which a computer program programmed or configured to execute the method for constructing a kernel module relationship graph based on dumb module nodes is stored in the computer-readable storage medium.

和现有技术相比,本发明具有下述优点:本发明包括输入内核模块集合M;对内核模块集合M中的每一个内核模块建立模块节点,得到内核模块节点集合{Nm},其中Nm表示第m个内核模块;引入哑模块节点;提取内核模块节点集合{Nm}中各个内核模块的in函数和out函数,得到in函数表和out函数表;根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到函数调用关系图GFdep;根据内核模块节点集合{Nm}中的External数据和Export数据建立External数据表和Export数据表,根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到数据共享关系图GDdep;将函数调用关系图GFdep和数据共享关系图GDdep构成内核模块依赖关系图GM,通过上述方式,提出了基于函数调用关系和基于数据共享的内核模块关系图模型和构建的基本方法,而且本发明通过引入哑模块节点,支持内核模块函数调用关系图和内核模块数据共享关系图的按需扩展和缩减,具有重构快速高效的优势。而且,本发明在根据内核以及内核模块之间的函数调用关系构建内核模块依赖有向图时,当内核模块集合发生变化时,支持基于旧版本内核模块依赖图中通过增减内核模块、函数以及共享数据符号来构建变化后的模块依赖图,提高模块依赖图的构建效率。Compared with the existing technology, the present invention has the following advantages: the present invention includes inputting a kernel module set M; establishing a module node for each kernel module in the kernel module set M, and obtaining a kernel module node set {N m }, where N m represents the mth kernel module; introduce dumb module nodes; extract the in function and out function of each kernel module in the kernel module node set {N m } to obtain the in function table and out function table; according to the in function table and out function table The symbolic correspondence between any in function and out function in the graph database establishes the reference relationship between kernel modules, and establishes the reference relationship between the dumb module node and the corresponding kernel module when the correspondence between the in function and the out function cannot be established. Reference relationship, get the function call relationship graph G Fdep ; establish the External data table and Export data table based on the External data and Export data in the kernel module node set {N m }, according to the symbolic correspondence between the External data and the Export data in the figure Establish the reference relationship between kernel modules in the database, and establish the reference relationship between the dumb module node and the corresponding kernel module when the correspondence between External data and Export data cannot be established, and obtain the data sharing relationship graph G Ddep ; the function call relationship The graph G Fdep and the data sharing relationship graph G Ddep constitute the kernel module dependency graph G M . Through the above method, a basic method of modeling and constructing the kernel module relationship graph based on function calling relationships and data sharing is proposed. Moreover, the present invention introduces Dumb module nodes support on-demand expansion and reduction of the kernel module function call relationship graph and the kernel module data sharing relationship graph, and have the advantage of fast and efficient reconstruction. Moreover, when the present invention constructs a kernel module dependency directed graph based on the function calling relationship between the kernel and the kernel module, when the kernel module set changes, it supports adding or subtracting kernel modules, functions and Share data symbols to build the changed module dependency graph, improving the efficiency of module dependency graph construction.

附图说明Description of the drawings

图1为本发明实施例中基于哑模块节点的内核模块依赖图构建方法的流程示意图。Figure 1 is a schematic flowchart of a method for constructing a kernel module dependency graph based on dumb module nodes in an embodiment of the present invention.

图2为本发明实施例中基于哑模块节点的内核模块依赖图扩展方法的流程示意图。Figure 2 is a schematic flowchart of a kernel module dependency graph expansion method based on dumb module nodes in an embodiment of the present invention.

图3为本发明实施例中基于哑模块节点的内核模块依赖图缩减方法的流程示意图。Figure 3 is a schematic flowchart of a kernel module dependency graph reduction method based on dumb module nodes in an embodiment of the present invention.

具体实施方式Detailed ways

如图1所示,本实施例基于哑模块节点的内核模块关系图构建方法包括:As shown in Figure 1, the method for constructing a kernel module relationship diagram based on dumb module nodes in this embodiment includes:

1)输入内核模块集合M;1) Enter the kernel module set M;

2)对内核模块集合M中的每一个内核模块建立模块节点,得到内核模块节点集合{Nm},其中Nm表示第m个内核模块;引入哑模块节点;2) Establish a module node for each kernel module in the kernel module set M, and obtain the kernel module node set {N m }, where N m represents the m-th kernel module; introduce dumb module nodes;

3)提取内核模块节点集合{Nm}中各个内核模块的in函数和out函数,得到in函数表和out函数表;根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到函数调用关系图GFdep;根据内核模块节点集合{Nm}中的External数据和Export数据建立External数据表和Export数据表,根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到数据共享关系图GDdep3) Extract the in function and out function of each kernel module in the kernel module node set {N m } to obtain the in function table and out function table; according to the symbols between any in function and out function in the in function table and out function table The correspondence relationship establishes the reference relationship between kernel modules in the graph database, and establishes the reference relationship between the dumb module node and the corresponding kernel module when the correspondence relationship between the in function and the out function cannot be established, and obtains the function call relationship graph G Fdep ; Establish External data tables and Export data tables based on the External data and Export data in the kernel module node set {N m }, and establish reference relationships between kernel modules in the graph database based on the symbolic correspondence between External data and Export data. And for the situation where the correspondence between External data and Export data cannot be established, the reference relationship between the dumb module node and the corresponding kernel module is established, and the data sharing relationship graph G Ddep is obtained;

4)将函数调用关系图GFdep和数据共享关系图GDdep构成内核模块依赖关系图GM4) Combine the function call relationship graph G Fdep and the data sharing relationship graph G Ddep to form the kernel module dependency graph G M .

本实施例中,步骤2)中引入的哑模块节点包括暂未发现节点(notfound_dummy)和暂未使用节点(unused_dummy),所述暂未发现节点用于存放所有暂未被定义的函数符号,所述暂未使用节点用于存放还未被引用的函数符号。In this embodiment, the dummy module nodes introduced in step 2) include not yet discovered nodes (notfound_dummy) and not yet used nodes (unused_dummy). The temporarily undiscovered nodes are used to store all undefined function symbols, so The aforementioned unused nodes are used to store function symbols that have not yet been referenced.

本实施例中,步骤3)中根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历out函数表中的每一个out函数作为当前out函数,针对当前out函数在in函数表中寻找对应的in函数,如果找到对应的in函数,则在图数据库中建立当前out函数对应的内核模块、找到的in函数对应的内核模块之间的引用关系,否则在图数据库中建立当前out函数对应的内核模块、暂未发现节点之间的引用关系;然后,检查in函数表中是否存在未被匹配的in函数,如果存在未被匹配的in函数,则在图数据库中建立该in函数对应的内核模块、暂未使用节点之间的引用关系,从而,得到函数调用关系图GFdepIn this embodiment, in step 3), a reference relationship between kernel modules is established in the graph database based on the symbolic correspondence between any in function and out function in the in function table and out function table, and the in function and out function cannot be established. The steps for establishing the reference relationship between the dumb module node and the corresponding kernel module include: first, traverse each out function in the out function table as the current out function, and search for the current out function in the in function table The corresponding in function. If the corresponding in function is found, a reference relationship between the kernel module corresponding to the current out function and the kernel module corresponding to the found in function is established in the graph database. Otherwise, a reference relationship between the current out function and the kernel module corresponding to the found in function is established in the graph database. Kernel module, no reference relationship between nodes has been found yet; then, check whether there is an unmatched in function in the in function table. If there is an unmatched in function, create a corresponding in function in the graph database. The reference relationship between the kernel module and the unused nodes is thus obtained, and the function call relationship graph G Fdep is obtained.

本实施例中,步骤3)中根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历External数据表中的每一个External数据作为当前External数据,针对当前External数据在Export数据表中寻找对应的Export数据,如果找到对应的Export数据,则在图数据库中建立当前External数据对应的内核模块、找到的Export数据对应的内核模块之间的引用关系,否则在图数据库中建立当前External数据对应的内核模块、暂未发现节点之间的引用关系;然后,检查Export数据表中是否存在未被匹配的Export数据,如果存在未被匹配的Export数据,则在图数据库中建立该Export数据对应的内核模块、暂未使用节点之间的引用关系,得到数据共享关系图GDdepIn this embodiment, in step 3), a reference relationship between kernel modules is established in the graph database based on the symbolic correspondence between External data and Export data, and a dumb module is established in the case where the correspondence between External data and Export data cannot be established. The steps for the reference relationship between the node and the corresponding kernel module include: first, traverse each External data in the External data table as the current External data, and search for the corresponding Export data in the Export data table for the current External data. If the corresponding To export data, a reference relationship between the kernel module corresponding to the current External data and the kernel module corresponding to the found Export data is established in the graph database. Otherwise, a reference relationship between the kernel module corresponding to the current External data and the node not yet found is established in the graph database. The reference relationship between The reference relationship is obtained, and the data sharing relationship graph G Ddep is obtained.

如图2所示,本实施例步骤4)之后还包括在新增内核模块时更新内核模块依赖关系图GM的步骤:As shown in Figure 2, after step 4) of this embodiment, the step of updating the kernel module dependency graph G M when adding a new kernel module is also included:

A1)输入新增的内核模块m,以及待更新的内核模块依赖关系图GMA1) Enter the newly added kernel module m and the kernel module dependency graph G M to be updated;

A2)为内核模块m建立模块节点nm,并将模块节点nm加入到待更新的内核模块依赖关系图GM的模块节点集合{NM}中;A2) Establish module node n m for kernel module m, and add module node n m to the module node set {N M } of the kernel module dependency graph G M to be updated;

A3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepA3) Update the function call relationship graph G Fdep according to the in function and out function of the module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of the module node n m , get the updated data sharing relationship diagram G Ddep ;

A4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMA4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M .

本实施例中,步骤A3)包括:将模块节点nm的in函数更新到模块节点集合{NM}的in函数表中,将模块节点nm的out函数更新到模块节点集合{NM}的out函数表中;建立模块节点nm的out函数与{NM}的in函数表中in函数符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的in函数在暂未发现节点中存在对应的out函数,为模块节点nm和暂未发现节点中out函数对应的内核模块建立引用关系;如果模块节点nm在in函数集存在未被匹配的in函数,则在图数据库中建立未被匹配的in函数对应的内核模块、暂未使用节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据更新到模块节点集合{NM}的Export数据表中,将模块节点nm的External数据更新到模块节点集合{NM}的External数据表中;建立模块节点nm的External数据与{NM}的Export数据表中Export数据符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的Export数据在暂未发现节点中存在对应的External数据,为模块节点nm和暂未发现节点中External数据对应的内核模块建立引用关系;如果模块节点nm在Export数据集存在未被匹配的Export数据,则在图数据库中建立未被匹配的Export数据对应的内核模块、暂未使用节点之间的引用关系,得到更新后的数据共享关系图GDdepIn this embodiment, step A3) includes: updating the in function of the module node n m to the in function table of the module node set {N M }, and updating the out function of the module node n m to the module node set {N M }. in the out function table of The corresponding out function has not yet been found in the node, and a reference relationship is established between the module node n m and the kernel module corresponding to the out function in the node that has not been found yet; if the module node n m has an unmatched in function in the in function set, then Establish a reference relationship between the kernel module corresponding to the unmatched in function and the unused node in the graph database, and obtain the updated function call relationship graph G Fdep ; update the Export data of module node n m to the module node set In the Export data table of {N M }, update the External data of the module node n m to the External data table of the module node set {N M }; establish the External data of the module node n m and the Export data table of {N M } The corresponding relationship between the Export data symbols in the graph database establishes the reference relationship between modules; if the Export data of the module node n m has corresponding External data in the yet-to-be-discovered node, it is the External data in the module node n m and the yet-to-be-discovered node. The kernel module corresponding to the data establishes a reference relationship; if the module node n m has unmatched Export data in the Export data set, then the kernel module corresponding to the unmatched Export data and the unused node are established in the graph database. Reference relationship, get the updated data sharing relationship graph G Ddep .

如图3所示,本实施例步骤4)之后还包括在删除内核模块时更新内核模块依赖关系图GM的步骤:As shown in Figure 3, step 4) in this embodiment also includes the step of updating the kernel module dependency graph G M when deleting the kernel module:

B1)输入待删除的内核模块m,以及待更新的内核模块依赖关系图GMB1) Enter the kernel module m to be deleted and the kernel module dependency graph G M to be updated;

B2)从待更新的内核模块依赖关系图GM的模块节点集合{NM}中删除内核模块m对应的模块节点nmB2) Delete the module node n m corresponding to the kernel module m from the module node set {N M } of the kernel module dependency graph G M to be updated;

B3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepB3) Update the function call relationship graph G Fdep according to the in function and out function of module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of module node n m , get the updated data sharing relationship diagram G Ddep ;

B4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMB4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M .

本实施例中,步骤B3)包括:将模块节点nm的in函数从模块节点集合{NM}的in函数表中移除,将模块节点nm的out函数从模块节点集合{NM}的out函数表中移除;针对暂未使用节点中对应模块节点nm包含的in函数,若该in函数未被使用,则直接将其从暂未使用节点中删除,否则针对使用该in函数的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据从模块节点集合{NM}的Export数据表中移除,将模块节点nm的External数据从模块节点集合{NM}的External数据表中移除;针对暂未使用节点中对应模块节点nm包含的Export数据,若该Export数据未被使用,则直接将其从暂未使用节点中删除,否则针对使用该Export数据的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的数据共享关系图GDdepIn this embodiment, step B3) includes: removing the in function of the module node n m from the in function table of the module node set {N M }, and removing the out function of the module node n m from the module node set {N M } Removed from the out function table; for the in function contained in the corresponding module node n m in the unused node, if the in function is not used, delete it directly from the unused node, otherwise use the in function For any other kernel module j, modify the reference relationship between kernel module j and module node n m in the graph database to the reference relationship between kernel module j and no nodes yet found, and obtain the updated function call relationship graph G Fdep ; Remove the Export data of module node n m from the Export data table of module node set {N M }, and remove the External data of module node n m from the External data table of module node set {N M }; For the Export data contained in the corresponding module node n m in the unused node, if the Export data is not used, it is directly deleted from the unused node. Otherwise, for any other kernel module j that uses the Export data, in In the graph database, the reference relationship between kernel module j and module node n m is modified to the reference relationship between kernel module j and undiscovered nodes, and the updated data sharing relationship graph G Ddep is obtained.

综上所述,内核模块之间基于函数调用和数据结构共享形成错综复杂的关系图。本实施例中把内核模块作为图中的节点,如果内核模块A调用了内核模块B中的任意内核功能函数,则在A和之间B连接一条有向边,其中A为边的起始节点,B为边的终止节点,这表明内核模块A因函数调用而依赖于内核模块B。对同一内核版本中的所有模块均执行上述操作,得到内核模块函数依赖关系图GFdep。本专利中把内核模块作为图中的节点,如果内核模块A和B中共享了B中定义的全局数据,则在A和之间B连接一条有向边,其中A为边的起始节点,B为边的终止节点,这表明内核模块A因共享数据而依赖于内核模块B。对同一内核版本中的所有模块均执行上述操作,将得到内核模块数据共享关系图GDdep。函数调用关系图GFdep和数据共享关系图GDdep共同构成了内核模块关系图(GM),因此内核模块关系图(GM)包括了两个关系图GDdep和GFdep,的构造。根据实际使用的要求,关系图GDdep和GFdep的构造过程均包括了初始化、模块增减和模块删除三类过程。通过上述方式,本实施例提出了基于函数调用关系和基于数据共享的内核模块关系图模型和构建的基本方法,而且本发明通过引入哑模块节点,支持内核模块函数调用关系图和内核模块数据共享关系图的按需扩展和缩减,具有重构快速高效的优势。而且,在根据内核以及内核模块之间的函数调用关系构建内核模块依赖有向图时,当内核模块集合发生变化时,支持基于旧版本内核模块依赖图中通过增减内核模块、函数以及共享数据符号来构建变化后的模块依赖图,提高模块依赖图的构建效率。To sum up, kernel modules form an intricate relationship graph based on function calls and data structure sharing. In this embodiment, the kernel module is used as a node in the graph. If kernel module A calls any kernel function in kernel module B, then a directed edge is connected between A and B, where A is the starting node of the edge. , B is the terminal node of the edge, which indicates that kernel module A depends on kernel module B due to function calls. Perform the above operations on all modules in the same kernel version to obtain the kernel module function dependency graph G Fdep . In this patent, the kernel module is used as a node in the graph. If kernel modules A and B share the global data defined in B, then a directed edge is connected between A and B, where A is the starting node of the edge. B is the terminal node of the edge, which indicates that kernel module A depends on kernel module B due to shared data. Perform the above operations on all modules in the same kernel version, and the kernel module data sharing relationship diagram G Ddep will be obtained. The function call relationship graph G Fdep and the data sharing relationship graph G Ddep together constitute the kernel module relationship graph ( GM ). Therefore, the kernel module relationship graph ( GM ) includes the structure of two relationship graphs, G Ddep and G Fdep . According to the requirements of actual use, the construction process of the relationship diagrams G Ddep and G Fdep includes three types of processes: initialization, module addition and deletion, and module deletion. Through the above method, this embodiment proposes a basic method of constructing a kernel module relationship graph model based on function calling relationships and data sharing. Moreover, the present invention supports kernel module function calling relationship graphs and kernel module data sharing by introducing dumb module nodes. The on-demand expansion and contraction of the relationship diagram has the advantage of fast and efficient reconstruction. Moreover, when building a kernel module dependency directed graph based on the function call relationship between the kernel and kernel modules, when the kernel module set changes, it is supported to add or remove kernel modules, functions and shared data based on the old version of the kernel module dependency graph. Symbols are used to construct the changed module dependency graph to improve the efficiency of module dependency graph construction.

此外,本实施例还提供一种基于哑模块节点的内核模块关系图构建系统,包括相互连接的微处理器和存储器,所述微处理器被编程或配置以执行前述基于哑模块节点的内核模块关系图构建方法的步骤。In addition, this embodiment also provides a system for constructing a kernel module relationship graph based on dumb module nodes, including a microprocessor and a memory connected to each other. The microprocessor is programmed or configured to execute the aforementioned kernel module based on dumb module nodes. Steps of the relationship diagram construction method.

此外,本实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有被编程或配置以执行前述基于哑模块节点的内核模块关系图构建方法的计算机程序。In addition, this embodiment also provides a computer-readable storage medium that stores a computer program programmed or configured to execute the aforementioned method for constructing a kernel module relationship graph based on dummy module nodes.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可读存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。Those skilled in the art will understand that embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. This application refers to flowcharts of methods, devices (systems), and computer program products according to embodiments of the application and/or instructions executed by a processor for implementing a process or processes in the flowchart and/or a block diagram. A device for the functions specified in a box or boxes. These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.

以上所述仅是本发明的优选实施方式,本发明的保护范围并不仅局限于上述实施例,凡属于本发明思路下的技术方案均属于本发明的保护范围。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理前提下的若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions that fall under the idea of the present invention belong to the protection scope of the present invention. It should be pointed out that for those of ordinary skill in the art, several improvements and modifications may be made without departing from the principles of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims (7)

1.一种基于哑模块节点的内核模块关系图构建方法,其特征在于,包括:1. A method for constructing a kernel module relationship graph based on dumb module nodes, which is characterized by including: 1)输入内核模块集合M;1) Enter the kernel module set M; 2)对内核模块集合M中的每一个内核模块建立模块节点,得到内核模块节点集合{Nm},其中Nm表示第m个内核模块;引入哑模块节点;2) Establish a module node for each kernel module in the kernel module set M, and obtain the kernel module node set {N m }, where N m represents the m-th kernel module; introduce dumb module nodes; 3)提取内核模块节点集合{Nm}中各个内核模块的in函数和out函数,得到in函数表和out函数表;根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到函数调用关系图GFdep;根据内核模块节点集合{Nm}中的External数据和Export数据建立External数据表和Export数据表,根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系,得到数据共享关系图GDdep;其中in函数是指内核功能函数,out函数是指内核调用函数,Export数据是指本模块中定义而被多个模块共享使用的全局数据;External数据是指本模块中使用的外部模块中定义的外部数据;3) Extract the in function and out function of each kernel module in the kernel module node set {N m } to obtain the in function table and out function table; according to the symbols between any in function and out function in the in function table and out function table The correspondence relationship establishes the reference relationship between kernel modules in the graph database, and establishes the reference relationship between the dumb module node and the corresponding kernel module when the correspondence relationship between the in function and the out function cannot be established, and obtains the function call relationship graph G Fdep ; Establish External data tables and Export data tables based on the External data and Export data in the kernel module node set {N m }, and establish reference relationships between kernel modules in the graph database based on the symbolic correspondence between External data and Export data. And for the situation where the correspondence between External data and Export data cannot be established, the reference relationship between the dumb module node and the corresponding kernel module is established, and the data sharing relationship diagram G Ddep is obtained; where the in function refers to the kernel function function, and the out function refers to the kernel call Function, Export data refers to global data defined in this module and shared and used by multiple modules; External data refers to external data defined in external modules used in this module; 4)将函数调用关系图GFdep和数据共享关系图GDdep构成内核模块依赖关系图GM4) Combine the function call relationship graph G Fdep and the data sharing relationship graph G Ddep to form the kernel module dependency graph G M ; 步骤2)中引入的哑模块节点包括暂未发现节点和暂未使用节点,所述暂未发现节点用于存放所有暂未被定义的函数符号,所述暂未使用节点用于存放还未被引用的函数符号;步骤3)中根据in函数表和out函数表中任意in函数和out函数之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立in函数和out函数对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历out函数表中的每一个out函数作为当前out函数,针对当前out函数在in函数表中寻找对应的in函数,如果找到对应的in函数,则在图数据库中建立当前out函数对应的内核模块、找到的in函数对应的内核模块之间的引用关系,否则在图数据库中建立当前out函数对应的内核模块、暂未发现节点之间的引用关系;然后,检查in函数表中是否存在未被匹配的in函数,如果存在未被匹配的in函数,则在图数据库中建立该in函数对应的内核模块、暂未使用节点之间的引用关系,从而,得到函数调用关系图GFdep;步骤3)中根据External数据和Export数据之间的符号对应关系在图数据库中建立内核模块之间的引用关系,且对无法建立External数据和Export数据对应关系的情况建立哑模块节点和对应内核模块之间的引用关系的步骤包括:首先,遍历External数据表中的每一个External数据作为当前External数据,针对当前External数据在Export数据表中寻找对应的Export数据,如果找到对应的Export数据,则在图数据库中建立当前External数据对应的内核模块、找到的Export数据对应的内核模块之间的引用关系,否则在图数据库中建立当前External数据对应的内核模块、暂未发现节点之间的引用关系;然后,检查Export数据表中是否存在未被匹配的Export数据,如果存在未被匹配的Export数据,则在图数据库中建立该Export数据对应的内核模块、暂未使用节点之间的引用关系,得到数据共享关系图GDdepThe dumb module nodes introduced in step 2) include undiscovered nodes and unused nodes. The undiscovered nodes are used to store all function symbols that have not yet been defined. The unused nodes are used to store functions that have not yet been defined. Referenced function symbols; in step 3), a reference relationship between kernel modules is established in the graph database based on the symbolic correspondence between any in function and out function in the in function table and out function table, and the in function and out function cannot be established. The steps for establishing the reference relationship between the dumb module node and the corresponding kernel module include: first, traverse each out function in the out function table as the current out function, and search for the current out function in the in function table The corresponding in function. If the corresponding in function is found, a reference relationship between the kernel module corresponding to the current out function and the kernel module corresponding to the found in function is established in the graph database. Otherwise, a reference relationship between the current out function and the kernel module corresponding to the found in function is established in the graph database. Kernel module, no reference relationship between nodes has been found yet; then, check whether there is an unmatched in function in the in function table. If there is an unmatched in function, create a corresponding in function in the graph database. The reference relationship between the kernel module and the unused node is obtained, thereby obtaining the function call relationship graph G Fdep ; in step 3), the reference between the kernel modules is established in the graph database based on the symbolic correspondence between the External data and the Export data. relationship, and for situations where the corresponding relationship between External data and Export data cannot be established, the steps to establish the reference relationship between the dumb module node and the corresponding kernel module include: first, traverse each External data in the External data table as the current External data, and target The current External data searches for the corresponding Export data in the Export data table. If the corresponding Export data is found, a reference relationship between the kernel module corresponding to the current External data and the kernel module corresponding to the found Export data is established in the graph database. Otherwise, Establish the kernel module corresponding to the current External data in the graph database, and no reference relationship between nodes has been found yet; then, check whether there is unmatched Export data in the Export data table. If there is unmatched Export data, then Establish a reference relationship between the kernel module corresponding to the Export data and the unused nodes in the graph database, and obtain the data sharing relationship graph G Ddep . 2.根据权利要求1所述的基于哑模块节点的内核模块关系图构建方法,其特征在于,步骤4)之后还包括在新增内核模块时更新内核模块依赖关系图GM的步骤:2. The kernel module relationship graph construction method based on dumb module nodes according to claim 1, characterized in that, after step 4), it also includes the step of updating the kernel module dependency graph G M when adding a new kernel module: A1)输入新增的内核模块m,以及待更新的内核模块依赖关系图GMA1) Enter the newly added kernel module m and the kernel module dependency graph G M to be updated; A2)为内核模块m建立模块节点nm,并将模块节点nm加入到待更新的内核模块依赖关系图GM的模块节点集合{NM}中;A2) Establish module node n m for kernel module m, and add module node n m to the module node set {N M } of the kernel module dependency graph G M to be updated; A3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepA3) Update the function call relationship graph G Fdep according to the in function and out function of module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of module node n m , get the updated data sharing relationship diagram G Ddep ; A4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMA4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M . 3.根据权利要求2所述的基于哑模块节点的内核模块关系图构建方法,其特征在于,步骤A3)包括:将模块节点nm的in函数更新到模块节点集合{NM}的in函数表中,将模块节点nm的out函数更新到模块节点集合{NM}的out函数表中;建立模块节点nm的out函数与{NM}的in函数表中in函数符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的in函数在暂未发现节点中存在对应的out函数,为模块节点nm和暂未发现节点中out函数对应的内核模块建立引用关系;如果模块节点nm在in函数集存在未被匹配的in函数,则在图数据库中建立未被匹配的in函数对应的内核模块、暂未使用节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据更新到模块节点集合{NM}的Export数据表中,将模块节点nm的External数据更新到模块节点集合{NM}的External数据表中;建立模块节点nm的External数据与{NM}的Export数据表中Export数据符号对应关系,在图数据库中建立模块间的引用关系;如果模块节点nm的Export数据在暂未发现节点中存在对应的External数据,为模块节点nm和暂未发现节点中External数据对应的内核模块建立引用关系;如果模块节点nm在Export数据表存在未被匹配的Export数据,则在图数据库中建立未被匹配的Export数据对应的内核模块、暂未使用节点之间的引用关系,得到更新后的数据共享关系图GDdep3. The method for constructing a kernel module relationship graph based on dumb module nodes according to claim 2, characterized in that step A3) includes: updating the in function of the module node n m to the in function of the module node set {N M } In the table, update the out function of module node n m to the out function table of module node set {N M }; establish the corresponding relationship between the out function of module node n m and the in function symbol in the in function table of {N M }, Establish a reference relationship between modules in the graph database; if the in function of module node n m has a corresponding out function in an undiscovered node, establish a reference for the kernel module corresponding to the out function in module node n m and the undiscovered node. relationship; if module node n m has an unmatched in function in the in function set, establish a reference relationship between the kernel module corresponding to the unmatched in function and the unused node in the graph database, and obtain the updated Function call graph G Fdep ; update the Export data of module node n m to the Export data table of module node set {N M }, and update the External data of module node n m to the External data of module node set {N M }. table; establish a corresponding relationship between the External data of module node n m and the Export data symbol in the Export data table of {N M }, and establish a reference relationship between modules in the graph database; if the Export data of module node n m has not yet been found There is corresponding External data in the node, and a reference relationship is established between the module node n m and the kernel module corresponding to the External data in the node that has not yet been discovered; if the module node n m has unmatched Export data in the Export data table, then in the graph database Establish a reference relationship between the kernel module corresponding to the unmatched Export data and the unused node, and obtain the updated data sharing relationship graph G Ddep . 4.根据权利要求1所述的基于哑模块节点的内核模块关系图构建方法,其特征在于,步骤4)之后还包括在删除内核模块时更新内核模块依赖关系图GM的步骤:4. The kernel module relationship graph construction method based on dumb module nodes according to claim 1, characterized in that, after step 4), it also includes the step of updating the kernel module dependency relationship graph G M when the kernel module is deleted: B1)输入待删除的内核模块m,以及待更新的内核模块依赖关系图GMB1) Enter the kernel module m to be deleted and the kernel module dependency graph G M to be updated; B2)从待更新的内核模块依赖关系图GM的模块节点集合{NM}中删除内核模块m对应的模块节点nmB2) Delete the module node n m corresponding to the kernel module m from the module node set {N M } of the kernel module dependency graph G M to be updated; B3)根据模块节点nm的in函数、out函数更新函数调用关系图GFdep,得到更新后的函数调用关系图GFdep,根据模块节点nm的Export数据、External数据更新数据共享关系图GDdep,得到更新后的数据共享关系图GDdepB3) Update the function call relationship graph G Fdep according to the in function and out function of module node n m , obtain the updated function call relationship graph G Fdep, and update the data sharing relationship graph G Ddep according to the Export data and External data of module node n m , get the updated data sharing relationship diagram G Ddep ; B4)将更新后的函数调用关系图GFdep和更新后的数据共享关系图GDdep构成更新后的内核模块依赖关系图GMB4) The updated function call relationship graph G Fdep and the updated data sharing relationship graph G Ddep constitute the updated kernel module dependency relationship graph G M . 5.根据权利要求4所述的基于哑模块节点的内核模块关系图构建方法,其特征在于,步骤B3)包括:将模块节点nm的in函数从模块节点集合{NM}的in函数表中移除,将模块节点nm的out函数从模块节点集合{NM}的out函数表中移除;针对暂未使用节点中对应模块节点nm包含的in函数,若该in函数未被使用,则直接将其从暂未使用节点中删除,否则针对使用该in函数的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的函数调用关系图GFdep;将模块节点nm的Export数据从模块节点集合{NM}的Export数据表中移除,将模块节点nm的External数据从模块节点集合{NM}的External数据表中移除;针对暂未使用节点中对应模块节点nm包含的Export数据,若该Export数据未被使用,则直接将其从暂未使用节点中删除,否则针对使用该Export数据的其他任意内核模块j,在图数据库中将内核模块j、模块节点nm之间的引用关系修改为内核模块j、暂未发现节点之间的引用关系,得到更新后的数据共享关系图GDdep5. The kernel module relationship graph construction method based on dumb module nodes according to claim 4, characterized in that step B3) includes: extracting the in function of module node n m from the in function table of module node set {N M } Remove from, remove the out function of module node n m from the out function table of module node set {N M }; for the in function contained in the corresponding module node n m in the unused node, if the in function has not been If used, directly delete it from the unused node, otherwise for any other kernel module j that uses the in function, modify the reference relationship between kernel module j and module node n m in the graph database to kernel module j , the reference relationship between nodes has not been found yet, and the updated function call relationship graph G Fdep is obtained; the Export data of module node n m is removed from the Export data table of module node set {N M }, and module node n is The External data of m is removed from the External data table of the module node set {N M }; for the Export data contained in the corresponding module node n m in the unused node, if the Export data is not used, it is directly removed from the temporary Delete the unused node, otherwise for any other kernel module j that uses the Export data, modify the reference relationship between kernel module j and module node n m in the graph database to the reference relationship between kernel module j and the node that has not been found yet. Reference relationship, get the updated data sharing relationship graph G Ddep . 6.一种基于哑模块节点的内核模块关系图构建系统,包括相互连接的微处理器和存储器,其特征在于,所述微处理器被编程或配置以执行权利要求1~5中任意一项所述基于哑模块节点的内核模块关系图构建方法的步骤。6. A kernel module relationship graph construction system based on dumb module nodes, including an interconnected microprocessor and a memory, characterized in that the microprocessor is programmed or configured to execute any one of claims 1 to 5 The steps of the method for constructing a kernel module relationship graph based on dumb module nodes. 7.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有被编程或配置以执行权利要求1~5中任意一项所述基于哑模块节点的内核模块关系图构建方法的计算机程序。7. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a kernel module relationship diagram that is programmed or configured to execute the dumb module node-based kernel module diagram in any one of claims 1 to 5. A computer program for constructing a method.
CN202110281352.9A 2021-03-16 2021-03-16 Method, system and medium for constructing kernel module relation graph based on dummy module node Active CN113157979B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110281352.9A CN113157979B (en) 2021-03-16 2021-03-16 Method, system and medium for constructing kernel module relation graph based on dummy module node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110281352.9A CN113157979B (en) 2021-03-16 2021-03-16 Method, system and medium for constructing kernel module relation graph based on dummy module node

Publications (2)

Publication Number Publication Date
CN113157979A CN113157979A (en) 2021-07-23
CN113157979B true CN113157979B (en) 2023-09-29

Family

ID=76887271

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110281352.9A Active CN113157979B (en) 2021-03-16 2021-03-16 Method, system and medium for constructing kernel module relation graph based on dummy module node

Country Status (1)

Country Link
CN (1) CN113157979B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5581768A (en) * 1995-02-27 1996-12-03 Intel Corporation Method and apparatus for executing applications in place from write once/seldom memories
CN110659085A (en) * 2019-09-27 2020-01-07 泉州华中科技大学智能制造研究院 Method and device for overloading limited number of functions in Linux kernel module

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5581768A (en) * 1995-02-27 1996-12-03 Intel Corporation Method and apparatus for executing applications in place from write once/seldom memories
CN110659085A (en) * 2019-09-27 2020-01-07 泉州华中科技大学智能制造研究院 Method and device for overloading limited number of functions in Linux kernel module

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
并行帧缓存设备:基于多核CPU的Xorg并行显示优化;高珑; 戴华东; 杨沙洲; 丁滟;软件学报;第31卷(第10期);3309-3320 *

Also Published As

Publication number Publication date
CN113157979A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
JP6875557B2 (en) Methods and devices for writing service data to the blockchain system
CN104462668B (en) Computer-implemented method for designing an industrial product modeled with a binary tree
US9400767B2 (en) Subgraph-based distributed graph processing
US20120272228A1 (en) Method and apparatus for determining compatible versions of dependent entities in a computer system
US11210181B2 (en) System and method for implementing data manipulation language (DML) on Hadoop
CN103810257A (en) Method and device for upgrading software database and equipment
CN109542875B (en) Configuration file generation method and device
CN114020840A (en) A data processing method, device, server, storage medium and product
WO2017045491A1 (en) Method and system for upgrading sqlite3 embedded database
CN104461621A (en) Attribute information updating method and device
WO2016070571A1 (en) M2m node management method and apparatus, and computer storage medium
CN117631996A (en) Fault domain expansion method, device, computer equipment and storage medium
CN103984571A (en) Method and device for uprating operating system partition
CN108536447B (en) Operation and maintenance management method
CN113157979B (en) Method, system and medium for constructing kernel module relation graph based on dummy module node
CN113297132A (en) Generation method and device of migration file list, electronic equipment and computer readable medium
CN115421764A (en) A module identification method, device, equipment and storage medium to be upgraded
CN110020288A (en) A kind of page furbishing method and device
CN108073584B (en) Data processing method and server
EP3340048A1 (en) System and method for content - application split
CN109241071A (en) A kind of Android database upgrade method, apparatus and terminal
CN109960751B (en) Calculation flow graph construction method and device and storage medium
WO2016095491A1 (en) Equipment upgrading method and transport network equipment
CN105740095A (en) Method and apparatus for restoring factory settings
CN113609136B (en) Method and device for stably maintaining service number, computer equipment 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