Access permission control method and control device of embedded system, and storage medium
By configuring permission control information in user-mode applications, the problems of complex permission control and high resource consumption in embedded systems are solved, enabling fast and batch permission configuration and improving the configuration efficiency of embedded systems.
Patent Information
- Application Number
- CN202011053457.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-29
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2040-09-29
AI Technical Summary
Existing access control methods for embedded Linux systems are complex to configure, resource-intensive, and have limited applications, failing to meet the actual needs of resource-constrained platforms.
Configure permission control information before use in user-mode applications. Use permission control information to configure permissions for files in a specified file or path in batches, reducing resource consumption and improving configuration efficiency.
It enables rapid, batch permission configuration for user-mode applications with low resource consumption, reducing configuration complexity and improving efficiency.
Smart Images

Figure CN112052439B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded system access control technology, specifically to an application access control method for embedded systems, an application access control device for embedded systems, and a computer-readable storage medium. Background Technology
[0002] In existing embedded Linux systems, in order to protect instruction execution and effectively manage system resources, the CPU's operating state is divided into kernel mode and user mode based on the embedded system's permissions.
[0003] Ordinary user applications typically run in user mode to avoid consuming or interfering with system resources. When an application needs to call a system function, it will execute the corresponding kernel code. For example, when outputting data, it will call the output kernel code. At this time, the CPU will be in kernel mode. After executing the kernel code, the CPU will switch back to user mode to continue executing the application.
[0004] In existing technologies, user-mode applications can access kernel space in two ways: discretionary access control based on access control lists and mandatory access control. However, these methods are complex to configure and consume significant resources, making them unsuitable for resource-constrained embedded platforms. Furthermore, existing embedded systems can only modify permission control information for single files or devices, severely limiting their application capabilities and failing to meet practical application needs. Summary of the Invention
[0005] To overcome the technical problems of complex configuration, high resource consumption, and limited application of existing embedded system access control methods, this invention provides an embedded system access control method and an embedded system access control device. By configuring the corresponding access control information before the user-mode application is used, the access permissions of the user-mode application can be quickly and batch configured with low resource consumption, which greatly reduces the configuration complexity and improves the configuration efficiency.
[0006] To achieve the above objectives, the present invention provides an access control method for an embedded system. The control method includes: acquiring and running an application with edited permissions; running the application with edited permissions when the embedded system is in a first running state; determining whether the application with edited permissions executes a system call; and generating a corresponding call control result when the application with edited permissions executes the system call.
[0007] Preferably, obtaining the permission-edited application includes: obtaining permission control information, which includes permission control information for a specified file and permission control information for a specified path file; and editing the original application based on the permission control information to obtain the permission-edited application.
[0008] Preferably, determining whether the application executes a system call after the permissions are edited includes: obtaining the call content of the application after the permissions are edited in real time; determining whether the call content is system call content; and if the call content is system call content, determining that the application executes the system call after the permissions are edited.
[0009] Preferably, generating the corresponding call control result includes: switching the embedded system to a second running state; obtaining the operation information of the application after the permission is edited; verifying the operation information based on the permission control information; executing the operation information if the verification is successful, otherwise generating corresponding error information; taking the execution of the operation information or the generation of the corresponding error information as the call control result, and switching the embedded system back to the first running state.
[0010] Preferably, the permission control information includes multiple control permissions, and the verification of the operation information based on the permission control information includes: matching the operation information with each of the control permissions; determining whether there is a matching control permission that matches the operation information; and if there is a matching control permission, determining that the verification is successful.
[0011] Preferably, executing the operation information includes: obtaining an operation object corresponding to the operation information; if the operation object is a preset special object, performing a virtualization operation on the preset special object to obtain a virtualized operation object; and performing a corresponding operation on the operation object.
[0012] Accordingly, the present invention also provides an access control device for an embedded system, the control device comprising: an acquisition module for acquiring and running an application with edited permissions, and running the application with edited permissions when the embedded system is in a first running state; a determination module for determining whether the application with edited permissions executes a system call; and a control module for generating a corresponding call control result when the application with edited permissions executes the system call.
[0013] Preferably, the acquisition module includes: an information acquisition unit, used to acquire permission control information, the permission control information including permission control information for a specified file and permission control information for a specified path file; and an editing unit, used to edit the original application based on the permission control information to obtain the application after permission editing.
[0014] Preferably, the determining module includes: a content acquisition unit, used to acquire in real time the call content of the application after the permission is edited; a judgment unit, used to determine whether the call content is system call content; and a determining unit, used to determine that the application after the permission is edited executes the system call if the call content is system call content.
[0015] Preferably, the control module includes: a first switching unit for switching the embedded system to a second running state; an operation acquisition unit for acquiring operation information applied after permission editing; a verification unit for verifying the operation information based on the permission control information; a control unit for executing the operation information if the verification is successful, otherwise generating corresponding error information; and a second switching unit for using the execution of the operation information or the generation of corresponding error information as the call control result, and switching the embedded system back to the first running state.
[0016] Preferably, the permission control information includes multiple control permissions, and the verification unit is used to: match the operation information with each of the control permissions; determine whether there is a matching control permission that matches the operation information; and if there is a matching control permission, determine that the verification is successful.
[0017] Preferably, the first control unit is configured to: acquire an operation object corresponding to the operation information; if the operation object is a preset special object, perform a virtualization operation on the preset special object to obtain a virtualized operation object; and perform a corresponding operation on the operation object.
[0018] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided by the present invention.
[0019] The present invention has at least the following technical effects through the technical solution provided by the present invention:
[0020] By configuring the corresponding permission control information before using user-mode applications, and using this permission control information to configure the permissions of specified files or all files under specified paths of the application, access permissions for user-mode applications can be quickly and batch configured with low resource consumption, which greatly reduces configuration complexity and improves configuration efficiency.
[0021] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0022] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0023] Figure 1 This is a flowchart illustrating the specific implementation of the access control method for an embedded system provided in this embodiment of the invention.
[0024] Figure 2 This is a flowchart illustrating the specific implementation of the permission control method for embedded systems provided in this embodiment of the invention, which determines whether an application should execute a system call after permission editing.
[0025] Figure 3 This is a schematic diagram of the access control device for an embedded system provided in an embodiment of the present invention. Detailed Implementation
[0026] To overcome the technical problems of complex configuration, high resource consumption, and limited application of existing embedded system access control methods, this invention provides an embedded system access control method and an embedded system access control device. By configuring the corresponding access control information before the user-mode application is used, the access permissions of the user-mode application can be quickly and batch configured with low resource consumption, which greatly reduces the configuration complexity and improves the configuration efficiency.
[0027] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0028] In this invention, the terms "system" and "network" are used interchangeably. "Multiple" refers to two or more; therefore, in this invention, "multiple" can also be understood as "at least two." "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / ", unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, it should be understood that in the description of this invention, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0029] Please see Figure 1 This invention provides an access control method for an embedded system, the method comprising:
[0030] S10) Obtain and run the application after permission editing, and run the application after permission editing when the embedded system is in the first running state;
[0031] S20) Determine whether the application will execute a system call after the permissions are edited;
[0032] S30) If the system call is executed after the permission is edited, the corresponding call control result is generated.
[0033] Furthermore, in this embodiment of the invention, obtaining the edited application with permissions includes: obtaining permission control information, the permission control information including permission control information for a specified file and permission control information for a specified path file; and editing the original application based on the permission control information to obtain the edited application with permissions.
[0034] In one possible implementation, the permissions of the original application are first edited. In this embodiment of the invention, this can be done by first editing the permissions of the original application on an external terminal device, and then downloading and transmitting the permission-edited application to the current embedded system. Alternatively, the input device and / or display device can be configured through the current embedded system, and the permissions of the original application can be directly edited within the current embedded system to obtain the permission-edited application. For example, permission control information can be obtained first, and then the original application can be edited based on this permission control information. For instance, the permission control information can be added to the configuration file of the original application to obtain the permission-edited application. When batch permission control is required for files under a certain path, permission control information for that path can be added to the permission control information to achieve permission control for files under that path. After the embedded system obtains the permission-edited application, it runs the permission-edited application.
[0035] In this embodiment of the invention, by improving the existing permission control method, the corresponding permission control information is added to the application before the application runs, instead of configuring the application's permissions on-site by calling a dedicated file system in the embedded system when the application runs. This greatly reduces the complexity of configuring the application's permissions, and at the same time, it eliminates the need to configure a dedicated file system, greatly reducing resource consumption and improving the efficiency of application configuration.
[0036] Furthermore, by adding permission control information for files at a specific path to the permission control information, permissions can be quickly configured for files at the same path simultaneously, thereby greatly improving the speed of application permission configuration and significantly reducing the application limitations of permission control methods.
[0037] Please see Figure 2In this embodiment of the invention, determining whether the application executes a system call after the permission is edited includes:
[0038] S201) Obtain the content of the application's calls after the permissions have been edited in real time;
[0039] S202) Determine whether the called content is system call content;
[0040] S203) If the called content is a system call content, determine the permission to edit and then the application executes the system call.
[0041] After the application with modified permissions is installed on the current embedded system and started running, the embedded system's CPU operates in the first running state, such as user mode. In this state, the application can only access its own resources for processing and execution. During operation, the embedded system monitors the application's calls in real time. At a certain moment, if the application needs to access a file resource within the embedded system, it initiates a system call to access that file. The embedded system then recognizes this call as a system call and determines that the application is executing a system call.
[0042] In this embodiment of the invention, generating the corresponding call control result includes: switching the embedded system to a second running state; obtaining the operation information of the application after the permission is edited; verifying the operation information based on the permission control information; executing the operation information if the verification is successful, otherwise generating corresponding error information; using the execution of the operation information or the generation of the corresponding error information as the call control result, and switching the embedded system back to the first running state.
[0043] Furthermore, in this embodiment of the invention, the permission control information includes multiple control permissions, and the verification of the operation information based on the permission control information includes: matching the operation information with each of the control permissions; determining whether there is a matching control permission that matches the operation information; and if there is a matching control permission, then determining that the verification is successful.
[0044] In one possible implementation, after determining that the application is executing a system call after permission editing, the embedded system's CPU is first switched to a second running state, such as kernel mode. Then, the operation information of the application after permission editing is obtained, for example, file reading. At this point, the embedded system verifies the file reading operation based on the permission control information configured in the application after permission editing. For example, the embedded system can call the kernel permission control layer in the system call processing code, then read the aforementioned permission control information, and match each permission item in the permission control information with the file reading operation to determine if there is a matching control permission. For example, in this embodiment, it is determined that there is a matching control permission in the permission control information that matches the file reading operation, thus confirming that the verification is successful. At this time, the CPU specifies the corresponding file reading operation, and after the reading operation is completed, it switches back to the first running state, such as user mode.
[0045] In this embodiment of the invention, by using permission control information to configure corresponding access permissions in the application, instead of setting up a dedicated file system in the embedded system to configure application access permissions, the resource consumption in the process of controlling application access permissions is greatly reduced. Especially in resource-constrained embedded systems, it can have lower resource consumption and corresponding faster running speed, thus achieving better system performance.
[0046] In this embodiment of the invention, executing the operation information includes: obtaining an operation object corresponding to the operation information; if the operation object is a preset special object, performing a virtualization operation on the preset special object to obtain a virtualized operation object; and performing a corresponding operation on the operation object.
[0047] In practical applications, the objects that an application needs to access may be files or other devices. Therefore, in order to reduce the complexity of application access, in one possible implementation, the operation object corresponding to the operation information of the application after permission editing is first obtained. For example, in this embodiment of the invention, the operation object includes, but is not limited to, files or devices. If the object is a preset special object, such as a device, then a virtualization operation is performed on the device. For example, by calling the virtual file system in the embedded system and performing a virtualization operation on the device, the device is virtualized into a file. At this time, the corresponding operation is performed on the above-mentioned operation object, such as a data writing operation.
[0048] In this embodiment of the invention, by judging the operation object of the application, when the operation object of the application is a non-file type object, the object can be converted into a virtualized file, thereby reducing the complexity of the application's operation on the operation object, realizing unified management of device and file paths, and improving the performance of the embedded system.
[0049] The access control device for an embedded system provided in the embodiments of the present invention will be described below with reference to the accompanying drawings.
[0050] Please see Figure 3 Based on the same inventive concept, embodiments of the present invention provide an access control device for an embedded system. The control device includes: an acquisition module, configured to acquire and run an application with edited permissions, and run the application with edited permissions when the embedded system is in a first running state; a determination module, configured to determine whether the application with edited permissions executes a system call; and a control module, configured to generate a corresponding call control result when the application with edited permissions executes the system call.
[0051] Preferably, the acquisition module includes: an information acquisition unit, used to acquire permission control information, the permission control information including permission control information for a specified file and permission control information for a specified path file; and an editing unit, used to edit the original application based on the permission control information to obtain the application after permission editing.
[0052] Preferably, the determining module includes: a content acquisition unit, used to acquire in real time the call content of the application after the permission is edited; a judgment unit, used to determine whether the call content is system call content; and a determining unit, used to determine that the application after the permission is edited executes the system call if the call content is system call content.
[0053] Preferably, the control module includes: a first switching unit for switching the embedded system to a second running state; an operation acquisition unit for acquiring operation information applied after permission editing; a verification unit for verifying the operation information based on the permission control information; a first control unit for executing the operation information if the verification is successful, otherwise generating corresponding error information; and a second switching unit for using the execution of the operation information or the generation of corresponding error information as the call control result, and switching the embedded system back to the first running state.
[0054] Preferably, the permission control information includes multiple control permissions, and the verification unit is used to: match the operation information with each of the control permissions; determine whether there is a matching control permission that matches the operation information; and if there is a matching control permission, determine that the verification is successful.
[0055] Preferably, the first control unit is configured to: acquire an operation object corresponding to the operation information; if the operation object is a preset special object, perform a virtualization operation on the preset special object to obtain a virtualized operation object; and perform a corresponding operation on the operation object.
[0056] Furthermore, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the present invention.
[0057] The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the scope of the technical concept of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention.
[0058] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention will not describe the various possible combinations separately.
[0059] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a microcontroller, chip, or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0060] Furthermore, various different implementations of the present invention can be combined arbitrarily, as long as they do not violate the spirit of the present invention, they should also be regarded as the content disclosed in the present invention.
Claims
1. An access control method for an embedded system, characterized in that, The control method includes: The application with edited permissions is obtained and run, and the application with edited permissions is run when the embedded system is in the first running state. During the operation of the application after permission editing, the call content of the application after permission editing is monitored in real time to determine whether the application after permission editing executes system calls; When the system call is executed after the permission is edited, a corresponding call control result is generated, including: switching the embedded system to a second running state; obtaining the operation information of the application after the permission is edited; verifying the operation information based on the permission control information; executing the operation information if the verification is successful, otherwise generating corresponding error information; using the execution of the operation information or the generation of the corresponding error information as the call control result, and switching the embedded system back to the first running state; The permission-edited application is obtained by editing the permissions of the original application on an external terminal device. The permission editing of the original application includes: Before the application runs, access control information is obtained, including access control information for a specified file and access control information for a specified path file. Editing the original application based on the permission control information to obtain the application after permission editing includes: adding the permission control information to the configuration file of the original application to obtain the application after permission editing.
2. The control method according to claim 1, characterized in that, The step of determining whether the application executes a system call after the permission is edited includes: The application's call content after the permissions are edited can be obtained in real time; Determine whether the content being called is a system call. If the content being called is a system call, the application will execute the system call after the permission to edit is confirmed.
3. The control method according to claim 1, characterized in that, The access control information includes multiple control permissions, and the verification of the operation information based on the access control information includes: The operation information is matched with each of the control permissions; Determine whether there is a matching control permission that matches the operation information; If the matching control permission exists, the verification is considered successful.
4. The control method according to claim 1, characterized in that, The information for executing the operation includes: Obtain the operation object corresponding to the operation information; If the operation object is a preset special object, then a virtualization operation is performed on the preset special object to obtain the virtualized operation object; Perform the corresponding operation on the operation object.
5. An access control device for an embedded system, characterized in that, The control device includes: An acquisition module is used to acquire and run the application after permission editing, and to run the application after permission editing when the embedded system is in the first running state; The determination module is used to monitor the call content of the application after permission editing in real time during the operation of the application, and determine whether the application after permission editing executes system calls. A control module is configured to generate a corresponding call control result when the system call is executed after the permission is edited. The control module includes: a first switching unit for switching the embedded system to a second running state; an operation acquisition unit for acquiring operation information of the application after the permission is edited; a verification unit for verifying the operation information based on the permission control information; a control unit for executing the operation information if the verification is successful, otherwise generating corresponding error information; and a second switching unit for using the execution of the operation information or the generation of corresponding error information as the call control result, and switching the embedded system back to the first running state. The permission-edited application is obtained by editing the permissions of the original application on an external terminal device. The permission editing of the original application includes: Before the application runs, access control information is obtained, including access control information for a specified file and access control information for a specified path file. Editing the original application based on the permission control information to obtain the application after permission editing includes: adding the permission control information to the configuration file of the original application to obtain the application after permission editing.
6. The control device according to claim 5, characterized in that, The determining module includes: The content acquisition unit is used to acquire the content called by the application after the permission is edited in real time; The judgment unit is used to determine whether the called content is system call content; The determining unit is configured to determine, when the called content is system call content, whether the application with the permission to edit will execute the system call.
7. The control device according to claim 5, characterized in that, The access control information includes multiple control permissions, and the verification unit is used for: The operation information is matched with each of the control permissions; Determine whether there is a matching control permission that matches the operation information; If the matching control permission exists, the verification is considered successful.
8. The control device according to claim 5, characterized in that, The first control unit is used for: Obtain the operation object corresponding to the operation information; If the operation object is a preset special object, then a virtualization operation is performed on the preset special object to obtain the virtualized operation object; Perform the corresponding operation on the operation object.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the method described in any one of claims 1-4.
Citation Information
Patent Citations
Method for defining application program authority based on Linux system and electronic device
CN109325358A
File-based access control for shared hardware devices
US20070150630A1
