CN116243924A - Method and device for detecting error value of kernel configuration item - Google Patents

Method and device for detecting error value of kernel configuration item Download PDF

Info

Publication number
CN116243924A
CN116243924A CN202310142912.1A CN202310142912A CN116243924A CN 116243924 A CN116243924 A CN 116243924A CN 202310142912 A CN202310142912 A CN 202310142912A CN 116243924 A CN116243924 A CN 116243924A
Authority
CN
China
Prior art keywords
configuration
configuration item
value
kconfig
item
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.)
Pending
Application number
CN202310142912.1A
Other languages
Chinese (zh)
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.)
Zhongke Nanjing Software Technology Research Institute
Institute of Software of CAS
Original Assignee
Zhongke Nanjing Software Technology Research Institute
Institute of Software of CAS
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 Zhongke Nanjing Software Technology Research Institute, Institute of Software of CAS filed Critical Zhongke Nanjing Software Technology Research Institute
Priority to CN202310142912.1A priority Critical patent/CN116243924A/en
Publication of CN116243924A publication Critical patent/CN116243924A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking

Abstract

The invention discloses a method and a device for detecting error values of kernel configuration items, wherein the method comprises the following steps: acquiring a Kconfig configuration item definition file of a kernel configuration file to be detected; storing the Kconfig information in the Kconfig configuration item definition file to a tree structure; and analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure to obtain the error types of the configuration items in the configuration files to be checked. The method and the device realize the detection of the problems of value risk and the like of the kernel configuration items.

Description

