Kernel anomaly identification method and system based on Linux kernel domain knowledge

By extracting Linux kernel text data, extracting key features and using attention mechanism to enhance abnormal semantic features, combined with pre-trained kernel exception classifiers, the kernel exception recognition complexity, low accuracy and low security in the existing technology is solved. The problem of this paper achieves efficient and accurate kernel exception recognition, improving system stability and security.

CN118820476BActive Publication Date: 2024-12-06KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411297418.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2024-12-06
Estimated Expiration
2044-09-18

AI Technical Summary

Technical Problem

The existing technology has high complexity, difficulty in maintaining, low accuracy and low security when detecting Linux kernel exceptions. It is impossible to effectively identify and deal with complex kernel exceptions, resulting in threats to system stability and security.

Method used

Using the kernel exception recognition method based on Linux kernel domain knowledge, local exception semantic features are enhanced by extracting kernel text data, extracting key features, vectorized representation, and using attention mechanisms to enhance local exception semantic features, and using pre-trained kernel exception classifiers for identification, reducing The complexity of manual design rules and the readability of features improve identification accuracy and efficiency.

Benefits of technology

It realizes automation, high efficiency and high accuracy of Linux kernel exceptions, reduces maintenance complexity and security risks, and improves system stability and data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118820476B_ABST
    Figure CN118820476B_ABST
Patent Text Reader

Abstract

The invention discloses a kernel anomaly recognition method and system based on Linux kernel domain knowledge, the method comprising: extracting Linux kernel text data #imgabs0#; extracting key features #imgabs2# from the Linux kernel text data #imgabs1# according to a preset kernel anomaly corpus; vectorizing the Linux kernel text data #imgabs3# and the key features #imgabs4# to obtain a text data vector matrix #imgabs5# and an abnormal vocabulary vector matrix #imgabs6#; enhancing the local abnormal semantic features of the text data vector matrix #imgabs7# and the abnormal vocabulary vector matrix #imgabs8# by using an attention mechanism to obtain a regional abnormal enhanced semantic feature matrix #imgabs9# that highlights the key abnormal features; and classifying the regional abnormal enhanced semantic feature matrix #imgabs10# by using a pre-trained kernel anomaly classifier to obtain a kernel anomaly recognition result. The invention improves data security, and improves the accuracy and recognition efficiency of kernel anomaly recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to Linux kernel anomaly recognition technology, and in particular to a kernel anomaly recognition method and system based on Linux kernel domain knowledge. Background Art

[0002] The Linux operating system is widely used in servers, cloud computing, embedded devices and other fields due to its open source, stable and efficient features. However, due to the increasing complexity of the system and the diversity of the application environment, Linux kernel exceptions are becoming increasingly prominent, such as memory leaks, deadlocks, process crashes, etc. These problems not only affect the normal operation of the system, but may also lead to serious consequences such as data loss and service interruptions. Detecting kernel exceptions is to analyze and solve kernel exceptions based on kernel exceptions, which is an important task to maintain the stable operation of the operating system. The current field of kernel exception detection technology mainly relies on traditional log analysis, system monitoring and debugging tools, most of which are based on rule matching and manually designed code features. The manually designed code rule matching mode has the following disadvantages:

[0003] 1) High complexity and difficult maintenance. On the one hand, it is necessary to find the regularity of abnormal characteristic information. Due to the huge and complex system logs, different keyword-based code matching patterns are designed according to each regular information, which is very complex. On the other hand, as the kernel code is constantly updated, the keyword-based code matching patterns defined according to the regularity need to be updated accordingly, which is not conducive to the maintenance of the tool.

[0004] 2) Low accuracy. Manual features designed based on rules have a one-to-one nature and cannot cover all exceptions. With the continuous update of kernel code and some complex kernel exceptions, such as concurrency problems and resource competition, if the manual design features cannot be updated in time, the recognition accuracy will be reduced.

[0005] 3) Low security. Manually designed features are usually more readable, and compared with automatically generated features, these manual features are often more vulnerable to cracking and analysis by malicious users. Once the source code is cracked, malicious users can easily identify these features, resulting in the leakage of core data, which in turn causes serious damage to the entire system. Summary of the invention

