Method, device and electronic equipment for determining file integrity of a file system

By determining the integrity of target files in the file system when the target application makes a request, the problem of file system performance degradation is solved, and stability and security are improved.

CN114528598BActive Publication Date: 2026-06-19VIVO MOBILE COMM CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2022-02-14
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

The file system frequently triggers integrity checks during runtime, leading to performance degradation.

Method used

The integrity of the target file in the file system is determined only when the target application initiates a request to call the detection interface, thus avoiding frequent triggering of integrity checks.

Benefits of technology

It maintains stable file system performance, avoids performance degradation caused by frequent checks, and improves the security of target files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528598B_ABST
    Figure CN114528598B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for determining the file integrity of a file system, comprising: upon receiving a request to call a detection interface of the file system, if the request is initiated by a target application, calling the detection interface; determining a target file in the file system based on application data of the target application through the detection interface; and determining the integrity of the target file in the file system based on M first file identifiers and second file identifiers of the target file; wherein the first file identifiers include: file identifiers corresponding to all files in the file system before the file system image is installed on the electronic device; and the second file identifiers include: file identifiers corresponding to the target file after the file system image is installed on the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of terminal equipment technology, and specifically relates to a method, apparatus and electronic device for determining the file integrity of a file system. Background Technology

[0002] A file system is a method and data structure used by an operating system to define files on a storage device or partition. In other words, it is a software mechanism that organizes, manages, and stores file information on a storage device. It is mainly responsible for organizing and allocating space on file storage devices, as well as storing files and protecting and retrieving stored files.

[0003] In some scenarios, it is necessary to check the integrity of files in the file system. When the file system is running, the integrity check function runs at the kernel level. The integrity check function is started by kernel level parameters. After the integrity check function is started, opening any file in the file system will trigger the integrity check function. After the integrity check function is triggered, the integrity check needs to be performed on all files in the file system. The frequent triggering of the file integrity check function and the integrity check of all files in the file system will lead to a decrease in the performance of the file system. Summary of the Invention

[0004] The purpose of this application is to provide a method, apparatus, and electronic device for determining the file integrity of a file system, which can solve the problem of file system performance degradation.

[0005] In a first aspect, embodiments of this application provide a method for determining the file integrity of a file system. The method includes: upon receiving a request to invoke a detection interface of the file system, if the request is initiated by a target application, invoking the detection interface; determining a target file in the file system based on application data of the target application through the detection interface; and determining the integrity of the target file in the file system based on M first file identifiers and second file identifiers of the target file; wherein the first file identifiers include: file identifiers corresponding to all files in the file system before the image is installed on the electronic device; and the second file identifiers include: file identifiers corresponding to the target file after the image is installed on the electronic device.

[0006] Secondly, embodiments of this application provide a device for determining the file integrity of a file system. The device includes: a calling module, configured to, upon receiving a call request to a file system detection interface, call the detection interface if the call request is initiated by a target application; a first determining module, configured to determine a target file in the file system based on application data of the target application through the detection interface; and a second determining module, configured to determine the integrity of the target file in the file system based on M first file identifiers and second file identifiers of the target file; wherein the first file identifiers include: file identifiers corresponding to all files in the file system before the file system is installed onto the electronic device; and the second file identifiers include: file identifiers corresponding to the target file after the file system is installed onto the electronic device.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method as described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, they implement the steps of the method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method as described in the first aspect.

[0010] The technical solution provided in this application includes: upon receiving a request to call a file system detection interface, if the request is initiated by a target application, then calling the detection interface; through the detection interface, determining a target file in the file system based on the application data of the target application; determining the integrity of the target file in the file system based on M first file identifiers and second file identifiers of the target file; wherein, the first file identifiers include: file identifiers corresponding to all files in the file system before the image is installed on the electronic device; the second file identifiers include: file identifiers corresponding to the target file after the image is installed on the electronic device.

[0011] The technical solution provided by the embodiments of this application determines the target file and its integrity only when the target application initiates a call request to the detection interface. Therefore, the detection interface is called only according to the actual needs of the target application, and the integrity detection function of the file system is not frequently triggered. Only the integrity of the target file in the file system is determined, thereby keeping the performance of the file system stable. Attached Figure Description

