Program running method, and device

By using dynamic mirroring and springboard function pointer segments in embedded devices to directly access the kernel and public code libraries, the problems of low operating efficiency and poor reliability are solved, and efficient and reliable application operation is achieved.

WO2024221965A1PCT designated stage expired Publication Date: 2024-10-31HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2023/138169
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-26
Filing Date
2023-12-12
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Existing solutions for running applications are inefficient in the embedded field, cannot meet real-time requirements, and have reliability issues that affect the operation of other applications and devices when the kernel crashes.

Method used

By obtaining the dynamic image of the application, using the springboard function pointer segment to directly access the kernel and the public code library, direct addressing is achieved, reducing system function calling time, and loading the dynamic image in user mode to reduce the risk of attacks on the kernel, and delete the symbol table To streamline dynamic mirroring and reduce system resource overhead.

Benefits of technology

It improves the operating efficiency of applications and system reliability, reduces the impact of kernel crashes on other applications and devices, and shortens fault recovery time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023138169_31102024_PF_FP_ABST
    Figure CN2023138169_31102024_PF_FP_ABST
Patent Text Reader

Abstract

A program running method, and a device, which relate to the technical field of terminals, and can improve the efficiency of running an application program. The method comprises: acquiring a dynamic mirror image of an application program, wherein the dynamic mirror image comprises a trampoline function pointer segment, the trampoline function pointer segment comprises at least one trampoline function pointer, the at least one trampoline function pointer corresponds to at least one interface, and the at least one interface comprises an interface of a kernel or an interface of a common code library; and calling the interface of the kernel or the interface of the common code library according to the trampoline function pointer segment, so as to run the application program.
Need to check novelty before this filing date? Find Prior Art

Description

Method and device for program operation

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on April 26, 2023, with application number 202310475447.3 and application name “A method and device for running a program”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a method and device for running a program. Background Art

[0003] With the development of terminal technology, the number of applications installed in electronic devices has gradually increased, providing users with more and more complex functions. The embedded field has high requirements for real-time performance. However, the existing application running solutions have low application running efficiency and cannot meet this real-time requirement.

[0004] Summary of the Invention

[0005] The present application provides a method and device for executing a program, which can improve the efficiency of executing an application program.

[0006] To achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, a method for executing a program is provided, applied to a device. The method can be executed by the device or by a component of the device, such as a processor, chip, or system-on-chip. It can also be implemented by a logic module or software that implements all or part of the device's functions. The method comprises: obtaining a dynamic image of an application; wherein the dynamic image includes a springboard function pointer segment, the springboard function pointer segment includes at least one springboard function pointer, and the at least one springboard function pointer corresponds to at least one interface, including a kernel interface or a common code library interface; and, based on the springboard function pointer segment, calling the kernel interface or the common code library interface to execute the application.

[0008] Based on the above technical solution, when an electronic device runs a dynamic image of an application, since the dynamic image includes a springboard function pointer segment, the springboard function pointer in the springboard function pointer segment corresponds to the kernel interface or the interface of the public code library. Therefore, the springboard function pointer can be used to directly jump to the system function, such as the kernel interface function, the public code library interface function, etc., to realize the call of the memory interface or the public code library interface, which can achieve the effect of direct addressing, shorten the system function call time, and have high operating efficiency and fast response.

[0009] In one possible design, the springboard function pointer segment is determined based on interface information, which indicates the mapping relationship between at least one interface and at least one springboard function address. Based on this design, the springboard function pointer segment in the dynamic image is determined based on the mapping relationship between the kernel interface or the public code interface and the springboard function address. Subsequently, this springboard function pointer segment can be used to directly call system functions, such as kernel interface functions or public code library interface functions. This enables direct addressing and completes calls to kernel and public code library interfaces, shortening system function call time and improving program execution efficiency.

[0010] In one possible design, obtaining a dynamic image of an application includes: compiling the application to generate a first dynamic image; wherein the first dynamic image includes a symbol table, a data segment, and a code segment; and determining a dynamic image based on the first dynamic image; wherein the dynamic image also includes the data segment and the code segment, but does not include the symbol table. Based on this design, the compiled application image is streamlined, such as by removing the symbol table, which occupies a large portion of memory space, to generate the final dynamic image. This effectively reduces the size of the dynamic image and reduces system resource overhead, thereby enabling the loading and operation of diverse services using minimal system resources.

[0011] In one possible design, the dynamic image also includes a description segment, which includes one or more of the following: the dynamic image size, the data space size, the relative offset of the entry function, and the relative offset of the springboard function pointer. Based on this design, a description segment is added to the dynamic image, which contains parameters related to the dynamic image. This description segment can be used to verify the dynamic image. Based on whether the verification passes, the dynamic image is determined to be run, thereby improving the security and reliability of program execution.

[0012] In one possible design, after obtaining the dynamic image of the application, the method further includes: obtaining a dynamic loading request; wherein the dynamic loading request is used to request loading the dynamic image; entering kernel state through a system call in user state to obtain a description segment in the dynamic image; and verifying the dynamic image in user state based on the description segment. Based on this design, the dynamic image is verified in user state. If an attack specifically targeting the application exists, the user state may be attacked, and the risk of directly attacking the kernel is significantly reduced. If the user state is attacked, it will not affect the operation of other applications and the entire electronic device, which can improve reliability, thereby allowing stable and reliable completion of user service upgrades or incremental deployments without affecting authenticated services and the kernel.

