Isolated multi-system communication and management method and system based on eBPF

By using eBPF processing code and hook functions to process shared memory communication data between isolated systems, the existing technology problems of low data processing efficiency and security risks between isolated systems are solved, efficient data filtering and processing is achieved, and system security is improved. performance and communication efficiency.

CN118779131APending Publication Date: 2024-10-15KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410923038.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing technology lacks a data processing mechanism for shared memory communication between isolated systems. Especially when the amount of data is large, there is a waste of resources and low efficiency. It also lacks a dynamic filtering method, which may introduce security risks.

Method used

Adopt an isolated multi-system communication management method based on eBPF, mount hook functions between system domains through eBPF processing code, implement data filtering and processing, use hook functions to capture and process communication data in shared memory, and control services through eBPF Transfer and process data packets between various system domains.

Benefits of technology

It realizes safe and effective communication data filtering and processing between isolated multiple systems, improves data communication efficiency, reduces development difficulty, and increases system security functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779131A_ABST
    Figure CN118779131A_ABST
Patent Text Reader

Abstract

The invention provides an eBPF-based isolated multi-system communication and management method and system. The method comprises the steps of S1, completing or generating eBPF processing codes according to requirements; s2, when the eBPF processing code is mounted to the system domain, executing S4; s3 is executed when the system domain is mounted to other system domains; s3, the eBPF processing codes form a data packet by the system domain, the data packet is sent to an eBPF control service of a target system domain corresponding to the eBPF processing codes to be mounted through a shared memory, and the corresponding eBPF control service receives the data packet and analyzes the data packet and then executes S4; s4, generating a hook function from the eBPF processing code, and mounting the hook function to a corresponding position of an operating system; s5, after the hook function triggers operation, capturing and processing related data, and sending the related data to an eBPF processing module corresponding to the corresponding eBPF control service; and S6, the processing module reads the data of the data packet and calls a related processing mechanism. The method has the advantages of low complexity, high flexibility, high safety and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication management technology, and in particular to an isolated multi-system communication and management method and system based on eBPF. Background Art

[0002] In current computer system technology, register-based virtual machine technology - Berkeley Packet Filter (BPF) and its evolutionary version extended Berkeley Packet Filter (eBPF) have been widely used and developed in the field of Linux operating systems. As an efficient and secure virtual machine technology, eBPF can be quickly converted into code that can be executed at the kernel level by the local JIT compiler, and widely serves multiple application scenarios such as security monitoring, sandbox environment, network filtering, program tracing, performance analysis and debugging. The eBPF mount point can be defined in advance. If the corresponding mount point does not exist, the eBPF program can be mounted almost anywhere in the kernel or user program through kprobe or uprobe.

[0003] In terms of hardware isolation virtualization technology, solutions such as jailhouse and kvisor allow multiple independent systems to be run in isolation on a multi-core SoC system. These systems each have independent memory and other hardware resources and communicate with each other through shared memory. However, existing technologies have obvious defects:

[0004] 1. There is a lack of data processing mechanisms for shared memory communication data between isolated systems. Especially when the amount of data is huge, it is necessary not only to filter at the sending end, but also to repeat the same filtering operation at the receiving end, resulting in waste of resources and low efficiency.

[0005] 2. The existing technology fails to provide a dynamic filtering method for shared memory communication data between isolated systems. Simply relying on application mounting cannot effectively achieve real-time filtering of shared memory data. Although a certain degree of filtering can be achieved through kernel modules, this method has poor flexibility and may introduce security risks, increasing the risk of system abnormalities. Summary of the invention

[0006] The technical problem to be solved by the present invention is: in response to the technical problems existing in the prior art, the present invention provides an eBPF-based isolated multi-system communication and management method and system with low complexity, flexibility and high security, so as to realize efficient filtering and processing of shared memory data packets.

[0007] In order to solve the above technical problems, the technical solution proposed by the present invention is:

[0008] An isolated multi-system communication and management method based on eBPF includes the following steps:

[0009] S101, complete or generate eBPF processing code according to requirements;

[0010] S102, the eBPF control service corresponding to the present system domain determines whether the eBPF processing code is mounted to the present system domain or other target system domains by the system domain mount flag of the eBPF processing code, and executes step S104 when the eBPF processing code is mounted to the present system domain; and executes step S103 when the eBPF processing code is mounted to other target system domains;

[0011] S103, the eBPF control service of the system domain sends the data packet composed of the eBPF processing code to the eBPF control service of the target system domain corresponding to the eBPF processing code to be added through the shared memory, and the corresponding eBPF control service receives the data packet and parses it and then executes S104;

[0012] S104, the corresponding eBPF control service generates a hook function for the corresponding eBPF processing code and mounts it to the corresponding mount point of the operating system;

[0013] S105, after the hook function is triggered to run, it captures and processes relevant communication data, and sends the relevant data to the eBPF processing module corresponding to the corresponding eBPF control service;

[0014] S106, the corresponding eBPF processing module reads the data packet data and calls the relevant processing mechanism.

[0015] Furthermore, a hook function is mounted at the communication location of the shared memory of each system domain to process the communication data.

[0016] Furthermore, the data processing includes data filtering. When the corresponding filtering hook function is triggered, the data to be filtered is filtered, including filtering in the sending system domain and filtering in the receiving system domain. The filtering hook function is mounted to the shared memory communication mount point location of each system domain and is used to filter the shared memory communication data of each system domain.

[0017] Furthermore, the data processing includes a corresponding processing function: when the corresponding processing hook function is triggered, the corresponding data to be processed is processed and the data packet is regenerated; the corresponding data packet to be forwarded is sent by the hook function to the corresponding eBPF processing module of the current system domain, and forwarded by the eBPF processing module to other different system domains. The corresponding processing hook function is mounted to the shared memory communication mount point location of each system domain. The corresponding processing hook function obtains the communication data packet between each system domain, and regenerates the communication data packet between each system domain after being processed by the hook function.

[0018] Furthermore, the corresponding hook function can be mounted to the system domain that needs to send data, and can also be mounted to the system domain that needs to receive data.

[0019] Furthermore, the main eBPF control service generates a hardware resource protection eBPF function based on the isolated system hardware configuration resource file, and mounts the corresponding hardware resource protection hook function, so that the main system domain can only use the pre-configured main system domain hardware resources. For the hardware resources isolated to the slave system domain, the corresponding hardware resource protection hook function will be triggered to prevent illegal use. Each slave system domain can only use the pre-configured slave system domain hardware resources, otherwise the corresponding hook function will be triggered to prevent illegal use.

[0020] Furthermore, a hook function is mounted on the virtual device of each system domain. When the corresponding virtual device is used, the hook function of the corresponding virtual device is triggered, and the relevant register operations are composed into a data packet, which is sent by the corresponding eBPF processing module to the system domain that has the hardware resources corresponding to the virtual device, so as to realize the actual control of the physical device.

[0021] Furthermore, in the process of mounting the monitoring hook function to the slave system domain through the main system domain, when the monitoring hook function of the slave system domain is triggered, the corresponding eBPF processing module of the slave system domain sends a monitoring data packet to the main system domain, and the main system domain receives the monitoring data packet in real time, thereby realizing real-time monitoring of the data processing status of the slave system domain by the main system domain.

[0022] The monitoring data packet is generated by the corresponding monitoring hook function from the system domain.

[0023] Furthermore, it also includes that for a system domain without eBPF related components, the corresponding system domain without eBPF related components sends the data packet composed of filtering and processing functions to the eBPF control service of the system domain with eBPF related components that requires inter-domain communication through shared memory through the eBPF control service of the system domain with eBPF related components, and the eBPF control service of the system domain with eBPF related components generates relevant eBPF code based on the received data packet, and mounts the hook function at the relevant mount point location of the system domain with eBPF related components to filter and process the transmitted communication data.