[0012] Figure 1 This illustration shows a first flowchart of a method for determining file integrity in a file system according to an embodiment of this application;

[0013] Figure 2 This illustration shows a second flowchart of a method for determining file integrity in a file system according to an embodiment of this application.

[0014] Figure 3 This diagram illustrates a third method for determining file integrity in a file system according to an embodiment of this application.

[0015] Figure 4 This diagram illustrates a fourth method for determining file integrity in a file system according to an embodiment of this application.

[0016] Figure 5 A schematic diagram of the structure of the file integrity determination device of the file system provided in the embodiments of this application is shown;

[0017] Figure 6 This invention provides a schematic diagram of the structure of an electronic device according to an embodiment of the present application.

[0018] Figure 7 This diagram illustrates the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0020] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0021] The following description, in conjunction with the accompanying drawings, details the method, apparatus, and electronic device for determining the file integrity of the file system provided in this application, through specific embodiments and application scenarios.

[0022] Figure 1 This diagram illustrates a flowchart of a method for determining file integrity in a file system according to an embodiment of this application. The execution entity of this method can be a server, which can be an independent server or a server cluster composed of multiple servers. Furthermore, the server can be a server capable of determining the integrity of files in the file system. Figure 1 As shown, the method may include the following steps.

[0023] Step S101: Upon receiving a request to call the file system detection interface, if the request is initiated by the target application, then the detection interface is called.

[0024] Specifically, a file system is the method and data structure used by the operating system to define files on storage devices or partitions. In other words, it's the software mechanism that organizes, manages, and stores file information on storage devices. Its main responsibilities include organizing and allocating space on file storage devices, storing files, protecting them, and retrieving them. When integrity checks are needed on files within the file system, the target application can initiate a request to call the file system's check interface. This check interface can be an Application Programming Interface (API) provided by a Software Development Kit (SDK) for the file system. The SDK provides the necessary documentation for the API interface.

[0025] The call request includes, but is not limited to, the permission identifier of the detection interface and the device certificate of the terminal device where the file system resides. The permission identifier of the detection interface is the API key requested by the user when logging into the server's webpage to call the API interface for the target application. This API key is then embedded in the target application, and it is included in every SDK interface call made by the target application. Additionally, the user can request the server to allocate a allowed number of calls to the detection interface for the target application, which can be the daily limit for calls to the detection interface. The device certificate for the terminal device is generated before the terminal device leaves the factory. A public-private key pair is generated for each terminal device, and the public key is signed with the manufacturer's root certificate (root_cert) to form the terminal device's device certificate (cert). At the time of device shipment, the public-private key and the device certificate (cert) are written into the storage of the Trusted Execution Environment (TEE). The TEE ensures that it is not interfered with by the conventional operating system.

[0026] Furthermore, when an application calls the file system detection interface, the interface can be invoked according to the target application's current usage scenario. This interface can be called in any usage scenario of the target application. For example, if the target application is a finance-related application, the interface would be called when a user is using the application's money transfer function.

[0027] For a file system, which contains multiple files, before the file system image is installed on the terminal device, the name of each file in the critical partition image such as boot and system can be recorded, and the hash value of each directory name and file name can be calculated using the SHA256 function. The correspondence between the file name, the hash corresponding to each file name, the directory, the hash corresponding to the directory name, the correspondence between the file name and the hash corresponding to each file name, and the correspondence between the directory and the hash corresponding to the directory name is stored to form a comparison database for subsequent integrity detection of the target file.

[0028] In one possible implementation, the call request includes a permission identifier for the detection interface, and calling the detection interface includes: calling the detection interface if the permission identifier is valid and the number of times the detection interface has been called has not exceeded a first threshold.

