System file access method, electronic equipment and storage medium

By creating temporary files in the system management process and updating their permissions, the problem of modifying file permissions in the existing technology affecting the operation of other programs is solved, and a solution to unified file access under the read-only file system and permissions between multiple processes is realized.

CN119622814APending Publication Date: 2025-03-14ECARX (HUBEI) TECHCO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411789842.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The existing technology may affect the operation of other programs when modifying file permissions, and cannot dynamically modify file permissions. The modification permissions fail in the read-only file system, and it is difficult to unify the permissions of the same file between multiple processes.

Method used

The system management process detects whether the current process has the target permissions. If so, a temporary file corresponding to the target file is created. The current process accesses the temporary file according to the target permissions, realizing the file read and write operations without modifying the target file's permissions.

Benefits of technology

Ensure that the original permissions of all files in the system do not change, avoid the impact of modifying file permissions on the operation of other programs, ensure that other programs can run normally and the stability of the root file system, and avoid failure of modifying permissions under the read-only file system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119622814A_ABST
    Figure CN119622814A_ABST
Patent Text Reader

Abstract

The invention provides a system file access method, electronic equipment and a storage medium, the method comprises the following steps: in response to detection that a current process does not pass permission verification of a target file, a system management process judges whether the current process has a target permission for the target file according to a configuration file, and if yes, the current process does not pass the permission verification of the target file; if yes, the system management process creates a temporary file corresponding to the target file, the current process accesses the temporary file according to the target permission, and file access based on the system management process is achieved. The influence of file permission modification on running of other programs is avoided, normal running of the other programs and stability of the root file system are guaranteed, modification failure caused by permission modification can be avoided, meanwhile, permission unification is not needed among multiple processes, management is convenient, and user experience is improved. And the read-write of the process can be more intuitively controlled through the temporary file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of system technology, and in particular to a system file access method, electronic device and storage medium. Background Art

[0002] DAC (Discretionary Access Control) is a basic permission access framework used in Linux systems. It attaches permission information to files to determine whether a process has read or write permissions to a file. At the same time, in Linux systems, there is a super user root who can ignore the restrictions of DAC and access all files in the system. For security reasons, the system does not allow programs other than init or systemd to use the root account to start. This may cause a program to lack relevant permissions for the target file, which in turn causes access failure and affects the normal operation of the program function.

[0003] In order to successfully start a program, the existing technology usually modifies the file's permission information by changing the owner, changing the mode, or ACL (Access Control List) so that the program can access the file normally. However, this will at least have the following problems: 1. Files are global, and modifying the permissions of a file may affect the operation of other programs; 2. In a read-only file system, it is impossible to dynamically modify the permissions of a file; 3. It is difficult to unify the permissions of the same file among multiple processes, which increases the difficulty of maintenance. Summary of the invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide a system file access method, electronic device and storage medium to solve the problems in the prior art such as modifying file permissions affecting the operation of other programs, inability to dynamically modify file permissions, and difficulty in unifying permissions for the same file among multiple processes.

[0005] The present invention provides a method for accessing a system file, the method comprising:

[0006] In response to detecting that the current process fails to pass the permission verification of the target file, the system management process determines, based on the configuration file, whether the current process has the target permission for the target file, wherein the current process is a process other than the system management process;

[0007] If so, the system management process creates a temporary file corresponding to the target file;

[0008] The current process accesses the temporary file according to the target permission.

[0009] Optionally, the method further includes:

[0010] The current process loads the read-write module of the system management process and calls the file opening function in the read-write module. The file opening function verifies the permission of the target file for the current process according to the permission list information of the target file.

[0011] Optionally, the file opening function verifies the permissions of the target file for the current process according to the permission list information of the target file, including:

[0012] The file opening function determines whether the process identifier of the current process exists in the permission list information;

[0013] If so, the file opening function determines whether the preset permissions corresponding to the process identifier in the permission list information meet the target permissions. If so, it is determined that the current process passes the permission verification of the target file.