[0006] The technical problem to be solved by the present invention is as follows: In view of the above problems in the prior art, a kernel anomaly recognition method and system based on Linux kernel domain knowledge are provided, which can improve the accuracy and efficiency of kernel anomaly recognition.

[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0008] A kernel anomaly identification method based on Linux kernel domain knowledge comprises the following steps:

[0009] S101, extracting Linux kernel text data ;

[0010] S102, extract the Linux kernel text data Extract key features based on the preset kernel anomaly corpus ;

[0011] S103, Linux kernel text data and key features Vectorize the text data to get the vector matrix and the abnormal word vector matrix ;

[0012] S104, convert the text data vector matrix and the abnormal word vector matrix The attention mechanism is used to enhance the local abnormal semantic features, and the regional abnormal enhanced semantic feature matrix with highlighted key abnormal features is obtained. ;

[0013] S105, enhance the semantic feature matrix of regional anomalies The kernel anomaly recognition result is obtained by using a pre-trained kernel anomaly classifier, wherein the kernel anomaly classifier is pre-trained to establish a regional anomaly enhanced semantic feature matrix. , and the mapping relationship between kernel exception identification results.

[0014] Furthermore, step S101 includes:

[0015] S201, using a search command to search for all kernel print data from the kernel source code using a specified kernel keyword, including the data source path and source file, text data and specific line number of the data source;

[0016] S202, performing data cleaning on the obtained kernel print data to obtain Linux kernel text data , the data cleaning includes some or all of the following cleaning methods: (1) filtering the kernel print data in the non-driver code file according to the data source path and source file in the kernel print data; (2) if the kernel print data is equal to the maximum output length of the search command, obtaining its complete text data and specific number of lines of the data source according to the data source path and source file to replace the incomplete text data and specific number of lines of the data source obtained by the search command; (3) removing specified useless characters; (4) replacing hyphens with spaces; (5) replacing specified abbreviations with corresponding non-abbreviations.

[0017] Furthermore, in step S102, key features are extracted according to the preset kernel abnormality corpus. include:

[0018] S301, text data from the Linux kernel Extract key term sets based on a preset list of key terms ;

[0019] S302, for key term set Each key term in , extract the corresponding key words according to the mapping relationship between key terms and key words in the preset kernel anomaly corpus , so that we can finally get the key vocabulary set Key features of the composition .

[0020] Further, in step S103, the Linux kernel text data and key features Vectorize the text data to get the vector matrix and the abnormal word vector matrix The function expression is:

[0021] ,

[0022] ,

[0023] In the above formula, is the preset embedding vector, the superscript Represents a text content identifier, , represents the dimension of the embedding vector, Represents the total number of words in the text data. , Indicates The total number of words in the text data; is the preset embedding vector, the superscript Represents the key feature identifier, , Indicates the total number of key words. , Indicates the number of key words.

[0024] Furthermore, in step S104, the text data vector matrix and the abnormal word vector matrix The attention mechanism is used to enhance the local abnormal semantic features, and the regional abnormal enhanced semantic feature matrix with highlighted key abnormal features is obtained. The function expression is:

[0025] ,

[0026] In the above formula, , represents the j-th row of the matrix, , Represents the mutual information vector The kth element of Represents the abnormal vocabulary vector matrix The k-th row vector has:

[0027] ,

[0028] In the above formula, is the softmax activation function, Represents a vector matrix of text data In the jth row, the superscript T stands for transpose.

[0029] Furthermore, the kernel anomaly classifier in step S105 includes an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer, and the regional anomaly enhancement semantic feature matrix The kernel anomaly recognition results obtained by using the kernel anomaly classifier include:

[0030] S401, enhance the semantic feature matrix of regional anomalies As input to the input layer of the kernel anomaly classifier;

[0031] S402, using the convolutional layer to enhance the semantic feature matrix for the input region abnormality according to the following formula Use convolution kernels of three different dimensions to learn the regional abnormality enhanced semantic feature matrix in each dimension:

[0032] ,

[0033] In the above formula, Represents the abnormal enhanced semantic feature map of k types of convolution kernels, represents the height of the convolution kernel, , represents the RELU activation function, represents the convolution kernel, express From the first Go to The sub-matrix of Represents the bias vector of the convolutional layer;