[0024] An isolated multi-system communication and management system based on eBPF comprises a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute an isolated multi-system communication and management method based on eBPF.

[0025] Compared with the prior art, the advantages of the present invention are:

[0026] The present invention mounts the shared memory receiving and sending functions through the hook function of the eBPF program between isolated multiple systems. When the hook function detects that a predefined communication event is triggered, the shared memory receiving and sending functions previously mounted or received from other systems are called to realize data processing for receiving / sending communication data. A safe and effective communication data filtering and processing mechanism between isolated multiple systems is realized. By flexibly mounting the function hook function between each system domain, the data communication efficiency is improved, the related work is reduced, the development difficulty is reduced, and the system security function is increased. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is an overall block diagram of an embodiment of the present invention.

[0028] Figure 2 The following is a flow chart of the hook function mounting according to an embodiment of the present invention.

[0029] Figure 3 This is a flow chart of data filtering in the master system domain and the slave system domain according to an embodiment of the present invention.

[0030] Figure 4 This is a flow chart of the eBPF hook function between multiple systems according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] In this embodiment, C, Python and other languages ​​are used to generate eBPF code on multiple systems isolated by hardware such as jailhouse and kvisor, and then eBPF is used to compile and mount hook functions in each system domain to process shared memory data, such as data filtering, data forwarding, and data extraction between multiple systems. The main system domain and the slave system domain are operating systems such as Linux and RTOS (Real-time operating system, RTOS).

[0033] like Figure 1 and 2As shown, the isolated multi-system communication and management method based on eBPF in this embodiment includes a master system domain and a slave system domain. The master eBPF control service and the eBPF processing module are run in the master system domain; the slave eBPF control service and the eBPF processing module are run in the slave system domain: the eBPF related components are related components supporting the eBPF function such as the eBPF virtual machine, JIT, eBPFMaps, etc. For system domains without eBPF related components, only the master or slave eBPF control service is run in the master or slave system domain.

[0034] Master and slave eBPF control services: The eBPF control services of each system domain communicate through shared memory. The corresponding eBPF control service receives data packets sent by the eBPF control services of other system domains, and sends data packets to the eBPF control services of other system domains. The eBPF control service of each system domain mounts the corresponding eBPF code to the corresponding position of the system in this system domain. The master eBPF control service runs in the master system domain and can control the eBPF control service of the slave system domain; the slave eBPF control service runs in the slave system domain.

[0035] eBPF processing module: After the hook function is triggered, it captures and processes the relevant data and sends the relevant data to the corresponding eBPF processing module. The eBPF processing module of each system domain reads the corresponding data and calls the relevant processing mechanism. The relevant processing mechanism of the eBPF processing module can be flexibly defined.

[0036] eBPF processing code: eBPF code is written manually or generated by the master or slave eBPF control service or obtained in other ways. The eBPF code is stored in the corresponding system domain. Each eBPF code has a system domain mount flag to describe which system domain it needs to be mounted to.

[0037] The specific operation steps of the isolated multi-system communication and management method based on eBPF are as follows:

[0038] S101, complete or generate eBPF processing code according to requirements;

[0039] S102, the eBPF control service corresponding to the current system domain determines whether the eBPF processing code is mounted to the current system domain or other target system domains by the system domain mount flag of the eBPF processing code, and executes step S104 when the eBPF processing code is mounted to the current system domain; and executes step S103 when the eBPF processing code is mounted to other target system domains;

[0040] S103, the eBPF control service of the system domain sends the data packet composed of the eBPF processing code to the eBPF control service of the target system domain corresponding to the eBPF processing code to be added through the shared memory, and the corresponding eBPF control service receives the data packet and parses it and then executes step S104;

[0041] S104, the corresponding eBPF control service generates a hook function for the corresponding eBPF processing code and mounts it to the corresponding mount point of the operating system;

[0042] S105, after the hook function is triggered to run, relevant data is captured and processed, and the relevant data is sent to the eBPF processing module corresponding to the corresponding eBPF control service;

