Application program dynamic upgrade method, generation method, device and electronic device
By verifying the source of the patch library and the trustworthiness in memory during application runtime, the security and reliability issues of application upgrades in existing technologies are resolved, enabling secure and reliable dynamic upgrades without interrupting the application.
Patent Information
- Application Number
- CN202110994054.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-27
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2041-08-27
AI Technical Summary
Existing technologies lack sufficient security and reliability for application upgrades, especially when updating during uninterrupted service, which raises concerns about code security and reliability.
During the target application's runtime, an upgrade signal is received, the patch library is read and its source is verified to be trustworthy, and after dynamic upgrade, the trustworthiness of the patch library in memory is verified again. The security and reliability of the upgrade process are ensured through pre-defined callback functions and signature technology.
It enables trusted dynamic upgrades without interrupting applications, ensuring the security and reliability of the upgrade process, preventing the illegal replacement of patch libraries, and guaranteeing the security and reliability of the upgraded application.
Smart Images

Figure CN113672272B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, method, apparatus, and electronic device for dynamically upgrading applications. Background Art
[0002] With the development of information technology, application service providers offer a wide variety of specialized services. Some service providers, such as game service providers, email service providers, internet service providers, and cloud service providers, need to provide 24 / 7 uninterrupted service. Most application services require periodic maintenance, backend service upgrades, and bug and defect fixes. Taking game services as an example, new games often encounter problems in their initial launch phase. The solution is often to restart the service, which impacts user experience and game performance data.
[0003] For uninterrupted application service updates, many hot-patching technologies such as Over-the-Air (OTA) and Live Updates exist to enable dynamic updates. However, these technologies often have security vulnerabilities and cannot guarantee the security and reliability of the code. Summary of the Invention
[0004] The purpose of this application is to provide a method, method, apparatus, and electronic device for dynamic application upgrades, thereby solving the security and reliability issues of application upgrades in the prior art.
[0005] In a first aspect, embodiments of this application provide a method for dynamically upgrading an application, including:
[0006] If an upgrade signal is received during the execution of the target application, read the patch library at the target location;
[0007] Verify the credibility of the patch library's source;
[0008] If the source of the patch library is trustworthy, the target application is dynamically upgraded based on the patch library;
[0009] After the target application is dynamically upgraded, the first function is called for the first time to verify whether the patch library in memory is trustworthy;
[0010] If the patch library in memory is trusted, the first function is invoked, whereby the first function is the function updated by the target application according to the patch library.
[0011] Optionally, verifying the trustworthiness of the source of the read patch library includes:
[0012] The patch library is parsed to obtain the signature value in the patch library;
[0013] The signature value is decrypted using the built-in public key to obtain the first feature value;
[0014] Calculate the second feature value of the patch library;
[0015] If the first feature value matches the second feature value, the source of the patch library is determined to be trustworthy, and the first feature value is saved in a secure storage area.
[0016] Optionally, verifying the trustworthiness of the patch library in memory includes:
[0017] The third characteristic value of the patch library is calculated based on the starting address and length of the patch library in memory;
[0018] If the third feature value is determined to be consistent with the first feature value stored in the secure storage area, the patch library in memory is determined to be trustworthy.
[0019] Optionally, dynamically upgrading the target application based on the patch library includes:
[0020] Display the loading of the patch library;
[0021] Obtain the address of the dynamic update function from the patch library;
[0022] The target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function.
[0023] Optionally, the target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function, including:
[0024] In the dynamic update function, the address of the original function and the address of the target function corresponding to the address of the original function are dynamically searched.
[0025] If the original function corresponding to the original function address is not called, the original function address will be dynamically updated to the target function address.
[0026] Secondly, embodiments of this application also provide an application generation method, comprising:
[0027] Generate a patch library for application upgrades;
[0028] A callback function is pre-defined in the application code according to the preset interface specification. The callback function is used to read the patch library.
[0029] Optionally, a patch library for upgrading the application is generated, including:
[0030] The dynamic update function is set according to the preset interface specification, and the dynamic update function includes the correspondence between the original function address and the target function address;
[0031] Compile the patch library;
[0032] The feature values of the patch library are signed to generate a signature value, which is used to verify whether the source of the patch library is trustworthy.
[0033] Optionally, the feature values of the patch library are signed to generate a signature value, including:
[0034] The signature value is generated by signing the feature value of the patch library with a private key using a signing tool.
[0035] The signature value is written into the ELF portion of the executable linkable file format of the patch library.
[0036] Optionally, the method further includes:
[0037] A signal handling function is set in the application's code, which is used to call the callback function when an upgrade signal is received.
[0038] Thirdly, embodiments of this application also provide an electronic device, including: a transceiver, a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the application dynamic upgrade method as described in the first aspect, or the application generation method as described in the second aspect.
[0039] Fourthly, embodiments of this application also provide an application dynamic upgrade device, comprising:
[0040] The read module is used to read the patch library at the target location when an upgrade signal is received during the execution of the target application.
[0041] The first verification module is used to verify whether the source of the patch library is trustworthy;
[0042] An upgrade module is used to dynamically upgrade the target application based on the patch library, provided that the source of the patch library is trustworthy.
[0043] The second verification module is used to verify whether the patch library in memory is trustworthy when the first function is called for the first time after the target application is dynamically upgraded.
[0044] The calling module is used to invoke the first function, which is the function updated by the target application according to the patch library, provided that the patch library in memory is trusted.
[0045] Fifthly, embodiments of this application also provide an application generation apparatus, comprising:
[0046] The generation module is used to generate patch libraries for application upgrades;
[0047] The first setting module is used to pre-set callback functions in the application code according to a preset interface specification. The callback functions are used to read the patch library.
[0048] In a sixth aspect, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the application dynamic upgrade method as described in the first aspect, or the application generation method as described in the second aspect.
[0049] The above-mentioned technical solution of this application has at least the following beneficial effects:
[0050] The application dynamic upgrade method of this application embodiment first reads the patch library at the target location when an upgrade signal is received during the operation of the target application; second, it verifies whether the source of the patch library is trustworthy; third, if the source of the patch library is trustworthy, it dynamically upgrades the target application according to the patch library; thus, it achieves a trustworthy dynamic upgrade without interrupting the target application, ensuring the security of the upgrade process; then, after the target application is dynamically upgraded, when the first function is called for the first time, it verifies whether the patch library in memory is trustworthy; finally, if the patch library in memory is trustworthy, it calls the first function, which is the function updated by the target application according to the patch library. This verifies the trustworthiness of the patch library in memory before the first call to the updated function, avoiding the phenomenon of the patch library being illegally replaced after verifying the source of the patch library during the upgrade process, thus ensuring the security and reliability of the upgrade. Attached Figure Description
[0051] Figure 1 This is one of the flowcharts illustrating the application dynamic upgrade method according to an embodiment of this application;
[0052] Figure 2 This is a second flowchart illustrating the application dynamic upgrade method according to an embodiment of this application;
[0053] Figure 3 This is a flowchart illustrating the application generation method according to an embodiment of this application.
[0054] Figure 4 This is a schematic diagram of the structure of the application dynamic upgrade device according to an embodiment of this application;
[0055] Figure 5 This is a schematic diagram of the structure of the application generation apparatus according to an embodiment of this application;
[0056] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0057] To make the technical problems, technical solutions, and advantages of this application clearer, a detailed description will be provided below in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as particular configurations and components are provided merely to aid in a comprehensive understanding of the embodiments of this application. Therefore, those skilled in the art should understand that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Furthermore, for clarity and brevity, descriptions of known functions and structures have been omitted.
[0058] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0059] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0060] In the embodiments provided in this application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0061] like Figure 1 The diagram shown is one of the flowcharts illustrating a dynamic application upgrade method according to an embodiment of this application. The method includes:
[0062] Step 101: If an upgrade signal is received during the operation of the target application, read the patch library at the target location;
[0063] In this step, the upgrade signal can be sent by a third-party application. The third-party application can be software developed by the user to upgrade the application. When the application needs to be upgraded, the third-party application sends an upgrade signal to the application that needs to be upgraded.
[0064] Step 102: Verify whether the source of the patch library is trustworthy;
[0065] It should be noted that during the creation of the patch library, the relevant content of the patch library can be signed with a private key. In this way, the target application can decrypt the signature to determine whether the source of the patch library is trustworthy.
[0066] Step 103: If the source of the patch library is trustworthy, dynamically upgrade the target application according to the patch library.
[0067] Step 104: After the target application is dynamically upgraded, when the first function is called for the first time, verify whether the patch library in memory is trustworthy;
[0068] In this step, before the first call to the updated function after the target application is upgraded, the trustworthiness of the patch library mapped to memory needs to be verified. This prevents a "hacker" from maliciously replacing a trusted patch library after the source of the patch library has been verified during the upgrade process, thus ensuring the security and reliability of the target application after the upgrade.
[0069] Step 105: If the patch library in memory is trustworthy, call the first function, which is the function updated by the target application according to the patch library.
[0070] In the application dynamic upgrade method of this application embodiment, firstly, when an upgrade signal is received during the operation of the target application, a patch library at the target location is read; secondly, the source of the patch library is verified as trustworthy; thirdly, if the source of the patch library is trustworthy, the target application is dynamically upgraded according to the patch library; thus, a trustworthy dynamic upgrade is achieved without interrupting the target application, ensuring the security of the upgrade process; then, after the target application is dynamically upgraded, when the first function is called for the first time, the trustworthiness of the patch library in memory is verified; finally, if the patch library in memory is trustworthy, the first function is called, whereby the first function is the function updated by the target application according to the patch library. Thus, the trustworthiness of the patch library in memory is verified before the first call to the updated function, avoiding the phenomenon of the patch library being illegally replaced after verifying the source of the patch library during the upgrade process, ensuring the security and reliability of the upgraded application.
[0071] Here, it should be noted that in step 101, when an upgrade signal is received during the execution of the target application, the patch library in the target location is read. Specifically, this can be done as follows:
[0072] Upon receiving an upgrade signal, in response to the upgrade signal, the patch library at the target location is read by calling a callback function pre-defined in the target application;
[0073] Specifically, this step involves, after receiving the upgrade signal, using the set upgrade signal processing function to call the callback function to read the patch library at the target location. The callback function can be trust_update_func(), and the callback function is pre-defined in the target application's code according to a unified interface specification.
[0074] It should be noted that after the patch library is created, it will be placed in a specified directory, so that the target application can read the patch library in the predetermined directory; the patch library can be a dynamically loadable patch library.
[0075] As an optional implementation, step 103 verifies the credibility of the source of the read patch library, including:
[0076] The patch library is parsed to obtain the signature value in the patch library;
[0077] In this step, the signature value can be obtained from the parsing result of the Executable and Linkable Format (ELF) section of the patch library; specifically, the signature value can be obtained by using a signing tool to sign the feature value of the patch library with a private key during the patch library creation process. The feature value of the patch library is a hash value calculated based on the patch library file.
[0078] The signature value is decrypted using the built-in public key to obtain the first feature value;
[0079] Calculate the second feature value of the patch library; specifically, this step involves reading the patch library file from the hard disk and calculating the hash value of the patch library.
[0080] If the first feature value matches the second feature value, the source of the patch library is determined to be trustworthy, and the first feature value is saved in a secure storage area.
[0081] In this step, if the first feature value is consistent with the second feature value, it is determined that the signature value of the patch library has been successfully verified, that is, the source of the patch library is trustworthy.
[0082] When the first and second signature values are confirmed to be consistent, the source of the patch library is deemed trustworthy. Thus, the first signature value obtained from parsing the signature value can be stored in a secure storage area. This ensures that the patch library has not been illegally replaced when the updated function is called for the first time during the upgrade process, thereby ensuring the security and reliability of the target application after the upgrade.
[0083] In this optional implementation, the first feature value obtained by parsing the signature value is compared with the second feature value calculated based on the patch library obtained from the hard disk to determine whether the source of the patch library is trustworthy. In this way, the source of the patch library can be guaranteed to be trustworthy, thereby ensuring the security and reliability of the target application upgrade process.
[0084] Furthermore, as an optional implementation, verifying the trustworthiness of the in-memory patch library includes:
[0085] The third characteristic value of the patch library is calculated based on the starting address and length of the patch library in memory;
[0086] It should be noted that after the target application upgrade is complete, the patch library will be mapped into memory by the target application. Thus, when the first function updated during the upgrade process is called for the first time, the hash value (third characteristic value) of the patch library can be calculated by using the starting address and length of the memory mapping of the patch library.
[0087] If the third feature value is determined to be consistent with the first feature value stored in the secure storage area, the patch library in memory is determined to be trustworthy.
[0088] In this optional implementation, when it is determined that the third feature value is consistent with the first feature value stored in the secure storage area, it is determined that the memory-mapped patch library is the same as the patch library used during the target application upgrade. In this way, it can be determined that after verifying the legality of the patch library's source, the patch library has not been illegally replaced. Thus, the security and reliability of the target application during and after the upgrade process can be ensured.
[0089] As an optional implementation, step 104, dynamically upgrading the target application according to the patch library, includes:
[0090] Explicitly load the patch library; this step can specifically involve explicitly loading the patch library by calling the dlopen function.
[0091] Obtain the address of the dynamic update function from the patch library;
[0092] The target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function.
[0093] In this step, the dynamic update function can be identified as dynamic_update. The dynamic_update function enumerates the names of the old and new functions that need to be replaced, as well as the code implementation of the new function. The target application dynamically replaces the old and new functions by calling the dynamic_update function in the patch library, thereby achieving dynamic upgrade of the target application.
[0094] As a specific implementation, the target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function, including:
[0095] In the dynamic update function, the address of the original function and the address of the target function corresponding to the address of the original function are dynamically searched.
[0096] If the original function corresponding to the original function address is not called, the original function address will be dynamically updated to the target function address.
[0097] In this specific implementation, the original function address is dynamically updated to the target function address only when the original function corresponding to the original function address is not called. In this way, the dynamic updating of functions is achieved without interrupting the target application.
[0098] Next, combine Figure 2 The process of the application dynamic upgrade method according to the embodiments of this application will be described as follows:
[0099] Step 201: Receive the USER1 signal sent by the third-party application, that is, receive the upgrade signal sent by the third-party application;
[0100] Step 202: Use the set signal processing function to call the threshold callback function trust_update_func() to read the patch library at the target location;
[0101] Step 203: Parse the patch library and obtain the signature value;
[0102] Step 204: Verify the feature value obtained by decrypting the signature value; that is, compare the feature value obtained by decrypting the signature value with the signature value calculated based on the patch library to verify the feature value obtained by decrypting the signature value; if the verification is successful, proceed to step 206; if the verification fails, proceed to step 205.
[0103] Step 205: Abort the upgrade;
[0104] Step 206: Call the dlopen function to explicitly load the patch library and store the decrypted feature value in the secure storage area;
[0105] Step 207: Locate the address of the update function dynamic_update() in the patch library;
[0106] Step 208: Call dynamic_update() to replace the old function with the new one, completing the application upgrade;
[0107] Step 209: Before calling the new function, calculate the characteristic value of the patch library based on the starting address and length of the patch library mapped in memory;
[0108] Step 210: Compare whether the calculated feature value is consistent with the feature value stored in the secure storage area. If they are consistent, proceed to step 211; if they are inconsistent, proceed to step 212.
[0109] Step 211, call the new function;
[0110] Step 212: Prevent new function calls.
[0111] The application dynamic upgrade method of this application embodiment firstly reads the patch library at the target location when an upgrade signal is received during the target application's operation; secondly, it verifies the trustworthiness of the patch library's source; thirdly, if the patch library's source is trustworthy, it dynamically upgrades the target application based on the patch library. This allows for the dynamic replacement of functions in the target application without interrupting its operation, and the use of trusted computing technology ensures the security and reliability of the replacement process. Then, after the application upgrade, when the updated function is called for the first time, a feature value is calculated based on the starting address and length of the patch library obtained from memory and compared with the feature value stored in the secure storage area to further verify the patch library's trustworthiness. Finally, if the patch library in memory is trustworthy, the first function, which is the updated function of the target application based on the patch library, is called. This ensures the reliability and security of the upgraded application. Ultimately, this method achieves a secure and reliable application upgrade in a simple, safe, and reliable manner without affecting system performance, and can be widely applied in multiple fields such as network servers, industrial control, computing, and data centers.
[0112] like Figure 3 As shown in the embodiments of this application, an application generation method is also provided, including:
[0113] Step 301: Generate a patch library for upgrading the application; in this step, the patch library is a dynamically linkable patch library.
[0114] Step 302: Pre-set a callback function in the application code according to the preset interface specification. The callback function is used to read the patch library.
[0115] The application generation method of this application embodiment first generates a patch library for upgrading the application, and then pre-sets a callback function for reading the patch library in the application code according to a preset interface specification. In this way, the application can be dynamically upgraded by reading the patch library without interrupting the application.
[0116] It should be noted here that the preset interface specification is a set of rules that both the application and the patch library must follow. For example, the preset interface specification may include the storage location of the patch library, the specific parameters passed to the application's callback function, etc., but it is not limited to these. By making both the application and the patch library conform to the requirements of the preset interface specification, the application can be upgraded without interruption based on the patch library.
[0117] As an optional implementation, step 301 generates a patch library for upgrading the application, including:
[0118] The dynamic update function is set according to the preset interface specification. The dynamic update function includes the correspondence between the original function address and the target function address. That is to say, the development of the patch library must implement the dynamic update function dynamic_update() according to the unified interface specification. In the function dynamic_update(), the dynamic lookup and replacement of function addresses such as funcA to new_funcA, funcB to new_funcB, funcC to new_funcC, etc. in the target application are implemented.
[0119] The patch library is compiled; in this step, the code of the patch library is compiled into a dynamically loadable patch library patch.so;
[0120] The feature values of the patch library are signed to generate a signature value, which is used to verify whether the source of the patch library is trustworthy.
[0121] In this optional implementation, during the generation of the patch library, the feature value is signed, and the feature value of the patch library is obtained by parsing the signature during and after the application upgrade. This verifies whether the source of the patch library is trustworthy, thus ensuring the security and reliability of the application upgrade process and after the upgrade.
[0122] It should be noted that after generating the patch library, the patch library is placed in a specified directory so that the application can read the patch library from the specified directory according to the pre-defined convention, thereby upgrading the application.
[0123] As a specific implementation, the feature values of the patch library are signed to generate a signature value, including:
[0124] The signature value is generated by signing the feature value of the patch library with a private key using a signing tool.
[0125] The signature value is written into the ELF portion of the executable linkable file format of the patch library.
[0126] Furthermore, as an optional implementation, the method also includes:
[0127] A signal handling function is set in the application's code, which is used to call the callback function when an upgrade signal is received.
[0128] By setting a processing function in the application, after the application receives an upgrade signal, the set signal processing function calls a preset callback function to read the patch library at the target location, thereby enabling dynamic upgrade of the target application.
[0129] like Figure 4 As shown in the illustration, this application embodiment also provides an application dynamic upgrade device, including:
[0130] The reading module 401 is used to read the patch library at the target location when an upgrade signal is received during the operation of the target application.
[0131] The first verification module 402 is used to verify whether the source of the patch library is trustworthy;
[0132] Upgrade module 403 is used to dynamically upgrade the target application based on the patch library, provided that the source of the patch library is trustworthy;
[0133] The second verification module 404 is used to verify whether the patch library in memory is trustworthy when the first function is called for the first time after the target application is dynamically upgraded.
[0134] Module 405 is used to invoke the first function, which is the function updated by the target application according to the patch library, if the patch library in memory is trusted.
[0135] The application dynamic upgrade device of this application embodiment firstly reads the patch library at the target location when the target application receives an upgrade signal during its operation. Secondly, the first verification module 402 verifies whether the source of the patch library is trustworthy. Thirdly, if the source of the patch library is trustworthy, the upgrade module 403 dynamically upgrades the target application according to the patch library. In this way, a trustworthy dynamic upgrade of the target application is achieved without interrupting the target application, ensuring the security of the upgrade process. Then, after the target application is dynamically upgraded, the second verification module 404 verifies whether the patch library in memory is trustworthy when the first function is called for the first time. Finally, if the patch library in memory is trustworthy, the calling module 405 calls the first function, which is the function updated by the target application according to the patch library. In this way, the trustworthiness of the patch library in memory is verified before the first call to the updated function, avoiding the phenomenon that the patch library is illegally replaced after verifying the source of the patch library during the upgrade process, thus ensuring the security and reliability of the upgrade.
[0136] Optionally, the first verification module 403 includes:
[0137] The first acquisition submodule is used to parse the patch library and obtain the signature value in the patch library;
[0138] The second acquisition submodule is used to decrypt the signature value using the built-in public key to obtain the first feature value;
[0139] The calculation submodule is used to calculate the second feature value of the patch library;
[0140] The determination submodule is used to determine the source of the patch library is trustworthy when the first feature value is consistent with the second feature value, and to save the first feature value in a secure storage area.
[0141] Optionally, the second verification module 404 includes:
[0142] The third characteristic value of the patch library is calculated based on the starting address and length of the patch library in memory;
[0143] If the third feature value is determined to be consistent with the first feature value stored in the secure storage area, the patch library in memory is determined to be trustworthy.
[0144] The calculation submodule is used to calculate the third characteristic value of the patch library based on the starting address and length of the patch library in memory;
[0145] The determination submodule is used to determine the trustworthiness of the patch library in memory when the third feature value is consistent with the first feature value stored in the secure storage area.
[0146] Optionally, the upgrade module 404 includes:
[0147] The loading submodule is used to display the loading of the patch library;
[0148] The third acquisition submodule is used to obtain the address of the dynamic update function from the patch library;
[0149] The upgrade submodule is used to dynamically upgrade the target application by calling the dynamic update function corresponding to the address of the dynamic update function.
[0150] Optionally, the upgrade submodule includes:
[0151] The lookup unit is used to dynamically look up the address of the original function and the address of the target function corresponding to the address of the original function in the dynamic update function.
[0152] The update unit is used to dynamically update the original function address to the target function address when the original function corresponding to the original function address is not called.
[0153] like Figure 5 As shown in the illustration, this application also provides an application generation apparatus, comprising:
[0154] Module 501 is used to generate a patch library for upgrading the application.
[0155] The first setting module 502 is used to pre-set a callback function in the application code according to a preset interface specification. The callback function is used to read the patch library.
[0156] In the application generation apparatus of this application embodiment, firstly, the generation module 501 generates a patch library for upgrading the application, and then the first setting module 502 pre-sets a callback function for reading the patch library in the application code according to a preset interface specification. In this way, the application can be dynamically upgraded by reading the patch library without interrupting the application.
[0157] Optionally, the generation module 501 includes:
[0158] The configuration submodule is used to configure the dynamic update function according to the preset interface specification. The dynamic update function includes the correspondence between the original function address and the target function address.
[0159] A compilation module is used to compile the patch library;
[0160] A generation submodule is used to sign the feature values of the patch library and generate a signature value, which is used to verify whether the source of the patch library is trustworthy.
[0161] Optionally, the generation submodule includes:
[0162] The generation unit is used to sign the feature value of the patch library with a private key using a signing tool to generate the signature value.
[0163] A writing unit is used to write the signature value into the ELF (Executable Linkable File Format) portion of the patch library.
[0164] Furthermore, the device also includes:
[0165] The second setting module is used to set a signal handling function in the application's code, the signal handling function being used to call the callback function when an upgrade signal is received.
[0166] like Figure 6 As shown, this application embodiment also provides an electronic device, including: a transceiver 610, a memory 620, a processor 600, and a computer program stored on the memory 620 and running on the processor 600. When the processor 600 executes the computer program, it implements the various processes of the application dynamic upgrade method embodiment described above and can achieve the same technical effect, or it implements the various processes of the application generation method embodiment described above and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0167] Among them, Figure 6 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 600) and memory (memory 620). The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 610 can be multiple elements, including transmitters and transceivers, providing a unit for communicating with various other devices over a transmission medium. For different terminals, the user interface 630 can also be an interface capable of connecting external or internal devices, including but not limited to keypads, displays, speakers, microphones, joysticks, etc. The processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 can store data used by the processor 600 during operation.
[0168] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a computer program instructing the relevant hardware to implement them. The computer program includes instructions to perform some or all of the steps of the above methods; and the computer program can be stored in a readable storage medium, which can be any form of storage medium.
[0169] In addition, this application embodiment also provides a computer-readable storage medium storing a program. When executed by a processor, the program implements the various processes of the application dynamic upgrade method embodiment described above, or the various processes of the application generation method embodiment described above, achieving the same technical effect. To avoid repetition, these will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0170] Furthermore, it should be noted that in the apparatus and method of this application, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of this application. Moreover, the steps performing the above series of processes can naturally be executed in the order described or in chronological order, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of this application can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof. This is something that those skilled in the art can achieve by using their basic programming skills after reading the description of this application.
[0171] Therefore, the object of this application can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of this application can also be achieved simply by providing a program product containing program code implementing the method or apparatus. That is, such a program product also constitutes this application, and a storage medium storing such a program product also constitutes this application. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future.
[0172] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal 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 said element.
[0173] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles described in this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for dynamically upgrading an application, characterized in that, include: If an upgrade signal is received during the execution of the target application, read the patch library at the target location; Verify the credibility of the patch library's source; If the source of the patch library is trustworthy, the target application is dynamically upgraded based on the patch library; After the target application is dynamically upgraded, the first function is called for the first time to verify whether the patch library in memory is trustworthy; If the patch library in memory is trustworthy, the first function is invoked, where the first function is the function updated by the target application according to the patch library; Verifying the trustworthiness of the patch library in memory includes: The third characteristic value of the patch library is calculated based on the starting address and length of the patch library in memory; If the third feature value is found to be consistent with the first feature value stored in the secure storage area, the patch library in memory is determined to be trustworthy; wherein, the first feature value is the feature value obtained by decrypting the signature value in the patch library using the built-in public key.
2. The method according to claim 1, characterized in that, Verify the credibility of the source of the read patch library, including: The patch library is parsed to obtain the signature value in the patch library; The signature value is decrypted using the built-in public key to obtain the first feature value; Calculate the second feature value of the patch library; If the first feature value matches the second feature value, the source of the patch library is determined to be trustworthy, and the first feature value is saved in a secure storage area.
3. The method according to claim 1, characterized in that, Dynamically upgrading the target application according to the patch library includes: Display the loading of the patch library; Obtain the address of the dynamic update function from the patch library; The target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function.
4. The method according to claim 3, characterized in that, The target application is dynamically upgraded by calling the dynamic update function corresponding to the address of the dynamic update function, including: In the dynamic update function, the address of the original function and the address of the target function corresponding to the address of the original function are dynamically searched. If the original function corresponding to the original function address is not called, the original function address will be dynamically updated to the target function address.
5. An electronic device, comprising: The device includes a transceiver, a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that the processor, when executing the computer program, implements the application dynamic upgrade method as described in any one of claims 1 to 4.
6. An application dynamic upgrade device, characterized in that, include: The read module is used to read the patch library at the target location when an upgrade signal is received during the execution of the target application. The first verification module is used to verify whether the source of the patch library is trustworthy; An upgrade module is used to dynamically upgrade the target application based on the patch library, provided that the source of the patch library is trustworthy. The second verification module is used to verify whether the patch library in memory is trustworthy when the first function is called for the first time after the target application is dynamically upgraded. The module is used to invoke the first function, which is the function updated by the target application according to the patch library, provided that the patch library in memory is trusted. The second verification module includes: The calculation submodule is used to calculate the third characteristic value of the patch library based on the starting address and length of the patch library in memory; The determination submodule is used to determine the trustworthiness of the patch library in memory when the third feature value is consistent with the first feature value stored in the secure storage area; wherein the first feature value is the feature value obtained by decrypting the signature value in the patch library using the built-in public key.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the application dynamic upgrade method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Application updating method and device, electronic equipment and storage medium
CN110308924A
Software system upgrading method based on hot patching, terminal and storage medium
CN111562934A