[0034] S403, using the pooling layer to extract the abnormal enhanced semantic feature matrix of three different dimensional regions according to the following formula Key features to reduce data dimension and reduce overfitting risk:

[0035] ,

[0036] In the above formula, represents the pooling layer output vector of the abnormal enhanced semantic feature map of k types of convolution kernels, Indicates taking the maximum value, Abnormal enhanced semantic feature map representing k types of convolutional kernels The List;

[0037] S404, use the fully connected layer to integrate the key features obtained by the pooling layer and convert them into a one-dimensional vector:

[0038] ,

[0039] In the above formula, is the one-dimensional vector obtained by transformation, , and They are the key features obtained by the pooling layer, Indicates the concatenation and merging of two vectors;

[0040] S405, use the output layer to normalize the one-dimensional vector obtained by the fully connected layer and use the softmax function to calculate the probability of the label being 1 and the probability of the label being 0:

[0041] ,

[0042] In the above formula, is the detection label obtained by the i-th kernel anomaly classifier, is the softmax activation function, and are the weight and bias vector of the output layer respectively, and , the detection label obtained by the i-th kernel anomaly classifier represents the The probability of the text label being 1 and the label being 0; if the calculated probability value of the label being 1 is greater than the probability of the label being 0, then the data is kernel abnormal data; the function expression of the loss function used by the kernel abnormal classifier in step S105 during training is:

[0043] ,

[0044] In the above formula, is the loss function, For the summation symbol, is the i-th true label, is the detection label obtained by the i-th kernel anomaly classifier.

[0045] Furthermore, before step S105, the following steps of training the kernel anomaly classifier are also included:

[0046] S501, extracting Linux kernel text data in normal kernel state and abnormal kernel state respectively Samples and text data for the Linux kernel The samples are labeled with a label indicating the kernel is normal or abnormal.

[0047] S502, Linux kernel text data The samples extract key features based on the kernel anomaly corpus Samples of

[0048] S503, Linux kernel text data and key features The samples are vectorized to obtain the text data vector matrix and the abnormal word vector matrix Samples of

[0049] S504, convert the text data vector matrix and the abnormal word vector matrix The samples use the attention mechanism to enhance the local abnormal semantic features, and obtain the regional abnormal enhancement semantic feature matrix that highlights the key abnormal features. ;

[0050] S505, enhance the semantic feature matrix of regional anomalies The samples and their corresponding labels for indicating the normal or abnormal state of the kernel are used to construct a training data set, a kernel abnormality classifier is constructed, and the kernel abnormality classifier is trained using the training data set to establish a regional abnormality enhanced semantic feature matrix , and the mapping relationship between kernel exception identification results.

[0051] The present invention also proposes a kernel anomaly identification system based on Linux kernel domain knowledge, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute any one of the kernel anomaly identification methods based on Linux kernel domain knowledge.

[0052] The present invention also proposes a computer-readable storage medium, in which a computer program / instruction is stored. The computer program / instruction is programmed or configured to execute any one of the kernel exception identification methods based on Linux kernel domain knowledge through a processor.

[0053] The present invention also proposes a computer program product, comprising a computer program / instruction, wherein the computer program / instruction is programmed or configured to execute any one of the kernel anomaly identification methods based on Linux kernel domain knowledge through a processor.

[0054] Compared with the prior art, the present invention has the following advantages:

[0055] The present invention is used to extract Linux kernel text data and key features After that, they are vectorized and converted into numerical data through word embedding technology, which can avoid manual rule design, reduce complexity and reduce subsequent maintenance work.

[0056] The present invention converts Linux kernel text data and key features The text data vector matrix obtained by vectorization and the abnormal word vector matrix Use the attention mechanism to enhance the local abnormal semantic features and obtain the regional abnormal enhanced semantic feature matrix that highlights the key abnormal features. , by fusing the attention mechanism, the regional anomaly is obtained to enhance the semantic features, reduce the readability of the features, and improve data security.

[0057] The present invention's regional abnormality enhanced semantic feature matrix The pre-trained kernel anomaly classifier is used to classify the kernel anomaly recognition results, and the anomaly detection classifier is used to realize the automatic, efficient and high-accuracy recognition of Linux kernel anomalies. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.