[0029] Specifically, the server assigns access to the detection interface to the target application. When the target application calls the detection interface, the server checks whether the permission identifier carried in the call request initiated by the target application is valid. If invalid, the server returns a permission error feedback message to the target application. If valid, the server continues to check whether the number of times the target application has called the detection interface exceeds the allowed number of calls. If it exceeds the allowed number, the server returns a feedback message indicating that the number of calls has exceeded the allowed number. If it does not exceed the allowed number, the server calls the detection interface. The allowed number of calls can be set according to the actual needs of the target application, and this embodiment does not limit it. Therefore, the detection interface is only called when the permission identifier is valid and the number of times the detection interface has been called does not exceed a first threshold, which improves the security and reliability of the integrity detection of target files in the file system and further avoids the problem of file system performance degradation caused by frequent interface calls.

[0030] Step S103: Determine the target file in the file system based on the application data of the target application through the detection interface.

[0031] Specifically, application data includes, but is not limited to, usage scenario data of the target application and application cache data. Usage scenario data of the target application includes, but is not limited to, data on the application functions currently being used by the user. For example, when a user is currently using the transfer function of a financial application, the usage scenario data for that financial application would be data related to the transfer function, such as the transfer account, transfer password, and transfer amount. The target file can be at least one file in the file system related to the target application.

[0032] Step S105: Determine the integrity of the target file in the file system based on the M first file identifier information and the second file identifier information of the target file.

[0033] Specifically, the first file identification information includes: the file identifiers corresponding to all files in the file system before the image is installed on the electronic device; the second file identification information includes: the file identifiers corresponding to the target file after the file system image is installed on the electronic device.

[0034] Understandably, file identification includes, but is not limited to, the file name and its hash value. The integrity of a target file in the file system can be determined using its file name and hash value. Specifically, the corresponding file is searched for in the aforementioned database based on the target file's name. If the file is not found, it indicates that the target file does not belong to the file in the file system image, and a feedback result is returned to the target application. If the file is found, but the hash value of the target file's name does not match the hash value of that file in the database, it indicates that the target file has been modified, and a feedback result is returned to the target application.

[0035] The technical solution disclosed in this application's embodiments ensures that the integrity of the target file in the file system is determined only after the target application initiates a call request to the file system's detection interface. Opening any file in the file system will not trigger the integrity detection function of the target file in the file system, thus avoiding the problem of file system performance degradation.

[0036] In one possible implementation, after determining the integrity of the target file in the file system based on M first file identification information and the second file identification information of the target file, the determination method further includes: feeding back the integrity result of the target file in the file system to the target application.

[0037] The integrity results include, but are not limited to, the target file being a file in a file system image, the hash value of the target file's filename matching the hash value of the corresponding file in the comparison database, the target file not being a file in a file system image, and the hash value of the target file not matching the hash value of the corresponding file in the comparison database.

[0038] After confirming the integrity of the target file in the file system, the integrity result is fed back to the target application so that the target application can understand the integrity status of the files in the file system and thus perform subsequent operations accordingly. For example, if the target file is incomplete, the current function of the target application can be prohibited from continuing or its execution can be controlled. If the target file is complete, the current function of the target application can continue to execute. For example, a financial application might call a detection interface to determine the integrity of the target file before performing a transfer function; if the target file is incomplete, the transfer function should be prohibited.

[0039] Figure 2 This diagram illustrates a flowchart of a method for determining file integrity in a file system according to an embodiment of this application. The execution entity of this method can be a server, which can be an independent server or a server cluster composed of multiple servers. Furthermore, the server can be a server capable of determining the integrity of files in the file system. Figure 2 As shown, the method may include the following steps.

[0040] Step S201: Upon receiving a request to call the file system detection interface, if the request is initiated by the target application, then the detection interface is called.

[0041] Step S203: Through the detection interface, randomly select a target number of target files from the files in the file system based on the usage scenario data of the target application; or, through the detection interface, select a first number of first target files from the files in the file system based on the usage scenario data of the target application, and randomly select a second number of second target files from the files in the file system, wherein the first target file is a key file corresponding to the usage scenario data, and the target files include the first target file and the second target file.

