CN117573465A - Program flow monitoring method, device, equipment and storage medium - Google Patents

Program flow monitoring method, device, equipment and storage medium Download PDF

Info

Publication number
CN117573465A
CN117573465A CN202311371311.4A CN202311371311A CN117573465A CN 117573465 A CN117573465 A CN 117573465A CN 202311371311 A CN202311371311 A CN 202311371311A CN 117573465 A CN117573465 A CN 117573465A
Authority
CN
China
Prior art keywords
monitoring point
monitoring
logic
data
monitored
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
CN202311371311.4A
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.)
China Automotive Innovation Co Ltd
Original Assignee
China Automotive Innovation Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Automotive Innovation Co Ltd filed Critical China Automotive Innovation Co Ltd
Priority to CN202311371311.4A priority Critical patent/CN117573465A/en
Publication of CN117573465A publication Critical patent/CN117573465A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Abstract

The application relates to a program stream monitoring method, a device, equipment and a storage medium, which comprise the steps of pre-coding each monitoring point in program stream data to be monitored to obtain a pre-coding data set; determining a corresponding operation logic expected value of the program stream data to be monitored when the program stream data operates in an expected logic sequence according to the pre-coding data set and a preset cyclic redundancy algorithm; and operating the program flow data to be monitored, sequentially acquiring the operating states of all monitoring points in the monitoring entity according to the operating sequence of the monitoring points, and determining the operating logic actual value of the current monitoring point according to the coded data corresponding to the operating states of the current monitoring point, the preset cyclic redundancy algorithm and the operating logic actual value of the previous monitoring point of the current monitoring point until the operating logic actual value of the last monitoring point in the program flow data to be monitored is determined.

Description