[0014] Optionally, in response to detecting that the current process fails to pass the permission verification of the target file, the method further includes:

[0015] The current process calls the file opening function and sends the process identifier of the current process, the target permission and the path information of the target file to the system management process;

[0016] The system management process determines whether the current process has the target permission for the target file based on the configuration file, including:

[0017] The system management process determines whether there is permission configuration information corresponding to the process identifier in the configuration file;

[0018] If so, the system management process determines whether there is path information of the target file in the permission configuration information, and whether the configuration permission corresponding to the path information satisfies the target permission;

[0019] If so, it is determined that the current process has the target permission for the target file.

[0020] Optionally, after the system management process creates a temporary file corresponding to the target file, the method further includes:

[0021] The system management process updates the permission list information of the temporary file according to the target permission;

[0022] The current process accesses the temporary file according to the target permission, including:

[0023] The current process calls the file opening function again, and the file opening function determines whether the current process passes the permission verification of the temporary file according to the permission list information of the temporary file. If so, the current process accesses the temporary file.

[0024] Optionally, the current process accesses the temporary file according to the target permission, including:

[0025] In the case where the target permission is a read permission, the current process sends an update notification to the system management process;

[0026] The system management process updates the content of the target file to the temporary file in response to the update notification, and feeds back an update completion notification to the current process after the update is completed;

[0027] In response to the update completion notification, the current process calls the file read function in the read-write module to read the temporary file.

[0028] Optionally, the current process accesses the temporary file according to the target permission, including:

[0029] In the case where the target permission is a write permission, the current process calls the file write function in the read-write module to write the temporary file, and feeds back a write completion notification to the system management process after the writing is completed;

[0030] In response to the write completion notification, the system management process updates the content of the temporary file to the target file.

[0031] Optionally, after the current process accesses the temporary file according to the target permission, the method further includes:

[0032] The current process sends a processing completion notification to the system management process;

[0033] The system management process deletes the temporary file in response to the processing completion notification.

[0034] The present application also provides an electronic device, the electronic device comprising:

[0035] Processor and memory;

[0036] The processor is used to execute the steps of the system file access method provided in any embodiment of the present application by calling the program or instruction stored in the memory.

[0037] An embodiment of the present application also provides a computer-readable storage medium, which stores a program or instruction, and the program or instruction enables a computer to execute the steps of the system file access method provided by any embodiment of the present application.

[0038] In summary, the present application proposes a method for accessing system files. In response to detecting that the current process has not passed the permission verification of the target file, the system management process determines whether the current process has the target permission for the target file according to the configuration file. If so, the system management process creates a temporary file corresponding to the target file, and the current process accesses the temporary file according to the target permission, thereby realizing file access based on the system management process. The method can create a temporary file for the current process according to the configuration file through the system management process for reading, writing and other processing without modifying the permission information of the target file. It can ensure that the original permissions of all files in the system do not change, avoid the impact of modifying file permissions on the operation of other programs, ensure the normal operation of other programs and the stability of the root file system, and, in a read-only file system, avoid modification failures caused by modifying permissions, thereby avoiding file access failures. At the same time, there is no need to unify permissions between multiple processes, which is convenient for management, and the reading and writing of processes can be controlled more intuitively through temporary files. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 is a flow chart of a method for accessing system files provided by an embodiment of the present application;

[0041] Figure 2 This is a flow chart of accessing a system file provided by an embodiment of the present application;

[0042] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.

[0044] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0045] As mentioned in the background technology, in response to the problems in the prior art, this application proposes a method for accessing system files. Figure 1 This is a flowchart of a method for accessing a system file provided by an embodiment of the present application, which can be applied to various systems where non-system management processes perform read and write control on system files, such as a vehicle computer system. Figure 1 , the access methods of this system file include:

[0046] S110 . In response to detecting that the current process fails to pass the permission verification of the target file, the system management process determines whether the current process has the target permission for the target file based on the configuration file.

[0047] The system management process may be a process with root privileges in the system, that is, process No. 1. In an embodiment of the present application, the system management process may be systemd, that is, a system and service manager.