[0043] S106, the corresponding eBPF processing module reads the data packet data and calls the relevant processing mechanism.

[0044] The present system domain is a master system domain or a slave system domain, and the target system domain is a master system domain or a slave system domain. This embodiment has one master system domain and one or more slave system domains.

[0045] The eBPF control service is the master eBPF control service in the master system domain and the slave eBPF control service in the slave system domain.

[0046] The corresponding mount points can be defined in advance, or mount points can be provided almost anywhere in the kernel or user program through kprobe or uprobe.

[0047] In this embodiment, a hook function is mounted at the communication location of each system domain shared memory for processing the communication data. The corresponding communication hook function can be mounted to the system domain that needs to send data or to the system domain that needs to receive data, that is, the hook function can be mounted to different system domains.

[0048] In this embodiment, data processing includes data filtering; when the corresponding filtering hook function is triggered, the data to be filtered is filtered, including filtering in the sending system domain and filtering in the receiving system domain.

[0049] In a specific application embodiment, for data filtering, a hook function is mounted in the shared memory related receiving function of the main system domain, and the shared memory data that meets the requirements is received, and the shared memory data that does not meet the requirements is filtered to refuse the communication data from being received. Among them, the shared memory data that does not meet the requirements is the communication data that meets the preset communication data filtering rules. For example, the mmio_read function mounts a hook function through eBPF to filter out the shared memory data that does not meet the requirements, thereby reducing unnecessary resource waste in the main system domain.

[0050] The shared memory related sending function of the main system domain is mounted with a hook function, and the shared memory data that meets the requirements is sent, and the shared memory data that does not meet the requirements is filtered to refuse the communication data from being sent. Among them, the shared memory data that does not meet the requirements is the communication data that meets the preset filtering rules. For example, the mmio_write function is mounted with a hook function through eBPF to filter out the shared memory data to be sent that does not meet the requirements, thereby reducing the resource consumption related to data sending and reducing unnecessary resource waste from the system domain.

[0051] In this embodiment, the corresponding data processing function: when the corresponding processing hook function is triggered, the corresponding data to be processed is captured and processed, and the data packet is regenerated. The corresponding data packet that needs to be forwarded is sent to the corresponding eBPF processing module by the hook function, and the eBPF processing module forwards it to different system domains. For example: when the slave system domain needs to send a data packet to the main system domain, the current position data packet is captured after the hook function is triggered by sending the data packet, and the current position data packet is calculated, wherein the calculation algorithm includes but is not limited to rendering, value taking, averaging, etc., and the calculated data packet is reassembled into a new data packet and sent to the eBPF processing module, and the eBPF processing module sends it to the main system domain through shared memory.

[0052] In this embodiment, data processing includes data forwarding: if the shared memory receiving function of the hook function is triggered, the shared memory receiving function determines whether the communication data satisfies the preset communication data forwarding rules; if the preset communication data forwarding rules are satisfied, data forwarding is performed on the communication data according to the communication data forwarding rules; if the shared memory sending function of the hook function is triggered, the shared memory sending function determines whether the communication data satisfies the preset forwarding rules; if the preset communication data forwarding rules are satisfied, data forwarding is performed on the communication data according to the communication data forwarding rules.

[0053] In a specific application embodiment, for data forwarding, a hook function is mounted at the corresponding data processing function position in the main system domain, and for shared memory data forwarding that meets the requirements, for example, a hook function is mounted through eBPF at the corresponding driver (uart, i2c, etc.) related register read and write function position, and the corresponding register write data is forwarded to the shared memory register mapping position, and the corresponding register read data is forwarded to read the corresponding shared memory register mapping position data.

[0054] The hook function is mounted at the corresponding data processing function position of the slave system domain, and the shared memory data that meets the requirements is forwarded. For example, after receiving the shared memory data from the slave system domain, the corresponding interrupt trigger function position is mounted through eBPF, and the corresponding register write data operation is directly written to the physical register through the hook function, and the corresponding register read operation is converted to directly read the physical register through the hook function.