[0059] Figure 2It is a schematic diagram of a model of an embodiment of the present invention, wherein: embedding represents converting text into an embedding vector, AFM embedding represents a feature vector represented under the attention mechanism model, and TextCNN is a kernel anomaly classifier.

[0060] Figure 3 Schematic diagram of word vector conversion in an embodiment of the present invention, where word2vec is a related model used to generate word vectors.

[0061] Figure 4 Schematic diagram of the regional anomaly enhanced semantic feature matrix (RA-ESF) in an embodiment of the present invention.

[0062] Figure 5 Schematic diagram of an anomaly detection classifier in an embodiment of the present invention. DETAILED DESCRIPTION

[0063] Embodiment 1

[0064] This embodiment proposes a kernel anomaly identification method based on Linux kernel domain knowledge, such as Figure 1 and Figure 2 As shown, the following steps are included:

[0065] Data feature extraction, including:

[0066] S101, extracting Linux kernel text data And use this to build a kernel anomaly detection dataset ,The data in this dataset include kernel abnormal text data and non-abnormal text data;

[0067] S102, build a kernel exception corpus, extract the Linux kernel text data Extract abnormal words as key features based on the preset kernel abnormal corpus ;

[0068] Build a kernel anomaly recognition model, including:

[0069] S103, Linux kernel text data and abnormal vocabulary are vectorized, specifically the Linux kernel text data and key features Vectorize the text data to get the vector matrix and the abnormal word vector matrix ;

[0070] S104, using attention mechanism to fuse key features of abnormal words , thereby enhancing the local abnormal semantic representation based on the text data. Specifically, the text data vector matrix and the abnormal word vector matrix The attention mechanism is used to enhance the local abnormal semantic features, and the regional abnormal enhanced semantic feature matrix with highlighted key abnormal features is obtained. ;

[0071] S105, the semantic feature matrix is ​​enhanced The input kernel anomaly classifier is used to identify whether it is a kernel anomaly. Specifically, the regional anomaly is enhanced into the semantic feature matrix. The kernel anomaly recognition result is obtained by using a pre-trained kernel anomaly classifier, wherein the kernel anomaly classifier is pre-trained to establish a regional anomaly enhanced semantic feature matrix. , and the mapping relationship between kernel exception identification results.

[0072] Each step is described in detail below.

[0073] Step S101 of this embodiment specifically includes the following steps:

[0074] S201, using a search command to search for all kernel print data from the kernel source code using a specified kernel keyword, including the data source path and source file, text data and specific line number of the data source;

[0075] Taking the kernel print function as a kernel keyword as an example, the text content containing the key print function is obtained from the kernel source code through the grep command, and the source path, specific line number and specific content of the print function of the key print function are obtained. The specific key print function example is shown in Table 1:

[0076] Table 1 Key printing function examples

[0077]

[0078] S202, performing data cleaning on the obtained data source path, text data and specific number of lines of data source, these kernel print data, to obtain Linux kernel text data , the data cleaning includes some or all of the following cleaning methods:

[0079] (1) Filter the kernel print data in the non-driver code file according to the data source path and source file in the kernel print data;

[0080] For example, when using the grep command to perform a broad search, all files will be traversed, including header files, explanation documents, and other data files. The data in some files is the printed text data in non-driver files, which needs to be filtered. The source path includes the source path and the source file. You can filter the printed text data in non-driver related code files based on the suffix of the source file;

[0081] (2) If the kernel print data is equal to the maximum output length of the search command, then the complete text data and the specific number of lines of the data source are obtained according to the data source path and the source file to replace the incomplete text data and the specific number of lines of the data source obtained by the search command;

[0082] For example, the data obtained by the grep command will be truncated for overlong printed content. For incomplete output content, it is necessary to obtain the complete printed text data content again through the data source path and data source line number;

[0083] (3) Eliminate specified useless characters;

[0084] For example, “()” has no special meaning for kernel exception identification, so it is removed;

[0085] (4) Replace hyphens with spaces;

[0086] For example, "pr_info" is changed to "pr info" etc.

[0087] (5) Replace the specified abbreviations with the corresponding non-abbreviations;

[0088] For example: "pr err" is replaced with "print error", etc.