[0048] Specifically, the system management process may not be controlled by DAC, and is not restricted by file permission information when accessing any system file, that is, it can access all system files. In addition, the system management process is started before all other processes in the system; for example, in response to detecting that the vehicle system is powered on, the system management process is started.

[0049] In the embodiment of the present application, the current process is a process other than the system management process, that is, a non-system management process. Specifically, the non-root program will generate the current process after self-starting. The current process can first execute the DAC process to perform permission verification of the target file.

[0050] The target file is a system file that the current program wants to access; the permission verification of the target file can be based on the permission list information of the target file to verify whether the current process has the permission to access it. Exemplarily, the permission verification of the target file can be performed on the current process through the open function in the read-write module of the system management process.

[0051] In a specific implementation, the method provided in the embodiment of the present application further includes:

[0052] The current process loads the read-write module of the system management process and calls the file opening function in the read-write module. The file opening function verifies the permission of the target file for the current process according to the permission list information of the target file.

[0053] Among them, the read-write module can be implemented using a dynamic library, and the read-write module can be composed of read-write related functions, such as a file open function (systemd_open), a file read function (systemd_write), a file write function (systemd_read), etc. Exemplarily, each function in the original read-write module can be rewritten according to the functions that each function needs to perform in the embodiment of the present application, and then the rewritten functions are stored in the read-write module.

[0054] Specifically, the current process can first load the read-write module of the system management process, and then call the file open function in the read-write module to execute the file open function. The file open function can execute the DAC process to verify the permissions of the target file for the current process according to the permission list information of the target file.

[0055] The permission list information of the target file may specifically be an access control list maintained for the target file, which specifically records which users or user groups have what access rights to the target file, and the access rights may be read, write, execute, etc. By loading the read-write module of the system management process and then verifying the permission of the target file for the current process through the file open function, the access rights of the current process may be verified through DAC first, which can improve the efficiency of the current process in accessing the target file.

[0056] In one example, the file opening function verifies the permissions of the target file for the current process according to the permission list information of the target file, including:

[0057] The file open function determines whether the process ID of the current process exists in the permission list information; if so, the file open function determines whether the preset permissions corresponding to the process ID in the permission list information meet the target permissions. If so, it is determined that the current process passes the permission verification of the target file.

[0058] The permission list information may include each process ID and the corresponding preset permissions; the process ID may be the UID (User Identifier) ​​of the process. Specifically, the file opening function may first determine whether the process ID of the current process exists in the permission list information. If so, it indicates that the current process has certain access permissions.

[0059] Further, the file opening function can determine whether the preset permissions corresponding to the process identifier in the permission list information meet the target permissions, where the target permissions can be permissions required by the current process for the target file. For example, if the preset permissions include at least the target permissions, it can be determined that the preset permissions meet the target permissions.

[0060] Specifically, if the preset permissions corresponding to the process identifier in the permission list information meet the target permissions, it means that the access permissions of the current process can meet the current access requirements. At this time, it can be determined that the current process passes the permission verification of the target file.

[0061] Through the above example, DAC verification of the current process can be implemented according to each process ID and the corresponding preset permission in the permission list information, as well as the process ID of the current process, which can improve the efficiency of the current process in accessing the target file.

[0062] In an embodiment of the present application, when the current process passes the permission verification of the target file, the file open function can return the handle of the target file, wherein the handle is an integer or pointer used to identify the target file; and then the current process can access the target file according to the handle, such as reading the target file, writing the target file, executing the target file, or reading and writing the target file. Since the current process interacts with the operating system through the handle instead of directly accessing the underlying hardware resources, the security and stability of the system can be improved.

[0063] In addition, when the current process fails to pass the permission verification of the target file, the system management process can determine whether the current process has the target permission for the target file through the configuration file.

[0064] The configuration file may be pre-set according to the access rights of each process to the file, the configuration file may only have read and write permissions for the system management process, and each entry in the configuration file may be in JSON (JavaScript Object Notation) format. Each entry in the configuration file may be composed of a process identifier and permission configuration information corresponding to the process identifier.