[0013] In one possible design, after obtaining a dynamic image of the application, the method further includes: allocating data space in user mode based on the size of the data space; and initializing data segments in the data space that do not contain initial values. Based on this design, by initializing data segments that do not contain initial values ​​in user mode, if an attack specifically targeting the application exists, the user mode may be attacked, and the risk of directly attacking the kernel is significantly reduced. If the user mode is attacked, it will not affect the operation of other applications or the entire electronic device, thereby improving reliability. In addition, compared to attacking the kernel, attacking the user mode has a smaller fault domain. After a failure, only a single application is restarted, and other business functions are not affected, resulting in a shorter recovery time.

[0014] In a second aspect, a device is provided, which has the function of implementing the method described in the first aspect and any design thereof. The function can be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes one or more modules corresponding to the above-mentioned functions. In one possible example, the device includes an acquisition unit (or acquisition module) and a processing unit (or processing module); the acquisition unit is used to acquire a dynamic image of an application; wherein the dynamic image includes a springboard function pointer segment, the springboard function pointer segment includes at least one springboard function pointer, the at least one springboard function pointer corresponds to at least one interface, and the at least one interface includes an interface of the kernel or an interface of a common code library; the processing unit is used to call the interface of the kernel or the interface of the common code library according to the springboard function pointer segment to run the application.

[0015] In one possible design, the springboard function pointer segment is determined based on interface information, and the interface information is used to indicate a mapping relationship between at least one interface and at least one springboard function address.

[0016] In one possible design, the processing unit is specifically used to: compile an application to generate a first dynamic image; wherein the first dynamic image includes: a symbol table, a data segment, and a code segment; determine a dynamic image based on the first dynamic image; wherein the dynamic image also includes a data segment and a code segment, and the dynamic image does not include a symbol table.

[0017] In a possible design, the dynamic image also includes a description segment, which includes one or more of the following: dynamic image size, data space size, entry function relative offset, and springboard function pointer relative offset.

[0018] In one possible design, the acquisition unit is also used to obtain a dynamic loading request; wherein the dynamic loading request is used to request the loading of a dynamic image; the acquisition unit is also used to enter the kernel state through a system call in the user state to obtain the description segment in the dynamic image; the processing unit is also used to verify the dynamic image according to the description segment in the user state.

[0019] In a possible design, the processing unit is further used to: allocate data space according to the size of the data space in user mode; and initialize data segments that do not contain initial values ​​in the data space.

[0020] Optionally, the device described in the second aspect may further include a storage unit, wherein the storage unit stores a program or instruction. When the processing unit executes the program or instruction, the device described in the second aspect may execute the method described in the first aspect.

[0021] In a third aspect, a device is provided, comprising: a processor and a memory, wherein the memory is coupled to the processor, the memory is used to store program code, the program code includes instructions, and the processor reads the instructions from the memory so that the device executes the method described in the first aspect and any one of the designs thereof.

[0022] In one possible design, the device further includes a communication interface that can be used for the device to communicate with other devices (e.g., electronic devices). Exemplarily, the communication interface can be a transceiver, an input / output interface, an interface circuit, an output circuit, an input circuit, a pin, or related circuits.

[0023] In one possible design, the device may also include a display screen, which can be used for the device to perform display operations.

[0024] In a fourth aspect, a computer-readable storage medium is provided, which includes a computer program or instructions. When the computer program or instructions are run on a device, the device executes the method described in the first aspect and any one of the designs thereof.

[0025] In a fifth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer can execute the method described in the first aspect and any one of the designs thereof.

[0026] In a sixth aspect, a circuit system is provided, the circuit system including a processing circuit, wherein the processing circuit is configured to execute the method described in any one of the designs of the first aspect.

[0027] In the seventh aspect, a chip system is provided, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor. When the at least one processor executes the instructions, the at least one processor executes the method described in the first aspect and any one of the designs therein.

[0028] It should be noted that the technical effects brought about by any design in the above-mentioned second to seventh aspects can refer to the technical effects brought about by the corresponding design in the first or second aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] FIG1 is a schematic diagram of electronic equipment types provided in an embodiment of the present application;

[0030] FIG2 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0031] FIG3A is a software structure block diagram of an electronic device provided in an embodiment of the present application;

[0032] FIG3B is a block diagram of a memory structure of an electronic device provided in an embodiment of the present application;

[0033] FIG4 is a flow chart of a method for executing a program according to an embodiment of the present application;

[0034] FIG5 is a schematic diagram of a resident image provided by an embodiment of the present application;

[0035] FIG6A is a schematic diagram of a first dynamic mirror provided by an embodiment of the present application;

[0036] FIG6B is a schematic diagram of a dynamic mirroring method provided by an embodiment of the present application;

[0037] FIG7 is a schematic diagram of a scenario provided by an embodiment of the present application;

[0038] FIG8 is a schematic structural diagram of a device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two).

[0040] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0041] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0042] In the embodiments of this application, an "application" may refer to a computer program that performs one or more tasks, including but not limited to processes and programs that run within a system and do not have a visual user interface, as well as programs that have a visual user interface. A "public code library" may include code that can be accessed or called by one or more applications.

[0043] In some embodiments, the embedded field has high requirements for real-time performance and reliability. However, existing solutions for running applications have low application operating efficiency and cannot meet these real-time requirements. In addition, electronic devices load applications to provide users with the corresponding functions of the applications. However, when electronic devices load applications through the kernel, if there is an external attack specifically targeting the application, it will attack the kernel that is loading the application, causing the kernel to crash, thereby affecting the operation of other applications and the entire electronic device, resulting in poor reliability. In addition, the system resources of electronic devices in the embedded field are limited.

[0044] Therefore, an embodiment of the present application provides a method for running a program. When an electronic device is running an application, it directly accesses the kernel and / or the common code library according to the springboard function pointer segment. The springboard function pointer segment includes at least one springboard function pointer. The at least one springboard function pointer corresponds to at least one interface. The at least one interface includes an interface of the kernel and / or an interface of the common code library, which can be directly addressed, thereby improving operation efficiency.