[0089] In step S102 of this embodiment, when building the kernel exception corpus, key terms related to the kernel exception are collected and sorted and added to the kernel exception corpus, for example, kernel exception printing such as mismatch (matching error), invalid (illegal), and failed (failed). In addition, important words (important_vocal) are extracted from the text data (content) of these key terms, so that there is a mapping relationship between key terms and important words in the kernel exception corpus. The data attributes and data types of the kernel exception corpus are shown in Table 2.

[0090] Table 2 Kernel anomaly corpus data information table

[0091]

[0092] On this basis, the abnormal words in the text data are extracted according to the kernel abnormal corpus as the features that need to be focused on in the detection task. In step S102 of this embodiment, the key features are extracted according to the preset kernel abnormal corpus. include:

[0093] S301, text data from the Linux kernel Extract key term sets based on a preset list of key terms ;

[0094] S302, for key term set Each key term in , extract the corresponding key words according to the mapping relationship between key terms and key words in the preset kernel anomaly corpus , so that we can finally get the key vocabulary set Key features of the composition .

[0095] like Figure 3 As shown, in step S103 of this embodiment, the GloVe word vector trained based on Twitter data is used as the embedding vector , Linux kernel text data Convert to word vector matrix , the formula is as follows:

[0096]

[0097] in, represents the dimension of the embedding vector, Indicates the total number of words in the text data, superscript Represents a text content identifier, Indicates The total number of words in the text data;

[0098] Similarly, the key features Also converted into a word vector matrix , the formula is as follows:

[0099]

[0100] Among them, the superscript Represents the key feature identifier, Indicates the number of key words. is the embedding vector, Indicates the total number of key words.

[0101] like Figure 4 As shown, in step S104 of this embodiment, the text data vector matrix As the key matrix in the attention mechanism model, and the abnormal word vector matrix As the value matrix in the attention mechanism model, the text data vector matrix and the abnormal word vector matrix The attention mechanism is used to enhance the local abnormal semantic features to obtain the regional abnormal enhancement semantic feature matrix that highlights the key abnormal features. When the text data vector matrix and the abnormal word vector matrix The special matrix containing the fusion abnormal information is calculated through the attention mechanism, and then combined with the text data vector matrix Add together to get the regional anomaly enhancement semantic feature matrix that highlights the key anomaly features , the calculation formula is as follows:

[0102] ,

[0103] In the above formula, , represents the j-th row of the matrix, , Mutual Information Vector The kth element of Represents the abnormal word vector matrix The k-th row element in a column with:

[0104] ,

[0105] In the above formula, is the softmax activation function, Represents a vector matrix of text data In the jth row, the superscript T stands for transpose.

[0106] The kernel anomaly classifier in step S105 of this embodiment is as follows: Figure 5 As shown, it includes an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer, and the regional abnormality enhances the semantic feature matrix The kernel anomaly recognition results obtained by using the kernel anomaly classifier include:

[0107] S401, enhance the semantic feature matrix of regional anomalies As input to the input layer of the kernel anomaly classifier;

[0108] S402, using the convolutional layer to enhance the semantic feature matrix of the input region abnormality Three convolution kernels of different dimensions are used to learn the regional abnormality enhanced semantic feature matrix in each dimension. The formula is as follows:

[0109] ,

[0110] In the above formula, Represents the abnormal enhanced semantic feature map of k types of convolution kernels, represents the height of the convolution kernel, , represents the RELU activation function, represents the convolution kernel, express From the first Go to The sub-matrix of Represents the bias vector of the convolutional layer;

[0111] S403, using the pooling layer to extract the abnormal enhanced semantic feature matrix of three different dimensional regions The most important feature is the key feature, which can reduce the data dimension and reduce the risk of overfitting. The calculation formula is as follows:

[0112] ,

[0113] In the above formula, represents the pooling layer output vector of the abnormal enhanced semantic feature map of k types of convolution kernels, Indicates taking the maximum value, Abnormal enhanced semantic feature map representing k types of convolutional kernels The List;

[0114] S404, using the fully connected layer to integrate the key features obtained by the pooling layer and convert them into a one-dimensional vector. The calculation formula is as follows:

[0115] ,

[0116] In the above formula, is the one-dimensional vector obtained by transformation, , and They are the key features obtained by the pooling layer. Indicates the concatenation and merging of two vectors;

