Data processing method and apparatus
Provided are a data processing method and apparatus applied to a target device in which a Linux operating system is running. A first program is deployed in the Linux operating system. The method includes: loading a target loading and invasion machine into a first memory space of the first program, and creating, in the first memory space, a second memory space for the target loading and invasion machine, where the second memory space is simply available to the target loading and invasion machine and to a program loadable by the target loading and invasion machine; configuring a second runtime environment for a second program, where the second runtime environment is isolated from a first runtime environment of the first program; and loading the second program into the second memory space based on the second runtime environment, and running the second program in a threaded manner.
1 . A data processing method, applied to a target device in which a Linux operating system is running, wherein a first program is deployed in the Linux operating system, and the method comprises:
loading a target loading and invasion machine into a first memory space of the first program, and creating, in the first memory space, a second memory space for the target loading and invasion machine, wherein the second memory space is simply available to the target loading and invasion machine and to a program loadable by the target loading and invasion machine;
configuring a second runtime environment for a second program, wherein the second runtime environment is isolated from a first runtime environment of the first program; and
loading the second program into the second memory space based on the second runtime environment, and running the second program in a threaded manner;
wherein the loading the second program into the second memory space based on the second runtime environment comprises:
loading a binary file of the second program and parsing the binary file; and
loading, in the second runtime environment, a dependency library required for the second program into the second memory space based on the parsed binary file.
2 . The method according to claim 1 , wherein the running the second program in the threaded manner comprises:
creating a virtual main thread; and
running the second program in the threaded manner through the virtual main thread.
3 . The method according to claim 1 , further comprising:
acquiring a real-time running situation of the first program; and
performing running control on the second program based on the running situation.
4 . The method according to claim 1 , wherein the second program is a security service program, and the second program is used to invade the first program and provide a security service for the first program.
5 . The method according to claim 1 , wherein the loading the target loading and invasion machine into the first memory space of the first program comprises:
loading the target loading and invasion machine into the first memory space of the first program in a form of a shared library of the first program.
6 . The method according to claim 1 , wherein the target device is an Internet of Things device, and the first program is a user mode program.
7 . A data processing apparatus, applied to a target device in which a Linux operating system is running, wherein a first program is deployed in the Linux operating system, and the apparatus comprises:
a processor;
a memory; and
a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, causes the processor to:
load a target loading and invasion machine into a first memory space of the first program, and create, in the first memory space, a second memory space for the target loading and invasion machine, wherein the second memory space is simply available to the target loading and invasion machine and to a program loadable by the target loading and invasion machine;
configure a second runtime environment for a second program, wherein the second runtime environment is isolated from a first runtime environment of the first program; and
load the second program into the second memory space based on the second runtime environment, and run the second program in a threaded manner;
wherein the processor is further caused to:
load a binary file of the second program and parse the binary file; and
load, in the second runtime environment, a dependency library required for the second program into the second memory space based on the parsed binary file.
8 . A non-transitory computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, causes the processor to implement the following:
loading a target loading and invasion machine into a first memory space of a first program, and creating, in the first memory space, a second memory space for the target loading and invasion machine, wherein the second memory space is simply available to the target loading and invasion machine and to a program loadable by the target loading and invasion machine;
configuring a second runtime environment for a second program, wherein the second runtime environment is isolated from a first runtime environment of the first program; and
loading the second program into the second memory space based on the second runtime environment, and running the second program in a threaded manner;
wherein the processor is further caused to implement the following:
loading a binary file of the second program and parsing the binary file; and
loading, in the second runtime environment, a dependency library required for the second program into the second memory space based on the parsed binary file.
9 . The apparatus according to claim 7 , wherein the processor is further caused to:
create a virtual main thread; and
run the second program in the threaded manner through the virtual main thread.
10 . The apparatus according to claim 7 , wherein the processor is further caused to:
acquire a real-time running situation of the first program; and
perform running control on the second program based on the running situation.
11 . The apparatus according to claim 7 , wherein the second program is a security service program, and the second program is used to invade the first program and provide a security service for the first program.
12 . The apparatus according to claim 7 , wherein the processor is further caused to:
load the target loading and invasion machine into the first memory space of the first program in a form of a shared library of the first program.
13 . The apparatus according to claim 7 , wherein the target device is an Internet of Things device, and the first program is a user mode program.
14 . The storage medium according to claim 8 , wherein the processor is further caused to implement the following:
creating a virtual main thread; and
running the second program in the threaded manner through the virtual main thread.
15 . The storage medium according to claim 8 , wherein the processor is further caused to implement the following:
acquiring a real-time running situation of the first program; and
performing running control on the second program based on the running situation.
16 . The storage medium according to claim 8 , wherein the second program is a security service program, and the second program is used to invade the first program and provide a security service for the first program.
17 . The storage medium according to claim 8 , wherein the processor is further caused to implement the following:
loading the target loading and invasion machine into the first memory space of the first program in a form of a shared library of the first program.
18 . The storage medium according to claim 8 ,
wherein a target device is an Internet of Things device, and the first program is a user mode program.