[0042] Specifically, this can be achieved by traversing the file directories of the file system, such as the boot directory and the system directory, recording the name of each directory and each file, as well as the hash corresponding to each directory name and the hash corresponding to each file name, to form a file list, such as list=<file,hash> This file list includes directory information of the file directory and file identification information of the files in the file directory. The file identification information includes, but is not limited to, the file name and the hash value of the file name. The TEE's random detection security program (TA) determines the target number of target files from the file list. The target number of target files and the file identification information of the target number of target files form a list of records to be detected. The target number can be set to any value, such as 50, 100, etc. The first number and the second number are added together to equal the target number.

[0043] One approach involves the Task Force (TA) randomly selecting a target number of files from the file system. Due to the TA's security, malware or users cannot know in advance which files the TA will select, thus preventing pre-forging of target files and enhancing their security. Alternatively, the TA can select a first number of target files from the file system and a second number of randomly selected target files from the same file system. This allows for target file selection to suit different usage scenarios of the target application, while also preventing tampering and further improving security. Target applications include, but are not limited to, financial, shopping, and social applications. Different application types correspond to different usage scenarios; for example, for financial applications, usage scenarios include, but are not limited to, money transfers, payments, and repayments.

[0044] Step S205: Determine the integrity of the target file in the file system based on the M first file identifier information and the second file identifier information of the target file.

[0045] It is worth noting that steps S201 and S205 have the same or similar implementation as steps S101 and S105 described above. The similarities can be referred to each other, and the embodiments of this application will not be repeated here.

[0046] The technical solution disclosed in this application ensures that integrity checks on target files in the file system are only performed after the target application initiates a call request to the file system's detection interface. Opening any file in the file system will not trigger integrity checks on target files, thus avoiding performance degradation issues. Furthermore, by selecting a target number of target files and performing integrity checks on them, network traffic consumption can be reduced when the terminal device transmits the target number of target files.

[0047] Figure 3 This diagram illustrates a flowchart of a method for determining file integrity in a file system according to an embodiment of this application. The execution entity of this method can be a server, which can be an independent server or a server cluster composed of multiple servers. Furthermore, the server can be a server capable of determining the file integrity of the file system. Figure 3 As shown, the method may include the following steps.

[0048] Step S301: Upon receiving a request to call the file system detection interface, if the request is initiated by the target application, then the detection interface is called.

[0049] Step S303: Determine the target file in the file system based on the application data of the target application through the detection interface.

[0050] Step S304: Sign the file list formed by the target file and the second file identification information of the target file using the private key of the terminal device to obtain the signature value of the file list.

[0051] Specifically, the TA can use the private key of the terminal device stored in the TEE to sign the target file and the file list formed by the target file's second file identification information, obtaining a signature value. After signing, malicious software or users cannot add, delete, or modify the target file, thereby improving the security of the target file.

[0052] Step S305: Verify the signature value using the public key of the terminal device. If the signature value verification passes, determine the integrity of the target file in the file system based on the M first file identification information and the second file identification information of the target file.

[0053] It is worth noting that steps S301, S303 and S305 have the same or similar implementation as steps S101 to S105 described above. The similarities can be referred to each other, and the embodiments of this application will not be repeated here.

[0054] The technical solution disclosed in this application ensures that the integrity of the target file in the file system is determined only after the target application initiates a call request to the file system's detection interface. Opening any file in the file system will not trigger the integrity detection function of the target file, thus avoiding performance degradation issues. Furthermore, after signing, malicious software or users cannot add, delete, or modify the target file, thereby improving the security of the target file.

[0055] In one possible implementation, the permission identifier, the device certificate of the terminal device, and the number of times the detection interface has been called carried in the call request are verified. The signature value is verified by the public key of the terminal device. If the permission identifier, the number of times the interface has been called, and the device certificate have all been verified, and the signature value has been verified, the integrity of the target file in the file system is determined based on M first file identifier information and second file identifier information of the target file.