[0055] The above is data forwarding between the master system domain and the slave system domain, and the method between the slave system domains is similar. Without modifying the kernel between the isolated multiple systems, the effect of isolating the physical device register sharing between the multiple systems can be achieved with very little code.

[0056] In this embodiment, data processing includes data extraction: if the shared memory receiving function of the hook function is triggered, the shared memory receiving function extracts data from the communication data according to the preset data extraction rules and stores it to the specified location or sends it to the specified target; if the shared memory sending function of the hook function is triggered, the shared memory sending function extracts data from the communication data according to the preset data extraction rules and stores it to the specified location or sends it to the specified target.

[0057] Specifically, for data extraction, a hook function is mounted at the corresponding data processing function position of the main system, and the shared memory data that meets the requirements is extracted; the hook function is mounted at the corresponding data processing function position of the slave system domain, and the shared memory data that meets the requirements is forwarded. For example, after receiving the shared memory data from the corresponding slave system domain, the corresponding interrupt trigger function position is mounted through eBPF, and the corresponding register write data operation is directly written to the physical register through the hook function, and the corresponding register read operation is converted to directly read the physical register through the hook function.

[0058] In this embodiment, data processing includes data debugging: if the shared memory receiving function of the hook function is triggered, the shared memory receiving function performs data debugging on the communication data according to a preset data debugging method and stores the debugging result to a specified location or sends it to a specified target; if the shared memory sending function of the hook function is triggered, the shared memory sending function performs data debugging on the communication data according to a preset data debugging method and stores the debugging result to a specified location or sends it to a specified target.

[0059] For operations such as data extraction and data debugging between multiple systems, eBPF is also used to mount related hook functions at corresponding locations to achieve the corresponding purposes. The principles are the same and will not be repeated here.

[0060] like Figure 3 As shown, in a specific application embodiment, multiple system domains mutually use eBPF to mount hook functions to realize functions such as data processing, function debugging, performance analysis, and anomaly detection between multiple systems. The eBPF mount hook functions between multiple systems can be the master system domain and the slave system domain supporting the eBPF function, or the slave system domain and the slave system domain. The communication of data between multiple systems can be handled safely and flexibly, reducing development difficulties and related workload.

[0061] In this embodiment, the main eBPF control service generates a hardware resource protection eBPF function based on the isolated system hardware configuration resource file, and mounts the corresponding hook function. The main system domain can only use the hardware resources configured for the main system domain, and triggers the corresponding hook function for the hardware resources isolated to the slave system domain to prevent illegal use. Each slave system domain can only use the configured hardware resources, and triggers the corresponding hook function for the hardware resources that are not configured to prevent illegal use.

[0062] This embodiment takes jailhouse as an example to implement that the master and slave system domains can only use their own configured hardware resources. The specific implementation steps of triggering the corresponding hook function to prevent illegal use of unconfigured hardware resources are as follows:

[0063] 1. Generate eBPF processing code based on the jailhouse hardware isolation profile of the main system domain, and mount hook functions at relevant locations of the main system domain to prevent illegal use when hardware resources other than the jailhouse hardware isolation profile of the main system domain are used.

[0064] 2. Generate eBPF processing code based on the jailhouse hardware isolation profile of each slave system domain, and mount the hook function at the relevant location of the master system domain. When the master system domain uses the hardware resources defined in the jailhouse hardware isolation profile of each slave system domain, illegal use is prevented.

[0065] 3. The master eBPF control service of the master system domain generates eBPF code based on the jailhouse hardware isolation configuration files of each slave system domain, and the master eBPF control service composes data packets and sends them to the slave eBPF control services of each slave system domain.

[0066] 4. Each slave system domain receives data packet analysis from the eBPF control service and mounts a hook function at the relevant location of the slave system domain to prevent illegal use when the slave system domain uses hardware resources outside the definition of the jailhouse hardware isolation configuration file of each slave system domain.

[0067] 5. The corresponding jailhouse hardware isolation configuration file can be generated by the eBPF control service or by other means, such as by developers. The corresponding eBPF code can be generated in the master system domain or in the slave system domain.