Program flow monitoring method, device, equipment and storage medium
Technical Field
The present invention relates to the field of software program technologies, and in particular, to a program flow monitoring method, device, equipment and storage medium.
Background
Program flow logic monitoring is a technique for checking the correct operation of software, focusing on control flow errors that can cause deviations from a valid (i.e., encoded/compiled) program sequence during error-free operation of an application program, and if one or more program instructions are processed in an incorrect order, or even not processed at all, incorrect control flow can occur, which in turn can lead to problems such as data inconsistencies, data corruption, or other software failures.
The current method for program flow logic monitoring adopts a watchdog module to monitor the running condition of software, however, the program flow monitoring method based on the watchdog module can detect whether the program flow is running completely within a period of time and cannot detect whether the program flow is running effectively according to design logic.
Disclosure of Invention
In order to solve the technical problem that whether the program stream is effectively operated according to the design logic can not be detected, the embodiment of the application provides a program stream monitoring method, device, equipment and storage medium.
In one aspect, an embodiment of the present application provides a program flow monitoring method, where the method includes: acquiring program flow data to be monitored, wherein the program flow data to be monitored comprises at least one monitoring entity, and the monitoring entity comprises at least one monitoring point;
precoding each monitoring point in the monitoring entity to obtain a precoding data set, wherein the precoding data set is a set of precoding data of each monitoring point;
determining an expected operation logic value corresponding to the program stream data to be monitored when operating in an expected logic sequence according to the pre-coding data set and a preset cyclic redundancy algorithm, wherein the expected logic sequence is the sequence of normal logic operation of the monitoring points;
operating the program stream data to be monitored, sequentially acquiring the operating states of all monitoring points in the monitoring entity according to the operating sequence of the monitoring points, and determining the operating logic actual value of the current monitoring point according to the coded data corresponding to the operating states of the current monitoring point, the preset cyclic redundancy algorithm and the operating logic actual value of the previous monitoring point of the current monitoring point until the operating logic actual value of the last monitoring point in the program stream data to be monitored is determined;
And determining whether the program stream data to be monitored operates according to an expected logic sequence based on the actual value of the operation logic of the last monitoring point and the expected value of the operation logic.
Further, the determining, according to the pre-encoded data set and a preset cyclic redundancy algorithm, an expected operation logic value corresponding to the program stream data to be monitored when the program stream data is operated in an expected logic sequence includes:
determining an operation logic expected value corresponding to an initial monitoring point according to the pre-coding data corresponding to the initial monitoring point in the at least one monitoring entity, the preset cyclic redundancy algorithm and a verification initial value corresponding to the preset cyclic redundancy algorithm;
determining an operation logic expected value corresponding to a next monitoring point of the initial monitoring point according to the operation logic expected value corresponding to the initial monitoring point, the precoding data corresponding to the next monitoring point of the initial monitoring point and the preset cyclic redundancy algorithm, traversing each monitoring point in the at least one monitoring entity according to an expected logic sequence until determining the operation logic expected value corresponding to a last monitoring point in the at least one monitoring entity;
And taking the operation logic expected value corresponding to the last monitoring point in the at least one monitoring entity as the operation logic expected value corresponding to the program flow data to be monitored when operating in the expected logic sequence.
Further, the determining, according to the pre-encoded data corresponding to the initial monitoring point in the at least one monitoring entity, the preset cyclic redundancy algorithm, and the check initial value corresponding to the preset cyclic redundancy algorithm, an operation logic expected value corresponding to the initial monitoring point includes:
taking pre-coding data corresponding to an initial monitoring point in the at least one monitoring entity and a verification initial value corresponding to the preset cyclic redundancy algorithm as input data of the preset cyclic redundancy algorithm;
and inputting the input data of the preset cyclic redundancy algorithm into the preset cyclic redundancy algorithm to output the operation logic expected value corresponding to the initial monitoring point.
Further, after the operation states of the monitoring points in the monitoring entity are sequentially obtained according to the operation sequence of the monitoring points, the method further includes:
and determining the actual value of the operation logic of the initial monitoring point according to the coded data corresponding to the operation state of the initial monitoring point, the preset cyclic redundancy algorithm and the verification initial value corresponding to the preset cyclic redundancy algorithm.
Further, the coded data corresponding to the running state comprises pre-coded data corresponding to the running state of the monitoring point and illegal coded data corresponding to the non-running state of the monitoring point;
correspondingly, the determining the actual value of the operation logic of the current monitoring point according to the encoded data corresponding to the operation state of the current monitoring point, the preset cyclic redundancy algorithm and the actual value of the operation logic of the previous monitoring point of the current monitoring point comprises the following steps:
if the current monitoring point is operated, determining an operation logic actual value of the current monitoring point according to the pre-coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of a monitoring point before the current monitoring point;
if the current monitoring point is not operated, determining the operation logic actual value of the current monitoring point according to the illegal coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of the previous monitoring point of the current monitoring point.
Further, the determining whether the program stream data to be monitored operates according to the expected logic sequence based on the actual value of the operation logic of the last monitoring point and the expected value of the operation logic includes:
Judging whether the actual value of the operation logic of the last monitoring point is equal to the expected value of the operation logic;
if the program flow data to be monitored are equal, running the program flow data to be monitored according to an expected logic sequence;
if not, generating a program flow operation abnormal instruction, and transmitting the program flow operation abnormal instruction to an abnormal state processing module.
Further, the precoding each monitoring point in the monitoring entity to obtain a precoded data set includes:
and precoding each monitoring point in the monitoring entity in turn according to the operation sequence of the monitoring points to obtain the precoding data set.
In another aspect, an embodiment of the present application provides a program flow monitoring apparatus, where the apparatus includes:
the system comprises an acquisition module, a monitoring module and a control module, wherein the acquisition module is used for acquiring program flow data to be monitored, the program flow data to be monitored comprises at least one monitoring entity, and the monitoring entity comprises at least one monitoring point;
the precoding data set determining module is used for precoding each monitoring point in the monitoring entity to obtain a precoding data set, wherein the precoding data set is a set of precoding data of each monitoring point;
The operation logic expected value determining module is used for determining an operation logic expected value corresponding to the program stream data to be monitored when operated in an expected logic sequence according to the pre-coding data set and a preset cyclic redundancy algorithm, wherein the expected logic sequence is the sequence of normal logic operation of the monitoring points;
the running logic actual value determining module is used for running the program stream data to be monitored, sequentially acquiring the running states of all monitoring points in the monitoring entity according to the running sequence of the monitoring points, and determining the running logic actual value of the current monitoring point according to the coded data corresponding to the running states of the current monitoring point, the preset cyclic redundancy algorithm and the running logic actual value of the previous monitoring point of the current monitoring point until the running logic actual value of the last monitoring point in the program stream data to be monitored is determined;
and the logic sequence judging module is used for determining whether the program flow data to be monitored operates according to the expected logic sequence based on the last monitored operation logic actual value and the operation logic expected value.
In another aspect, a program flow monitoring device is provided, where the program flow monitoring device includes a processor and a memory, where at least one instruction, at least one program, a set of codes, or a set of instructions is stored, where the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement a program flow monitoring method as described above.
Another aspect provides a computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions loaded and executed by a processor to implement a program flow monitoring method as described above.
By implementing the application, the method has the following beneficial effects:
according to the method and the device, based on the pre-coding data set corresponding to the monitoring points in the program stream data to be monitored and the preset cyclic redundancy algorithm, the corresponding expected value of the operation logic of the program stream data to be monitored when the program stream data to be monitored operates in the expected logic sequence is determined so as to be compared with the actual value of the operation logic of the last monitoring point in the program stream data to be monitored in the operation process determined based on the cyclic redundancy algorithm, and whether the program stream data to be monitored operates according to the expected logic sequence can be determined according to the comparison result.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a program flow monitoring method according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for determining an expected value of operation logic according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for determining an expected value of an operation logic corresponding to an initial monitoring point according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for determining an actual value of an operation logic of a current monitoring point according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a program flow monitoring device according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a configuration of an operation logic expected value determining module according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a first operation logic expected value determination sub-module according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present application based on the embodiments herein.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, a flow chart of a program flow monitoring method provided in an embodiment of the present application is shown, and a technical solution of the present application is described in detail below with reference to fig. 1. It is noted that the present specification provides method operational steps as described in the examples or flowcharts, but may include more or fewer operational steps based on conventional or non-inventive labor. The sequence of steps recited in the embodiments is only one way of performing the sequence of steps and does not represent a unique order of performance, and the method specifically includes the steps of:
S101: and acquiring program flow data to be monitored, wherein the program flow data to be monitored comprises at least one monitoring entity, and the monitoring entity comprises at least one monitoring point.
In this embodiment of the present application, the program flow data to be monitored may include a plurality of monitoring entities, where the monitoring entities may include a plurality of monitoring points, where the monitoring entities are subroutines in the program flow data to be monitored, and by setting a plurality of monitoring points on the subroutines, so that the monitoring program flow may operate according to an expected logic sequence, specifically, the number of monitoring points in each monitoring entity may be all the same, or all the monitoring points may be different, or all the monitoring points may be partially the same, and not specifically limited herein.
S103: and precoding each monitoring point in the monitoring entity to obtain a precoding data set, wherein the precoding data set is a set of precoding data of each monitoring point.
In a specific embodiment, each monitoring point in the monitoring entity is pre-coded in turn to obtain a pre-coded data set, wherein the pre-coded data set is a set of pre-coded data corresponding to each monitoring point, and further, by pre-coding each monitoring point in the monitoring entity, an expected operating logic value corresponding to the monitoring program stream data when the monitoring program stream data operates in an expected logic sequence is determined by using the pre-coded data set obtained by pre-coding and a preset cyclic redundancy algorithm, and then, an actual operating logic value corresponding to the monitoring point which operates normally can be determined according to the pre-coded data set and the preset cyclic redundancy algorithm, and further, whether the program stream data to be monitored operates according to the expected logic sequence can be determined by comparing the actual operating logic value with the expected operating logic value, so that accurate monitoring of the program stream operating logic can be realized.
In practical applications, the monitoring entities may be further precoded sequentially to obtain respective precoded data corresponding to each monitoring entity, and in a specific embodiment, the types of the precoded data of the monitoring entities and the monitoring points may be unsigned integer (unsigned int), and the specific precoding data format may be referred to in table 1:
table 1 precoding data format
Field description High 16bits Low 16bits
Definition of the definition Monitoring entity: supervision Entity (SE) Monitoring points: check Point (CP)
Examples of the examples 0xFF00-0xFFFF 0x0000-0xFFFF
In a specific embodiment, all monitoring entities and monitoring points in the program stream are precoded according to the precoding data format in table 1 to obtain a precoded data set, and the specific precoded data set can be seen in table 2:
table 2 precoding data set
As can be seen from table 2, in the whole program flow, each monitoring point of each monitoring entity has a unique precoding data, where the above precoding data set may be used to determine an expected value of the operation logic, and may also be used to determine an actual value of the operation logic corresponding to the monitoring point that is operating normally, and it should be noted that the precoding data in table 2 may be flexibly configured according to the actual situation of the program flow, which is not limited herein specifically.
S105: and determining a corresponding operation logic expected value of the program stream data to be monitored when the program stream data operates in an expected logic sequence according to the pre-coded data set and a preset cyclic redundancy algorithm, wherein the expected logic sequence is the sequence of normal logic operation of the monitoring points.
In this embodiment of the present application, the preset cyclic redundancy algorithm may be a CRC (Cyclic Redundancy Check) algorithm, which is already mature for the CRC algorithm, and is not described in detail herein, so that a pre-encoded data set and the CRC algorithm corresponding to monitoring points in the program stream data to be monitored may be used to determine an expected value of operation logic corresponding to the program stream data to be monitored when the program stream data is operated in an expected logic sequence, so as to compare with an actual value of operation logic of a last monitoring point in the program stream data to be monitored in an operation process determined based on the cyclic redundancy algorithm, and further determine whether the program stream data to be monitored is operated according to the expected logic sequence according to a comparison result, thereby implementing accurate monitoring of the program stream operation logic and improving accuracy of program stream monitoring.
In a specific implementation manner, as shown in fig. 2, which is a schematic flow chart of a method for determining an expected value of an operation logic provided in an embodiment of the present application, specifically, step S105 may include:
S1051: determining an operation logic expected value corresponding to an initial monitoring point according to pre-coding data corresponding to the initial monitoring point in at least one monitoring entity, a preset cyclic redundancy algorithm and a verification initial value corresponding to the preset cyclic redundancy algorithm;
s1052: determining an operation logic expected value corresponding to the next monitoring point of the initial monitoring point according to the operation logic expected value corresponding to the initial monitoring point, the pre-coded data corresponding to the next monitoring point of the initial monitoring point and a preset cyclic redundancy algorithm, traversing each monitoring point in at least one monitoring entity according to an expected logic sequence until the operation logic expected value corresponding to the last monitoring point in the at least one monitoring entity is determined;
s1053: and taking the expected value of the operation logic corresponding to the last monitoring point in at least one monitoring entity as the expected value of the operation logic corresponding to the program flow data to be monitored when the program flow data to be monitored operates in the expected logic sequence.
In this embodiment of the present application, the data type of the check initial value corresponding to the preset cyclic redundancy algorithm may be unsigned int, and in a specific embodiment, the check initial value may be a specific value, for example, the check initial value may be 0x5A, and by setting the check initial value to a specific value, the contingency of the calculation result may be further reduced, so that the accuracy of program flow monitoring may be improved.
In a specific implementation manner, as shown in fig. 3, which is a schematic flow chart of a method for determining an expected value of an operation logic corresponding to an initial monitoring point provided in an embodiment of the present application, specifically, step S1051 may include:
s10511: taking pre-coded data corresponding to an initial monitoring point in at least one monitoring entity and a verification initial value corresponding to a preset cyclic redundancy algorithm as input data of the preset cyclic redundancy algorithm;
s10512: and inputting the input data of the preset cyclic redundancy algorithm into the preset cyclic redundancy algorithm to output the operation logic expected value corresponding to the initial monitoring point.
Specifically, according to the operation sequence of the monitoring entities and the operation sequence of the monitoring points, determining the sequence of the input to the preset cyclic redundancy algorithm, further determining the operation logic expected value when the program stream data to be monitored operates according to the expected logic sequence, wherein the operation when the operation logic expected value is determined is the simulation operation, and it can be understood that all the monitoring entities and all the monitoring points in the program stream data to be monitored operate according to the expected logic sequence in the process of determining the operation logic expected value, so that the operation logic expected value can be used as a comparison standard of the actual operation logic value, if the operation logic expected value is consistent with the actual operation logic value, the program stream data to be monitored operates according to the expected logic sequence, otherwise, the program stream data to be monitored does not operate according to the expected logic sequence.
In a specific embodiment, after the program stream data to be monitored runs to an initial monitoring point in the initial monitoring entity, inputting the initial value and the pre-coded data corresponding to the initial monitoring point into a preset cyclic redundancy algorithm, taking the output value of the preset cyclic redundancy algorithm as an operation logic expected value corresponding to the initial monitoring point, further determining the operation logic expected value corresponding to the initial monitoring point, after the program stream data to be monitored runs to a second monitoring point in the initial monitoring entity, inputting the operation logic expected value corresponding to the initial monitoring point and the pre-coded data corresponding to the second monitoring point into the preset cyclic redundancy algorithm, further determining the operation logic expected value corresponding to the second monitoring point in the initial monitoring entity, after all the monitoring points in the initial monitoring entity are executed, operating the initial monitoring point in the second monitoring entity, and so on, determining the operation logic expected value corresponding to the last monitoring point in the last monitoring entity, and taking the operation logic expected value corresponding to the last monitoring point in the last monitoring entity as the operation logic expected value corresponding to the program stream data to be monitored when the operation is performed in an expected logic sequence.
S107: and operating the program stream data to be monitored, sequentially acquiring the operating states of all monitoring points in the monitoring entity according to the operating sequence of the monitoring points, and determining the operating logic actual value of the current monitoring point according to the coded data corresponding to the operating states of the current monitoring point, the preset cyclic redundancy algorithm and the operating logic actual value of the previous monitoring point of the current monitoring point until the operating logic actual value of the last monitoring point in the program stream data to be monitored is determined.
In the embodiment of the application, the program stream data to be monitored is actually operated so as to determine the actual value of the operation logic of the program stream data to be monitored in the actual operation, and whether the program stream data to be monitored is operated according to the preset logic sequence can be verified through the comparison result between the actual value of the operation logic and the expected value of the operation logic.
In a specific embodiment, the running state includes two states, namely a running state and a non-running state, and further the encoded data corresponding to the running state may include pre-encoded data corresponding to the monitoring point when the monitoring point is run and illegal encoded data corresponding to the monitoring point when the monitoring point is not run, as shown in fig. 4, which is a schematic flow chart of the method for determining the actual value of the running logic of the current monitoring point provided in the embodiment of the present application, specifically, step S107 may include:
S1071: if the current monitoring point is operated, determining an actual operating logic value of the current monitoring point according to the pre-coding data corresponding to the current monitoring point, a preset cyclic redundancy algorithm and an actual operating logic value of a previous monitoring point of the current monitoring point;
s1072: if the current monitoring point is not operated, determining the actual value of the operation logic of the current monitoring point according to the illegal coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the actual value of the operation logic of the previous monitoring point of the current monitoring point.
In a specific embodiment, the current monitoring point is operated, which indicates that the program stream data to be monitored does not skip the current monitoring point in actual operation, so that the actual value of the operation logic of the current monitoring point can be determined according to the pre-coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the actual value of the operation logic of the previous monitoring point of the current monitoring point, wherein the specific operation of determining the actual value of the operation logic of the current monitoring point is to input the pre-coding data corresponding to the current monitoring point and the actual value of the operation logic of the previous monitoring point of the current monitoring point into the preset cyclic redundancy algorithm, and the output value of the preset cyclic redundancy algorithm at the moment can be used as the actual value of the operation logic when the current monitoring point operates according to the expected logic sequence, so that the actual value of the operation logic of the current monitoring point can be determined.
In another specific embodiment, the current monitoring point is not operated, which indicates that the program stream data to be monitored skips the current monitoring point in actual operation and then can determine the actual value of the operation logic of the current monitoring point according to the illegal coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the actual value of the operation logic of the previous monitoring point of the current monitoring point, wherein the specific operation of determining the actual value of the operation logic of the current monitoring point is to input the illegal coding data corresponding to the current monitoring point and the actual value of the operation logic of the previous monitoring point of the current monitoring point into the preset cyclic redundancy algorithm, and then the output value of the preset cyclic redundancy algorithm at this time can be used as the actual value of the operation logic when the current monitoring point does not operate according to the expected logic sequence, so that the actual value of the operation logic of the current monitoring point can be determined.
In a specific embodiment, after the step of sequentially acquiring the operation states of the monitoring points in the monitoring entity according to the operation sequence of the monitoring points, the method further includes:
and determining the actual value of the operation logic of the initial monitoring point according to the coded data corresponding to the operation state of the initial monitoring point, the preset cyclic redundancy algorithm and the verification initial value corresponding to the preset cyclic redundancy algorithm.
Specifically, when the current monitoring point is an initial monitoring point in the monitoring entity, the current monitoring point does not have the previous monitoring point at the moment, so that a verification initial value is set in a preset cyclic redundancy algorithm, so that an operation logic actual value of the initial monitoring point is determined according to encoded data corresponding to the operation state of the initial monitoring point, the preset cyclic redundancy algorithm and the verification initial value, and after the operation logic actual value of the initial monitoring point is determined, the operation logic actual value of the second monitoring point can be determined according to encoded data corresponding to the operation state of the second monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of the initial monitoring point until the operation logic actual value of the last monitoring point in the flow data of the program to be monitored is determined.
S109: and determining whether the program stream data to be monitored operates according to the expected logic sequence based on the actual value of the operation logic and the expected value of the operation logic of the last monitoring point.
In an alternative embodiment, step S109 may include:
judging whether the actual value of the operation logic of the last monitoring point is equal to the expected value of the operation logic;
if the program stream data to be monitored are equal, running the program stream data to be monitored according to an expected logic sequence;
If not, generating a program flow operation abnormal instruction and transmitting the program flow operation abnormal instruction to an abnormal state processing module.
In the embodiment of the application, through the comparison result between the operation logic actual value and the operation logic expected value, whether the program stream data to be monitored is operated according to the preset logic sequence can be verified, if the operation logic actual value and the operation logic expected value are equal, the program stream data to be monitored is indicated to be operated according to the preset logic sequence, otherwise, a program stream operation abnormal instruction can be generated, and the program stream operation abnormal instruction is transmitted to the abnormal state processing module, so that the abnormal state processing module is used for triggering a trigger watchdog mechanism of the whole program, and the program stream data to be monitored enters an abnormal state processing state.
Specifically, it is assumed that the program stream data to be monitored includes two monitoring entities, and each monitoring entity includes two monitoring points, where the pre-encoded data of the program stream data to be monitored can be referred to in table 3:
TABLE 3 precoding data for program stream data to be monitored
Numbering device Description of the invention Numerical value
1 CRC initial value 0x5A5A5A5A
2 SE0 CP0 0xFF000000
3 SE0 CP1 0xFF00000 1
3 SE1 CP0 0xFF010000
3 SE1 CP1 0xFF010001
The expected value of the operation logic and the actual value of the operation logic are described below with reference to Table 3, and the expected value of the operation logic at the initial monitoring point of the first monitoring entity is recorded as M 1 The expected value of the operation logic of the second monitoring point of the first monitoring entity is M 2 The operation logic expected value of the initial monitoring point of the second monitoring entity is M 3 The expected value of the operation logic of the second monitoring point of the second monitoring entity is M 4 Then
M 1 =CRC(0x5A5A5A5A,0xFF000000)
M 2 =CRC(M 1 ,0xFF000001)
M 3 =CRC(M 2 ,0xFF010000)
M 4 =CRC(M 3 ,0xFF010001)
Wherein CRC is a preset cyclic redundancy algorithm, and M is further calculated 4 And (3) corresponding expected running logic values when the program stream data to be monitored run in the expected logic sequence.
If all monitoring entities and all monitoring points operate according to the expected logic sequence, the actual value of the operation logic of the initial monitoring point of the first monitoring entity is recorded as M 5 The actual value of the operation logic of the second monitoring point of the first monitoring entity is M 6 The actual value of the operation logic of the initial monitoring point of the second monitoring entity is M 7 The actual value of the operation logic of the second monitoring point of the second monitoring entity is M 8 Then
M 5 =CRC(0x5A5A5A5A,0xFF000000)
M 6 =CRC(M s ,0xFF000001)
M 7 =CRC(M 6 ,0xFF010000)
M 8 =CRC(M 7 ,0xFF010001)
At this time, M 8 And M is as follows 4 And (3) performing the operation according to the expected logic sequence, namely, the program flow data to be monitored.
If the initial monitoring point of the second monitoring entity is not executed, recording the illegally encoded data of the initial monitoring point of the second monitoring entity as 0 x FFFFFFFF, the actual value of the operating logic of the initial monitoring point of the first monitoring entity is M 9 The actual value of the operation logic of the second monitoring point of the first monitoring entity is M 10 The actual value of the operation logic of the initial monitoring point of the second monitoring entity is M 11 Operating logic of a second monitoring point of a second monitoring entityActual value is M 12 Then
M 9 =CRC(0x5A5A5A5A,0xFF000000)
M 10 =CRC(M 9 ,0xFF000001)
M 11 =CRC(M 10 ,0xFFFFFFFF)
M 12 =CRC(M 11 ,0xFF010001)
At this time, M 12 And M is as follows 4 And the program flow data to be monitored are not operated according to the expected logic sequence, so that the accurate monitoring of the program flow operation logic can be realized, and the accuracy of program flow monitoring is improved.
The technical scheme of the embodiment of the application has the following technical effects:
according to the method and the device, based on the pre-coding data set corresponding to the monitoring points in the program stream data to be monitored and the preset cyclic redundancy algorithm, the corresponding expected value of the operation logic of the program stream data to be monitored when the program stream data to be monitored operates in the expected logic sequence is determined so as to be compared with the actual value of the operation logic of the last monitoring point in the program stream data to be monitored in the operation process determined based on the cyclic redundancy algorithm, and whether the program stream data to be monitored operates according to the expected logic sequence can be determined according to the comparison result.
The embodiment of the application also provides a program flow monitoring device, as shown in fig. 5, which is a schematic structural diagram of the program flow monitoring device provided in the embodiment of the application, and the vehicle-mounted data transmission device includes:
the acquiring module 10 is configured to acquire program flow data to be monitored, where the program flow data to be monitored includes at least one monitoring entity, and the monitoring entity includes at least one monitoring point.
The precoding data set determining module 20 is configured to precode each monitoring point in the monitoring entity to obtain a precoding data set, where the precoding data set is a set of precoding data of each monitoring point.
The operation logic expected value determining module 30 is configured to determine, according to the pre-encoded data set and a preset cyclic redundancy algorithm, an operation logic expected value corresponding to the program stream data to be monitored when the program stream data is operated in an expected logic sequence, where the expected logic sequence is an order in which the monitoring points operate according to normal logic.
The operation logic actual value determining module 40 is configured to operate the program stream data to be monitored, sequentially obtain the operation states of the monitoring points in the monitoring entity according to the operation sequence of the monitoring points, and determine the operation logic actual value of the current monitoring point according to the encoded data corresponding to the operation state of the current monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of the previous monitoring point of the current monitoring point until the operation logic actual value of the last monitoring point in the program stream data to be monitored is determined.
The logic sequence judging module 50 is configured to determine whether the program stream data to be monitored is operated according to the expected logic sequence based on the actual value of the operation logic and the expected value of the operation logic of the last monitoring point.
Further, as shown in fig. 6, which is a schematic structural diagram of the operation logic expected value determining module provided in the embodiment of the present application, the operation logic expected value determining module 30 includes:
the first operation logic expected value determining submodule 301 is configured to determine an operation logic expected value corresponding to an initial monitoring point according to pre-encoded data corresponding to the initial monitoring point in at least one monitoring entity, a preset cyclic redundancy algorithm, and a verification initial value corresponding to the preset cyclic redundancy algorithm.
The second operation logic expected value determining submodule 302 is configured to determine an operation logic expected value corresponding to a next monitoring point of the initial monitoring point according to the operation logic expected value corresponding to the initial monitoring point, the pre-encoded data corresponding to the next monitoring point of the initial monitoring point, and a preset cyclic redundancy algorithm, and traverse each monitoring point in the at least one monitoring entity according to an expected logic sequence until an operation logic expected value corresponding to a last monitoring point in the at least one monitoring entity is determined.
And the third expected value determining submodule 303 is configured to use the expected value of the operation logic corresponding to the last monitoring point in the at least one monitoring entity as the expected value of the operation logic corresponding to the program flow data to be monitored when the program flow data to be monitored operates in the expected logic sequence.
Further, as shown in fig. 7, which is a schematic structural diagram of a first operation logic expected value determining submodule provided in an embodiment of the present application, the first operation logic expected value determining submodule 301 may include:
and the input data determining unit 3011 is configured to take the pre-encoded data corresponding to the initial monitoring point in the at least one monitoring entity and the check initial value corresponding to the preset cyclic redundancy algorithm as input data of the preset cyclic redundancy algorithm.
The operation logic expected value determining unit 3022 is configured to input data of a preset cyclic redundancy algorithm into the preset cyclic redundancy algorithm, so as to output an operation logic expected value corresponding to the initial monitoring point.
Further, the apparatus further comprises:
the initial monitoring point operation logic actual value determining module is used for determining the initial monitoring point operation logic actual value according to the coded data corresponding to the initial monitoring point operation state, the preset cyclic redundancy algorithm and the verification initial value corresponding to the preset cyclic redundancy algorithm.
Further, the encoded data corresponding to the running state includes pre-encoded data corresponding to the running point and illegal encoded data corresponding to the non-running point, and the running logic actual value determining module 40 includes:
the first operation logic actual value determining sub-module 402 is configured to determine, if the current monitoring point is operated, an operation logic actual value of the current monitoring point according to the pre-encoded data corresponding to the current monitoring point, the preset cyclic redundancy algorithm, and an operation logic actual value of a monitoring point previous to the current monitoring point.
And the second operational logic actual value determining submodule 402 is configured to determine an operational logic actual value of the current monitoring point according to the illegally encoded data corresponding to the current monitoring point, the preset cyclic redundancy algorithm, and an operational logic actual value of a monitoring point previous to the current monitoring point if the current monitoring point is not operated.
Further, the logic sequence determination module 50 includes:
judging whether the actual value of the operation logic of the last monitoring point is equal to the expected value of the operation logic;
and if the program stream data to be monitored are equal, running the program stream data according to the expected logic sequence.
If not, generating a program flow operation abnormal instruction and transmitting the program flow operation abnormal instruction to an abnormal state processing module.
Further, the precoding data set determining module 20 includes:
the precoding data set determining submodule 201 is configured to perform precoding on each monitoring point in the monitoring entity in sequence according to the running sequence of the monitoring points, so as to obtain a precoding data set.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
The embodiment of the application provides a program flow monitoring device, which comprises a processor and a memory, wherein at least one instruction, at least one section of program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by the processor to realize the program flow monitoring method provided by the embodiment of the method.
The memory may be used to store software programs and modules that the processor executes to perform various functional applications and data processing by executing the software programs and modules stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for functions, and the like; the storage data area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide access to the memory by the processor.
The program flow monitoring device may be a server, and the embodiment of the present application further provides a schematic structural diagram of the server, referring to fig. 8, and the server 800 is used to implement the data processing method provided in the foregoing embodiment. The server 800 may vary considerably in configuration or performance and may include one or more processors 810 (e.g., one or more processors) and storage 830, one or more storage media 820 (e.g., one or more mass storage devices) storing applications 823 or data 822. Wherein memory 830 and storage medium 820 can be transitory or persistent. The program stored on the storage medium 820 may include one or more modules, each of which may include a series of instruction operations on a server. Still further, the processor 810 may be arranged to communicate with a storage medium 820 and to execute a series of instruction operations in the storage medium 820 on the server 800. The server 800 may also include one or more power supplies 860, one or more wired or wireless network interfaces 850, one or more input/output interfaces 840, and/or one or more operating systems 821, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
Embodiments of the present application also provide a computer readable storage medium that may be disposed in a server to store at least one instruction, at least one program, a set of codes, or a set of instructions related to implementing a program flow monitoring method in a method embodiment, where the at least one instruction, the at least one program, the set of codes, or the set of instructions are loaded and executed by the processor to implement the program flow monitoring method provided in the method embodiment.
Alternatively, in this embodiment, the storage medium may be located in at least one network server among a plurality of network servers of the computer network. Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: the foregoing sequence of the embodiments of the present application is only for describing, and does not represent the advantages and disadvantages of the embodiments. And the foregoing description has been directed to specific embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system and server embodiments, the description is relatively simple, as it is substantially similar to method embodiments, with reference to the partial description of method embodiments being relevant.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A program flow monitoring method, the method comprising:
acquiring program flow data to be monitored, wherein the program flow data to be monitored comprises at least one monitoring entity, and the monitoring entity comprises at least one monitoring point;
precoding each monitoring point in the monitoring entity to obtain a precoding data set, wherein the precoding data set is a set of precoding data of each monitoring point;
Determining an expected operation logic value corresponding to the program stream data to be monitored when operating in an expected logic sequence according to the pre-coding data set and a preset cyclic redundancy algorithm, wherein the expected logic sequence is the sequence of normal logic operation of the monitoring points;
operating the program stream data to be monitored, sequentially acquiring the operating states of all monitoring points in the monitoring entity according to the operating sequence of the monitoring points, and determining the operating logic actual value of the current monitoring point according to the coded data corresponding to the operating states of the current monitoring point, the preset cyclic redundancy algorithm and the operating logic actual value of the previous monitoring point of the current monitoring point until the operating logic actual value of the last monitoring point in the program stream data to be monitored is determined;
and determining whether the program stream data to be monitored operates according to an expected logic sequence based on the actual value of the operation logic of the last monitoring point and the expected value of the operation logic.
2. The method according to claim 1, wherein determining, according to the pre-encoded data set and a pre-set cyclic redundancy algorithm, an expected value of operation logic corresponding to the program stream data to be monitored when the program stream data is operated in an expected logic order comprises:
Determining an operation logic expected value corresponding to an initial monitoring point according to the pre-coding data corresponding to the initial monitoring point in the at least one monitoring entity, the preset cyclic redundancy algorithm and a verification initial value corresponding to the preset cyclic redundancy algorithm;
determining an operation logic expected value corresponding to a next monitoring point of the initial monitoring point according to the operation logic expected value corresponding to the initial monitoring point, the precoding data corresponding to the next monitoring point of the initial monitoring point and the preset cyclic redundancy algorithm, traversing each monitoring point in the at least one monitoring entity according to an expected logic sequence until determining the operation logic expected value corresponding to a last monitoring point in the at least one monitoring entity;
and taking the operation logic expected value corresponding to the last monitoring point in the at least one monitoring entity as the operation logic expected value corresponding to the program flow data to be monitored when operating in the expected logic sequence.
3. The method of claim 2, wherein the determining the expected value of the operation logic corresponding to the initial monitoring point according to the pre-encoded data corresponding to the initial monitoring point in the at least one monitoring entity, the pre-determined cyclic redundancy algorithm, and the check initial value corresponding to the pre-determined cyclic redundancy algorithm comprises:
Taking pre-coding data corresponding to an initial monitoring point in the at least one monitoring entity and a verification initial value corresponding to the preset cyclic redundancy algorithm as input data of the preset cyclic redundancy algorithm;
and inputting the input data of the preset cyclic redundancy algorithm into the preset cyclic redundancy algorithm to output the operation logic expected value corresponding to the initial monitoring point.
4. The method according to claim 1, further comprising, after sequentially acquiring the operation states of the monitoring points in the monitoring entity according to the operation order of the monitoring points:
and determining the actual value of the operation logic of the initial monitoring point according to the coded data corresponding to the operation state of the initial monitoring point, the preset cyclic redundancy algorithm and the verification initial value corresponding to the preset cyclic redundancy algorithm.
5. The method according to claim 1 or 4, wherein the encoded data corresponding to the running state includes pre-encoded data corresponding to when the monitoring point is run and illegally encoded data corresponding to when the monitoring point is not run;
correspondingly, the determining the actual value of the operation logic of the current monitoring point according to the encoded data corresponding to the operation state of the current monitoring point, the preset cyclic redundancy algorithm and the actual value of the operation logic of the previous monitoring point of the current monitoring point comprises the following steps:
If the current monitoring point is operated, determining an operation logic actual value of the current monitoring point according to the pre-coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of a monitoring point before the current monitoring point;
if the current monitoring point is not operated, determining the operation logic actual value of the current monitoring point according to the illegal coding data corresponding to the current monitoring point, the preset cyclic redundancy algorithm and the operation logic actual value of the previous monitoring point of the current monitoring point.
6. The method of claim 1, wherein the determining whether the program stream data to be monitored is to be run in an expected logical order based on the last monitoring point run logical actual value and the run logical expected value comprises:
judging whether the actual value of the operation logic of the last monitoring point is equal to the expected value of the operation logic;
if the program flow data to be monitored are equal, running the program flow data to be monitored according to an expected logic sequence;
if not, generating a program flow operation abnormal instruction, and transmitting the program flow operation abnormal instruction to an abnormal state processing module.
7. The method of claim 1, wherein precoding each monitoring point in the monitoring entity results in a precoded data set, comprising:
and precoding each monitoring point in the monitoring entity in turn according to the operation sequence of the monitoring points to obtain the precoding data set.
8. A program flow monitoring device, the device comprising:
the system comprises an acquisition module, a monitoring module and a control module, wherein the acquisition module is used for acquiring program flow data to be monitored, the program flow data to be monitored comprises at least one monitoring entity, and the monitoring entity comprises at least one monitoring point;
the precoding data set determining module is used for precoding each monitoring point in the monitoring entity to obtain a precoding data set, wherein the precoding data set is a set of precoding data of each monitoring point;
the operation logic expected value determining module is used for determining an operation logic expected value corresponding to the program stream data to be monitored when operated in an expected logic sequence according to the pre-coding data set and a preset cyclic redundancy algorithm, wherein the expected logic sequence is the sequence of normal logic operation of the monitoring points;
the running logic actual value determining module is used for running the program stream data to be monitored, sequentially acquiring the running states of all monitoring points in the monitoring entity according to the running sequence of the monitoring points, and determining the running logic actual value of the current monitoring point according to the coded data corresponding to the running states of the current monitoring point, the preset cyclic redundancy algorithm and the running logic actual value of the previous monitoring point of the current monitoring point until the running logic actual value of the last monitoring point in the program stream data to be monitored is determined;
And the logic sequence judging module is used for determining whether the program flow data to be monitored operates according to the expected logic sequence based on the last monitored operation logic actual value and the operation logic expected value.
9. A program flow monitoring device, characterized in that it comprises a processor and a memory in which at least one instruction, at least one program, a set of codes or a set of instructions is stored, which at least one instruction, at least one program, a set of codes or a set of instructions is loaded and executed by the processor to implement the program flow monitoring method according to any one of claims 1-7.
10. A computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the program flow monitoring method of any one of claims 1 to 7.
CN202311371311.4A 2023-10-20 2023-10-20 Program flow monitoring method, device, equipment and storage medium Pending CN117573465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311371311.4A CN117573465A (en) 2023-10-20 2023-10-20 Program flow monitoring method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311371311.4A CN117573465A (en) 2023-10-20 2023-10-20 Program flow monitoring method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117573465A true CN117573465A (en) 2024-02-20