[0056] Specifically, the server can verify the validity of the permission identifier (apikey) in the call request. If the permission identifier is valid, it then checks whether the number of times the detection interface has been called exceeds the allowed number of calls. If the permission identifier is invalid, it sends a message to the target application indicating that the permission identifier is invalid. If the number of times the detection interface has been called does not exceed the allowed number of calls, the server verifies whether the terminal device's certificate is signed and issued by the root certificate. If the number of times the detection interface has been called exceeds the allowed number of calls, it sends a message to the target application indicating that the number of times the detection interface has been called exceeds the allowed number of calls. If the terminal device's certificate is signed and issued by the root certificate, it verifies the signature value using the terminal device's public key stored in the TEE. If the terminal device's certificate is not signed and issued by the root certificate, it sends a message to the target application indicating that the root certificate verification failed.

[0057] If the signature verification passes, the system iterates through the target file and its filename, searching the database for a file corresponding to that filename. If no file is found, it indicates that the target file does not belong to the file in the file system image, and a response is returned to the target application. If a file is found, but its hash value does not match the hash value of that file in the database, it indicates that the target file has been modified, and a response is returned to the target application. If the signature verification fails, the system sends a message indicating that the signature verification failed to the target application.

[0058] The technical solution disclosed in this application ensures that the integrity of a target file in the file system is determined only after the target application initiates a call request to the file system's detection interface. Opening any file in the file system will not trigger the integrity detection function of the target file, thus avoiding performance degradation issues. Furthermore, after signing, malicious software or users cannot add, delete, or modify the target file, thereby improving its security.

[0059] Figure 4 This diagram illustrates a flowchart of a method for determining file integrity in a file system according to an embodiment of this application. The execution entity of this method can be a server, which can be an independent server or a server cluster composed of multiple servers. Furthermore, the server can be a server capable of determining the file integrity of the file system. Figure 4 As shown, the method may include the following steps.

[0060] Step S401: Upon receiving a request to call the file system detection interface, if the request is initiated by the target application, then the detection interface is called.

[0061] Step S403: Determine the target file in the file system based on the application data of the target application through the detection interface.

[0062] Step S405: If there is a first file identifier among the M first file identifiers that matches the second file identifier, determine that the target file is complete; or, if there is no first file identifier among the M first file identifiers that matches the second file identifier, determine that the target file is incomplete.

[0063] The first file identification information includes the first file name and the first hash value of the first file name; the second file identification information includes the second file name and the second hash value of the second file name; the matching of the first file identification information and the second file identification information includes: the first file name and the second file name match, and the first hash value and the second hash value match.

[0064] Specifically, the first filename is the filename of all files in the file system before the file system image was installed on the terminal device. The first hash value is the hash value corresponding to the filenames of all files in the file system before the file system image was installed on the terminal device. If the filename and hash value of the target file determined after the file system image was installed on the terminal device match the filename and hash value of the file before the file system image was installed on the terminal device, it indicates that the target file is complete and has not been tampered with after the file system image was installed on the terminal device. Furthermore, the target file is considered complete only if both the first and second filenames match, and the first and second hash values ​​match, resulting in a low false positive rate.

[0065] It is worth noting that steps S401 and S403 have the same or similar implementation as steps S101 to S103 described above. The similarities can be referred to each other, and the embodiments of this application will not be repeated here.

[0066] The technical solution disclosed in this application's embodiments ensures that the integrity of the target file in the file system is determined only after the target application initiates a call request to the file system's detection interface. Opening any file in the file system will not trigger the integrity detection function of the target file in the file system, thus avoiding the problem of file system performance degradation.

[0067] It should be noted that the file integrity determination method for a file system provided in this application embodiment can be executed by a file integrity determination device for a file system, or a control module within that file integrity determination device for executing the file integrity determination method for a file system. This application embodiment uses the execution of the file integrity determination method for a file system by a file integrity determination device as an example to illustrate the file integrity determination device for a file system provided in this application embodiment.

[0068] Figure 5This illustration shows a structural diagram of a file integrity determination device for a file system according to an embodiment of this application. The device 500 includes: a calling module 501, configured to call the detection interface if the call request is initiated by a target application upon receiving a call request for a file system detection interface; a first determining module 502, configured to determine a target file in the file system based on application data of the target application through the detection interface; and a second determining module 503, configured to determine the integrity of the target file in the file system based on M first file identification information and second file identification information of the target file; wherein the first file identification information includes: file identification information corresponding to all files in the file system before the file system image is installed on the electronic device; and the second file identification information includes: file identification information corresponding to the target file after the file system image is installed on the electronic device.