[0068] In this embodiment, a hook function is mounted on the virtual device of each system domain. When the corresponding virtual device is used, the hook function of the corresponding virtual device is triggered. The relevant operations form a data packet, which is sent by the eBPF processing module to the corresponding system domain with hardware resources to actually operate the physical device.

[0069] Specifically, taking the example that the master system domain has actual physical devices and the slave system domain has virtual devices, the implementation steps are as follows:

[0070] 1. Mount the hook function at the corresponding virtual device related register mount point location in the system domain.

[0071] 2. When the slave system domain uses the virtual device to operate the register, the hook function of the corresponding virtual device is triggered. The hook function captures the relevant register operation and generates a data packet, which is sent to the master system domain through the shared memory by the eBPF processing module of the slave system domain.

[0072] 3. The eBPF processing module in the main system domain receives the data packet, parses it, and then operates the corresponding register. At the same time, the eBPF processing module in the main system domain composes the result of the register operation into a data packet and sends it to the eBPF processing module in the corresponding slave system domain through the shared memory.

[0073] 4. The corresponding result data packet received from the eBPF processing module in the system domain is parsed and returned to the simulation device for use by the simulation device.

[0074] This embodiment also includes running only the master or slave eBPF control service for the system domain without eBPF related components. The corresponding system domain without eBPF related components sends the filtering and processing function composition data packet to the eBPF control service of the system domain with eBPF related components that needs inter-domain communication through the shared memory through the eBPF control service of the system domain with eBPF related components. The eBPF control service of the system domain with eBPF related components generates relevant eBPF code according to the received data packet, and mounts the hook function at the relevant mount point position of the system domain with eBPF related components to realize data processing of the communication data.

[0075] Specifically, taking the Zephyr RTOS system as an example, the specific implementation steps are as follows:

[0076] 1. Run the zephyr system from the system domain. The zephyr system runs the eBPF control service from the system domain, but the zephyr system from the system domain does not have eBPF related components and eBPF processing modules.

[0077] 2. The zephyr system in the slave system domain sends the data packets composed of filtering and processing functions of communication data to the target system domain (including the main system domain or the slave system domain) with eBPF-related components through the slave eBPF control service.

[0078] 3. The eBPF control service of the target system domain with eBPF-related components receives the data packet, generates eBPF code after parsing, and mounts the hook function at the relevant location of the target system domain.

[0079] 4. After writing data from the zephyr system in the system domain to the target system domain, the corresponding data filtering and processing hook functions are triggered, and the target system domain completes the data filtering and processing functions of the receiving zephyr system.

[0080] This embodiment mounts hook functions at isolation and virtualization related locations to filter illegal isolation and virtualization operations. Taking jailhouse as an example, the specific implementation steps are as follows:

[0081] 1. Generate eBPF code for jialhouse related prohibited operations (such as prohibiting virtual interrupts, virtual network cards, virtual memory, etc.), mount it to the corresponding system domain, and block the corresponding operations when the corresponding system domain uses the corresponding jialhouse function, thereby reducing jialhouse operations, reducing unnecessary system consumption, and improving real-time performance.

[0082] 2. Set the jialhouse related hardware usage permissions to generate eBPF code, mount it to the corresponding system domain, and block the corresponding operation when the corresponding system domain uses the corresponding jialhouse hardware usage permissions. For example, the read, write, execute, cache, etc. of the hardware device are uniformly set, without stopping to modify the code, reducing the related workload.

[0083] like Figure 4 As shown, the main system domain chooses to manually write or generate or other methods to obtain eBPF related code and send the eBPF related code to the slave system domain. The slave system domain receives the eBPF related code from the main system domain, compiles and generates a hook function after verification, and mounts it to the relevant function function position; at the same time, the main system domain can receive eBPF related code from the slave system domain, compiles and generates a hook function after verification, and mounts it to the relevant function function position; the eBPF code of the main system domain can be sent to all slave system domains. The slave system domain can send the eBPF processing code to the main system domain after having the permission. The specific permission is managed by the main eBPF control service of the main system domain, that is, receiving the eBPF processing code of the specified slave system domain.