[0045] Furthermore, electronic devices load dynamic images in both user and kernel modes. If an attack specifically targets an application, the attack will likely target user mode, significantly reducing the risk of a kernel attack. If an attack targets user mode, it will not affect other applications or the entire electronic device, improving reliability. Furthermore, by deleting symbol tables and streamlining dynamic images, electronic devices can effectively reduce the size of the dynamic image and reduce system resource overhead.

[0046] In order to make the embodiments of the present application clearer, some contents and concepts related to the embodiments of the present application are uniformly introduced below.

[0047] First, embedded systems

[0048] An embedded system is a computer system that combines software and hardware. Embedded devices have limited hardware resources, typically with memory ranging from kilobytes (KB) to megabytes (MB). They lack hard drives and typically use storage media such as flash memory.

[0049] Second, kernel mode and user mode

[0050] Kernel mode and user mode are the two operating levels of an operating system. Applications running in user mode cannot directly access the operating system's kernel data structures and programs. When an electronic device executes an application in an operating system, it spends most of its time in user mode. When the application requires assistance from the operating system to complete tasks it lacks the authority or capabilities to perform, it can switch to kernel mode through system calls to request kernel services.

[0051] When an electronic device runs a program in kernel space, it is said that the program is running in kernel mode; when the electronic device runs a program in user space, it is said that the program is running in user mode. The specific implementation of kernel space and user space can be referred to in the corresponding description in Figure 3B below, and will not be repeated here.

[0052] Third, dynamic loading

[0053] Dynamic loading is a program execution mechanism that allows a computer program to load a library (or other binary object) into memory at runtime (rather than compile time), then retrieve the addresses of functions and variables in the library, execute these functions or access these variables, and unload the library from memory when it is no longer needed.

[0054] Fourth, springboard function

[0055] The springboard function includes external symbols that the dynamic image may rely on, and consists of kernel system call functions and public library functions. The springboard function is used to participate in the compilation of the dynamic image in a specific form, converting the dependent external symbols into the springboard function base address and corresponding offset.

[0056] Fifth, symbol table

[0057] Symbols refer to variable names and function names in a program. Symbols include global symbols, external symbols, and local symbols.

[0058] A symbol table is a collection of symbols. A symbol table can also be called a symbol array. Each element in the symbol array is a symbol.

[0059] For example, a standard symbol table conforms to a certain format. The executable and linking format (ELF) file generated by compiling an application contains symbol table information. All symbol table information is aggregated into the .symtab section, which is an array of ElfN_Sym fields used to store symbol information. The symbol table information for an object file can be viewed using the readelf -s command. The specific definition of each symbol is as follows:

[0060] The program running method provided in the embodiment of the present application can be applied to the electronic device 100.

[0061] For example, as shown in FIG1 , the electronic device 100 may specifically be a mobile phone 11, a laptop computer 12, a tablet computer 13, a large-screen device 14, a wearable device (such as a smart watch, a smart bracelet, etc.) 15, a smart speaker, an in-vehicle device, a smart car, a vehicle, an airplane, a drone, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence (AI) device, a virtual reality (VR) terminal, an augmented reality (AR) terminal, an Internet of Things (IoT) terminal, a terminal in industrial control, a terminal in self-driving, a terminal in remote medical care, a terminal in a smart grid, a terminal in a smart city, a terminal in a smart home, or a smart home. The terminals in smart homes include terminals in smart logistics (such as devices that can monitor the location of cargo vehicles, devices that can monitor the temperature and humidity of cargo, etc.), terminals in smart agriculture (such as wearable devices that can collect relevant data of poultry and livestock, etc.), terminals in smart buildings (such as smart elevators, fire monitoring equipment, and smart electricity meters, etc.), terminals in smart medical care (such as wearable devices that can monitor the physiological status of humans or animals), terminals in smart transportation (such as smart buses, smart vehicles, shared bicycles, charging pile monitoring equipment, smart traffic lights, smart monitoring and smart parking equipment, etc.), terminals in smart retail (such as vending machines, self-service checkout machines, and unmanned convenience stores, etc.), terminals in digital energy (such as power supply equipment in photovoltaic power generation systems or wind power generation systems, and energy storage equipment, etc.), embedded devices, etc.

[0062] For another example, the electronic device 100 may specifically be a network device, such as a Node B (NB), a baseband unit (BBU), an access point (AP) in a wireless fidelity (WIFI) system, a wireless relay node, a wireless backhaul node, a transmission point (TP), or a transmission / receipt point (TRP), etc. It may also be a 5G, such as a gNB or a transmission point (TRP or TP) in an NR system, or a network node constituting a gNB or a transmission point, such as a baseband unit (BBU) or a distributed unit (DU), etc. It may also be a satellite, etc. For another example, the electronic device 100 in the present application may be a module, a module, a component, or a chip, etc., which is built into any device as one or more components or units. In some embodiments, the electronic device 100 may be a fixed device or a portable device.

[0063] Optionally, the operating system installed in the electronic device 100 includes but is not limited to an embedded operating system, This application does not limit the specific type of the electronic device 100 or the installed operating system.

[0064] For example, FIG2 shows a schematic structural diagram of the electronic device 100 .

[0065] The electronic device 100 includes one or more processors 201, and optionally, may also include a communication line 202, and at least one communication interface (Figure 2 is only illustrative of the example of including a communication interface 204 and a processor 201), and a memory 203.

[0066] The processor 201 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0067] The communication line 202 may include a path for connecting different components.

[0068] The communication interface 204 can be a transceiver module for communicating with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), ZigBee, 2G / 3G / 4G / 5G and other wireless communications, etc. For example, the transceiver module can be a device such as a transceiver or a transceiver. Optionally, the communication interface 204 can also be a transceiver circuit located in the processor 201 to realize signal input and signal output of the processor.