Method and device for detecting error value of kernel configuration item
Technical Field
The invention belongs to the technical field of computer software, and particularly relates to a method and a device for detecting an error value of a kernel configuration item.
Background
Linux kernels are used as typical high-configurable software, are now being applied to billions of devices, modules required by personalized configuration can meet specific requirements, complicated dependency relations exist among different modules, and interaction relations among the modules are described in kernel source codes by means of Kconfig modeling language. Unlike other typical modeling languages, kconfig has complex semantics and language characteristics, including 28 keywords and numerous operators. Its complex language behavior makes it particularly difficult to understand the module relationships correctly and to configure the Linux kernel. In the latest version v6.1 Linux kernel, kconfig defines more than 18000 configuration items. And the configuration items have different types of values, even if only the Boolean type is considered, the configuration combination situation exceeds 2≡18000 possibilities. In the process of kernel configuration, any configuration items have extremely strict upstream and downstream dependency relationships and value influence limits, which greatly increases the difficulty of correctly configuring the Linux kernel. In practical application, the situation that the configuration file of the kernel does not meet the value constraint of the configuration item in the Kconfig definition often occurs, so that the kernel cannot be compiled correctly, or errors occur during system operation, and threat is brought to the production safety of the application.
The existing configuration item dependence correlation tool mainly comprises ConfigFix and Kmax, the ConfigFix aims at solving the dependence conflict problem of the configuration item to be enabled and the upstream configuration item, an upstream configuration item value set is automatically generated for the configuration item to be enabled, but the experimental result shows that about 20% of possibility exists and the dependence conflict cannot be repaired, and in the process of generating the configuration value meeting the user requirement, higher learning cost is needed; kmax is researched from the Kconfig development angle aiming at the problem that dependence of an enabled configuration item is not met, the configuration item which is forcedly enabled but does not meet the dependence can be checked, but the tool has a larger false positive problem, and only the error situation that the enabled configuration item does not meet the dependence can be solved, so that the application range is limited.
However, in the kernel configuration of practical application, besides the dependency conflict and the dependency unsatisfied error, other error types such as value error, configuration item missing and the like may exist, and the kernel configuration item tool cannot completely cover the errors and has a certain degree of defects in terms of tool performance, so that a reliable and rapid automatic detection method for the kernel configuration item error value is needed to solve the configuration error problems.
Disclosure of Invention
Aiming at the problems of complex constraint conditions and configuration errors among kernel configuration items in the Linux kernel configuration file checking scene, the invention provides a method and a device for detecting the error values of the kernel configuration items. The method is used for rapidly and accurately checking the error value in the kernel configuration file through a new formalized semantic and a checking frame aiming at the Kconfig file, and assisting a user in modifying and configuring a target result.
The technical content of the invention comprises:
a method for detecting a kernel configuration item error value, the method comprising:
acquiring a Kconfig configuration item definition file of a kernel configuration file to be detected;
storing the Kconfig information in the Kconfig configuration item definition file to a tree structure;
and analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure to obtain the error types of the configuration items in the configuration files to be checked.
Further, the obtaining all Kconfig configuration item definition files of the kernel configuration file to be detected includes:
acquiring a kernel version of the kernel configuration file to be detected;
searching a source code corresponding to the kernel version;
and extracting all the Kconfig configuration item definition files in the source codes.
Further, the storing the Kconfig information in the Kconfig configuration item definition file to a tree structure includes:
unifying the grammar form of the Kconfig configuration item definition file;
obtaining a token stream through lexical analysis of the Kconfig configuration item definition file;
and carrying out semantic analysis on the token stream, and storing semantic analysis results into a tree structure.
Further, the obtaining the token stream through lexical analysis of the Kconfig configuration item definition file includes:
preprocessing the Kconfig configuration item definition to obtain an input data stream;
acquiring the category of the input data stream by using the t_ + state+regular expression name; the categories include: an initial state, a string state, or a help information state;
marking all characters in the input data stream according to the state names of the tuple forms contained in the token claims aiming at the input data stream with the category as the initial state so as to obtain a token stream of the input data stream;
aiming at an input data stream with the character string state of the category, marking all characters in the input data stream according to a tuple form state name contained in a token statement, a state switching mark and an ending mark which are obtained based on single and double quotation marks so as to obtain a token stream of the input data stream;
and marking all characters in the input data stream according to the tuple form state name contained in the token declaration, the state switching mark obtained based on the key words and the end mark determined by combining indentation and key word grammar so as to obtain the token stream of the input data stream.
Further, the semantic analysis is performed on the token stream, and the semantic analysis result is saved to a tree structure, including:
acquiring grammar expressions corresponding to the keywords and priorities of the marked keywords and grammar expressions in a combination mode;
analyzing from the basic item of the grammar expression by adopting a Python Yacc tool package, and obtaining a logic judgment or operation relation between the configuration items through analyzing the obtained configuration item names and the code operation types;
classifying keywords in the Kconfig configuration item definition file; the categories of the keywords include: a forced enabling relation indicating that the select expression is established, a direct dependency relation indicating a dependency on attribute and an if group relation of the configuration item and the menu item, a value limiting relation indicating a protection range condition, a default and an immediate, and a display control condition indicating an if judgment including a type expression and a display expression inside the configuration item and a visual key in the menu item;
and storing the logical relation between the configuration items represented by the keywords and the classification result of the configuration items into a tree structure.
Further, the error types of the configuration items include: configuration item missing, dependency conflict, dependency unsatisfied errors, value errors, and value risk.
Further, the parsing out the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure to obtain error types of each configuration item in the configuration files to be checked, including:
checking whether a configuration item is in the tree structure, judging that the error type of the configuration item is configuration item missing when the configuration item is not in the tree structure, and jumping to check whether the configuration item meets a select forced value when the configuration item is in the tree structure;
checking whether the configuration item meets the selection forced value, judging that the error type of the configuration item is dependent conflict when the value is wrong, and jumping to the value of the check dependent expression when the value is correct;
checking the value of the dependent expression, judging that the error type of the configuration item is dependent conflict and/or dependence is not satisfied when the value is wrong, and jumping to detect whether the value of the configuration item is in the value range when the value is correct;
detecting whether the value of the configuration item is in the value range, judging that the error type of the configuration item is a value error when the value of the configuration item is not in the value range, and jumping to check whether the configuration item is visible or not and whether the value of the configuration item is consistent with the default value when the value of the configuration item is in the value range;
checking whether the configuration item is visible or not and whether the configuration item value is consistent with the default value or not, judging that the error type of the configuration item is a value risk when the configuration item is invisible or the configuration item value is not consistent with the default value, and judging that the configuration item is free of errors when the configuration item is visible or the configuration item value is consistent with the default value.
A kernel configuration item error value detection apparatus, the apparatus comprising:
the acquisition module is used for acquiring a Kconfig configuration item definition file of the kernel configuration file to be detected;
the processing module is used for storing the Kconfig information in the Kconfig configuration item definition file into a tree structure;
the detection module is used for analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure so as to obtain the error types of the configuration items in the configuration files to be checked.
A computer device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform any of the methods described above.
A computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements any of the methods described above.
Compared with the prior art, the invention has the following positive effects:
(1) The invention supports the most abundant error types of detection in the existing research results, and other problems such as value risk which is not concerned by academic circles besides covering common dependence related errors are also included;
(2) The detection method of the invention tests in various architectures such as X86, ARM, RISC-V, etc., various release boards and various versions from the kernel V2.6 to the latest V6.0, and the experimental result proves that the accuracy of semantic modeling and error checking reaches 100 percent and no false positive exists;
(3) Under the use scene of once semantic modeling and multiple operation checking configuration files, the method and the device detect the error values of the configuration items of the kernel 18000 in the operation time within 2s, and can meet the frequent error detection requirement of users.
Drawings
FIG. 1 is a flow chart of a method of kernel configuration item error value detection.
FIG. 2 is a core profile check logic schematic.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention in any way.
From the engineering point of view, the invention enriches and expands the error detection types of the Linux kernel tool, provides new error classification, and is the detection method supporting the most abundant error types in the existing research results.
1) Dependency conflict refers to the problem that the establishment of a configuration item depends on the effectiveness or non-effectiveness of other configuration items, and the value of a target configuration item and a dependent configuration item conflicts. In the Kconfig grammar, the conditions for establishment of the configuration items are not limited to the depend keywords inside the configuration items, but include part of the attributes of the upstream group keywords. The dependency propagation chain includes dependencies in the configuration item internal dependency and the menu item dependency, in addition to the expression pointed to by the group key if.
2) Depending on the unsatisfied error, the assignment configuration item is enabled reasonably, but its dependency chain is not satisfied resulting in a kernel compilation error. The forced enabling of the configuration item by select does not check whether the dependency condition is true, which is the main cause of the dependency unsatisfied condition.
3) The value error is defined according to whether the Linux kernel can be correctly compiled according to the value of the configuration item, and comprises two situations: firstly, the value range requirement in the type key words and the digital configuration items; and secondly, mandatory range limitations for the number type.
4) The risk of value taking mainly focuses on the authority problem between the default value and the modifiable value of the user in the Kconfig semantic.
5) The configuration items are missing, the configuration items appearing in the kernel configuration file are not found in the Linux source code, and mainly because in the iterative development process of the Linux kernel, definition blocks of some configuration items are removed in the Kconfig file, but still appear in the configuration file, and the situation exists widely in the Linux release.
Aiming at the error classification, the kernel configuration item error value detection method disclosed by the invention has the technical scheme that the kernel source code Kconfig file is completely modeled and converted into a custom expression to describe specific behavior definition, a set of fixed logic check framework is designed to detect the configuration file, and an error information result with strong readability and user friendliness is output.
The technical scheme is as shown in fig. 1, and comprises the following steps:
(1) and in the preprocessing stage, obtaining a Kconfig file, unifying Kconfig code styles, processing all target Kconfig files into a Kconfig set file, and eliminating the differences of different versions and different developer code styles to form a unified grammar form.
The Kconfig file is obtained by searching a kernel version of the kernel configuration file, searching source codes corresponding to the kernel version, and extracting all Kconfig configuration item definition files in the source codes.
(2) In the Kconfig analysis stage, an analysis framework follows a traditional compiler front-end analysis mode, a token stream is obtained through lexical analysis, the token stream is transmitted to a grammar analyzer to construct a grammar tree, kconfig actual semantics are obtained, and a configuration item dependency relation file is output.
Firstly, after a Kconfig file in a kernel source code is preprocessed and used as an input data stream, a Python Lex tool package is adopted to mark all characters in the input data stream, so that a token stream is formed, and a foundation is laid for the next grammar analysis. When marking all characters in an input data stream, the input data stream is divided into three types according to Kconfig text rules: firstly, an initial state, and an important keyword completely matched by a regular expression; secondly, the character string state, the initial mark is marked by a single-double quotation mark, and the crossing is not allowed in principle; thirdly, the help information state is marked as a help key word, the next line is the help information, the end mark is marked as the line head indentation change (usually reducing indentation) and the line head presents a Kconfig key word meeting the grammar requirement. The lexical analysis distinguishes tags by including a state name in the form of a tuple in the token declaration, where the INITIAL state (INITIAL) exists by default and is not separately tagged, so that for regular expressions for which no state setting is made, it is uniformly considered that they belong to the INITIAL state, and the character string and help information state are distinguished by "t_" +state+ "regular expression name". Then designing a state switching mark, and classifying the character string states according to the grammar, wherein the conversion mark and the ending mark are single-double quotation marks; the transition mark of the help information state is obvious, namely the help key, and the end mark is determined by combining the indentation and part of key grammar together. Based on the simulation model processing mode of the existence state space expression, the invention can mark all characters in the input data stream.
Secondly, defining corresponding grammar expressions for different keywords, and adding the priority and combination mode of a group of tuple mark keywords besides the grammar expressions corresponding to the keywords in order to meet the priority matching requirement of the Kconfig dependent expressions. When complex expressions are analyzed from basic terms, configuration item names are first identified, then judging operations or logical operation (AND, OR, NOT) operations are possibly identified according to target codes, python Yacc toolkits are adopted to analyze the complex expressions one by one from bottom to top, token streams which are transmitted after the last stage of lexical analysis are identified, kconfig behavior semantics are completely modeled, father and son nodes are judged according to keywords representing dependency relationships, and the father and son nodes are saved to a self-defined tree structure. The tree comprises node types such as configuration items, menu items, if and choice groups, each node has the attributes such as name, type, path, group name, child node, dependency item, visibility, selectivity, help information and the like, all information defined by Kconfig is covered, the extracted dependency relationship is the basis of error value inspection in the next stage, and meanwhile, the dependency relationship expressions of all the configuration items are output to a file in a unified json format for secondary development of other requirements.
The Kconfig semantic modeling classifies Kconfig keywords mainly based on actual engineering experience and the error types, the first type is a forced enabling relation, whether a selection expression is established or not needs to be considered, if the selection expression is established, all other condition enabling configuration items are ignored, and specific semantics of the selection statement and establishment conditions of the specific semantics are saved. The second type is a direct dependency, comprising the dependency on properties of the configuration item and menu item and the if group relationship, which reflects the main properties of the dependency conditions between kernel source code, requiring the preservation of the complete dependency chain from the root node to the current configuration item. The third class is a value limit relationship, mainly range condition, default and real, which are strong limit requirements for range, and default and real are risk warning level checks, and whether errors or warnings are marked by different distinction modes. The fourth category is display control conditions, which include type expressions inside configuration items and if judgment of the display expressions, and visual keywords in menu items of a menu group, and the display control conditions do not act independently, and default and real keywords in the relation between display control and value limitation are combined in a semantic model, so that the judgment condition of the value risk of subsequent examination is affected. All the Kconfig behavior semantics are described by AND or NOR logic expressions, the configuration item name is used as a keyword, and the values comprise four attributes of "type", "rev_select", "dep", "constraint", and as shown below, except common "&", "| -! Except for the and or operator and "(", ")" the if condition constraint is indicated by brackets "[", "], for example," rev_select "in the following example indicates that config_b is the parent of config_a when config_d is y and that config_b is not associated with config_a when config_d is n.
Figure SMS_1
(3) In the configuration checking stage, the checking object is a configuration file compiled by the Linux kernel, all configuration item values of the configuration file to be checked are firstly analyzed, and then whether the logic traversal configuration item meets the Kconfig constraint requirement is checked, wherein the specific checking process is as follows: searching tree nodes according to the names of the configuration items to be checked, and returning an error of configuration item deletion if the tree nodes with the same names do not exist; secondly, searching tree nodes (namely parent nodes) of which all child nodes are configuration items to be checked, if the configuration items of the parent nodes are all 'y', selecting to be forcedly selected, if the configuration items of the parent nodes are all 'y', returning an error depending on conflict, otherwise, not processing the next step; thirdly, calculating whether a dependent item expression of the configuration item tree node to be checked is established, if not, returning that the dependency is not met, if not, and if not, the selection forced selection exists, returning a dependency conflict error, and if yes, continuing to check the value limiting condition in the next step; and fourthly, for the value limiting constraint, firstly checking whether the value of the configuration item is in the default value range of the node type and the value range of the defined constraint, if the value is out of the value range, returning a value error, if the value is not out of the value range, continuously checking the visibility of the node of the configuration item, if the value is not visible, comparing whether the actual value is the same as the default value of the node, if the value is different, returning a warning of the value risk, and otherwise, not being in error. Classifying the checked error configuration items according to the error types, outputting files in a unified json format together with the upstream configuration items influencing the value of the error configuration items and the actual value of the upstream configuration items, and facilitating the user to select the configuration items for modification and correction.
In summary, the invention not only includes the problem of value risk which is not concerned by academia, but also is suitable for various architectures and versions, and can rapidly detect error values with a large number of configuration items.
Based on the same conception, the invention also discloses a device for detecting the error value of the kernel configuration item, which comprises the following steps:
the acquisition module is used for acquiring a Kconfig configuration item definition file of the kernel configuration file to be detected;
the processing module is used for storing the Kconfig information in the Kconfig configuration item definition file into a tree structure;
the detection module is used for analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure so as to obtain the error types of the configuration items in the configuration files to be checked.
Based on the unified conception, the invention also discloses an electronic device which can be a computer device, a notebook computer, a server or other types of electronic devices.
The electronic device may include at least one processor and memory. The processor may execute instructions stored in the memory. The processor is communicatively coupled to the memory via a data bus. In addition to the memory, the processor may also be communicatively coupled to input devices, output devices, and communication devices via a data bus.
The processor may be any conventional processor. The processor may include, for example, a central processing unit (Central Processing Unit, CPU), an image processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a System On Chip (SOC), an application specific integrated Chip (Application Specific Integrated Circuit, ASIC), or a combination thereof.
The memory may be implemented by any type of volatile or nonvolatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
In the embodiments of the present disclosure, the memory stores executable instructions, and the processor may read the executable instructions from the memory and execute the instructions to implement all or part of the steps of the methods in the above-described exemplary embodiments.
Based on the unified concept, exemplary embodiments of the present disclosure also include a computer program product or a computer-readable storage medium storing the computer program product. The computer program instructions are embodied in a computer program instruction that is executable by a processor to implement all or part of the steps described in the above exemplary embodiments.
The computer program product may write program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages, as well as scripting languages (e.g., python). The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
A computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the readable storage medium include: a Static Random Access Memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic or optical disk, or any suitable combination of the foregoing having one or more electrical conductors.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. The specification and embodiments are to be regarded as exemplary only, and the disclosure is not limited to the exact construction illustrated and described above, and various modifications and changes may be made without departing from the scope thereof.