[0084] In this embodiment, eBPF related codes can also be sent between slave system domains, and the hook function is compiled and mounted to the relevant function position after verification. The eBPF code can be sent between slave system domains only after having the permission. For the slave system domain, the specific permission is managed by the slave eBPF control service of each slave system domain, that is, receiving the eBPF processing code of the specified slave system domain.

[0085] Specifically, the main system domain generates eBPF code through languages ​​such as C and Python, and sends it to the corresponding slave system domain through shared memory through the eBPF mounting processing steps. After the slave system domain receives the eBPF code and verifies the eBPF code successfully, it is compiled and mounted to the corresponding function location through JIT and other methods. After the corresponding hook function runs successfully, it is returned to the main system domain through shared memory to indicate that the corresponding slave system hook function has been successfully mounted.

[0086] For example, the main system domain chooses to manually write or generate or otherwise obtain the data processing function of the eBPF-related code from the system domain, sends it to the corresponding slave system domain through shared memory, receives and verifies the eBPF data processing function from the system domain, and compiles and mounts it to the slave system domain to process data optimization and reduce the amount of shared memory data transmission between the main system domain and the slave system domain.

[0087] The above is applicable to the eBPF hook function between the master system domain and the slave system domain, and between the slave system domains. Further, the master system domain can send relevant data packets to multiple slave system domains, and the slave system domain can send data packets to the master system domain and multiple slave system domains.

[0088] For functions such as functional debugging, performance analysis, and anomaly detection, eBPF is also used to mount related hook functions at corresponding locations to achieve the corresponding purposes. The principles are the same and will not be elaborated here.

[0089] In this embodiment, the shared memory data packets are filtered and processed by eBPF mounting hook functions between isolated multiple systems. The master system domain can send eBPF programs to the slave system domain and selectively receive the slave system domain eBPF programs to mount hook functions; the slave system domain can send eBPF programs and selectively receive other system domain eBPF programs to mount hook functions. At the same time, for shared memory communication between isolated systems that requires special processing procedures, eBPF's flexible mounting function hook function can be used.

[0090] In this embodiment, after each sending system domain writes shared memory data to the receiving system domain, the receiving system domain will trigger an interrupt to ensure the real-time performance of the shared memory communication.

[0091] This embodiment provides a safe and effective communication data filtering and processing mechanism between isolated multiple systems. The flexible mounting function hook function between each system domain improves the data communication efficiency, reduces related work, reduces development difficulty, and increases system security functions.

[0092] In this embodiment, the data filtering, processing, forwarding and other functional methods between the master system domain and the slave system domain, and between the slave system domains are similar. Without modifying the isolated multi-system kernel and application, the shared memory data isolation of each system domain between the isolated multi-systems is achieved.

[0093] This embodiment also provides an isolated multi-system communication and management system based on eBPF, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute an isolated multi-system communication and management method based on eBPF.

[0094] In this embodiment, an isolated multi-system communication and management system based on eBPF and an isolated multi-system communication and management method based on eBPF have a one-to-one correspondence, and will not be described one by one here.

[0095] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment, it is not intended to limit the present invention. Therefore, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.

Claims

1. An isolated multi-system communication and management method based on eBPF, characterized in that: The following steps are involved: S101, complete or generate eBPF processing code according to requirements; S102, the eBPF control service corresponding to the present system domain determines whether the eBPF processing code is mounted to the present system domain or other target system domains by the system domain mount flag of the eBPF processing code, and executes step S104 when the eBPF processing code is mounted to the present system domain; and executes step S103 when the eBPF processing code is mounted to other target system domains; S103, the eBPF control service of the system domain sends the data packet composed of the eBPF processing code to the eBPF control service of the target system domain corresponding to the eBPF processing code to be added through the shared memory, and the corresponding eBPF control service receives the data packet and parses it and then executes step S104; S104, the corresponding eBPF control service generates a hook function for the corresponding eBPF processing code and mounts it to the corresponding mount point of the operating system; S105, after the hook function is triggered to run, it captures and processes relevant communication data, and sends the relevant data to the eBPF processing module corresponding to the corresponding eBPF control service; S106, the corresponding eBPF processing module reads the data packet data and calls the relevant processing mechanism.