[0069] The memory 203 may be a device having a storage function. For example, it may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via the communication line 202. The memory may also be integrated with the processor.

[0070] The memory 203 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 201. The processor 201 is used to execute the computer-executable instructions stored in the memory 203, thereby implementing the method provided in the embodiment of the present application.

[0071] Alternatively, in an embodiment of the present application, the processor 201 may also perform functions related to the processing of the method provided in the following embodiments of the present application, and the communication interface 204 is responsible for communicating with other devices or communication networks, which is not specifically limited in the embodiment of the present application.

[0072] Optionally, the memory 203 in the embodiment of the present application may also be used to store information or parameters described in the following embodiments.

[0073] The computer-executable instructions in the embodiments of the present application may also be referred to as application code, which is not specifically limited in the embodiments of the present application.

[0074] In a specific implementation, as an embodiment, the processor 201 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 2 .

[0075] In a specific implementation, as an embodiment, the electronic device 100 may include multiple processors, such as processor 201 and processor 207 in FIG2 . Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0076] In a specific implementation, as an embodiment, the electronic device 100 may further include an output device 205 and an input device 206. The output device 205 communicates with the processor 201 and may display information in a variety of ways.

[0077] It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the structure and form of the electronic device 100, and the embodiment of the present application does not limit the structure and form of the electronic device 100.

[0078] In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure (for example, it may also include a sensor module, a display screen, an audio module, and / or a camera, etc.), or combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0079] 2 is merely a schematic illustration and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also use an interface connection method different from that shown in FIG2 or a combination of multiple interface connection methods.

[0080] It should be noted that the software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. FIG3A shows a software structure block diagram of an electronic device 100 provided in an embodiment of the present application.

[0081] As shown in FIG. 3A , the electronic device 100 includes but is not limited to one or more of the following software modules: a dynamic loading module 31 and a dynamic loading management module 32 .

[0082] The dynamic loading module 31 is used to copy the data segments in the dynamic image to the data space, configure the initialization process structure, initialize the running environment of the dynamic image, etc.

[0083] The dynamic loading management module 32 is used to verify the dynamic image, divide the data space from the memory pool, initialize the data segment that does not contain the initial value, etc. The dynamic loading management module can also be called a dynamic loading manager.

[0084] For example, taking an electronic device including an embedded operating system with a layered architecture as an example, the operating system of the electronic device may include a user layer and a kernel layer. For example, the above-mentioned dynamic loading module 31 may be located in the kernel layer of the operating system of the electronic device, and the dynamic loading management module 32 may be located in the user layer of the electronic device. Specifically, the user layer includes a component layer and an application layer, and the dynamic loading management module 32 may be located in the component layer of the electronic device. For a detailed introduction to the operating system and each layer (such as the user layer, kernel layer, component layer, and application layer of the embedded operating system, etc.), reference may be made to the explanations and descriptions in conventional technology, and the embodiments of this application will not be elaborated on.

[0085] It can be understood that the software modules included in the electronic device 100 shown in Figure 3A are only one possible division method. It can also include more or fewer modules, or other division methods. This application does not impose any restrictions on this.

[0086] FIG3B shows a block diagram of a memory structure of an electronic device 100 provided in an embodiment of the present application.

[0087] The memory space of the electronic device 100 may include, but is not limited to, one or more of the following: a kernel space 301 , a user space 302 , and a public code space 303 .

[0088] Kernel space 301 is the address space allocated by the operating system in memory and used by the kernel. When electronic device 100 runs a program (such as an application or other program) in kernel space, it can be said that the program is running in kernel state. With reference to Figure 3A, the dynamic loading module 31 runs in kernel space 301.

[0089] User space 302 is the address space allocated by the operating system in memory for use by applications. When the electronic device 100 runs a program (e.g., an application or other program) in user space, it can be said that the program is running in user mode. With reference to FIG3A , the dynamic loading management module 32 runs in user space 302. For example, the dynamic loading management module 32 running in user space 302 (or user mode) can trigger the dynamic loading module 31 in kernel mode to execute corresponding functions.

[0090] By distinguishing between kernel space and user space, the operating system code (the operating system code is much more robust than the application code) can be isolated from the application code.

[0091] The public code space 303 is an address space allocated by the operating system in the memory and is used to store the public code library, the system interface springboard function table, the public interface springboard function table, etc. Optionally, the public code library, the system interface springboard function table, and the public interface springboard function table may be located at the component layer of the electronic device 100.

[0092] It can be understood that the address space included in the electronic device 100 shown in Figure 3B is only one possible division method. It can also include more or less space, or other division methods. This application does not limit this.

[0093] The technical solutions involved in the following embodiments can all be implemented in a device having the structure shown in FIG. 2 , FIG. 3A and / or FIG. 3B .

[0094] It is understood that in the embodiments of the present application, the electronic device can perform some or all of the steps in the embodiments of the present application. These steps or operations are merely examples, and the embodiments of the present application can also perform other operations or variations of various operations. In addition, the various steps can be performed in a different order than those presented in the embodiments of the present application, and it is possible that not all operations in the embodiments of the present application need to be performed.

[0095] The following will describe in detail the method for running the program provided in the embodiment of the present application with reference to Figures 4 to 7.

[0096] For example, Figure 4 is a flowchart of a method for executing a program provided in an embodiment of the present application. As shown in Figure 4, the method includes the following steps.

[0097] S401, the electronic device compiles a kernel to generate a system interface springboard function table.

[0098] Exemplarily, the system interface springboard function table is used to indicate a mapping relationship between at least one system interface and at least one springboard function address, and at least one system interface and at least one springboard function address have a one-to-one correspondence.