Family

ID=89863311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311371311.4A Pending CN117573465A (en) 2023-10-20 2023-10-20 Program flow monitoring method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117573465A (en)

Similar Documents

Publication Publication Date Title
US5081626A (en) System for detection and location of events
US20130262938A1 (en) Method for providing a value for determining whether an error has occurred in the execution of a program
CN105929723B (en) The control device of life prediction is carried out by error correction
CN108038021B (en) Code memory checking method for computer program operation stage
CN107766188B (en) Memory detection method and device in train control system
Johnson An introduction to the design and analysis of fault-tolerant systems
US20100100221A1 (en) Expert knowledge methods and systems for data analysis
EP1550155A1 (en) Expert knowledge methods and systems for data analysis
CA2689416C (en) Control apparatus and control method
KR101626967B1 (en) Method and apparatus for operating application to prevent hacking
CN110688249A (en) Error injection detection circuit of error correction code circuit
CN111475868B (en) CPU instruction protection method and system suitable for function and information security chip
CN117573465A (en) Program flow monitoring method, device, equipment and storage medium
CN109254898B (en) Software module execution sequence monitoring method and system
US4213188A (en) Apparatus for detecting and correcting errors in arithmetic processing of data represented in the numerical system of residual classes
CN114779913B (en) Resetting method and chip for adaptively adjusting working frequency
US11263313B2 (en) Securing execution of a program
EP4089538A1 (en) System and method for improved control flow monitoring of processors
CN112783705B (en) Test method, device, system, chip and electronic equipment
CN105320574B (en) Control device having error correction function corresponding to monitored operation condition
CN116631492B (en) Relay protection method and system based on multi-core processor chip
US8224882B2 (en) Industrial controller
CN113176983B (en) Program flow monitoring method and program flow monitoring system, CPU and chip
Kim et al. An empirical evaluation of maximum likelihood voting in failure correlation conditions
JP2021015321A (en) Procedure identification device, calculation model generation device, procedure identification method, procedure identification program, calculation model generation method, calculation model generation program, learning data generation device and calculation program

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