[0117] S405, using the output layer to normalize the one-dimensional vector obtained by the fully connected layer and using the softmax function to calculate the probability of the label being 1 and the probability of the label being 0. The calculation formula is as follows:

[0118] ,

[0119] In the above formula, is the detection label obtained by the i-th kernel anomaly classifier, is the softmax activation function, and are the weight and bias vector of the output layer respectively, and , the detection label obtained by the i-th kernel anomaly classifier represents the first The probability of a text label being 1 and a label being 0; if the calculated probability value of the label being 1 is greater than the probability of the label being 0, then the data is kernel abnormal data;

[0120] In this embodiment, a loss function L between the true label and the detection label is defined, and the parameters of the kernel anomaly classifier are continuously adjusted to reduce the value of L infinitely, so as to achieve the purpose of making the predicted label closer and closer to the true label. The function expression of the loss function used by the kernel anomaly classifier in step S105 during training is:

[0121] ,

[0122] In the above formula, is the loss function, For the summation symbol, is the i-th true label, is the detection label obtained by the i-th kernel anomaly classifier.

[0123] Before step S105 of this embodiment, the following steps are also included for training the kernel anomaly classifier:

[0124] S501, extracting Linux kernel text data in normal kernel state and abnormal kernel state respectively The specific extraction process is the same as step S101, and then the Linux kernel text data The sample is labeled with a label indicating the kernel is normal or abnormal. Specifically, the label field value is annotated by experts. The label value is 0 or 1. 0 indicates that the data text of the sample does not belong to the kernel abnormality, and 1 indicates that the data text of the sample belongs to the kernel abnormality.

[0125] S502, Linux kernel text data The samples extract key features based on the kernel anomaly corpus The specific implementation process is the same as step S102. The final pre-training data set of the kernel anomaly recognition model is expressed as .in, Represents important words (important_vocal) extracted from text data (content), Indicates The label type of the data text (lable);

[0126] S503, Linux kernel text data and key features The samples are vectorized to obtain the text data vector matrix and the abnormal word vector matrix The specific implementation process is the same as step S103;

[0127] S504, convert the text data vector matrix and the abnormal word vector matrix The samples use the attention mechanism to emphasize the local abnormal semantic feature enhancement to obtain the regional abnormal enhancement semantic feature matrix with highlighted key abnormal features. , the specific implementation process is the same as step S104;

[0128] S505, enhance the semantic feature matrix of regional anomalies The samples and their corresponding labels for indicating the normal or abnormal state of the kernel are used to construct a training data set, a kernel abnormality classifier is constructed, and the kernel abnormality classifier is trained using the training data set to establish a regional abnormality enhanced semantic feature matrix , and the mapping relationship between kernel exception identification results.

[0129] The kernel anomaly recognition method based on Linux kernel domain knowledge proposed in this embodiment constructs a kernel anomaly detection dataset and a kernel anomaly domain corpus, and extracts abnormal words in each data according to the corpus, converts text data into numerical data, and reduces maintenance complexity; integrates the attention mechanism to obtain regional anomaly enhanced semantic features, improves data security, and uses anomaly detection classifiers to more accurately identify kernel anomalies and improve kernel anomaly recognition accuracy.

[0130] Embodiment 2

[0131] This embodiment proposes a kernel exception identification system based on Linux kernel domain knowledge, including a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge described in Embodiment 1. The system includes:

[0132] Data collection module: The system collects kernel logs through the data collection module and preprocesses the collected logs to obtain Linux kernel text data. ;

[0133] Anomaly detection module: After preprocessing, the Linux kernel text data Extract kernel abnormal key words as key features , and then the Linux kernel text data and key features After data vectorization, the text data vector matrix is ​​obtained and the abnormal word vector matrix , input it into the trained kernel anomaly recognition model based on Linux kernel domain knowledge to identify potential kernel abnormal behaviors;

[0134] Early warning module: Once the abnormal monitoring module detects abnormal kernel behavior, the early warning module is immediately activated and the abnormal results are automatically reported to the kernel R&D staff for processing, thus avoiding misjudgment by front-line technical service workers and significantly saving time costs.