[0099] In some embodiments, the electronic device compiles the kernel to generate a resident image, which may also be referred to as a system image. For example, the resident image generated by the electronic device compiling the kernel may be as shown in FIG5 , where the kernel space and the space of the dynamic loading management module are packaged into the resident image. The resident image may refer to a segment of address space or memory area.

[0100] Exemplarily, the resident image includes (or stores) at least one system interface, which is an interface to the kernel (or kernel space). The system interface is used for user space to call kernel space. For example, an application (e.g., an application running in user mode) can call the kernel through the system interface. The electronic device encapsulates the at least one system interface and the at least one springboard function address to generate a system interface springboard function table (g_syscallsDispatchList).

[0101] Optionally, the electronic device may further generate a public interface springboard function table, for example, by compiling a public code library to generate the public interface springboard function table. Exemplarily, the electronic device encapsulates at least one public interface and at least one springboard function address to generate a public interface springboard function table (g_libcallsDispatchList). The public interface is an interface of the public code library, and the public interface is used by user space to call the public code library. For example, an application (e.g., an application running in user mode) accesses the public code library through the public interface.

[0102] For example, the public interface springboard function table may be used to indicate a mapping relationship between at least one public interface and at least one springboard function address, where at least one public interface and at least one springboard function address have a one-to-one correspondence.

[0103] Optionally, the system interface springboard function table and the public interface springboard function table may be combined into one table, which only needs to indicate the corresponding correspondence.

[0104] 3B , the system interface springboard function table and the public interface springboard function table may be stored in the public code space 303 , and any application may access the public code space 303 to obtain the system interface springboard function table and the public interface springboard function table.

[0105] S402: The electronic device generates a dynamic image based on the compiled application.

[0106] As shown in FIG5 , the electronic device compiles an application in the user space to generate a dynamic image, which is stored in the user space of the image. The user space of the image is an address space allocated by the operating system in the memory for storing the dynamic image.

[0107] Exemplarily, the dynamic image stores (or includes) but is not limited to one or more of the following: a code segment, a data segment, a springboard function pointer segment, and a description segment. The dynamic image does not include a symbol table.

[0108] Optionally, a dynamic image may refer to an address space or memory area that may be used to store a code segment, a data segment, a springboard function pointer segment, and / or a description segment.

[0109] Illustratively, the code segment (.text) includes the code of the application.

[0110] The code segment's memory area is optionally determined before the application runs. It is typically read-only, though some architectures allow the code segment to be writable, allowing the application to be modified. The code segment may also contain read-only constant variables, such as string constants.

[0111] Illustratively, the data segment (.data) includes initialized global variables and initialized static variables in the application.

[0112] Exemplarily, the springboard function pointer segment includes at least one springboard function pointer. For example, the at least one springboard function pointer segment includes a springboard function pointer corresponding to a system interface and / or a springboard function pointer corresponding to a public interface.

[0113] For example, at least one springboard function pointer corresponds to at least one interface, and the at least one interface includes an interface of the kernel space and / or an interface of the public code library. The springboard function pointer is used to indicate a function address of the system interface or a function address of the public interface.

[0114] Exemplarily, the description segment (.description) includes, but is not limited to, one or more of the following: dynamic image size, data space size, entry function relative offset, and springboard function pointer relative offset.

[0115] For example, the dynamic image size is used to indicate the size of the address space of the dynamic image.

[0116] For example, the data space size is used to indicate the size of the memory space used to store data.

[0117] For example, the entry function relative offset is used to indicate the offset between the entry address of the application program and the base address, where the base address is the first address of the dynamic image, such as address 0.

[0118] For example, the relative offset of the springboard function pointer is used to indicate the offset between the address pointed to by the springboard function pointer and the base address. The base address is the first address of the dynamic image, such as address 0.

[0119] In some embodiments, the above S402, in which the electronic device generates a dynamic image based on the compiled application, may include the following steps 1 and 2.

[0120] In step 1, the electronic device compiles the application program to generate a first dynamic image.

[0121] Exemplarily, the contents stored in the first dynamic image are shown in FIG6A . The first dynamic image includes, but is not limited to, one or more of the following: an ELF header, a program header table, a code segment, a constant segment, a data segment, an uninitialized data segment, a section header table, a string constant pool, and a symbol table.

[0122] In step 2, the electronic device determines a dynamic image according to the first dynamic image.

[0123] Exemplarily, the electronic device generates the dynamic image by performing one or more of the following operations: deleting a symbol table in the first dynamic image, adding a springboard function pointer segment to the first dynamic image, and adding a description segment to the first dynamic image.

[0124] For example, the electronic device uses the objdump tool in the compiler to delete the symbol table from the first dynamic image.

[0125] When an electronic device generates the first dynamic image, the code segment occupies a small part of the memory space, and the symbol table occupies most of the memory space. Deleting the symbol table and streamlining the dynamic image can effectively reduce the size of the dynamic image and reduce system resource overhead, so that the loading and operation of diversified services can be completed with as few system resources as possible.

[0126] Optionally, in addition to deleting the symbol table in the first dynamic image, the electronic device can also delete the ELF header, program header table, uninitialized data segment, section header table, and / or string constant pool to generate a dynamic image, which can further reduce the size of the dynamic image.

[0127] In some embodiments, the springboard function pointer segment may be determined by the electronic device according to a system interface springboard function table and / or a public interface springboard function table.

[0128] Exemplarily, the electronic device replaces at least one system interface in the system interface springboard function table with at least one springboard function pointer (g_callsDispatchList), and uses the springboard function pointer and a corresponding offset to indicate the function address of the system interface. And / or, the electronic device replaces at least one public interface in the public interface springboard function table with at least one springboard function pointer, and uses the springboard function pointer and a corresponding offset to indicate the function address of the public interface.