[0069] In this embodiment of the application, the integrity of the target file in the file system is only determined after the target application initiates a call request to the file system detection interface. Opening any file in the file system will not trigger the integrity detection function of the target file in the file system, thus avoiding the problem of file system performance degradation.

[0070] In one possible implementation, the first file identification information includes a first filename and a first hash value of the first filename, and the second file identification information includes a second filename and a second hash value of the second filename. The second determining module 503 is further configured to determine that the target file is complete if there is a first file identifier that matches the second file identifier among the M first file identification information; or, determine that the target file is incomplete if there is no first file identifier that matches the second file identifier among the M first file identification information. Wherein, matching the first file identification information with the second file identification information includes: the first filename and the second filename matching, and the first hash value and the second hash value matching.

[0071] In one possible implementation, the application data includes usage scenario data. The first determining module 502 is further configured to randomly select a target number of target files from the files in the file system based on the usage scenario data of the target application through a detection interface; or, through a detection interface, to select a first number of first target files from the files in the file system based on the usage scenario data of the target application, and to randomly select a second number of second target files from the files in the file system, wherein the first target file is a key file corresponding to the usage scenario data, and the target files include the first target file and the second target file.

[0072] In one possible implementation, it further includes: a signature module, used to sign the file list formed by the target file and the second file identification information of the target file using the private key of the terminal device, to obtain the signature value of the file list; and a second determination module, used to verify the signature value using the public key of the terminal device, and, if the signature value verification is successful, to determine the integrity of the target file in the file system based on the M first file identification information and the second file identification information of the target file.

[0073] One possible implementation also includes a feedback module, which provides feedback to the target application on the integrity results of the target file in the file system.

[0074] The file integrity determination device in the file system embodiments of this application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.

[0075] The file integrity determination device for the file system in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit it.

[0076] The file integrity determination device for the file system provided in this application embodiment can implement the various processes implemented in the above method embodiments, and will not be described again here to avoid repetition.

[0077] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0078] The electronic device 600 includes, but is not limited to, components such as: radio frequency unit 601, network module 602, audio output unit 603, input unit 604, sensor 605, display unit 606, user input unit 607, interface unit 608, memory 609, and processor 610.

[0079] Those skilled in the art will understand that the electronic device 600 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 610 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0080] The processor 610 is configured to, upon receiving a request to call the file system detection interface, invoke the detection interface if the request is initiated by the target application; through the detection interface, determine the target file in the file system based on the application data of the target application; and determine the integrity of the target file in the file system based on M first file identification information and second file identification information of the target file; wherein the first file identification information includes: the file identification information corresponding to all files in the file system before the image is installed on the electronic device; and the second file identification information includes: the file identification information corresponding to the target file after the image is installed on the electronic device.

[0081] The first file identification information includes a first filename and a first hash value of the first filename, and the second file identification information includes a second filename and a second hash value of the second filename. The processor 610 is further configured to determine that the target file is complete if there is a first file identifier that matches the second file identifier among the M first file identification information; or, determine that the target file is incomplete if there is no first file identifier that matches the second file identifier among the M first file identification information. Wherein, matching the first file identification information with the second file identification information includes: the first filename and the second filename matching, and the first hash value and the second hash value matching.

[0082] The application data includes usage scenario data. The processor 610 is also used to randomly select a target number of target files from the files in the file system based on the usage scenario data of the target application through the detection interface; or, based on the usage scenario data of the target application through the detection interface, to select a first number of first target files from the files in the file system and to randomly select a second number of second target files from the files in the file system, wherein the first target file is a key file corresponding to the usage scenario data, and the target files include the first target file and the second target file.

[0083] The processor 610 is also used to sign the file list formed by the target file and the second file identification information of the target file using the private key of the terminal device to obtain the signature value of the file list; to verify the signature value using the public key of the terminal device; and, if the signature value verification is successful, to determine the integrity of the target file in the file system based on the M first file identification information and the second file identification information of the target file.