[0135] This embodiment also proposes a computer-readable storage medium, in which a computer program / instruction is stored. The computer program / instruction is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge described in Embodiment 1 through a processor.

[0136] This embodiment also proposes a computer program product, including a computer program / instruction, which is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge described in Embodiment 1 through a processor.

[0137] The kernel exception identification system based on Linux kernel domain knowledge proposed in this embodiment can automatically identify abnormal kernel behavior and report the abnormal behavior directly to kernel R&D workers for processing, thereby avoiding the tedious analysis and diagnosis of abnormalities by front-line technical service engineers, significantly saving time costs, helping to improve the maintenance efficiency of kernel engineers, and ensuring the stability of the system.

[0138] In summary, the present invention proposes a kernel anomaly recognition method based on Linux kernel domain knowledge. By constructing a kernel anomaly detection dataset, which includes kernel anomaly text data and non-abnormal text data; by using word embedding technology, the text data is converted into numerical data, which can avoid manual design of rules, reduce complexity, and reduce later maintenance work; through the abnormal domain corpus to extract abnormal vocabulary, the attention mechanism is integrated to obtain regional abnormal enhanced semantic features, reduce the readability of the features, and improve data security; finally, the anomaly detection classifier is used to automatically identify kernel anomalies and improve the accuracy of kernel anomaly recognition.

[0139] The present invention also proposes a kernel anomaly recognition system based on Linux kernel domain knowledge. By using a pre-trained model of a kernel anomaly recognition method based on Linux kernel domain knowledge, anomalies are automatically detected and reported, avoiding the tedious analysis and diagnosis of anomalies by front-line technical service engineers, significantly saving time costs, helping to improve the maintenance efficiency of kernel engineers and ensuring the stability of the system.

[0140] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0141] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A kernel anomaly identification method based on Linux kernel domain knowledge, characterized in that: The steps include: S101, extracting Linux kernel text data ; S102, extract the Linux kernel text data Extract key features based on the preset kernel anomaly corpus ; S103, Linux kernel text data and key features Vectorize the text data to get the vector matrix and the abnormal word vector matrix ; S104, convert the text data vector matrix and the abnormal word vector matrix The attention mechanism is used to enhance the local abnormal semantic features, and the regional abnormal enhanced semantic feature matrix with highlighted key abnormal features is obtained. , the function expression is: , In the above formula, Represents the region abnormality enhanced semantic feature matrix The jth row of , Represents the mutual information vector The kth element of Represents the abnormal word vector matrix The k-th row element in a column with: , In the above formula, is the softmax activation function, Represents a vector matrix of text data In the jth row, the T in the superscript means transpose; S105, enhance the semantic feature matrix of regional anomalies The kernel anomaly recognition result is obtained by using a pre-trained kernel anomaly classifier, wherein the kernel anomaly classifier is pre-trained to establish a regional anomaly enhanced semantic feature matrix. , and the mapping relationship between kernel exception identification results.

2. The kernel anomaly identification method based on Linux kernel domain knowledge according to claim 1, characterized in that: Step S101 includes: S201, using a search command to search for all kernel print data from the kernel source code using a specified kernel keyword, including the data source path and source file, text data and specific line number of the data source; S202, performing data cleaning on the obtained kernel print data to obtain Linux kernel text data , the data cleaning includes some or all of the following cleaning methods: (1) filtering the kernel print data in the non-driver code file according to the data source path and source file in the kernel print data; (2) if the kernel print data is equal to the maximum output length of the search command, obtaining its complete text data and specific number of lines of the data source according to the data source path and source file, and replacing the incomplete text data and specific number of lines of the data source obtained by the search command; (3) removing specified useless characters; (4) replacing hyphens with spaces; (5) replacing specified abbreviations with corresponding non-abbreviations.

3. The kernel anomaly identification method based on Linux kernel domain knowledge according to claim 1, characterized in that: In step S102, key features are extracted based on the preset kernel anomaly corpus. include: S301, text data from the Linux kernel Extract key term sets based on a preset list of key terms ; S302, for key term set Each key term in , extract the corresponding key words according to the mapping relationship between key terms and key words in the preset kernel anomaly corpus , so that we can finally get the key vocabulary set Key features of the composition .