[0129] Exemplarily, when the dynamic image includes a springboard function pointer segment, the above-mentioned step two, in which the electronic device determines the dynamic image based on the first dynamic image, may include: the electronic device determines the dynamic image based on the first dynamic image and the system interface springboard function table, the electronic device determines the dynamic image based on the first dynamic image and the public interface springboard function table, or the electronic device determines the dynamic image based on the first dynamic image, the system interface springboard function table, and the public interface springboard function table.

[0130] Exemplarily, the electronic device streamlines the first dynamic image (taking FIG. 6A as an example), deletes the symbol table in the first dynamic image, and adds a springboard function pointer segment and a description segment to the first dynamic image. The obtained dynamic image is shown in FIG. 6B , and the description segment can be used as the header of the dynamic image.

[0131] FIG. 6A and FIG. 6B are merely examples. The first dynamic image and the dynamic image may include more or less content than shown in the figure, and the positions of the various segments or content are not limited.

[0132] Among them, the ELF header is used to indicate the location, size and other information of the program header table and section header table.

[0133] The program header table is used to indicate information such as the size, location, flag, and access rights of each segment in the first dynamic image.

[0134] The constant section (.rodata) includes read-only data, such as string constants, global variables const, and constants defined by #define.

[0135] The uninitialized data segment (.bss) includes uninitialized global variables and uninitialized local static variables in the program. The default value of uninitialized global variables and uninitialized local static variables is 0.

[0136] The section header table describes the location and size of sections and is primarily used for linking and debugging. Sections differ from segments in that segments are essential for program execution, and the code or data within a segment is divided into distinct sections. The section header table complements the program header table.

[0137] The string constant pool (string table) is used to store strings to avoid repeated creation of strings.

[0138] For a detailed introduction to the ELF header, program header table, code segment (.text), constant segment, data segment (.data), uninitialized data segment, section header table, string constant pool, and symbol table, please refer to the explanations and descriptions in conventional technology.

[0139] The above S401-S402 describes the process of compiling the kernel and application program. The following describes loading a dynamic image based on S403-S413.

[0140] S403: The electronic device initiates a dynamic loading request in user mode.

[0141] Exemplarily, the dynamic loading request is used to request dynamic loading of a dynamic image.

[0142] For example, if application 1 running in the electronic device needs to start application 2, application 1 will request to dynamically load the dynamic image of application 2.

[0143] S404: The electronic device enters the kernel state through a system call in the user state and obtains the description segment.

[0144] With reference to Figure 7 , the process of an electronic device in user mode calling a system interface to obtain a description segment may include the following steps S701 and S702 . S701 : The dynamic loading management module of the electronic device requests the description segment from the user space of the image via the dynamic loading module. S702 : The dynamic loading module of the electronic device obtains the description segment from the user space of the image and sends it to the user space.

[0145] S405: The electronic device verifies the dynamic image according to the description segment in the user state.

[0146] Exemplarily, the electronic device verifies the dynamic image in user mode based on the dynamic image size, data space size, entry function relative offset, and / or springboard function pointer relative offset. For example, the electronic device uses a verification program running in user mode to verify the dynamic image based on the description segment.

[0147] For example, if the dynamic image size, data space size, entry function relative offset, and / or springboard function pointer relative offset do not match the actual corresponding parameters of the dynamic image, the electronic device determines that the verification has failed. If they do match, the electronic device determines that the verification has passed. Optionally, the electronic device obtains the actual corresponding parameters of the dynamic image, such as the actual address space size of the dynamic image, during the process of storing the dynamic image.

[0148] For example, the electronic device verifies the dynamic image based on the dynamic image size. If the electronic device determines that the dynamic image size does not match the actual address space size of the dynamic image, the verification fails; if they do, the verification passes. The electronic device verifies the dynamic image based on the data space size. If the data space size is larger than the address space size of the dynamic image, the verification fails; otherwise, the verification passes. The electronic device verifies the dynamic image based on the relative offset of the entry function. If the relative offset of the entry function is larger than the address space size of the dynamic image, the verification fails; otherwise, the verification passes. The electronic device verifies the dynamic image based on the relative offset of the springboard function pointer. If the relative offset of the springboard function pointer is larger than the address space size of the dynamic image, the verification fails; otherwise, the verification passes.

[0149] 7 , the above S405 may include: S703 , the dynamic loading management module running in the user state verifies the dynamic image according to the description segment.

[0150] In this way, the electronic device verifies the dynamic image in the user state. If there is an attack specifically targeting the application, the user state may be attacked, and the risk of directly attacking the kernel is significantly reduced. If the user state is attacked, it will not affect other applications and the operation of the entire electronic device, which can improve reliability, so that the upgrade or incremental deployment of user services can be completed stably and reliably without affecting the authenticated services and kernel.

[0151] S406: The electronic device allocates data space according to the size of the data space.

[0152] Exemplarily, the data space is used for initializing the electronic device.

[0153] 7 , the dynamic loading management module divides the data space from the memory pool of the dynamic loading management module.

[0154] Optionally, if the electronic device successfully allocates data space, initialization is performed (for example, executing S407 below); otherwise, the process of loading the dynamic image is exited.

[0155] S407: The electronic device initializes the application program in the user mode without including a data segment of an initial value.

[0156] For example, the data segment that does not include the initial value may be a data segment other than the .data segment, such as a .bss segment.

[0157] Exemplarily, the electronic device initializes a data segment that does not contain an initial value in the data space in the user space.

[0158] 7 , S407 may include: S704 , the dynamic loading management module of the electronic device initializes other data segments except the .data segment in the application program in the data space.