[0084] The processor 610 is also used to provide feedback on the integrity results of the target files in the file system to the target application.

[0085] The radio frequency (RF) unit 601 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink data from the base station and processes it with the processor 610; additionally, it transmits uplink data to the base station. Typically, the RF unit 601 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, and a duplexer. Furthermore, the RF unit 601 can also communicate with networks and other devices via a wireless communication system.

[0086] The electronic device provides users with wireless broadband internet access through the network module 602, such as helping users send and receive emails, browse web pages, and access streaming media.

[0087] The audio output unit 603 can convert audio data received by the radio frequency unit 601 or the network module 602 or stored in the memory 609 into audio signals and output them as sound. The audio output unit 603 includes a speaker, a buzzer, and a receiver, etc.

[0088] It should be understood that, in the embodiments of this application, the input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042. The graphics processing unit 6041 processes image data of still pictures or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode.

[0089] The display unit 606 may include a display panel 6061, which may be configured using a liquid crystal display, an organic light-emitting diode, or other similar means. The user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touchscreen. The touch panel 6071 may include a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here. The memory 609 can be used to store software programs and various data, including but not limited to application programs and the operating system. The processor 610 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and application programs, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 610.

[0090] The electronic device 600 also includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 8061 according to the ambient light level, and the proximity sensor can turn off the display panel 8061 and / or the backlight when the electronic device 600 is moved to the ear.

[0091] The display unit 606 is used to display information input by the user or information provided to the user (such as displaying a summary). The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0092] User input unit 607 can be used to receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device. Specifically, user input unit 607 includes touch panel 6071 and other input devices 6072. Touch panel 6071, also known as a touch screen, can collect touch operations on or near the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 6071).

[0093] The touch panel 6071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 610. The processor 610 receives commands and executes them. Furthermore, the touch panel 6071 can be implemented using various types of touch sensors, such as resistive, capacitive, infrared, and surface acoustic wave sensors. In addition to the touch panel 6071, the user input unit 607 may also include other input devices 6072. Specifically, other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be elaborated further here.

[0094] Furthermore, the touch panel 6071 can cover the display panel 6061. When the touch panel 6071 detects a touch operation on or near it, it transmits the information to the processor 610 to determine the type of touch event. Subsequently, the processor 610 provides corresponding visual output on the display panel 6061 based on the type of touch event. Although in Figure 6 In this embodiment, the touch panel 6071 and the display panel 6061 are two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 6071 and the display panel 6061 can be integrated to realize the input and output functions of the electronic device. The specific implementation is not limited here.

[0095] Interface unit 608 serves as an interface for connecting external devices to electronic device 600. For example, external devices may include a wired or wireless headphone port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface unit 608 can be used to receive input from external devices (e.g., data, power, etc.) and transmit the received input to one or more components within electronic device 600, or it can be used to transmit data between electronic device 600 and external devices.

[0096] The memory 609 can be used to store software programs and various data. The memory 609 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 609 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0097] The processor 610 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 609, and by calling data stored in the memory 609, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. The processor 610 may include one or more processing units; preferably, the processor 610 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 610.

[0098] Optionally, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a program or instructions stored in the memory 702 and executable on the processor 701. When the program or instructions are executed by the processor 701, they implement the various processes of the above-described method embodiment for determining the file integrity of the file system and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0099] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.

[0100] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described method embodiment for determining the file integrity of the file system and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0101] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0102] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described method embodiment for determining the file integrity of the file system, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0103] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0104] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0105] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0106] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method of determining the integrity of a file of a file system, characterized by, The determination method includes: Upon receiving a request to call the file system detection interface, if the request is initiated by the target application, the detection interface is called, wherein the detection interface is an API provided by the SDK for the file system, and the request includes the permission identifier of the detection interface. The target file in the file system is determined based on the application data of the target application through the detection interface. The integrity of the target file in the file system is determined based on M first file identifiers and the second file identifier of the target file; The first file identification information includes: the file identifiers corresponding to all files in the file system before the image is installed on the terminal device; the second file identification information includes: the file identifiers corresponding to the target file after the image is installed on the terminal device. The system provides feedback to the target application regarding the integrity results of the target file in the file system.