[0065] Exemplarily, the format of the entries in the configuration file is: {unit: "unit_name", r_path: {"path_name1", "path_name2"}, w_path: {"path_name1", "path_name2"}}, indicating that the service service with process ID unit_name has read and write permissions for files in path_name1 and path_name2.

[0066] In an embodiment of the present application, if the current process fails to pass the permission verification of the target file, the process ID and other information of the current process can be sent to the system management process through the file open function, and then the system management process determines whether the current process has the target permission based on the configuration file.

[0067] In a specific implementation, in response to detecting that the current process fails to pass the target file permission verification, the method further includes: the current process calls a file open function to send the process identifier of the current process, the target permission, and the path information of the target file to the system management process;

[0068] The system management process determines whether the current process has the target permission for the target file based on the configuration file, including the following steps:

[0069] Step 11: The system management process determines whether there is permission configuration information corresponding to the process identifier in the configuration file;

[0070] Step 12: If it exists, the system management process determines whether there is path information of the target file in the permission configuration information, and whether the configuration permission corresponding to the path information satisfies the target permission;

[0071] Step 13: If yes, determine that the current process has the target permission for the target file.

[0072] Specifically, if the current process fails to pass the permission verification of the target file, the file open function may send the path information of the target file, the process ID of the current process, and the target permission to the system management process.

[0073] Furthermore, the system management process can combine the configuration file, the received path information, the process identifier and the target permission to determine whether the current process has the target permission for the target file. Specifically, in step 11, the system management process can first determine whether there is permission configuration information corresponding to the received process identifier in the configuration file, wherein the permission configuration information includes the path information of each file and the corresponding configuration permission.

[0074] In step 12, if there is permission configuration information corresponding to the process identifier in the configuration file, it means that permissions have been pre-configured for the current process. It can be further determined whether there is path information of the target file in the permission configuration information, and whether the configuration permissions corresponding to the path information meet the target permissions.

[0075] If the permission configuration information contains the path information of the target file, and the corresponding configuration permission satisfies the target permission, it means that the target permission for the target file has been pre-configured for the current process, and it can be determined that the current process has the target permission for the target file.

[0076] In addition, if the configuration file does not contain permission configuration information corresponding to the process identifier, or the permission configuration information does not contain the path information of the target file, or the configuration permissions corresponding to the path information in the permission configuration information do not satisfy the target permissions, it can be determined that the current process does not have the target permissions for the target file. At this time, the system management process can return an access failure signal, and the current process can display a prompt message in the interface based on the access failure signal.

[0077] Through the above implementation, when the current process fails to pass the permission verification of the target file, the process ID and other information can be sent to the system management process through the file opening function, so that the system management process can initiate a judgment on whether the current process has the target permission based on the process ID and other information. The file opening function can send information to the system management process after executing the DAC process, without starting other functions or processes to make judgments, which can avoid increasing the system burden and ensure the stability of system operation.

[0078] S120: If yes, the system management process creates a temporary file corresponding to the target file.

[0079] Specifically, when the system management process determines that the current process has the target permission for the target file based on the configuration file, the system management process may create a temporary file corresponding to the target file, such as a tmp file.

[0080] S130: The current process accesses the temporary file according to the target permission.

[0081] Specifically, after the system management process creates a temporary file corresponding to the target file, the system management process can send the handle of the temporary file to the current process, and then after the current process receives the handle, it can access the temporary file based on the handle of the temporary file, such as writing to the temporary file, reading from the temporary file, executing the temporary file, or reading and writing from the temporary file.

[0082] In an embodiment of the present application, in order to ensure the security of the process operating system files, the system management process can modify the permission list information of the temporary file after creating the temporary file so that the current process has target permissions for the temporary file, thereby avoiding the current process having too much permissions for the temporary file, thereby avoiding security risks caused by exceeding the target permissions.

