WO2024046260A1 - 一种热补丁方法及相关装置 - Google Patents
一种热补丁方法及相关装置 Download PDFInfo
- Publication number
- WO2024046260A1 WO2024046260A1 PCT/CN2023/115208 CN2023115208W WO2024046260A1 WO 2024046260 A1 WO2024046260 A1 WO 2024046260A1 CN 2023115208 W CN2023115208 W CN 2023115208W WO 2024046260 A1 WO2024046260 A1 WO 2024046260A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- functions
- processes
- information
- call information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/572—Secure firmware programming, e.g. of basic input output system [BIOS]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/577—Assessing vulnerabilities and evaluating computer system security
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/656—Updates while running
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/658—Incremental updates; Differential updates
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/484—Precedence
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present application relates to the field of computer technology, and in particular, to a hot patch method and related devices.
- the server's kernel can already fix kernel defects without restarting the system based on hot patching, which is called kernel hot patching.
- kernel hot patching hot patching
- Processes, threads, and shared software libraries also need to be patched. Otherwise, the server may be exposed to attacks that exploit vulnerabilities such as Heartbleed or GHOST.
- a common way to deal with library vulnerabilities in a server is to restart the server or restart the application causing downtime and the vulnerability window. Additionally, administrators rarely know which libraries a service is using, so they need to restart the entire server to update the service.
- the technical problem to be solved by the embodiments of this application is to provide a hot patch method and related devices, which can repair vulnerabilities in the software library running on the server without restarting the process, and solve the problems caused by restarting the server or application program. Losses due to service suspension.
- the implementation example of this application provides a hot patch method, which is characterized in that the method includes: determining patch files generated for multiple objective functions; determining M from N processes based on the multiple objective functions.
- the target process and records the initial call information of the M target processes.
- the initial call information includes the information that each of the target processes calls the multiple target functions.
- N and M are integers greater than 0, and N is greater than Or equal to M; determine the current call information corresponding to each of the M target processes, each of the current call information includes information that the corresponding target process currently calls the multiple target functions; based on the initial
- the calling information and the current calling information corresponding to each target process and the patch file are used to perform hot patch operations on the M target processes respectively.
- multiple target processes that call the vulnerable function are first determined, and the information that each target process calls the target function (such as the vulnerable function) is recorded (that is, the initial call information); Next, obtain the information of each target process currently calling the vulnerability function (which can also be understood as the information of the current vulnerability function being called); further, based on the information of the current vulnerability function being called, determine the vulnerabilities that can currently be patched. function; finally, the target process that can currently be patched is determined based on the initial call information of multiple target processes, and the target process is patched based on the patch file, so that the software running on the server can be patched without restarting the process.
- the library repairs vulnerabilities and solves the loss of service suspension caused by restarting the server or application.
- it is necessary to wait until all target processes do not call the vulnerable function before patching all target processes (or threads) at once, resulting in low patching efficiency.
- the initial call information since all the target processes that need to be patched are recorded in advance, as well as the information on how each target process calls the vulnerable function (i.e., the initial call information), after determining the vulnerable function that can currently be patched, you can Based on the initial call information, the target process that can currently be patched is determined from multiple target processes, so that patching can be implemented flexibly according to priority or strategy, thus improving the efficiency of hot patching.
- the patch file includes repair information for each of the multiple objective functions
- determining the patch file generated for the multiple objective functions includes: comparing multiple functions The original code and the repair code are used to determine the plurality of objective functions from the plurality of functions; based on the repair code, the repair information of each of the plurality of objective functions is determined.
- an application service can be run on the electronic device, and multiple functions may be called in the application service.
- the vulnerable functions need to be patched.
- the electronic device can first determine the function of the vulnerability in the application service based on the original code and repair code of the application service (which can be understood as the code modified by the programmer for the vulnerability), and then based on the repair code, it can The patch files for all vulnerable functions are obtained, and the vulnerable functions can be patched based on the patch files, thereby improving the security of the system.
- comparing the original code and the repair code of multiple functions and determining the multiple target functions from the multiple functions includes: running the original code and the repair code respectively. , obtain the first intermediate information of the original code and the second intermediate information of the repair code by modifying the compiler parameters; determine from the multiple functions based on the first intermediate information and the second intermediate information the multiple objective functions.
- the original code and the repair code of the application service can be run separately on the compiler of the electronic device, and then the intermediate files of the original code and the intermediate files of the repair code are respectively obtained by hijacking GCC. Further, the target function (such as the vulnerability function) can be determined by comparing the intermediate files of the original code and the intermediate files of the repaired code.
- the intermediate information between the original code and the repair code can be obtained, which avoids By changing the CC variables of the build project to indirectly call the compiler to obtain the original code and the intermediate files of the repair code, which leads to the problem of limited application scenarios, it reduces the debugging overhead and has a wider scope of application.
- the method further includes: determining M target processes from N processes based on the multiple target functions, including: determining whether each of the N processes calls the At least one of the plurality of target functions; the N processes include one or more of a running process, a newly started process and a process that is about to be pulled up; if one of the plurality of target functions is called At least one of the processes is determined as the target process.
- a process calling a target function such as a vulnerability function
- a target function such as a vulnerability function
- the vulnerable functions that can currently be patched it can be determined from multiple target processes based on the initial call information.
- the target processes that can currently be patched are identified, so that patches can be flexibly patched according to priorities or policies, thus improving the efficiency of hot patching.
- recording the initial call information of the M target processes includes: replacing the memory page corresponding to each of the M target processes with a soft interrupt instruction, and the The soft interrupt instruction is used to suspend the operation of the corresponding target process; and obtain the initial call information of the M target processes.
- the memory page corresponding to the target process can be replaced with a soft interrupt instruction to suspend the running of the target process, so that the initial call of the target process can be obtained information to record in advance all the target processes that need to be patched, and the information about calling vulnerable functions by each target process.
- the vulnerable functions that can currently be patched you can start from multiple target processes based on the initial call information. Determine the target processes that can currently be patched, so that you can flexibly patch based on priority or strategy, thereby improving the efficiency of hot patching.
- determining the current call information corresponding to each of the M target processes includes: recording the current call information of each of the M target processes. information of multiple target functions, and update the corresponding current call information.
- performing a hot patch operation on the M target processes based on the initial call information, the current call information corresponding to each target process, and the patch file includes: According to the hot patch strategy, based on the initial call information and the current call information corresponding to each of the target processes and the repair information of each of the multiple target functions, the M target processes are Hot patch operations are performed on target processes that meet the hot patch policy.
- the hot patch policy can be a customized policy, and the hot patch policy can be divided into multiple dimensions, for example, the function dimension: when a certain vulnerable function is not called by all processes/threads, that is, the vulnerable function (funcx ) when the corresponding value is 0, you can start patching; thread dimension: when func1, func2, and func3 are not called by thread_x, that is, when the corresponding value of thread_x is reduced to 0, you can start patching; full dimension: all vulnerable functions are not called When called by all threads, that is, when the values corresponding to all vulnerable functions are reduced to 0, patching can begin.
- the function dimension when a certain vulnerable function is not called by all processes/threads, that is, the vulnerable function (funcx ) when the corresponding value is 0, you can start patching
- thread dimension when func1, func2, and func3 are not called by thread_x, that is, when the corresponding value of thread_x is reduced to 0, you can start patching
- full dimension all vulnerable functions are not called When called by
- the present application provides a hot patch device, which is characterized in that the device includes: a first processing unit for determining patch files generated for multiple objective functions; a second processing unit for determining based on the The plurality of target functions determine M target processes from the N processes, and record the initial call information of the M target processes.
- the initial call information includes information that each of the target processes calls the multiple target functions.
- N and M are integers greater than 0, and N is greater than or equal to M; the third processing unit is used to determine the M targets
- the current call information corresponding to each of the target processes in the target process, each of the current call information includes information that the corresponding target process currently calls the multiple target functions; a fourth processing unit, configured to based on the initial call information According to the current calling information and the patch file corresponding to each of the target processes, hot patch operations are performed on the M target processes respectively.
- the patch file includes repair information for each of the multiple objective functions
- the first processing unit is specifically configured to: compare the original code and the original code of the multiple functions. a repair code that determines the plurality of objective functions from the plurality of functions; and based on the repair code, determines the repair information for each of the plurality of objective functions.
- the first processing unit is specifically configured to: run the original code and the repair code respectively, and obtain the first intermediate information of the original code and the first intermediate information of the original code by modifying compiler parameters. Repairing second intermediate information of the code; determining the plurality of objective functions from the plurality of functions based on the first intermediate information and the second intermediate information.
- the second processing unit is specifically configured to: determine whether each of the N processes calls at least one of the multiple target functions; the N processes include One or more of a running process, a newly launched process, and a process that is about to be launched; if at least one of the plurality of target functions is called, the corresponding process is determined to be the target process.
- the second processing unit is specifically configured to: replace the memory page corresponding to each of the M target processes with a soft interrupt instruction, and the soft interrupt instruction is used to Pause and run the corresponding target process; obtain the initial call information of the M target processes.
- the third processing unit is specifically configured to: record the information that each of the M target processes currently calls the multiple target functions, and update the corresponding Current call information.
- the fourth processing unit is specifically configured to: according to the hot patch strategy, based on the initial call information and the current call information corresponding to each of the target processes and the multiple target functions
- the repair information of each of the target functions in the M target processes is used to perform a hot patch operation on the target process that satisfies the hot patch policy among the M target processes.
- the present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.
- inventions of the present application provide an electronic device.
- the electronic device includes a processor, and the processor is configured to support the electronic device in implementing corresponding functions in a hot patch method provided in the first aspect.
- the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
- the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
- the present application provides a chip system, which includes a processor and is used to support an electronic device to implement the functions involved in the above-mentioned first aspect, for example, generating or processing information involved in the above-mentioned hot patch method.
- the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device.
- the chip system may be composed of chips, or may include chips and other discrete devices.
- the present application provides a computer program, characterized in that the computer program includes instructions that, when the computer program is executed by a computer, cause the computer to perform any of the methods described in the first aspect. .
- FIG. 1 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present invention.
- FIG. 2 is a software structure block diagram of the electronic device 100 according to the embodiment of the present invention.
- Figure 3 is an architectural diagram of a user-mode hot patch library provided by the prior art.
- Figure 4 is a schematic flow chart of patch production by a user-mode hot patch library provided by the prior art.
- Figure 5 is a schematic diagram of preparing and applying patches in a user-mode hot patch library provided by the prior art.
- Figure 6 is a schematic diagram of the system architecture of a hot patch provided by an embodiment of the present invention.
- Figure 7 is a schematic flowchart of a user mode hot patch method in an embodiment of the present application.
- FIG. 8 is a schematic flowchart of user mode hot patch production according to an embodiment of the present invention.
- Figure 9 is a schematic diagram of a hijacking compiler provided by an embodiment of the present invention.
- Figure 10 is a schematic diagram of user mode injection provided by an embodiment of the present invention.
- Figure 11 is a schematic diagram of initial call data statistics provided by an embodiment of the present invention.
- Figure 12 is a schematic diagram of a statistics call provided by an embodiment of the present invention.
- Figure 13 is a schematic diagram of a user mode hot patch process provided by an embodiment of the present invention.
- Figure 14 is a schematic diagram of a hot patch device provided by this application according to an embodiment of the present invention.
- an embodiment means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application.
- the appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art understand, both explicitly and implicitly, that the embodiments described herein may be combined with other embodiments.
- Tracing function a Linux system call, is used for process tracking. It provides the parent process with the ability to observe and control the execution of its child processes, and allows the parent process to check and replace the kernel image (including registers) of the child process. value.
- Compiler Computer Collection, CC
- compiler variables defined when building the project.
- System call can run another specified program and load the new program into the memory space of the current process.
- FIG. 1 shows a schematic structural diagram of an electronic device 100 .
- electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different component configuration.
- the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
- the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
- Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, And subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an environment.
- the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
- the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
- the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing units.
- the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait.
- application processor application processor, AP
- modem processor graphics processing unit
- GPU graphics processing unit
- image signal processor image signal processor
- ISP image signal processor
- controller memory
- video codec digital signal processor
- DSP digital signal processor
- baseband processor baseband processor
- NPU neural-network processing unit
- different processing units can be independent devices or integrated in one or more processors.
- the controller may be the nerve center and command center of the electronic device 100 .
- the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
- the processor 110 may also be provided with a memory for storing instructions and data.
- the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
- processor 110 may include one or more interfaces.
- Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter, UART) interface, Mobile Industry Division mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (universal serial bus , USB) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- MIPI Mobile Industry Division mobile industry processor interface
- GPIO general-purpose input/output
- SIM subscriber identity module
- USB universal serial bus
- the interface connection relationships between the modules illustrated in the embodiment of the present invention are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
- the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
- the charging management module 140 is used to receive charging input from the charger.
- the charger can be a wireless charger or a wired charger.
- the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
- the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
- the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
- the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
- the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
- Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
- the display screen 194 is used to display images, videos, etc.
- Display 194 includes a display panel.
- the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
- LCD liquid crystal display
- OLED organic light-emitting diode
- AMOLED organic light-emitting diode
- FLED flexible light-emitting diode
- Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
- the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
- the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
- the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
- Camera 193 is used to capture still images or video.
- the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
- the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
- CMOS complementary metal-oxide-semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
- ISP outputs digital image signals to DSP for processing.
- DSP converts digital image signals into standard RGB, YUV and other format image signals.
- electronic device 100 may include other cameras.
- the electronic device may also include a dot matrix emitter (not shown in the figure) for emitting light.
- the camera collects the light reflected by the face and obtains the face image.
- the processor processes and analyzes the face image and compares it with the stored face image information for verification.
- Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
- Video codecs are used to compress or decompress digital video.
- Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
- MPEG moving picture experts group
- MPEG2 MPEG2, MPEG3, MPEG4, etc.
- NPU is a neural network (NN) computing processor.
- NN neural network
- Intelligent cognitive applications of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
- the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
- Internal memory 121 may be used to store computer executable program code, which includes instructions.
- the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 .
- the internal memory 121 may include a program storage area and a data storage area.
- the stored program area can store the operating system and at least one application required for the function (such as Such as face recognition function, fingerprint recognition function, mobile payment function, etc.).
- the storage data area can store data created during the use of the electronic device 100 (such as face information template data, fingerprint information templates, etc.).
- the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc.
- the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
- the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
- Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
- Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
- Microphone 170C also called “microphone” or “microphone”, is used to convert sound signals into electrical signals.
- the headphone interface 170D is used to connect wired headphones.
- the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
- OMTP open mobile terminal platform
- CTIA Cellular Telecommunications Industry Association of the USA
- the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
- pressure sensor 180A may be disposed on display screen 194 .
- the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
- the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
- Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
- the light emitting diode may be an infrared light emitting diode.
- the ambient light sensor 180L is used to sense ambient light brightness.
- the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
- the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
- Fingerprint sensor 180H is used to collect fingerprints.
- the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
- the fingerprint sensor 180H can be disposed below the touch screen.
- the electronic device 100 can receive the user's touch operation on the area corresponding to the fingerprint sensor on the touch screen.
- the electronic device 100 can respond to the touch operation and collect the fingerprint of the user's finger. information.
- Temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy.
- Touch sensor 180K also called “touch panel”.
- the touch sensor 180K can be disposed on the display screen 194.
- the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
- the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
- the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
- Visual output related to the touch operation may be provided through display screen 194 .
- the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
- the buttons 190 include a power button, a volume button, etc.
- Key 190 may be a mechanical key. It can also be a touch button.
- the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
- the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
- the SIM card interface 195 is used to connect a SIM card.
- the SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
- the electronic device 100 uses an eSIM, that is, an embedded SIM card.
- the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
- the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
- This embodiment of the present invention takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
- FIG. 2 is a software structure block diagram of the electronic device 100 according to the embodiment of the present invention.
- the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
- the layers communicate through software interfaces.
- the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer.
- the application layer can include a series of application packages.
- the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video Frequency, SMS and other applications (also called applications).
- the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
- API application programming interface
- the application framework layer includes some predefined functions.
- the application framework layer can include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
- a window manager is used to manage window programs.
- the window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
- Content providers are used to store and retrieve data and make this data accessible to applications.
- Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
- the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
- a view system can be used to build applications.
- the display interface can be composed of one or more views.
- a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
- the phone manager is used to provide communication functions of the electronic device 100 .
- call status management including connected, hung up, etc.
- the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
- the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
- the notification manager is used to notify download completion, message reminders, etc.
- the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of a conversation interface. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
- Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
- the core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.
- the application layer and application framework layer run in virtual machines.
- the virtual machine executes the java files of the application layer and application framework layer into binary files.
- the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
- System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (Media Libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
- the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
- the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
- the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
- the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.
- 2D Graphics Engine is a drawing engine for 2D drawing.
- the kernel layer is the layer between hardware and software.
- the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
- the user mode hot patch technology is as follows:
- FIG 3 is an architectural diagram of a user-mode hot patch library provided by the existing technology.
- libcare generates a patch file by comparing the assembly file generated during the construction of the original code and the new version code; libcare identifies the process And loads the patch in a manner similar to loading a shared object (library) into the target process memory; ibcare changes the instructions of the target process and jumps to the patch.
- Figure 4 is a schematic process diagram for making patches by a user-mode hot patch library provided by the prior art.
- the user-mode hot patch making of libcare is mainly done by changing the compiled CC variables (project When calling the compiler variable, it will jump to the program set by libcare).
- This has two purposes. One is to call the compiler again in the libcare program, and on this basis, you can add compilation parameters that were not originally available; the other is In this way, the output location of the compiled intermediate file can be obtained. Then, libcare generates the patch file by comparing the source code and the intermediate file (assembly file) of the patch code.
- Figure 5 is a schematic diagram of preparing and applying patches in a user-mode hot patch library provided by the prior art.
- libcare traverses the /proc/ file
- the process that needs to be patched is found among all processes.
- libcare waits until there is no patch symbol information in the stack of each thread in the process, then stops the process through ptrace, performs code injection, and inserts the entry of the target function into the process. Modified to jump to the patch function location.
- This solution can repair vulnerabilities in the software library running on the server without restarting the electronic device (such as the server), but it has the following shortcomings:
- Disadvantage 1 libcare indirectly calls the compiler to generate assembly files by changing the compiler variables (CC variables) of the built project, but Some scenarios are not applicable. For example, some projects require cross-compilation and use compiler variables, which will conflict with the construction of patches. For example, some projects may not be built using compiler variables, so they cannot be built. Patch construction.
- Disadvantage 2 During the patch preparation process, libcare obtains the target process by traversing the /proc/ folder during the stage of identifying the target process. This causes many non-target processes to be scanned. If there are too many processes, it will consume a lot of time.
- Disadvantage 3 In order to maintain the memory consistency of the process, it is necessary to ensure that each thread is running in a safe position (there is no patch symbol information in the stack). libcare will sequentially traverse all threads until all threads are in a safe position. Only then will the jump instructions be injected into the process. This prevents libcare from configuring partial thread patching.
- the hot patch method provided in this application can be used to solve the above technical problems.
- FIG. 6 is a schematic diagram of a hot patch system architecture provided by an embodiment of the present invention.
- This system can run in the software system of the above-mentioned electronic device 100 and can be used to modify the software library without restarting the process. Repair vulnerabilities to avoid service suspension losses caused by restarting electronic devices (such as servers) or applications.
- the system architecture can include a patch production tool (upatch build), a patch enhancement tool (upatch helper), a user-mode injection tool (compel program), and a kernel-mode patch module (upatch handler).
- the patch production tool can generate user-space patch files by hijacking gcc, comparing difference functions (such as vulnerability functions), and processing intermediate files. How the patch production tool produces user-space patch files will be explained in detail later, and I will not go into details here.
- the patch enhancement tool can be used to query whether a patch is inserted into an executable file (which can be a patch file for a binary file), to query the version of the patch in the executable file, and to query the correspondence between the patch and the executable file.
- User-mode injection tools can be used to obtain the initial stack call status of the process/thread (i.e.
- the kernel-mode patch module can be used to update the function call data of processes/threads in real time and patch user-mode processes/threads. This will be explained in detail later, so I won’t go into details here.
- system architecture of a hot patch in Figure 6 is only an exemplary implementation in the embodiment of the present application.
- the system architecture of the hot patch in the embodiment of the present application includes but is not limited to the above system architecture.
- Figure 7 is a schematic flow chart of a user mode hot patching method in an embodiment of the present application.
- the hot patching method in an embodiment of the present application will be described below in conjunction with Figure 7 and based on the electronic device 100 in Figure 1. Describe it. It should be noted that, in order to describe the hot patch method in the embodiment of the present application in more detail, the present application describes that the corresponding execution subject is the electronic device 100 in each process step, but this does not mean that the embodiment of the present application can only be performed through all the processes. The described execution subject performs the corresponding method flow.
- Step S201 The electronic device determines patch files generated for multiple objective functions.
- the patch file includes repair information for each of the multiple objective functions.
- Multiple target functions may include, but are not limited to, one or more of functions that require vulnerability, functions that need to add content, and functions that need to delete content.
- a patch file can be understood as an executable program used to repair multiple target function vulnerabilities, which includes repair information for each target function.
- the repair information of each objective function can be understood as the executable program used to repair the corresponding objective function.
- the electronic device 100 determines the patch files generated for multiple target functions, including: the electronic device 100 compares the original codes and repair codes of the multiple functions, and determines the patch files from the multiple functions.
- the plurality of objective functions are described; based on the repair code, the repair information of each of the plurality of objective functions is determined.
- an application service may be run on the electronic device 100, and multiple functions may be called in the application service.
- the application service if a vulnerability occurs in one or more functions, the vulnerable functions need to be patched.
- the electronic device 100 can be based on the original code and repair code of the application service (which can be understood as the code modified by the programmer for the vulnerability), First determine the functions with vulnerabilities in the application service, and then based on the repair code, the patch files for all vulnerable functions can be obtained, and then the vulnerable functions can be patched based on the patch files, which improves the security of the system.
- the electronic device 100 compares the original code and the repair code of multiple functions, and determines the multiple target functions from the multiple functions, including: the electronic device 100 runs the original code respectively. code and the repair code, obtain the first intermediate information of the original code and the second intermediate information of the repair code by modifying compiler parameters; based on the first intermediate information and the second intermediate information, from the The plurality of objective functions are determined among the plurality of functions.
- the first intermediate information may include, but is not limited to, data and results generated during the running of the original code; the second intermediate information may include, but is not limited to, data and results generated during the running of the repair code.
- the original code and the repair code of the application service can be run separately on the compiler (GNU Compiler Collection, GCC) of the electronic device 100, and then the intermediate files of the original code and the intermediate files of the repair code are respectively obtained by hijacking GCC.
- the patch creation tool can determine the vulnerable function by comparing the intermediate files of the original code and the intermediate files of the repaired code.
- the intermediate information between the original code and the repair code can be obtained, which avoids By changing the CC variables of the build project to indirectly call the compiler to obtain the original code and the intermediate files of the repair code, which leads to the problem of limited application scenarios, it reduces the debugging overhead and has a wider scope of application.
- Figure 8 is a schematic flow chart of user-mode hot patch production provided by an embodiment of the present invention.
- the electronic device 100 can run the repair code and the original code respectively, and then hijack the compiler (such as gcc Compiler) execution entry, check environment variables (whether repair code compilation or original code compilation), determine the stage of patch production; apply for new memory space, layout new parameter set, modify the gcc original stack, and re-execute the system call (i.e. execve Call); compile and generate the original object file (pre object) and repair object file (post object), as well as related intermediate files.
- the compiler such as gcc Compiler
- check environment variables whether repair code compilation or original code compilation
- the original object file can correspond to the source code of a running user mode process in the past and compile a binary file
- the repair object file is obtained by recompiling the modified source code (without errors); further, compare the pre object and post object files to obtain the different functions and related data; generate according to the processing of the difference function, related data, meta information, etc.
- User mode hot patch in binary format (Executable and Linkable Format, ELF).
- Figure 9 is a schematic diagram of a hijacking compiler provided by an embodiment of the present invention.
- Step S202 The electronic device determines M target processes from N processes based on the plurality of target functions, and records the initial call information of the M target processes.
- the N processes include one or more of a running process, a newly launched process, and a process that is about to be launched.
- the initial call information includes information that each of the target processes calls the multiple target functions, and each of the target processes is a process that calls one or more of the multiple target functions.
- N and M is an integer greater than 0, and N is greater than or equal to M.
- the target process that can currently be patched is determined based on the initial call information of multiple target processes, and the target process is patched based on the patch file, so that the software library running on the server can be patched without restarting the process.
- determining M target processes from N processes based on the multiple target functions includes: determining whether each of the N processes calls one of the multiple target functions. At least one of; the N processes include one or more of a running process, a newly launched process, and a process that is about to be launched; if at least one of the multiple target functions is called, then The corresponding process is determined as the target process.
- recording the initial call information of the M target processes includes: replacing the memory page corresponding to each of the M target processes with a soft interrupt instruction, and the The soft interrupt instruction is used to suspend the operation of the corresponding target process; and obtain the initial call information of the M target processes.
- the memory page can be used to store the executable program of the process;
- the soft interrupt instruction can be understood as when the event cannot be processed in a short time, it is completed by the soft interrupt, that is, the running process can be suspended through the soft interrupt instruction.
- the memory pages corresponding to the target processes can be replaced with soft interrupt instructions to suspend the operation.
- the target process can obtain the initial call information of the target process, so as to record in advance all the target processes that need to be patched, and the information of each target process calling the vulnerable function. After determining the vulnerable function that can currently be patched, The target process that can currently be patched can be determined from multiple target processes based on the initial call information, thereby enabling flexible patching based on priority or strategy, thus improving the efficiency of hot patching.
- Figure 10 is a schematic diagram of user mode injection provided by an embodiment of the present invention.
- you can first search for the virtual memory space in the address mapping space of the running process ( virtual memory area, vma); after reading the vma information, find the corresponding memory page and replace it with a soft interrupt instruction.
- each file in the kernel has a corresponding index node inode in the file system (inode is a data structure in the UNIX operating system and contains some important information related to each file in the file system) , there is an attribute memory address (i_mapping) in the inode, and i_mapping saves the address space mapping information vma.
- all mmap call entries will check the file to determine whether it is a target binary file (whether a binary file needs to be patched); look for the address mapping of the running process vma in the space; after reading the vma information, find the corresponding memory page and replace it with a soft interrupt instruction; trigger the uprobe handler, and the kernel mode module performs related processing.
- Figure 11 is a schematic diagram of initial call data statistics provided by an embodiment of the present invention.
- the calling situation is passed to the kernel hot patch module. This information will be used in subsequent patches; the memory storing the compel program is deleted; all threads of the process are restored and the process runs normally.
- Step S203 The electronic device determines the current calling information corresponding to each of the M target processes.
- each of the current calling information includes information corresponding to the target process currently calling the plurality of target functions.
- determining the current call information corresponding to each of the M target processes includes: recording the current call information of each of the M target processes. information about multiple target functions, and update the corresponding current call information.
- the vulnerable function will be recorded in the corresponding current call information. Without pausing all threads or processes, the information of the target process currently calling the vulnerable function can be obtained for subsequent detection.
- the vulnerability functions that are currently not called are determined as vulnerable functions that can currently be patched, thereby improving the efficiency of hot patching and maintaining the memory consistency of the process.
- Figure 12 is a schematic diagram of a statistical call provided by an embodiment of the present invention.
- the entrance and exit of the vulnerable function can be hijacked to update the call statistics in real time, such as when When thread 1 calls func1, the count increases by one, and when the call completes, the count decreases by one.
- Step S204 The electronic device performs hot patch operations on the M target processes based on the initial call information, the current call information corresponding to each target process, and the patch file.
- Figure 13 is a schematic diagram of a user-mode hot patch process provided by an embodiment of the present invention.
- the figure is based on user-mode hot patching. Difference file and generate a patch file through the user mode patch tool; after the user mode generates the patch file, use the patch enhancement tool (upatch helper) to send the corresponding relationship between the vulnerability function and the binary file (repair information) to the kernel mode module; identify whether the process calls the vulnerability function, if called, triggers the kernel module to replace the corresponding memory page with a soft interrupt instruction; counts the initial call information of the process function through the user mode injection tool; saves the statistical data to the kernel module; the kernel module detects the process call information in real time, And the calling information of the thread calling the vulnerable function is updated in real time; according to the configuration policy, when the corresponding vulnerable function call is detected to be 0, it jumps to the new function address; the user mode problem is repaired and the hot patch process is completed.
- the patch enhancement tool upatch helper
- performing a hot patch operation on the M target processes based on the initial call information, the current call information corresponding to each target process, and the patch file includes: According to the hot patch strategy, based on the initial call information and the current call information corresponding to each of the target processes and the repair information of each of the multiple target functions, the M target processes are Hot patch operations are performed on target processes that meet the hot patch policy.
- the hot patch strategy can be a customized strategy.
- the hot patch strategy can be divided into multiple dimensions. For example, the function dimension: when a certain vulnerable function is not called by all processes/threads, that is, the value corresponding to the vulnerable function (funcx) When it is 0, you can start patching; thread dimension: when func1, func2, and func3 are not called by threadx, that is, when the corresponding value of threadx is reduced to 0, you can start patching; full dimension: when all vulnerable functions are not called by all threads , that is, when the values corresponding to all vulnerability functions are reduced to 0, patching can begin.
- the function dimension when a certain vulnerable function is not called by all processes/threads, that is, the value corresponding to the vulnerable function (funcx) When it is 0, you can start patching
- thread dimension when func1, func2, and func3 are not called by threadx, that is, when the corresponding value of threadx is reduced to 0, you can start patching
- full dimension when all vulnerable functions are not called by all thread
- FIG 14 is a schematic diagram of a hot patch device provided by this application according to an embodiment of the present invention.
- the hot patch device 30 may include a first processing unit 301, a second processing unit 302, and a third processing unit. 303.
- the fourth processing unit 304, the detailed description of each module is as follows.
- the first processing unit 301 is used to determine patch files generated for multiple objective functions.
- the second processing unit 302 is configured to determine M target processes from the N processes based on the plurality of target functions, and record the initial call information of the M target processes, where the initial call information includes each of the target processes.
- Information about the process calling the multiple target functions, N and M are integers greater than 0, and N is greater than or equal to M.
- the third processing unit 303 is configured to determine the current call information corresponding to each of the M target processes.
- Each of the current call information includes information that the corresponding target process currently calls the multiple target functions.
- the fourth processing unit 304 is configured to perform hot patch operations on the M target processes based on the initial call information, the current call information corresponding to each target process, and the patch file.
- the patch file includes repair information for each of the multiple objective functions
- the first processing unit 301 is specifically configured to: compare the original codes of the multiple functions. and a repair code to determine the plurality of objective functions from the plurality of functions; and based on the repair code, determine the repair information for each of the plurality of objective functions.
- the first processing unit 301 is specifically configured to: run the original code and the repair code respectively, and obtain the first intermediate information of the original code and the repair code by modifying compiler parameters.
- the second intermediate information of the repair code based on the first intermediate information and the second intermediate information, determine the plurality of objective functions from the plurality of functions.
- the second processing unit 302 is specifically configured to: determine whether each of the N processes calls at least one of the multiple target functions; the N processes include One or more of a running process, a newly launched process, and a process that is about to be launched; if at least one of the plurality of target functions is called, the corresponding process is determined to be the target process.
- the second processing unit 302 is specifically configured to replace the memory page corresponding to each of the M target processes with a soft interrupt instruction.
- the soft interrupt instruction is Suspend and run the corresponding target process; obtain the initial call information of the M target processes.
- the third processing unit 303 is specifically configured to: record each of the M target processes.
- the target process currently calls information on the plurality of target functions, and updates the corresponding current call information.
- the fourth processing unit 304 is specifically configured to: according to the hot patch strategy, based on the initial call information and the current call information corresponding to each of the target processes and the multiple targets According to the repair information of each target function in the function, a hot patch operation is performed on a target process among the M target processes that satisfies the hot patch strategy.
- the present application provides a computer storage medium, which is characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above hot patching methods is implemented.
- An embodiment of the present application provides an electronic device.
- the electronic device includes a processor, and the processor is configured to support the electronic device to implement corresponding functions in any of the above hot patch methods.
- the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
- the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
- the present application provides a chip system, which includes a processor and is used to support an electronic device to implement the above-mentioned functions, for example, generate or process information involved in the above-mentioned hot patch method.
- the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device.
- the chip system may be composed of chips, or may include chips and other discrete devices.
- the present application provides a computer program, which is characterized in that the computer program includes instructions that, when the computer program is executed by a computer, cause the computer to execute the above-mentioned user mode hot patching method.
- the disclosed device can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the above units is only a logical function division. In actual implementation, there may be other divisions.
- multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical or other forms.
- the units described above as separate components may or may not be physically separated.
- the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
- the above integrated units can be implemented in the form of hardware or software functional units.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to execute all or part of the steps of the above methods in various embodiments of the present application.
- a computer device which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device
- the aforementioned storage media may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviation: ROM) or random access memory (Random Access Memory, abbreviation: RAM), etc.
- U disk mobile hard disk
- magnetic disk magnetic disk
- optical disk read-only memory
- read-only memory Read-Only Memory
- RAM random access memory
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
Description
Claims (16)
- 一种热补丁方法,其特征在于,所述方法包括:确定针对多个目标函数生成的补丁文件;基于所述多个目标函数从N个进程中确定M个目标进程,并记录所述M个目标进程的初始调用信息,所述初始调用信息包括每个所述目标进程调用所述多个目标函数的信息,N和M为大于0的整数,且N大于或等于M;确定所述M个目标进程中每个所述目标进程对应的当前调用信息,每个所述当前调用信息包括对应目标进程当前调用所述多个目标函数的信息;基于所述初始调用信息和每个所述目标进程对应的当前调用信息以及所述补丁文件,对所述M个目标进程分别进行热补丁操作。
- 如权利要求1所述的方法,其特征在于,所述补丁文件包括所述多个目标函数中每个所述目标函数的修复信息,所述确定针对多个目标函数生成的补丁文件,包括:对比多个函数的原始代码和修复代码,从所述多个函数中确定所述多个目标函数;基于所述修复代码,确定所述多个目标函数中每个所述目标函数的所述修复信息。
- 如权利要求2所述的方法,其特征在于,所述对比多个函数的原始代码和修复代码,从所述多个函数中确定所述多个目标函数,包括:分别运行所述原始代码和所述修复代码,通过修改编译器参数获取所述原始代码的第一中间信息和所述修复代码的第二中间信息;基于所述第一中间信息和所述第二中间信息,从所述多个函数中确定所述多个目标函数。
- 如权利要求1-3任意一项所述的方法,其特征在于,所述基于所述多个目标函数从N个进程中确定M个目标进程,包括:判断所述N个进程中每个进程是否调用所述多个目标函数中的至少一个;所述N个进程包括正在运行的进程、新拉起的进程和即将被拉起的进程中的一种或多种;若调用所述多个目标函数中的至少一个,则将对应的进程确定为所述目标进程。
- 如权利要求4所述的方法,其特征在于,所述方法还包括:将所述M个目标进程中每个目标进程对应的内存页,替换为软中断指令,所述软中断指令用于暂停运行对应的目标进程;获取所述M个目标进程的所述初始调用信息。
- 如权利要求1-5任意一项所述的方法,其特征在于,所述确定所述M个目标进程中每个所述目标进程对应的当前调用信息,包括:记录所述M个目标进程中每个所述目标进程当前调用所述多个目标函数的信息,更新对应的所述当前调用信息。
- 如权利要求2-6任意一项所述的方法,其特征在于,所述基于所述初始调用信息和每个所述目标进程对应的当前调用信息以及所述补丁文件,对所述M个目标进程分别进行热补丁操作,包括:根据热补丁策略,基于所述初始调用信息和每个所述目标进程对应的当前调用信息以及所述多个目标函数中每个所述目标函数的所述修复信息,对所述M个目标进程中满足所述热补丁策略的目标进程进行热补丁操作。
- 一种热补丁装置,其特征在于,所述装置包括:第一处理单元,用于确定针对多个目标函数生成的补丁文件;第二处理单元,用于基于所述多个目标函数从N个进程中确定M个目标进程,并记录所述M个目标进程的初始调用信息,所述初始调用信息包括每个所述目标进程调用所述多个目标函数的信息,N和M为大于0的整数,且N大于或等于M;第三处理单元,用于确定所述M个目标进程中每个所述目标进程对应的当前调用信息,每个所述当前调用信息包括对应目标进程当前调用所述多个目标函数的信息;第四处理单元,用于基于所述初始调用信息和每个所述目标进程对应的当前调用信息以及所述补丁文件,对所述M个目标进程分别进行热补丁操作。
- 如权利要求8所述的装置,其特征在于,所述补丁文件包括所述多个目标函数中每个所述目标函数的修复信息,所述第一处理单元,具体用于:对比多个函数的原始代码和修复代码,从所述多个函数中确定所述多个目标函数;基于所述修复代码,确定所述多个目标函数中每个所述目标函数的所述修复信息。
- 如权利要求9所述的装置,其特征在于,所述第一处理单元,具体用于:分别运行所述原始代码和所述修复代码,通过修改编译器参数获取所述原始代码的第一中间信息和所述修复代码的第二中间信息;基于所述第一中间信息和所述第二中间信息,从所述多个函数中确定所述多个目标函数。
- 如权利要求8-10任意一项所述的装置,其特征在于,所述第二处理单元,具体用于:判断所述N个进程中每个进程是否调用所述多个目标函数中的至少一个;所述N个进程包括正在运行的进程、新拉起的进程和即将被拉起的进程中的一种或多种;若调用所述多个目标函数中的至少一个,则将对应的进程确定为所述目标进程。
- 如权利要求11所述的装置,其特征在于,所述第二处理单元,具体用于:将所述M个目标进程中每个目标进程对应的内存页,替换为软中断指令,所述软中断指令用于暂停运行对应的目标进程;获取所述M个目标进程的所述初始调用信息。
- 如权利要求8-12任意一项所述的装置,其特征在于,所述第三处理单元,具体用于:记录所述M个目标进程中每个所述目标进程当前调用所述多个目标函数的信息,更新对应的所述当前调用信息。
- 如权利要求9-13任意一项所述的装置,其特征在于,所述第四处理单元,具体用于:根据热补丁策略,基于所述初始调用信息和每个所述目标进程对应的当前调用信息以及所述多个目标函数中每个所述目标函数的所述修复信息,对所述M个目标进程中满足所述热补丁策略的目标进程进行热补丁操作。
- 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述权利要求1-7任意一项所述的方法。
- 一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机执行时,使得所述计算机执行如权利要求1-7中任意一项所述的方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP23859291.9A EP4560510A4 (en) | 2022-08-30 | 2023-08-28 | METHOD FOR EMERGENCY CORRECTION AND ASSOCIATED APPARATUS |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211048918.4A CN117668846A (zh) | 2022-08-30 | 2022-08-30 | 一种热补丁方法及相关装置 |
| CN202211048918.4 | 2022-08-30 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024046260A1 true WO2024046260A1 (zh) | 2024-03-07 |
Family
ID=90075722
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2023/115208 Ceased WO2024046260A1 (zh) | 2022-08-30 | 2023-08-28 | 一种热补丁方法及相关装置 |
Country Status (3)
| Country | Link |
|---|---|
| EP (1) | EP4560510A4 (zh) |
| CN (1) | CN117668846A (zh) |
| WO (1) | WO2024046260A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119473332A (zh) * | 2024-11-25 | 2025-02-18 | 天翼云科技有限公司 | 热补丁重启生效方法、装置、网络设备和可读存储介质 |
| CN120910872A (zh) * | 2025-10-10 | 2025-11-07 | 芯潮流(珠海)科技有限公司 | 存储器的漏洞修复方法、计算机装置及可读存储介质 |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120316770B (zh) * | 2025-06-18 | 2025-08-19 | 深圳鼎智通讯股份有限公司 | 一种提高智能终端安全性的防攻击方法及系统 |
| CN120781347B (zh) * | 2025-09-05 | 2026-01-27 | 浪潮云信息技术股份公司 | 一种操作系统内核漏洞修复方法、装置、设备及介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011060160A (ja) * | 2009-09-14 | 2011-03-24 | Fujitsu Ltd | ソフトウェア更新装置、方法、及びプログラム |
| US10310863B1 (en) * | 2013-07-31 | 2019-06-04 | Red Hat, Inc. | Patching functions in use on a running computer system |
| CN110851168A (zh) * | 2019-11-15 | 2020-02-28 | 腾讯科技(深圳)有限公司 | 数据处理方法及其装置、计算机可读存储介质 |
| CN111324491A (zh) * | 2020-03-18 | 2020-06-23 | 深圳Tcl数字技术有限公司 | 程序漏洞修复方法、装置及计算机可读存储介质 |
| CN112395616A (zh) * | 2019-08-15 | 2021-02-23 | 奇安信安全技术(珠海)有限公司 | 漏洞处理的方法、装置及计算机设备 |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2016068845A1 (en) * | 2014-09-01 | 2016-05-06 | Hewlett Packard Enterprise Development Lp | Dynamically applying a patch to a shared library |
| US10416990B2 (en) * | 2018-02-05 | 2019-09-17 | Infosys Limited | System and method for seamlessly patching shared libraries in server environment |
-
2022
- 2022-08-30 CN CN202211048918.4A patent/CN117668846A/zh active Pending
-
2023
- 2023-08-28 EP EP23859291.9A patent/EP4560510A4/en active Pending
- 2023-08-28 WO PCT/CN2023/115208 patent/WO2024046260A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011060160A (ja) * | 2009-09-14 | 2011-03-24 | Fujitsu Ltd | ソフトウェア更新装置、方法、及びプログラム |
| US10310863B1 (en) * | 2013-07-31 | 2019-06-04 | Red Hat, Inc. | Patching functions in use on a running computer system |
| CN112395616A (zh) * | 2019-08-15 | 2021-02-23 | 奇安信安全技术(珠海)有限公司 | 漏洞处理的方法、装置及计算机设备 |
| CN110851168A (zh) * | 2019-11-15 | 2020-02-28 | 腾讯科技(深圳)有限公司 | 数据处理方法及其装置、计算机可读存储介质 |
| CN111324491A (zh) * | 2020-03-18 | 2020-06-23 | 深圳Tcl数字技术有限公司 | 程序漏洞修复方法、装置及计算机可读存储介质 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4560510A4 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119473332A (zh) * | 2024-11-25 | 2025-02-18 | 天翼云科技有限公司 | 热补丁重启生效方法、装置、网络设备和可读存储介质 |
| CN120910872A (zh) * | 2025-10-10 | 2025-11-07 | 芯潮流(珠海)科技有限公司 | 存储器的漏洞修复方法、计算机装置及可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN117668846A (zh) | 2024-03-08 |
| EP4560510A4 (en) | 2025-11-19 |
| EP4560510A1 (en) | 2025-05-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2024046260A1 (zh) | 一种热补丁方法及相关装置 | |
| US11500534B2 (en) | Biometric recognition interaction method, graphics interaction interface, and related apparatus | |
| CN115017534B (zh) | 文件处理权限控制方法、装置及存储介质 | |
| CN114254285B (zh) | 同时显示多个应用界面时进行生物特征认证的方法 | |
| CN114816167B (zh) | 应用图标的显示方法、电子设备及可读存储介质 | |
| CN115442517B (zh) | 图像处理方法、电子设备及计算机可读存储介质 | |
| CN114706633B (zh) | 预加载方法、电子设备及存储介质 | |
| CN119376755A (zh) | 一种应用程序优化方法及电子设备 | |
| CN116755748A (zh) | 卡片更新方法、电子设备以及计算机可读存储介质 | |
| CN118444995B (zh) | 应用启动方法和电子设备 | |
| CN114879896B (zh) | 一种冻屏处理方法、电子设备及存储介质 | |
| CN115292199B (zh) | 一种显存泄露的处理方法及相关装置 | |
| CN116661882A (zh) | 预加载小程序的方法、电子设备及存储介质 | |
| CN116700768B (zh) | 一种应用的处理方法及相关装置 | |
| CN116664734B (zh) | 环形图的显示方法、电子设备及可读存储介质 | |
| WO2023143545A1 (zh) | 资源处理方法、装置、电子设备及计算机可读存储介质 | |
| CN113535252B (zh) | 应用程序的运行方法、相关设备及介质 | |
| CN120704811B (zh) | 一种图像处理方法、装置和电子设备 | |
| CN115291995B (zh) | 一种消息显示方法及相关电子设备、可读存储介质 | |
| CN117131497B (zh) | 一种软件检测方法及电子设备 | |
| CN116700740B (zh) | 软件修复方法和相关装置 | |
| CN115904142B (zh) | 显示即时通信消息的方法和装置 | |
| CN118260753B (zh) | 应用程序的管控方法及电子设备 | |
| CN119883393A (zh) | 一种信息处理方法、装置、设备及计算机可读存储介质 | |
| CN117952579B (zh) | 一种信息获取方法及移动终端 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23859291 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2023859291 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2023859291 Country of ref document: EP Effective date: 20250221 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| WWP | Wipo information: published in national office |
Ref document number: 2023859291 Country of ref document: EP |