[0159] This allows electronic devices to initialize data segments in user mode without initial values. If an attack specifically targets that application, it could potentially attack user mode, significantly reducing the risk of directly attacking the kernel. Attacking user mode does not affect other applications or the entire electronic device, improving reliability. Furthermore, attacks in user mode have a smaller failure domain than attacks in the kernel. After a failure, only a single application is restarted, leaving other business functions unaffected, resulting in faster recovery time.

[0160] S408: The electronic device initializes the data segment containing the initial value of the application program in the kernel state.

[0161] For example, the data segment containing the initial value may be the .data segment.

[0162] Exemplarily, the electronic device initializes a data segment containing initial values ​​in a data space application in a user space.

[0163] 7 , S408 may include: S705 , the dynamic loading module of the electronic device copies the data segment (.data segment) in the dynamic image to the data space.

[0164] Optionally, the present application does not limit the order of initializing the data segments that do not contain initial values ​​and initializing the data segments that contain initial values.

[0165] S409, the electronic device initializes the springboard function pointer in the kernel state.

[0166] Exemplarily, S409 may include: the electronic device initializing the springboard function pointer in the dynamic image according to the relative offset of the springboard function pointer, so that the springboard function pointer points to the system interface springboard function table and the public interface springboard function table.

[0167] 7 , the dynamic loading module of the electronic device initializes at least one springboard function pointer in the kernel space.

[0168] S410, the electronic device configures the initialization process structure in the kernel state. If the configuration is successful, the following S411 is executed; otherwise, the loading of the dynamic image is terminated.

[0169] For example, if the initialization process structure configuration is successful, the dynamic image will continue to be loaded. If the initialization process structure configuration fails, the dynamic image loading will be terminated.

[0170] 7 , the dynamic loading module of the electronic device configures the initialization process structure in the kernel space.

[0171] S411, the electronic device initializes the operating environment of the dynamic image in the kernel state.

[0172] Exemplarily, S411 may include: the electronic device configuring a memory protection unit (MPU) of the code segment and an MPU of the data segment in a kernel state to perform dynamic mirror isolation protection.

[0173] The memory access characteristics (such as supporting only privileged access or full access) and memory attributes (such as cacheable, bufferable, and shareable) of different storage areas are set in the memory protection unit to provide protection for code segments and data segments, thereby improving system reliability.

[0174] 7 , the dynamic loading module of the electronic device initializes the running environment of the dynamic image in the kernel space.

[0175] S412, the electronic device starts the dynamic image in the kernel state.

[0176] Exemplarily, S412 , the electronic device starting the dynamic image in the kernel state may include: the electronic device starting the dynamic image in the kernel state according to the relative offset of the entry function.

[0177] 7 , S412 may include: S706 , the dynamic loading module of the electronic device starts the dynamic image.

[0178] S413, the electronic device runs the dynamic mirror.

[0179] Exemplarily, S413, the electronic device running the dynamic image may include: the electronic device accessing the kernel (system interface) and / or the public code library (public interface) according to the springboard function pointer segment.

[0180] In this way, when the electronic device runs a dynamic image, it can directly jump to the system function through the springboard function pointer in the springboard function pointer segment, which can achieve the effect of direct addressing, shorten the system function call time, and have high operating efficiency and fast response.

[0181] In this application, unless otherwise specified, the same or similar parts between the various embodiments can refer to each other. In the various embodiments in this application, and the various implementation methods / implementation methods / implementation methods in each embodiment, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment are consistent and can be referenced to each other. The technical features in different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment can be combined to form new embodiments, implementation methods, implementation methods, or implementation methods according to their inherent logical relationships. In each example or each optional method described in the above embodiments, any content can be freely combined, and the combined content is also within the scope of this application. The above-described implementation methods of this application do not constitute a limitation on the scope of protection of this application.

[0182] The above describes in detail the method for running a program provided by the embodiment of the present application in conjunction with Figures 1 to 7. The following describes in detail the device provided by the embodiment of the present application in conjunction with Figure 8.

[0183] FIG8 is a schematic diagram of the structure of a device provided in an embodiment of the present application. For example, the device may be an electronic device. As shown in FIG8 , device 900 may include: a processing unit 901 and an acquisition unit 902 , and may also include a transceiver unit, a display unit, and / or a communication unit (not shown in FIG8 ).

[0184] In one possible design, device 900 is an electronic device, and device 900 can be used to implement the functions of the electronic device involved in the above method embodiments.

[0185] Optionally, the processing unit 901 is used to support the electronic device to execute any processing function in Figures 1 to 7.

[0186] Optionally, the acquisition unit 902 is configured to support the electronic device in executing any one of the acquisition functions in FIG. 1 to FIG. 7 .

[0187] Optionally, the transceiver unit is used to support the electronic device to perform any transceiver function in Figures 1-7, such as sending information to other devices and / or receiving information from other devices.

[0188] Optionally, the display unit is used to support the electronic device to perform any display function and / or touch function in Figures 1 to 7.

[0189] Optionally, a communication unit is used to support the electronic device to perform any communication function in Figures 1-7.

[0190] The transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or a transceiver module. The operations and / or functions of each unit in the device 900 are respectively to implement the corresponding processes of the method described in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional unit. For the sake of brevity, they are not repeated here.

[0191] Optionally, the device 900 shown in FIG8 may further include a storage unit (not shown in FIG8 ) storing a program or instruction. When the processing unit 901 and the acquisition unit 902 execute the program or instruction, the device 900 shown in FIG8 may execute the method described in the above method embodiment. The processing unit 901 and the acquisition unit 902 may be provided separately or combined into one unit, which is not limited in this application.

[0192] The technical effects of the device 900 shown in FIG8 may refer to the technical effects of the methods described in the above method embodiments, and will not be described in detail here.