[0083] In a specific implementation, after the system management process creates a temporary file corresponding to the target file, the method further includes: the system management process updates permission list information of the temporary file according to the target permission;

[0084] The current process accesses the temporary file according to the target permissions, including:

[0085] The current process calls the file open function again. The file open function determines whether the current process passes the temporary file permission verification based on the permission list information of the temporary file. If so, the current process accesses the temporary file.

[0086] Specifically, the system management process may update the permission list information of the temporary file according to the target permission, that is, write the target permission of the current process into the permission list information of the temporary file.

[0087] Furthermore, the system management process can send the handle of the temporary file to the current process, and after the current process receives the handle, it can re-awaken the read-write module of the system management process to call the file opening function again. The file opening function can verify the permissions of the temporary file for the current process based on the permission list information of the temporary file. If passed, the handle of the temporary file is returned to the current process. At this time, the current process's access to the target file is modified to access to the temporary file, and the current process accesses the temporary file based on the returned handle.

[0088] Through the above implementation, after the system management process creates a temporary file, the permission list information of the temporary file can be modified to ensure that the current process has sufficient access rights to the temporary file, thereby avoiding security risks caused by opening all permissions of the temporary file for the current process, thereby ensuring the security and operational stability of the system.

[0089] In an embodiment of the present application, the current process accesses the temporary file according to the target permissions, which may be reading the temporary file or writing the temporary file.

[0090] In some optional implementations, the current process accesses the temporary file according to the target permission, including the following steps:

[0091] Step 21: When the target permission is read permission, the current process sends an update notification to the system management process;

[0092] Step 22: In response to the update notification, the system management process updates the content of the target file to the temporary file, and feeds back an update completion notification to the current process after the update is completed;

[0093] Step 23: In response to the update completion notification, the current process calls the file read function in the read-write module to read the temporary file.

[0094] Among them, in step 21, if the target permission is the read permission, the current process can first send an update notification to the system management process and wait for the update completion notification.

[0095] In step 22, the system management process updates the content of the target file to the temporary file in response to the update notification, and feeds back an update completion notification to the current process after the update is completed.

[0096] Further, in step 23, the current process, in response to the update completion notification, calls a file read function in the read-write module, such as systemd_read, to perform a read process on the temporary file to read the content in the temporary file.

[0097] Through the above steps 21 to 23, the purpose of reading the target file content is achieved without modifying the file permissions when the DAC is rejected.

[0098] In some optional implementations, the current process accesses the temporary file according to the target permission, including the following steps:

[0099] Step 31: When the target permission is write permission, the current process calls the file write function in the read-write module to write the temporary file, and after the writing is completed, it feeds back a write completion notification to the system management process;

[0100] Step 32: In response to the write completion notification, the system management process updates the content of the temporary file to the target file.

[0101] Among them, in step 31, if the target permission is write permission, the current process first calls the file write function in the read-write module, such as systemd_write, writes the temporary file through the file write function, and feeds back a write completion notification to the system management process after the writing is completed.

[0102] Furthermore, in step 32, the system management process may update the content in the temporary file to the target file in response to the write completion notification, and send an update completion notification to the current process after the update is completed, so that the current process completes the write process.

[0103] Through the above steps 31 and 32, the purpose of writing content to the target file is achieved without modifying the file permissions when the file is rejected by DAC.

[0104] Considering that a certain storage space is occupied in the temporary file system, the temporary file can also be cleared after the current process completes the access. In one example, after the current process accesses the temporary file according to the target permission, it also includes:

[0105] The current process sends a processing completion notification to the system management process; the system management process deletes the temporary file in response to the processing completion notification.

[0106] Among them, after the current process completes the access, such as completing the write process, completing the read process, etc., it can send a processing completion notification to the system management process, and then the system management process can clear the temporary files after receiving the processing completion notification to avoid the temporary files still occupying the system memory after use, thereby ensuring the stability of the system operation.