4. The kernel anomaly identification method based on Linux kernel domain knowledge according to claim 1, characterized in that: In step S103, the Linux kernel text data and key features Vectorize them separately to get the text data vector matrix and the abnormal word vector matrix The function expression is: , , In the above formula, is the preset embedding vector, the superscript Represents a text content identifier, , represents the dimension of the embedding vector, Represents the total number of words in the text data. , Indicates The total number of words in the text data; is the preset embedding vector, the superscript Represents the key feature identifier, , Indicates the total number of key words. , Indicates the number of key words.

5. The kernel anomaly identification method based on Linux kernel domain knowledge according to claim 1, characterized in that: The kernel anomaly classifier in step S105 includes an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer. The kernel anomaly recognition results obtained by using the kernel anomaly classifier include: S401, enhance the semantic feature matrix of regional anomalies As input to the input layer of the kernel anomaly classifier; S402, using the convolutional layer to enhance the semantic feature matrix for the input region abnormality according to the following formula Use convolution kernels of three different dimensions to enhance the semantic feature matrix of regional anomalies for learning in each dimension: , In the above formula, Represents the abnormal enhanced semantic feature map of k types of convolution kernels, represents the height of the convolution kernel, , represents the RELU activation function, represents the convolution kernel, express From the Go to The sub-matrix of Represents the bias vector of the convolutional layer; S403, using the pooling layer to extract the abnormal enhanced semantic feature matrix of three different dimensional regions according to the following formula Key features to reduce data dimension and reduce overfitting risk: , In the above formula, represents the pooling layer output vector of the abnormal enhanced semantic feature map of k types of convolution kernels, Indicates taking the maximum value, Abnormal enhanced semantic feature map representing k types of convolutional kernels The List; S404, use the fully connected layer to integrate the key features obtained by the pooling layer and convert them into a one-dimensional vector: , In the above formula, is the one-dimensional vector obtained by transformation, , and They are the key features obtained by the pooling layer, Indicates the concatenation and merging of two vectors; S405, use the output layer to normalize the one-dimensional vector obtained by the fully connected layer and use the softmax function to calculate the probability of the label being 1 and the probability of the label being 0: , In the above formula, is the detection label obtained by the i-th kernel anomaly classifier, is the softmax activation function, and are the weight and bias vector of the output layer respectively, and , the detection label obtained by the i-th kernel anomaly classifier represents the The probability of the text label being 1 and the label being 0; if the calculated probability value of the label being 1 is greater than the probability of the label being 0, then the data is kernel abnormal data; the function expression of the loss function used by the kernel abnormal classifier in step S105 during training is: , In the above formula, is the loss function, For the summation symbol, is the i-th true label, is the detection label obtained by the i-th kernel anomaly classifier.

6. The kernel anomaly identification method based on Linux kernel domain knowledge according to claim 1, characterized in that: Before step S105, the following steps are also included for training the kernel anomaly classifier: S501, extracting Linux kernel text data in normal kernel state and abnormal kernel state respectively Samples and text data for the Linux kernel The samples are labeled with a label indicating the kernel is normal or abnormal. S502, Linux kernel text data The samples extract key features based on the kernel anomaly corpus Samples of S503, Linux kernel text data and key features The samples are vectorized to obtain the text data vector matrix and the abnormal word vector matrix Samples of S504, convert the text data vector matrix and the abnormal word vector matrix The samples use the attention mechanism to enhance the local abnormal semantic features, and obtain the regional abnormal enhancement semantic feature matrix that highlights the key abnormal features. ; S505, enhance the semantic feature matrix of regional anomalies The samples and their corresponding labels for indicating the normal or abnormal state of the kernel are used to construct a training data set, a kernel abnormality classifier is constructed, and the kernel abnormality classifier is trained using the training data set to establish a regional abnormality enhanced semantic feature matrix , and the mapping relationship between kernel exception identification results.

7. A kernel anomaly identification system based on Linux kernel domain knowledge, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program / instruction stored therein, characterized in that: The computer program / instruction is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge as described in any one of claims 1 to 6 through a processor.

9. A computer program product comprising a computer program / instructions, characterized in that The computer program / instruction is programmed or configured to execute the kernel exception identification method based on Linux kernel domain knowledge as described in any one of claims 1 to 6 through a processor.