A method and related device for protecting system data in a control system
By setting different access rights and operating procedures for data areas, user programs in the industrial control system are prevented from maliciously damaging system data during operation, and the problem of system data being vulnerable to attacks during compilation and downloading is solved, achieving Security protection of system data.
Patent Information
- Application Number
- CN202111404899.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-11-24
AI Technical Summary
In industrial control systems, user programs may be damaged by malicious viruses or abnormal operations through the software compilation and communication download process, resulting in malicious damage to system data.
By setting the access permission of the system data area to the first access permission and the access permission of the user data area to the second access permission, back up the public data and refresh the target system data to the interface data area before executing the user program in user mode, based on the interface data Execute user programs in the area and user data, and refresh interface data and restore public data after switching to system mode to protect system data.
It effectively prevents user programs from malicious damage to system data during operation and ensures the security and stability of system data.
Smart Images

Figure CN114091037B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial control technology, and in particular to a method and related device for protecting system data in a control system. Background Art
[0002] In industrial control systems, user process logic is generally written in languages such as FBD and ladder diagrams, compiled through configuration software to generate user programs and downloaded to the control system for execution.
[0003] Since this process requires software compilation and communication download, this process may be infected by malicious viruses or abnormal operations, causing the user program to maliciously damage key system data in the control system during operation. Summary of the invention
[0004] In view of this, the present invention provides a method and related device for protecting system data in a control system, which is used to solve the problem that the user program generated by compiling through configuration software and downloaded to the control system for operation needs to go through software compilation and communication download process, and this process may be caused by malicious viruses or abnormal operations, resulting in the user program maliciously destroying the system data during operation. The specific scheme is as follows:
[0005] A method for protecting system data in a control system is applied to the control system, wherein the control system includes: a user data area, a system data area, an interface data area and a public data area, wherein the user data area includes: user programs and user data, and the system data area includes: system codes and system data, and the method includes:
[0006] Setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0007] The control system is placed in a user mode, and before executing the user program, the public data in the public data area is backed up and the target system data is refreshed to the interface data area, and the user program is executed based on the interface data area, the target system data and the user data;
[0008] After the execution is completed, the control system is switched from the user mode to the system mode, the current interface data is refreshed to the system data area and the public data is restored at the same time.
[0009] In the above method, optionally, the interface data area includes: a data interface and a program interface, and executing the user program based on the interface data area and the target system data includes:
[0010] Selecting target system data matching the user program in the system data area;
[0011] Refreshing the target system data to the interface data area based on the data interface;
[0012] The target system data is acquired based on the program interface, and the user program is executed based on the target system data and the user data.
[0013] The above method, optionally, refreshes the current interface data to the system data area and restores the public data at the same time, including:
[0014] Adding a CRC check code to the current interface data to obtain target current interface data;
[0015] Performing a validity check on the current interface data of the target;
[0016] On the premise that the verification is passed, the current interface data is refreshed to the system data area, and the public data is restored at the same time.
[0017] The above method may also include:
[0018] Before the system code is executed, target user data matching the system code is selected, and the target user data is transferred to the interface data area based on the data interface;
[0019] The target user data is acquired based on the program interface, and the system code is executed based on the target user data and the system data.
[0020] The above method may optionally further include:
[0021] During the execution of the user program, if it is detected that the user program accesses the system data area, the execution of the user program is terminated.
[0022] A protection device for system data in a control system, applied to the control system, wherein the control system comprises: a user data area, a system data area, an interface data area and a public data area, wherein the user data area comprises: a user program and user data, the system data area comprises: a system code and system data, and the device comprises:
[0023] A setting module, used to set the access right of the system data area to a first access right and the access right of the user data area to a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0024] an execution module, configured to put the control system in a user mode, back up the public data in the public data area and refresh the target system data to the interface data area before executing the user program, and execute the user program based on the interface data area, the target system data and the user data;
[0025] The refresh and restore module is used to switch the control system from the user mode to the system mode after execution is completed, refresh the current interface data to the system data area and restore the public data at the same time.
[0026] In the above device, optionally, the interface data area includes: a data interface and a program interface, and the execution module includes:
[0027] A selection unit, used for selecting target system data matching the user program in the system data area;
[0028] A refresh unit, used for refreshing the target system data to the interface data area based on the data interface;
[0029] An execution unit is used to obtain the target system data based on the program interface, and execute the user program based on the target system data and the user data.
[0030] In the above device, optionally, the refresh and recovery module includes:
[0031] An adding unit, used for adding a CRC check code to the current interface data to obtain target current interface data;
[0032] A verification unit, used to verify the validity of the target current interface data;
[0033] The refresh and restore unit is used to refresh the current interface data to the system data area and restore the public data on the premise that the verification is passed.
[0034] A storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned method for protecting system data in the control system.
[0035] An electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to implement the above-mentioned method for protecting system data in the control system.
[0036] Compared with the prior art, the present invention has the following advantages:
[0037] The present invention discloses a method and device for protecting system data in a control system, including: setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, the first access right including: access to the system data area, the user data area, the interface data area and the public data area, the second access right including: access to the user data area, the interface data area and the public data area; making the control system in user mode, before executing the user program, backing up the public data and refreshing the target system data to the interface data area, executing the user program based on the interface data area, the target system data and the user data; after the execution is completed, switching from the user mode to the system mode, refreshing the current interface data to the system data area and restoring the public data at the same time. In the process of the user program accessing the system data, the data interface area is accessed according to the access right, thereby realizing the protection of the system data and avoiding the malicious destruction of the system data during the operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flow chart of a method for protecting system data in a control system disclosed in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a system data area and a user data area disclosed in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of interface data access disclosed in an embodiment of the present application;
[0042] Figure 4 A structural block diagram of a protection device for system data in a control system disclosed in an embodiment of the present application;
[0043] Figure 5 This is a schematic structural diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0046] The present invention discloses a method and device for protecting system data in a control system, which are applied to the process of protecting system data in a control system. In an industrial control system, user process logic is generally written in languages such as FBD and ladder diagrams, and is compiled by configuration software to generate a user program and downloaded to the control system for operation. Since this process requires software compilation and communication download processes, this process may be caused by malicious viruses or abnormal operations, resulting in the user program maliciously destroying key system data in the control system during operation. Therefore, in order to solve the above problems, the present invention provides a method for protecting system data in a control system, and the method is applied to a control system, wherein the control system includes: a user data area, a system data area, an interface data area, and a public data area, wherein the system data area: is generally a data area accessed by the control system code, which has nothing to do with the user program, including peripheral registers, system data, stacks, etc.; interface data area: the user program accesses the system data area through the interface data area; public data area: includes data required for program execution, mainly including R0~R13 registers, etc. The user data area includes: user program and user data, the system data area includes: system code and system data, and the execution flow of the method is as follows Figure 1 As shown, the steps include:
[0047] S101, setting the access right of the system data area to a first access right and the access right of the user data area to a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0048] In the embodiment of the present invention, the user program and the system code are configured in the control system development stage, so that the user program and the system code are divided in the storage space, and the two cannot have any intersection. The same configuration is also adopted for system data and user data. The configuration process of the system code and the user program is taken as an example for explanation, wherein the configuration is generally performed through the link file of the compiler. For example, in the system code implementation procedure, different spaces are configured as different access permissions, for example:
[0049] sysfunc_ram: ORIGIN = 0x8D001000, LENGTH = 0x0000F000 / *System code* /
[0050] usrfunc_ram:ORIGIN=0x8E000000,LENGTH=0x00800000 / *User program space* /
[0051] Further, based on the above method, the access rights of the system data area are set to the first access rights MMU permission 1 + MMU permission 2 and the access rights of the user data area are set to the second access rights MMU permission 2, wherein the first access rights MMU permission 1 + MMU permission 2 include: access to the system data area, the user data area, the interface data area and the public data area, and the second access rights MMU permission 2 include: access to the user data area, the interface data area and the public data area.
[0052] When the system is initialized, the data area access permissions for system mode and user mode are set according to the ARM architecture. In system mode, the system code in the system data area has access permissions to all data (MMU permission 1 + MMU permission 2), and in user mode, the user code in the user data area has no access permissions to system data.
[0053] Based on the above configuration, the structural diagram of the user data area and the system data area is as follows: Figure 2 As shown, after the configuration software is compiled, it is downloaded to the user program through Ethernet. The user program and user data can form a user data area, and the access permission of the user data area is MMU permission 2, wherein user data is data used by the user program, such as control process parameters, etc. The user program can access and issue user data, interface data and public data, wherein interface data belongs to the interface data area, and public data belongs to the public data area. System code and system data form a system data area, and the access permission of the system data area is MMU permission 1+MMU permission 2, wherein system data is data used by system code, and the system code can access and issue system data, public data and interface data.
[0054] Furthermore, the system code can read and write the permissions of all programs; user programs can only read and write user programs, and access to the specified restricted system data required by the user is achieved through interface data. This restriction is determined during system design and cannot be changed at other stages. The isolated use of ARM platform execution environment resources is achieved through public data to prevent abnormal damage.
[0055] S102, placing the control system in user mode, backing up the public data in the public data area and refreshing the target system data to the interface data area before executing the user program, and executing the user program based on the interface data area, the target system data and the user data;
[0056] In an embodiment of the present invention, the interface data area includes: a data interface and a program interface. In order to run the user program, the control system needs to be in user mode in advance. Before executing the user program, the public data in the public data area is backed up. The reason for the backup is that the public data in the user mode and the system mode have different corresponding data. In order to ensure that the control system can operate normally when switching to the user mode, the public data needs to be backed up.
[0057] The target system data matching the user program is selected in the system data area. The selection rule may be to pre-assign the same identifier to each user program and its corresponding target system data, and select based on the identifier. Alternatively, the target system code corresponding to each user program may be pre-stored in a specified location, and the target system data may be obtained at the specified location, or other preferred selection methods may be used. The specific selection method is not limited in the embodiment of the present invention. The target system data is the system data required by the user program during execution. The target system data is refreshed to the interface data area based on the data interface, and the target system data is obtained based on the program interface. The user program is executed based on the target system data and the user data. During the operation of the above-mentioned user program, the target system data is accessed based on the program interface of the interface data area according to the corresponding access rights, and there is no direct access to the system data area, thereby avoiding malicious damage to the system data.
[0058] Furthermore, if during the execution process, it is detected that the user program maliciously accesses the system data area, the program enters exception interrupt processing, terminates the execution of the user program, alarms and exits to restore the system code execution, where the malicious access to the system data area may be caused by errors in the user program writing process or other abnormal situations.
[0059] S103, after the execution is completed, the control system is switched from the user mode to the system mode, the current interface data is refreshed to the system data area and the public data is restored at the same time.
[0060] In an embodiment of the present invention, after monitoring that the execution of the user program is completed, the control system is switched from the user mode to the system mode. Since the interface data in the interface data area will change during the execution of the user program, the current interface data in the receiving data area is obtained, a CRC check code is added to the current interface data to obtain the target current interface data, and the legality of the target current interface data is checked. If the check passes, the current interface data is refreshed to the system data area, and the public data is restored at the same time. If the check fails, the current interface data is marked and the refresh to the interface data area is abandoned.
[0061] Further, the access diagram for interface data is as follows Figure 3 As shown, the controller system code is executed every cycle. Before executing the user program, the corresponding system data needs to be refreshed to the interface data in the interface data area for access by the user program. After executing the user program, the interface data is refreshed to the system data. The specific process is as follows: the interface data written to the interface data area after the user program operation is completed is refreshed to the system data in the system data area after the legality is judged, so as to realize the read and write access to the restricted system data.
[0062] The present invention discloses a method for protecting system data in a control system, comprising: setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, wherein the first access right includes: accessing the system data area, the user data area, the interface data area and the public data area, and the second access right includes: accessing the user data area, the interface data area and the public data area; placing the control system in user mode, backing up the public data and refreshing the target system data to the interface data area before executing the user program, and executing the user program based on the interface data area, the target system data and the user data; after the execution is completed, switching from the user mode to the system mode, refreshing the current interface data to the system data area and restoring the public data at the same time. In the process of the user program accessing the system data, the data interface area is accessed according to the access right, thereby realizing the protection of the system data and avoiding the malicious destruction of the system data during the operation.
[0063] In an embodiment of the present invention, before the system code is executed, target user data matching the system code is selected, wherein the selection principle may be pre-specified or other preferred selection methods. In an embodiment of the present invention, the specific selection principle is not limited. The target user data is user data required during the operation of the system code. The target user data is passed to the interface data area based on the data interface; the target user data is obtained based on the program interface, and the system code is executed based on the target user data and the system data.
[0064] Based on the above-mentioned method for protecting system data in a control system, an embodiment of the present invention provides a device for protecting system data in a control system, and the device is applied to a control system, wherein the control system includes: a user data area, a system data area, an interface data area and a public data area, wherein the user data area includes: user programs and user data, and the system data area includes: system codes and system data. The structural block diagram of the device is as follows: Figure 4 As shown, including:
[0065] A setting module 201 , an execution module 202 and a refresh and restore module 203 .
[0066] in,
[0067] The setting module 201 is used to set the access right of the system data area to a first access right and the access right of the user data area to a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0068] The execution module 202 is used to put the control system in user mode, back up the public data in the public data area and refresh the target system data to the interface data area before executing the user program, and execute the user program based on the interface data area, the target system data and the user data;
[0069] The refresh and restore module 203 is used to switch the control system from the user mode to the system mode after execution, refresh the current interface data to the system data area and restore the public data at the same time.
[0070] The present invention discloses a protection device for system data in a control system, wherein the access rights of the system data area are set as the first access rights and the access rights of the user data area are set as the second access rights, wherein the first access rights include: access to the system data area, the user data area, the interface data area and the public data area, and the second access rights include: access to the user data area, the interface data area and the public data area; in the user mode, before executing the user program, the public data is backed up and the target system data is refreshed to the interface data area, and the user program is executed based on the interface data area, the target system data and the user data; after the execution is completed, the system mode is switched to refresh the current interface data to the system data area and the public data is restored at the same time. In the process of the user program accessing the system data, the data interface area is accessed according to the access rights, thereby realizing the protection of the system data and avoiding the malicious destruction of the system data during the operation.
[0071] In the embodiment of the present invention, the interface data area includes: a data interface and a program interface, and the execution module 202 includes:
[0072] A selection unit 204 , a refresh unit 205 and an execution unit 206 .
[0073] in,
[0074] The selection unit 204 is used to select target system data matching the user program in the system data area;
[0075] The refresh unit 205 is used to refresh the target system data to the interface data area based on the data interface;
[0076] The execution unit 206 is used to obtain the target system data based on the program interface, and execute the user program based on the target system data and the user data.
[0077] In this method embodiment, the refresh and restore module 203 includes:
[0078] An adding unit 207 , a checking unit 208 and a refreshing and restoring unit 209 .
[0079] in,
[0080] The adding unit 207 is used to add a CRC check code to the current interface data to obtain the target current interface data;
[0081] The verification unit 208 is used to verify the validity of the target current interface data;
[0082] The refresh and restore unit 209 is used to refresh the current interface data to the system data area and restore the public data at the same time under the premise of passing the verification.
[0083] The embodiment of the present invention further provides a storage medium, the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned method for protecting system data in a control system. Applied to a control system, wherein the control system includes: a user data area, a system data area, an interface data area and a public data area, wherein the user data area includes: user programs and user data, the system data area includes: system code and system data, and the method includes:
[0084] Setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0085] The control system is placed in a user mode, and before executing the user program, the public data in the public data area is backed up and the target system data is refreshed to the interface data area, and the user program is executed based on the interface data area, the target system data and the user data;
[0086] After the execution is completed, the control system is switched from the user mode to the system mode, the current interface data is refreshed to the system data area and the public data is restored at the same time.
[0087] In the above method, optionally, the interface data area includes: a data interface and a program interface, and executing the user program based on the interface data area and the target system data includes:
[0088] Selecting target system data matching the user program in the system data area;
[0089] Refreshing the target system data to the interface data area based on the data interface;
[0090] The target system data is acquired based on the program interface, and the user program is executed based on the target system data and the user data.
[0091] The above method, optionally, refreshes the current interface data to the system data area and restores the public data at the same time, including:
[0092] Adding a CRC check code to the current interface data to obtain target current interface data;
[0093] Performing a validity check on the current interface data of the target;
[0094] On the premise that the verification is passed, the current interface data is refreshed to the system data area, and the public data is restored at the same time.
[0095] The above method may also include:
[0096] Before the system code is executed, target user data matching the system code is selected.
[0097] Passing the target user data to the interface data area based on the data interface;
[0098] The target user data is acquired based on the program interface, and the system code is executed based on the target user data and the system data.
[0099] The above method may optionally further include:
[0100] During the execution of the user program, if it is detected that the user program accesses the system data area, the execution of the user program is terminated.
[0101] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 5 As shown, it specifically includes a memory 301 and one or more programs 302, wherein the one or more programs 302 are stored in the memory 301 and are configured to be executed by one or more processors 303. The one or more programs 302 include instructions for performing the following operations:
[0102] Setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area;
[0103] The control system is placed in a user mode, and before executing the user program, the public data in the public data area is backed up and the target system data is refreshed to the interface data area, and the user program is executed based on the interface data area, the target system data and the user data;
[0104] After the execution is completed, the control system is switched from the user mode to the system mode, the current interface data is refreshed to the system data area and the public data is restored at the same time.
[0105] In the above method, optionally, the interface data area includes: a data interface and a program interface, and executing the user program based on the interface data area and the target system data includes:
[0106] Selecting target system data matching the user program in the system data area;
[0107] Refreshing the target system data to the interface data area based on the data interface;
[0108] The target system data is acquired based on the program interface, and the user program is executed based on the target system data and the user data.
[0109] The above method, optionally, refreshes the current interface data to the system data area and restores the public data at the same time, including:
[0110] Adding a CRC check code to the current interface data to obtain target current interface data;
[0111] Performing a validity check on the current interface data of the target;
[0112] On the premise that the verification is passed, the current interface data is refreshed to the system data area, and the public data is restored at the same time.
[0113] The above method may also include:
[0114] Before the system code is executed, target user data matching the system code is selected, and the target user data is transferred to the interface data area based on the data interface;
[0115] The target user data is acquired based on the program interface, and the system code is executed based on the target user data and the system data.
[0116] The above method may optionally further include:
[0117] During the execution of the user program, if it is detected that the user program accesses the system data area, the execution of the user program is terminated.
[0118] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0119] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0120] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present invention, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0121] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0122] The above is a detailed introduction to a method and device for protecting system data in a control system provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for protecting system data in a control system, characterized in that: Applied to a control system, wherein the control system comprises: a user data area, a system data area, an interface data area and a common data area, wherein the user data area comprises: a user program and user data, and the system data area comprises: a system code and system data, and the method comprises: Setting the access right of the system data area as a first access right and the access right of the user data area as a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area; Putting the control system in user mode, backing up the public data in the public data area and refreshing the target system data to the interface data area before executing the user program, and executing the user program based on the interface data area, the target system data and the user data; After the execution is completed, the control system is switched from the user mode to the system mode, the current interface data is refreshed to the system data area and the public data is restored at the same time.
2. The method according to claim 1, characterized in that The interface data area includes: a data interface and a program interface, and executing the user program based on the interface data area and the target system data includes: Selecting target system data matching the user program in the system data area; Refreshing the target system data to the interface data area based on the data interface; The target system data is acquired based on the program interface, and the user program is executed based on the target system data and the user data.
3. The method according to claim 2, characterized in that Refreshing the current interface data to the system data area and restoring the public data at the same time, comprising: Adding a CRC check code to the current interface data to obtain target current interface data; Performing a validity check on the current interface data of the target; On the premise that the verification is passed, the current interface data is refreshed to the system data area, and the public data is restored at the same time.
4. The method according to claim 2, characterized in that: Also includes Before the system code is executed, target user data matching the system code is selected. Passing the target user data to the interface data area based on the data interface; The target user data is acquired based on the program interface, and the system code is executed based on the target user data and the system data.
5. The method according to claim 1, characterized in that Also includes: During the execution of the user program, if it is detected that the user program accesses the system data area, the execution of the user program is terminated.
6. A protection device for system data in a control system, characterized in that: Applied to a control system, wherein the control system comprises: a user data area, a system data area, an interface data area and a common data area, wherein the user data area comprises: a user program and user data, the system data area comprises: a system code and system data, and the device comprises: A setting module, used to set the access right of the system data area to a first access right and the access right of the user data area to a second access right, wherein the first access right includes: access to the system data area, the user data area, the interface data area and the public data area, and the second access right includes: access to the user data area, the interface data area and the public data area; an execution module, configured to put the control system in a user mode, back up the public data in the public data area and refresh the target system data to the interface data area before executing the user program, and execute the user program based on the interface data area, the target system data and the user data; The refresh and restore module is used to switch the control system from the user mode to the system mode after execution is completed, refresh the current interface data to the system data area and restore the public data at the same time.
7. The device according to claim 6, characterized in that The interface data area includes: a data interface and a program interface, and the execution module includes: A selection unit, used for selecting target system data matching the user program in the system data area; A refresh unit, used for refreshing the target system data to the interface data area based on the data interface; An execution unit is used to obtain the target system data based on the program interface, and execute the user program based on the target system data and the user data.
8. The device according to claim 7, characterized in that The refresh and restore module comprises: An adding unit, used for adding a CRC check code to the current interface data to obtain target current interface data; A verification unit, used to verify the validity of the target current interface data; The refresh and restore unit is used to refresh the current interface data to the system data area and restore the public data at the same time under the premise of passing the verification.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method for protecting system data in a control system according to any one of claims 1 to 5.
10. An electronic device, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to perform the method for protecting system data in a control system as claimed in any one of claims 1 to 5.