[0107] The system file access method provided in the embodiment of the present application, in response to detecting that the current process has not passed the permission verification of the target file, the system management process determines whether the current process has the target permission for the target file according to the configuration file. If so, the system management process creates a temporary file corresponding to the target file, and the current process accesses the temporary file according to the target permission, thereby realizing file reading and writing based on the system management process. The method can create a temporary file for the current process according to the configuration file through the system management process for reading, writing and other processing without modifying the permission information of the target file. It can ensure that the original permissions of all files in the system do not change, avoid the impact of modifying file permissions on the operation of other programs, ensure the normal operation of other programs and the stability of the root file system, and in a read-only file system, it can also avoid modification failures caused by modifying permissions, thereby avoiding file access failures. At the same time, there is no need to unify permissions between multiple processes, which is convenient for management, and the reading and writing of processes can be controlled more intuitively through temporary files.

[0108] Figure 2 is a flow chart of accessing a system file provided by an embodiment of the present application, such as Figure 2 As shown, the access of non-root programs to system files may include the following steps:

[0109] S1: The non-root program starts to start automatically and loads the read-write module of the systemd process. The read-write module can be implemented using a dynamic library, in which the read-write related functions are rewritten. When the non-root program is executed, the dynamic library is loaded. When the read-write related functions are executed, the corresponding functions in the module are used to replace the original functions.

[0110] S2: The non-root program executes the open family function to open the file. At this time, the open function systemd_open() rewritten in the read-write module is used by default. Systemd_open first performs DAC permission verification. If the verification passes, the target file handle is directly returned. The non-root program performs the next read and write operation. If the verification fails, it enters process S3.

[0111] S3: systemd_open sends the path information of the target file, the required target permissions, and the cred of the non-root process (including but not limited to the service unit of the process) to the systemd process, and waits for the return value of the systemd process. After receiving the information, the systemd process enters S4;

[0112] S4: The systemd process accesses the configuration file config, checks whether it has relevant permissions based on the configuration file config and decides on the next step of execution; only root has read and write permissions to the configuration file here, and the configuration file entries are in JSON format, with the content format of {unit: "unit_name", r_path:{"path_name1","path_name2"}, w_path:{"path_name1","path_name2"}}, indicating that the service service with unit unit_name has read and write permissions to path_name1 and path_name2;

[0113] After receiving the permission information sent by the non-root program, the systemd process performs the following judgment: first, it matches unit_name. If it is not in the config, or if unit_name is in the config, if there is no target permission in the config, it enters S8. If the match succeeds, it enters S5.

[0114] S5: The systemd process creates a temporary tmp file based on the obtained target permissions, and modifies the tmp file permissions to ensure that the non-root program has sufficient permissions for the tmp file; then sends the tmp file handle to the non-root program. After the non-root program receives the signal sent by the systemd process, the systemd_open function wakes up again and returns the received file handle. At this time, the non-root access to the target file is modified to the access to the tmp file, and the following reading and writing are continued. If it is reading, it enters S6, and if it is writing, it enters S7;

[0115] S6: The non-root program uses the read function systemd_read rewritten in the read-write module to read the tmp file. First, it notifies the systemd process to update the tmp file and waits for the update completion signal. After the systemd process updates the content of the target file to the tmp file, it sends a completion signal to wake up the non-root program to read the content of the tmp file. In this way, the purpose of reading the target file is achieved without modifying the file permissions when it is rejected by DAC.

[0116] S7: The non-root program uses the rewritten write function systemd_write in the read-write module to write the tmp file. After the writing is completed, systemd_write will notify the systemd process to update the target file and wait for the update completion signal; after the systemd process updates the content in tmp to the target file, it sends a completion signal to wake up the non-root program to complete systemd_write. In this way, the purpose of writing the target file is achieved without modifying the file permissions when rejected by DAC.

[0117] The method for accessing system files provided by the embodiment of the present application is that in a system using the systemd process as the init process, the systemd process is the first process, has root permissions by default, is not controlled by DAC, and is started before all user-mode processes in the system. By communicating with systemd, the target file is read and written, which has at least the following advantages:

[0118] 1. Convenient management. By configuring the file, the file is attached to the service file of the startup process, which can control the reading and writing of the process more intuitively;

[0119] 2. Ensure that the permissions of all original files in the system do not change, so that non-root programs can run normally;

[0120] 3. The root file system is not modified, ensuring the stability of the root file system.

[0121] Figure 3 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 3 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .

[0122] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0123] The memory 402 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may run the program instructions to implement the system file access method and / or other desired functions of any embodiment of the present application described above. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0124] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including early warning information, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0125] Of course, to simplify, Figure 3 Only some of the components related to the present application in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 400 may also include any other appropriate components.

[0126] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the system file access method provided by any embodiment of the present application.

[0127] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0128] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the system file access method provided by any embodiment of the present application.

[0129] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0130] It should be noted that the terms used in this application are only for describing specific embodiments, rather than limiting the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements.

[0131] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0132] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the concept and technical solution of the invention to other occasions without improvement, should be regarded as the scope of protection of this application.

Claims

1. A method for accessing a system file, characterized in that: include: In response to detecting that the current process fails to pass the permission verification of the target file, the system management process determines, based on the configuration file, whether the current process has the target permission for the target file, wherein the current process is a process other than the system management process; If so, the system management process creates a temporary file corresponding to the target file; The current process accesses the temporary file according to the target permission.

2. The method according to claim 1, characterized in that The method further comprises: The current process loads the read-write module of the system management process and calls the file opening function in the read-write module. The file opening function verifies the permission of the target file for the current process according to the permission list information of the target file.

3. The method according to claim 2, characterized in that The file opening function verifies the permissions of the target file for the current process according to the permission list information of the target file, including: The file opening function determines whether the process identifier of the current process exists in the permission list information; If so, the file opening function determines whether the preset permissions corresponding to the process identifier in the permission list information meet the target permissions. If so, it is determined that the current process passes the permission verification of the target file.

4. The method according to claim 2, characterized in that: In response to detecting that the current process fails to pass the permission verification of the target file, the method further includes: The current process calls the file opening function and sends the process identifier of the current process, the target permission and the path information of the target file to the system management process; The system management process determines whether the current process has the target permission for the target file based on the configuration file, including: The system management process determines whether there is permission configuration information corresponding to the process identifier in the configuration file; If so, the system management process determines whether there is path information of the target file in the permission configuration information, and whether the configuration permission corresponding to the path information satisfies the target permission; If so, it is determined that the current process has the target permission for the target file.

5. The method according to claim 2, characterized in that: After the system management process creates a temporary file corresponding to the target file, the method further includes: The system management process updates the permission list information of the temporary file according to the target permission; The current process accesses the temporary file according to the target permission, including: The current process calls the file opening function again, and the file opening function determines whether the current process passes the permission verification of the temporary file according to the permission list information of the temporary file. If so, the current process accesses the temporary file.

6. The method according to claim 2, characterized in that The current process accesses the temporary file according to the target permission, including: In the case where the target permission is a read permission, the current process sends an update notification to the system management process; The system management process updates the content of the target file to the temporary file in response to the update notification, and feeds back an update completion notification to the current process after the update is completed; In response to the update completion notification, the current process calls the file read function in the read-write module to read the temporary file.

7. The method according to claim 2, characterized in that The current process accesses the temporary file according to the target permission, including: In the case where the target permission is a write permission, the current process calls the file write function in the read-write module to write the temporary file, and feeds back a write completion notification to the system management process after the writing is completed; The system management process updates the content of the temporary file to the target file in response to the write completion notification.

8. The method according to claim 1, characterized in that After the current process accesses the temporary file according to the target permission, the method further includes: The current process sends a processing completion notification to the system management process; The system management process deletes the temporary file in response to the processing completion notification.

9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the system file access method according to any one of claims 1 to 8 by calling the program or instruction stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or an instruction, wherein the program or the instruction enables a computer to execute the steps of the system file access method according to any one of claims 1 to 8.