Claims (10)

1. A method for detecting a core configuration item error value, the method comprising:
acquiring a Kconfig configuration item definition file of a kernel configuration file to be detected;
storing the Kconfig information in the Kconfig configuration item definition file to a tree structure;
and analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure to obtain the error types of the configuration items in the configuration files to be checked.
2. The method of claim 1, wherein the obtaining all Kconfig configuration item definition files of the kernel configuration file to be detected comprises:
acquiring a kernel version of the kernel configuration file to be detected;
searching a source code corresponding to the kernel version;
and extracting all the Kconfig configuration item definition files in the source codes.
3. The method of claim 1, wherein saving the Kconfig information in the Kconfig profile definition file to a tree structure comprises:
unifying the grammar form of the Kconfig configuration item definition file;
obtaining a token stream through lexical analysis of the Kconfig configuration item definition file;
and carrying out semantic analysis on the token stream, and storing semantic analysis results into a tree structure.
4. The method of claim 3, wherein the obtaining the token stream by lexical analysis of the Kconfig profile definition file comprises:
preprocessing the Kconfig configuration item definition to obtain an input data stream;
acquiring the category of the input data stream by using the t_ + state+regular expression name; the categories include: an initial state, a string state, or a help information state;
marking all characters in the input data stream according to the state names of the tuple forms contained in the token claims aiming at the input data stream with the category as the initial state so as to obtain a token stream of the input data stream;
aiming at an input data stream with the character string state of the category, marking all characters in the input data stream according to a tuple form state name contained in a token statement, a state switching mark and an ending mark which are obtained based on single and double quotation marks so as to obtain a token stream of the input data stream;
and marking all characters in the input data stream according to the tuple form state name contained in the token declaration, the state switching mark obtained based on the key words and the end mark determined by combining indentation and key word grammar so as to obtain the token stream of the input data stream.
5. The method of claim 3, wherein performing semantic analysis on the token stream and saving the semantic analysis result to a tree structure comprises:
acquiring grammar expressions corresponding to the keywords and priorities of the marked keywords and grammar expressions in a combination mode;
analyzing from the basic item of the grammar expression by adopting a Python Yacc tool package, and obtaining a logic judgment or operation relation between the configuration items through analyzing the obtained configuration item names and the code operation types;
classifying keywords in the Kconfig configuration item definition file; the categories of the keywords include: a forced enabling relation indicating that the select expression is established, a direct dependency relation indicating a dependency on attribute and an if group relation of the configuration item and the menu item, a value limiting relation indicating a protection range condition, a default and an immediate, and a display control condition indicating an if judgment including a type expression and a display expression inside the configuration item and a visual key in the menu item;
and storing the logical relation between the configuration items represented by the keywords and the classification result of the configuration items into a tree structure.
6. The method of claim 1, wherein the error type of the configuration item comprises: configuration item missing, dependency conflict, dependency unsatisfied errors, value errors, and value risk.
7. The method of claim 6, wherein the parsing out the configuration items and values of the configuration file to be checked and detecting the configuration items and values based on the tree structure to obtain the error types of each configuration item in the configuration file to be checked comprises:
checking whether a configuration item is in the tree structure, judging that the error type of the configuration item is configuration item missing when the configuration item is not in the tree structure, and jumping to check whether the configuration item meets a select forced value when the configuration item is in the tree structure;
checking whether the configuration item meets the selection forced value, judging that the error type of the configuration item is dependent conflict when the value is wrong, and jumping to the value of the check dependent expression when the value is correct;
checking the value of the dependent expression, judging that the error type of the configuration item is dependent conflict and/or dependence is not satisfied when the value is wrong, and jumping to detect whether the value of the configuration item is in the value range when the value is correct;
detecting whether the value of the configuration item is in the value range, judging that the error type of the configuration item is a value error when the value of the configuration item is not in the value range, and jumping to check whether the configuration item is visible or not and whether the value of the configuration item is consistent with the default value when the value of the configuration item is in the value range;
checking whether the configuration item is visible or not and whether the configuration item value is consistent with the default value or not, judging that the error type of the configuration item is a value risk when the configuration item is invisible or the configuration item value is not consistent with the default value, and judging that the configuration item is free of errors when the configuration item is visible or the configuration item value is consistent with the default value.
8. A kernel-configuration-item-error-value detection apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a Kconfig configuration item definition file of the kernel configuration file to be detected;
the processing module is used for storing the Kconfig information in the Kconfig configuration item definition file into a tree structure;
the detection module is used for analyzing the configuration items and the values of the configuration files to be checked, and detecting the configuration items and the values based on the tree structure so as to obtain the error types of the configuration items in the configuration files to be checked.
9. A computer device comprising a memory, in which a computer program is stored, and a processor arranged to run the computer program to perform the method of any of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method according to any of claims 1-7.
CN202310142912.1A 2023-02-08 2023-02-08 Method and device for detecting error value of kernel configuration item Pending CN116243924A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310142912.1A CN116243924A (en) 2023-02-08 2023-02-08 Method and device for detecting error value of kernel configuration item

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310142912.1A CN116243924A (en) 2023-02-08 2023-02-08 Method and device for detecting error value of kernel configuration item