2. The eBPF-based isolated multi-system communication and management method according to claim 1, characterized in that: A hook function is mounted at the shared memory communication location of each system domain to process the communication data.

3. The eBPF-based isolated multi-system communication and management method according to claim 2, characterized in that: The data processing includes data filtering. When the corresponding filtering hook function is triggered, the corresponding data to be filtered is filtered, including filtering in the sending system domain and filtering in the receiving system domain. The filtering hook function is mounted to the shared memory communication mount point location of each system domain and is used to filter the shared memory communication data of each system domain.

4. The eBPF-based isolated multi-system communication and management method according to claim 2, characterized in that: The data processing includes corresponding processing functions: when the corresponding processing hook function is triggered, the corresponding data to be processed is processed and the data packet is regenerated; the corresponding data packet to be forwarded is sent by the hook function to the corresponding eBPF processing module of the current system domain, and forwarded by the eBPF processing module to other different system domains. The corresponding processing hook function is mounted to the shared memory communication mount point location of each system domain. The corresponding processing hook function obtains the communication data packet between each system domain, and regenerates the communication data packet between each system domain after being processed by the hook function.

5. The eBPF-based isolated multi-system communication and management method according to any one of claims 1 to 4, characterized in that: The corresponding hook function can be mounted to the system domain that needs to send data, or it can be mounted to the system domain that needs to receive data.

6. The eBPF-based isolated multi-system communication and management method according to claim 2, characterized in that: The main eBPF control service generates a hardware resource protection eBPF function based on the isolated system hardware configuration resource file, and mounts the corresponding hardware resource protection hook function, so that the main system domain can only use the pre-configured main system domain hardware resources. For the hardware resources isolated to the slave system domain, the corresponding hardware resource protection hook function will be triggered to prevent illegal use. Each slave system domain can only use the pre-configured slave system domain hardware resources, otherwise the corresponding hook function will be triggered to prevent illegal use.

7. The eBPF-based isolated multi-system communication and management method according to claim 6, characterized in that: A hook function is mounted on the virtual device of each system domain. When the corresponding virtual device is used, the hook function of the corresponding virtual device is triggered, and the relevant register operations are composed into a data packet, which is sent by the corresponding eBPF processing module to the system domain that has the hardware resources corresponding to the virtual device, so as to realize the actual control of the physical device.

8. The eBPF-based isolated multi-system communication and management method according to claim 1, characterized in that: In the process of mounting the monitoring hook function to the slave system domain through the main system domain, when the monitoring hook function of the slave system domain is triggered, the corresponding eBPF processing module of the slave system domain sends a monitoring data packet to the main system domain, and the main system domain receives the monitoring data packet in real time to realize the real-time monitoring of the data processing status of the slave system domain by the main system domain. The monitoring data packet is generated by the corresponding monitoring hook function of the slave system domain.

9. The eBPF-based isolated multi-system communication and management method according to claim 1, characterized in that: It also includes a system domain without eBPF related components. The corresponding system domain without eBPF related components sends the data packet composed of filtering and processing functions through the eBPF control service of this system domain to the eBPF control service of the system domain with eBPF related components that requires inter-domain communication through shared memory. The eBPF control service of the system domain with eBPF related components generates relevant eBPF code based on the received data packet, and mounts the hook function at the relevant mount point location of the system domain with eBPF related components to realize data processing of the communication data.

10. An isolated multi-system communication and management system based on eBPF, comprising interconnected microprocessors and memories, characterized in that: The microprocessor is programmed or configured to execute the eBPF-based isolated multi-system communication and management method as described in any one of claims 1 to 9.