[0193] In addition to being in the form of device 900, the technical solution provided in this application may also be a functional unit or chip in an electronic device, or a device used in conjunction with the electronic device.

[0194] An embodiment of the present application also provides a chip system, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the chip system implements the method in any of the above method embodiments.

[0195] Optionally, there may be one or more processors in the chip system. The processor may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.

[0196] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be provided separately from the processor, which is not limited in the embodiments of the present application. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or provided on different chips. The embodiments of the present application do not specifically limit the type of memory or the configuration of the memory and the processor.

[0197] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.

[0198] It should be understood that each step in the above method embodiment can be completed by hardware integrated logic circuits in a processor or by software instructions. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0199] The present application also provides a readable storage medium having a program stored therein. When the program is executed on a computer or device, the program causes the computer or device to execute the above-mentioned steps to implement the method in the above-mentioned embodiment. The present application also provides a program product. When the program product is executed on a computer or device, the program causes the computer or device to execute the above-mentioned steps to implement the method in the above-mentioned embodiment.

[0200] In addition, embodiments of the present application further provide a device. Specifically, the device may be a component or module, and may include one or more processors and a memory connected together. The memory is used to store a program. When the program is executed by one or more processors, the device performs the methods described in each of the above method embodiments.

[0201] The apparatus, readable storage medium, program product, or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0202] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, read-only compact discs (CD-ROMs), or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).

[0203] Through the description of the above embodiments, those skilled in the art will clearly understand that for the sake of convenience and brevity, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed; that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0204] In the several embodiments provided in this application, it should be understood that the disclosed methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.

[0205] In addition, the functional units in the various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. The readable storage medium includes but is not limited to any of the following: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program code.

[0206] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for running a program, characterized in that: include: Acquire a dynamic image of an application; wherein the dynamic image includes a springboard function pointer segment, the springboard function pointer segment includes at least one springboard function pointer, the at least one springboard function pointer corresponds to at least one interface, and the at least one interface includes a kernel interface or a common code library interface; According to the springboard function pointer segment, the interface of the kernel or the interface of the common code library is called to run the application.

2. The method according to claim 1, characterized in that The springboard function pointer segment is determined according to interface information, and the interface information is used to indicate a mapping relationship between the at least one interface and at least one springboard function address.

3. The method according to claim 1 or 2, characterized in that: The step of obtaining a dynamic image of an application program includes: Compile the application to generate a first dynamic image; wherein the first dynamic image includes: a symbol table, a data segment and a code segment; The dynamic image is determined according to the first dynamic image; wherein the dynamic image also includes the data segment and the code segment, and the dynamic image does not include the symbol table.

4. The method according to any one of claims 1 to 3, characterized in that The dynamic image also includes a description segment, which includes one or more of the following: dynamic image size, data space size, entry function relative offset, and springboard function pointer relative offset.

5. The method according to claim 4, characterized in that After obtaining the dynamic image of the application, the method further includes: Obtaining a dynamic loading request; wherein the dynamic loading request is used to request loading of the dynamic image; Entering kernel state through system call in user state, obtaining the description segment in the dynamic image; The dynamic image is verified in the user state according to the description segment.

6. The method according to claim 4 or 5, characterized in that: After obtaining the dynamic image of the application, the method further includes: Allocating data space in the user state according to the size of the data space; In the data space, a data segment that does not contain an initial value is initialized.

7. A device, characterized in that: It includes an acquisition unit and a processing unit; The acquisition unit is used to acquire a dynamic image of the application; wherein the dynamic image includes a springboard function pointer segment, the springboard function pointer segment includes at least one springboard function pointer, the at least one springboard function pointer corresponds to at least one interface, and the at least one interface includes a kernel interface or a common code library interface; The processing unit is used to call the interface of the kernel or the interface of the common code library according to the springboard function pointer segment to run the application.

8. The device according to claim 7, characterized in that The springboard function pointer segment is determined according to interface information, and the interface information is used to indicate a mapping relationship between the at least one interface and at least one springboard function address.

9. The device according to claim 7 or 8, characterized in that The processing unit is specifically used for: Compile the application to generate a first dynamic image; wherein the first dynamic image includes: a symbol table, a data segment and a code segment; The dynamic image is determined according to the first dynamic image; wherein the dynamic image also includes the data segment and the code segment, and the dynamic image does not include the symbol table.

10. The device according to any one of claims 7 to 9, characterized in that The dynamic image also includes a description segment, which includes one or more of the following: dynamic image size, data space size, entry function relative offset, and springboard function pointer relative offset.

11. The device according to claim 10, characterized in that The acquisition unit is further used to obtain a dynamic loading request; wherein the dynamic loading request is used to request loading of the dynamic image; The acquisition unit is further used to enter the kernel state through a system call in the user state to acquire the description segment in the dynamic image; The processing unit is further configured to verify the dynamic image according to the description segment in the user state.

12. The device according to claim 10 or 11, characterized in that The processing unit is further used for: Allocating data space in the user state according to the size of the data space; In the data space, a data segment that does not contain an initial value is initialized.

13. A device, characterized in that include: A processor and a memory, wherein the memory is coupled to the processor, the memory is used to store program code, the program code includes instructions, and the processor reads the instructions from the memory to enable the device to execute the method according to any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is run on a device, the device is caused to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Program running method and equipment

    CN118860524A

  • Data protecting method and device

    CN106295385A

  • Application security protection method and related equipment

    CN110874468A

  • System function calling method and device, electronic equipment and readable medium

    CN114416219A

  • Compiler dispatch function for object-oriented C

    US5960197A

Cited By

  • Interface calling device and method for calling DSP by CPU of heterogeneous computer system

    CN119806692A