Publications (1)

Publication Number Publication Date
CN116243924A true CN116243924A (en) 2023-06-09

Family

ID=86629208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310142912.1A Pending CN116243924A (en) 2023-02-08 2023-02-08 Method and device for detecting error value of kernel configuration item

Country Status (1)

Country Link
CN (1) CN116243924A (en)

Similar Documents

Publication Publication Date Title
JP7398068B2 (en) software testing
US8132156B2 (en) Methods and systems for testing tool with comparative testing
US9418230B2 (en) Automated tools for building secure software programs
CN102804147B (en) Perform the code check executive system of the code check of ABAP source code
US20130332905A1 (en) Test code generation based on test documentation
US7711546B2 (en) User interface for machine aided authoring and translation
US10437574B2 (en) System and method for providing code completion features for code modules
US8171462B2 (en) User declarative language for formatted data processing
US20070260584A1 (en) System for processing formatted data
US9870485B2 (en) System and method for detecting sensitive user input leakages in software applications
US7523433B1 (en) System and method for automated analysis and hierarchical graphical presentation of application results
US10474887B2 (en) Identifying a layout error
KR101892206B1 (en) Bidirectional text checker
Yu et al. Characterizing the usage, evolution and impact of java annotations in practice
US9304893B1 (en) Integrated software development and test case management system
Zhao et al. Automatic assertion generation from natural language specifications using subtree analysis
CN115066674A (en) Method for evaluating source code using numeric array representation of source code elements
US11593076B2 (en) Method for merging architecture data
CN113778852B (en) Code analysis method based on regular expression
US20230195825A1 (en) Browser extension with automation testing support
CN110286912B (en) Code detection method and device and electronic equipment
CN116243924A (en) Method and device for detecting error value of kernel configuration item
Anderson et al. Supporting analysis of SQL queries in PHP AiR
KR101784280B1 (en) System and method for testing graphical user interface automatically
Scalabrino Automatically assessing and improving code readability and understandability

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