2. The method of determining file integrity of a file system according to claim 1, wherein, The first file identification information includes a first filename and a first hash value of the first filename; the second file identification information includes a second filename and a second hash value of the second filename; determining the integrity of the target file in the file system based on the M first file identification information and the second file identification information of the target file includes: If among the M first file identifiers, there is a first file identifier that matches the second file identifier, the target file is determined to be complete. Alternatively, if none of the M first file identifiers match the second file identifier, the target file is determined to be incomplete. The matching of the first file identification information with the second file identification information includes: the first file name and the second file name matching, and the first hash value and the second hash value matching.

3. The method for determining file integrity in a file system according to claim 1, characterized in that, The application data includes usage scenario data. Determining the target file in the file system based on the application data of the target application through the detection interface includes: Based on the usage scenario data of the target application, a target number of target files are randomly selected from the files in the file system through the detection interface. Alternatively, through the detection interface, based on the usage scenario data of the target application, a first number of first target files are selected from the files of the file system, and a second number of second target files are randomly selected from the files of the file system, wherein the first target file is a key file corresponding to the usage scenario data, and the target files include the first target file and the second target file.

4. The method for determining file integrity in a file system according to claim 1, characterized in that, After determining the target file in the file system based on the application data of the target application through the detection interface, the determination method further includes: The file list formed by the target file and the second file identification information of the target file is signed using the private key of the terminal device to obtain the signature value of the file list; The step of determining the integrity of the target file in the file system based on M first file identifiers and the second file identifier of the target file includes: The signature value is verified using the public key of the terminal device. If the signature value verification passes, the integrity of the target file in the file system is determined based on M first file identifier information and the second file identifier information of the target file.

5. A device for determining file integrity in a file system, characterized in that, include: The calling module is used to call the detection interface when a call request for the file system detection interface is received, if the call request is initiated by the target application, wherein the detection interface is an API provided by the SDK for the file system, and the call request includes the permission identifier of the detection interface. The first determining module is used to determine the target file in the file system based on the application data of the target application through the detection interface; The second determining module is used to determine the integrity of the target file in the file system based on M first file identification information and the second file identification information of the target file; The first file identification information includes: the file identifiers corresponding to all files in the file system before the image is installed to the terminal device; the second file identification information includes: the file identifier corresponding to the target file after the file system is installed to the terminal device. The feedback module is used to provide feedback to the target application on the integrity result of the target file in the file system.

6. The file integrity determination apparatus for a file system as described in claim 5, characterized in that, The first file identification information includes a first filename and a first hash value of the first filename; the second file identification information includes a second filename and a second hash value of the second filename. The second determining module is further configured to determine that the target file is complete if there is a first file identifier that matches the second file identifier among the M first file identifiers; Alternatively, if none of the M first file identifiers match the second file identifier, the target file is determined to be incomplete. The matching of the first file identification information with the second file identification information includes: the first file name and the second file name matching, and the first hash value and the second hash value matching.

7. The file integrity determination apparatus for a file system as described in claim 5, characterized in that, The application data includes usage scenario data. The first determining module is also used to randomly select a target number of target files from the files of the file system based on the usage scenario data of the target application through the detection interface. Alternatively, through the detection interface, based on the usage scenario data of the target application, a first number of first target files are selected from the files of the file system, and a second number of second target files are randomly selected from the files of the file system, wherein the first target file is a key file corresponding to the usage scenario data, and the target files include the first target file and the second target file.

8. The file integrity determination apparatus of the file system as described in claim 5, characterized in that, Also includes: The signature module is used to sign the target file and the file list formed by the second file identification information of the target file using the private key of the terminal device, so as to obtain the signature value of the file list; The second determining module is further configured to verify the signature value using the public key of the terminal device, and if the signature value verification passes, determine the integrity of the target file in the file system based on M first file identifier information and the second file identifier information of the target file.

9. An electronic device, characterized in that, The system includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for determining the file integrity of the file system as described in any one of claims 1-4.