CN105893085A - Method and device for loading kernel module - Google Patents

Method and device for loading kernel module Download PDF

Info

Publication number
CN105893085A
CN105893085A CN201610191888.0A CN201610191888A CN105893085A CN 105893085 A CN105893085 A CN 105893085A CN 201610191888 A CN201610191888 A CN 201610191888A CN 105893085 A CN105893085 A CN 105893085A
Authority
CN
China
Prior art keywords
kernel
module
loaded
target
kernel module
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.)
Pending
Application number
CN201610191888.0A
Other languages
Chinese (zh)
Inventor
郑龙日
夏良钊
卢永强
包沉浮
张煜龙
韦韬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201610191888.0A priority Critical patent/CN105893085A/en
Priority to PCT/CN2016/086411 priority patent/WO2017166447A1/en
Publication of CN105893085A publication Critical patent/CN105893085A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and device for loading a kernel module. The method comprises the specific steps that a response to a loading operation for loading the kernel module to be loaded to a target kernel is made, and feature information of the target kernel is acquired; based on the feature information, loading information corresponding to the kernel module to be loaded is configured; based on the loading information, the kernel module to be loaded is loaded into the target kernel. When the kernel module needs to be loaded to the target kernel, kernel version parameters, kernel symbol verifying parameters, kernel module loading function pointers, kernel module unloading function pointers and other loading information in an ELF file corresponding to the kernel module are directly modified, the loading information is suitable for verification of the target kernel, and the kernel module can be loaded into the target kernel. Under the condition that the kernel module does not need to be recompiled, the kernel modules are loaded into kernels of different versions, the applicability of the kernel module is enhanced, and the development cost is reduced.

Description

Kernel module loading method and device
Technical field
The application relates to computer realm, is specifically related to operating system field, particularly relates to kernel mould Block loading method and device.
Background technology
In the exploitation of kernel program, it usually needs generation comprises the interior of the source code of kernel program Core module, then, is loaded into kernel module in kernel, thus so that kernel program is permissible Kernel runs.At present, when kernel module is loaded in kernel, the side generally used Formula is: configure in kernel module is needed the parameter of verification by kernel in kernel module loading procedure, Then, it is loaded in kernel after kernel module being recompilated.
But, due to the multiformity of kernel version, the kernel loaded on the kernel of a version The parameter of the required verification of the kernel in module is fixing, causes the kernel module can only be at one Load on the kernel of version so that the suitability of kernel module is restricted, increase exploitation Cost.
Summary of the invention
This application provides kernel module loading method and device, be used for solving above-mentioned background technology The technical problem that part exists.
First aspect, this application provides kernel module loading method, and the method includes: response Operate in the loading that kernel module to be loaded is loaded into target kernel, obtain the spy of target kernel Reference ceases, wherein, and the kernel that target kernel is run after loading by kernel module to be loaded; Feature based information, configures the load information that kernel module to be loaded is corresponding, wherein, adds information carrying Breath includes: that verified by target kernel, for kernel module is loaded into the information of target kernel; Based on described load information, kernel module to be loaded is loaded in target kernel.
Second aspect, this application provides kernel module charger, and this device includes: obtain Unit, is configured to the loading in response to kernel module to be loaded is loaded into target kernel and operates, Obtaining the characteristic information of target kernel, wherein, target kernel is that kernel module to be loaded is loading The kernel run afterwards;Dispensing unit, is configured to feature based information, configures to be loaded The load information that kernel module is corresponding, wherein, load information includes: that verified by target kernel, For kernel module being loaded into the information of target kernel;Loading unit, is configured to based on adding Information carrying ceases, and is loaded in target kernel by kernel module to be loaded.
The kernel module loading method of the application offer and device, by response to by be loaded interior Core module is loaded into the loading operation of target kernel, obtains the characteristic information of target kernel;Based on Characteristic information, configures the load information that kernel module to be loaded is corresponding;Based on load information, will Kernel module to be loaded is loaded in target kernel.Achieve kernel module at needs in target Kernel version ginseng when loading on kernel, in directly corresponding to kernel module ELF file Number, kernel sign check parameter, kernel module loading function pointer, kernel module unloading function The load informations such as pointer are modified so that load information is applicable to the verification of target kernel, interior Core module can be loaded in target kernel.I.e. kernel module is in the case of without recompilating, It is carried in the kernel of different editions, enhances the suitability of kernel module, save development cost.
Accompanying drawing explanation
By reading retouching in detail with reference to made non-limiting example is made of the following drawings Stating, other features, purpose and advantage will become more apparent upon:
Fig. 1 is that the application can apply to exemplary system architecture figure therein;
Fig. 2 shows the flow process of an embodiment of the kernel module loading method according to the application Figure;
Fig. 3 shows an exemplary process diagram of the kernel module loading method in the application;
Fig. 4 shows the structure of an embodiment of the kernel module charger according to the application Schematic diagram;
Fig. 5 is adapted for the computer for the terminal unit or server realizing the embodiment of the present application The structural representation of system.
Detailed description of the invention
With embodiment, the application is described in further detail below in conjunction with the accompanying drawings.It is appreciated that , specific embodiment described herein is used only for explaining related invention, rather than to this Bright restriction.It also should be noted that, for the ease of describe, accompanying drawing illustrate only with About the part that invention is relevant.
It should be noted that in the case of not conflicting, the embodiment in the application and embodiment In feature can be mutually combined.Describe this below with reference to the accompanying drawings and in conjunction with the embodiments in detail Application.
Fig. 1 shows kernel module loading method or the embodiment of device that can apply the application Exemplary system architecture 100.
As it is shown in figure 1, system architecture 100 can include terminal unit 101,102,103, Network 104 and server 105.Network 104 is in order at terminal unit 101,102,103 and The medium of transmission link is provided between server 105.Network 104 can include various connection class Type, the most wired, wireless transmission link or fiber optic cables etc..
User can use terminal unit 101,102,103 by network 104 and server 105 Alternately, to receive or to send message etc..Can be provided with on terminal unit 101,102,103 Various communication applications, such as, instant messaging class application, browser class application, searching class application, Word processing class application etc..
Terminal unit 101,102,103 can have display screen and support network service Various electronic equipments, include but not limited to smart mobile phone, panel computer, E-book reader, (Moving Picture Experts Group Audio Layer III, dynamic image is special for MP3 player Family compression standard audio frequency aspect 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard audio frequency aspect 4) player, portable meter on knee Calculation machine and desk computer etc..
Server 105 can store the characteristic information of the kernel of multiple version, when receiving terminal During the inquiry request that equipment 101,102,103 sends, can be by the operating system in terminal The characteristic information of kernel feeds back to terminal unit so that terminal unit can be joined according to characteristic information Put the load information of kernel module, thus kernel module is carried in target kernel.
It should be understood that the number of terminal unit, network and the server in Fig. 1 is only signal Property.According to realizing needs, can have any number of terminal unit, network and server.
Refer to Fig. 2, it illustrates a reality of kernel module loading method according to the application Execute the flow process 200 of example.It should be noted that the kernel module that the embodiment of the present application is provided adds Support method is typically performed by the terminal unit 101,102,103 in Fig. 1.The method include with Lower step:
Step 201, operates in response to the loading that kernel module to be loaded is loaded into target kernel, Obtain the characteristic information of target kernel.
In the present embodiment, target kernel is run after loading by kernel module to be loaded Kernel.In the present embodiment, when kernel module is loaded in kernel by needs, can respond In the loading loading kernel module is operated, first obtain in the target for loading kernel module The characteristic information of core.
Explanation kernel module and the relation of kernel below: with the linux kernel of (SuSE) Linux OS As a example by, linux kernel program can be joined in kernel by kernel module.Such as, When exploitation completes Linux device driver, can firstly generate and comprise Linux equipment and drive The Linux kernel module of dynamic program, then, is loaded into this Linux kernel module in kernel. It is thus possible to call this Linux device driver in kernel.
In some optional implementations of the present embodiment, characteristic information includes: kernel version Parameter, kernel sign check parameter, kernel module loading function pointer, kernel module unloading letter Number pointer.
In the optional implementation of some of the present embodiment, obtain the characteristic information bag of target kernel Include: obtained the characteristic information of target kernel by the proc file system of target kernel.
In the present embodiment, when target kernel is linux kernel, can be by Linux The proc file system of core, finds kernel Release parameter i.e. vermagic parameter, interior nuclear symbol Verification and parameter interior the CRC parameter of nuclear symbol, kernel module loading function pointer, kernel mould Block unloading function pointer.
Step 202, feature based information, configure the load information that kernel module to be loaded is corresponding.
In this example, load information includes: that verified by target kernel, for by kernel mould Block is loaded into the information of target kernel.
Illustrate below in kernel module loading procedure, the kernel checking procedure to kernel module: The module loading mechanism of Linux: when kernel module is loaded into linux kernel by needs, permissible Input order insmod on the control station that linux operating system provides.Insmod order is permissible Call init_module by system and kernel module is loaded into kernel.Call insmod life After order, linux kernel can first check for whether kernel module meets ELF (Executable and Linkable Format, can perform linking format) form, if do not met, then kernel refusal adds Carry this kernel module.
Kernel module, after being compiled, can generate the ELF file that kernel module is corresponding, ELF file is included in core module loading procedure the parameter needing verification.When by kernel mould When block is loaded into kernel, linux kernel can read from the ELF file that kernel module is corresponding to be needed Parameter to be verified verifies.When kernel module is loaded into kernel, linux kernel needs The parameter of verification includes: kernel Release parameter i.e. vermagic parameter, kernel sign check and ginseng The interior CRC parameter of nuclear symbol of number, kernel module loading function pointer, kernel module unloading letter Number pointer.
Kernel Release parameter can be stored in the data of ELF file corresponding to kernel module In section .modinfo data segment.When kernel module is loaded into kernel, kernel can be to kernel version This parameter verifies, and i.e. judges that whether the kernel Release parameter in kernel module is with kernel itself Kernel Release parameter consistent, if it is inconsistent, kernel module cannot be carried in kernel.
The verification of interior nuclear symbol can be stored in ELF file corresponding to kernel module with parameter In data segment _ _ versions data segment.When kernel module is loaded into kernel, interior verification Kernel sign check and the parameter of the preservation in inside _ _ versions data segment verify, I.e. the kernel sign check of kernel module and parameter whether with the kernel sign check of kernel itself and Parameter is consistent, if it is inconsistent, interior nuclear symbol cannot be carried out loading.
When kernel module is loaded into kernel, the kernel module that can perform kernel module loads letter Kernel module is initialized by number init function.When kernel module is unloaded from kernel, The kernel module exit function of kernel module can be performed.In kernel module, comprise this_mod Ule structure, comprises relocation information in this_module structure, wrap in relocation information Refer to containing the kernel module loading function pointing to kernel module loading function storage address in kernel Pin, the kernel module unloading function of sensing kernel module unloading function storage address in kernel Pointer.
Continue with feature based information in explanation the application, configure kernel module to be loaded corresponding The principle of load information: when kernel module is loaded into kernel, due to each version Kernel, kernel Release parameter, the numerical value of kernel sign check parameter are different, kernel module Loading function pointer, kernel module unloading address pointed by function pointer is also different.Cause This, in order to by kernel module be applicable to the kernel being loaded into multiple different editions, need amendment Kernel Release parameter, kernel sign check and parameter in kernel module, needs to revise reorientation Kernel module loading function pointer in information, kernel module unloading function pointer so that kernel The kernel Release parameter of module, kernel sign check and parameter, kernel module loading function pointer, Kernel module unloading function pointer and the kernel module loading function pointer of target kernel, kernel mould Block unloading function pointer is consistent.
In some optional implementations of the present embodiment, feature based information, configure to be added The load information carrying kernel module corresponding includes: by executable file corresponding for kernel module The numerical value of kernel Release parameter field is configured to described kernel Release parameter;Kernel module is corresponding Executable file in the numerical value of kernel sign check parameter field be configured to kernel sign check Parameter.Module loading function pointer in executable file corresponding for kernel module and module are unloaded Carry function pointer and be configured to module loading function pointer and module unloading function pointer.
In the present embodiment, the kernel Release parameter of target kernel, interior nuclear symbol school are being got Test and parameter, after kernel module loading function pointer, kernel module unloading function pointer, can The respective field in ELF file corresponding to find kernel module, then, by respective field Numerical value be revised as the kernel Release parameter with target kernel, kernel sign check and parameter, interior Core module loading function pointer, kernel module unloading function is unanimously.Thus, by kernel When module loading is to kernel, target kernel can read from the ELF file that kernel module is corresponding Go out kernel Release parameter, kernel sign check and parameter, kernel module loading function pointer, interior Core module unloading function pointer, thus by verification, kernel module is loaded in target kernel.
In other words, in the present embodiment, load information includes being stored in kernel module correspondence Kernel module loading function pointer, kernel module with target kernel in ELF file unload letter Kernel Release parameter, kernel sign check and the parameter that number pointer is consistent, kernel module loads letter Number pointer, kernel module unloading function pointer.
In some optional implementations of the present embodiment, also comprise determining that in kernel module The kernel function indicated by interior nuclear symbol quoted or the variable storage address in target kernel; Storage address is set to the chained address of interior nuclear symbol.
In the kernel of different editions, the kernel function indicated by interior nuclear symbol or the change in kernel Amount address in kernel is also different.Therefore, in the instruction quoted in kernel module First the interior nuclear symbol of the variable in kernel function or kernel, can determine in kernel function or kernel Variable storage address in target kernel, then, verify in by this storage address configuration being Number chained address.It is thus possible to call kernel function in kernel module or access in kernel Variable time, due to kernel function or access the variable in kernel when link, be replaced For storage address corresponding in target kernel, such that it is able to verify in invocation target kernel Variable in number corresponding function or nuclear symbol is corresponding in accessing kernel.
In the present embodiment, it is also possible in the following ways kernel function is called: including Core module realizes a power function searching kernel function address, all kernel module codes When needs use kernel function, all can get, by this power function, the kernel called Function address in target kernel.Then, quoted by kernel function pointer, thus What elimination produced owing to the code of kernel module directly invokes kernel function depends on kernel version Rely.
In the present embodiment, the parameter needed for Transfer Parameters data can be realized in kernel module The structure of type, the function pointer in this structure can come with specific function address form Occupy-place.Make when kernel module is loaded into kernel, can be with the form of parameter to kernel mould Block transmission data.Before kernel module is loaded into target kernel, can be by letter in structure Number pointer assignment is the kernel function quoted address in target kernel.
Step 203, based on load information, is loaded into kernel module to be loaded in target kernel.
In the present embodiment, it is possible to use load information after configuration, by kernel module to be loaded It is loaded in target kernel.For example, it is possible to input on the control station that linux operating system provides Insmod order.Insmod order can call init_module by kernel mould by system Block is loaded into kernel.Target kernel can obtain kernel version from the ELF file that kernel module is corresponding This parameter, kernel sign check and parameter, kernel module loading function pointer, kernel module unload Carry function pointer.Then, with kernel Release parameter, the kernel sign check of target kernel self Compare with parameter, kernel module loading function pointer, kernel module unloading function pointer.
In the present embodiment, due to the most in advance by the phase in ELF file corresponding for kernel module The numerical value of the field answered be revised as the kernel Release parameter with target kernel, kernel sign check and Parameter, kernel module loading function pointer, kernel module unloading function pointer is unanimously.From And, when kernel module is loaded into kernel, can be by verification so that kernel module loads In target kernel.
Refer to Fig. 3, it illustrates an example of kernel module loading method in the application Property flow chart.
Step 301: collect the parameter that all kernel modules are required in loading procedure.
The parameter required in loading procedure of kernel module can include but are not limited to: kernel version This parameter, kernel sign check and parameter, kernel module loading function pointer, kernel module unload Carry function pointer.
Step 302: obtain the attribute information of target kernel.
In the present embodiment, mesh can be obtained by the proc file system of linux kernel The attribute information of mark kernel.Attribute information can include but not limited to: the place that kernel is operated in The reason framework of device, linux kernel version.
Step 303: search the characteristic information of target kernel corresponding to attribute information beyond the clouds.
Can collect in advance and be applicable to different processor architecture, the kernel of different kernel versions Release parameter, kernel sign check and parameter, kernel module loading function pointer, kernel module Unloading function pointer.The framework of processor that the kernel of target kernel is operated in, Linux The attribute informations such as kernel version and kernel Release parameter, kernel sign check and parameter, kernel mould Block loading function pointer, kernel module unloading function pointer, beyond the clouds corresponding storage.Thus, When kernel module being loaded into kernel in terminal, inquiry request, cloud can be sent to high in the clouds The framework of processor that end can be operated according to the kernel of target kernel, linux kernel version Attribute information such as this grade, returns, to terminal, the kernel being applicable to target kernel that this attribute information is corresponding Release parameter, kernel sign check and parameter, kernel module loading function pointer, kernel module Unloading function pointer.
In some kernels, there is also the particular restriction that kernel module is loaded.Such as: at some Using in the equipment of android system, the kernel of android system is linux kernel, Linux The checksum value of kernel module can be verified by kernel, it is judged that whether kernel module is and kernel Compile simultaneously.At this point it is possible to obtain the verification of the kernel module being applicable to target kernel from high in the clouds And value, thus by verification, kernel module is loaded on target kernel.
Step 304, searches the characteristic information of target kernel in this locality.
When the most not finding the kernel Release parameter being applicable to target kernel, interior nuclear symbol The information such as verification and parameter, kernel module loading function pointer, kernel module unloading function pointer Time, can search further in this locality.Can be at kernel mirror image file, memory device File, proc file system are searched.Such as, it has been carried in target kernel when finding The kernel module of same type time, can obtain from this kernel module kernel Release parameter, Kernel sign check and parameter, kernel module loading function pointer, kernel module unloading function refer to Pin.
Step 305: the respective field in the ELF file that kernel module is corresponding is set.
Getting the kernel Release parameter of target kernel, kernel sign check and parameter, kernel After the characteristic informations such as module loading function pointer, kernel module unloading function pointer, Ke Yicha Find the respective field in the ELF file that kernel module is corresponding.Then, by the number of respective field Value is revised as the kernel Release parameter with target kernel, kernel sign check and parameter, kernel mould Block loading function pointer, kernel module unloading function is unanimously.
Step 306: kernel module is loaded in target kernel.
By insmod order, kernel module is loaded in kernel.
Below on the basis of the kernel module loading method of the application of described above, this is described Kernel module loading method difference with the prior art in application:
In the prior art, for the kernel of each version, need revise kernel Release parameter, Kernel sign check parameter, kernel module loading function pointer, kernel module unloading function pointer. Then, for the kernel of each version, it is both needed to the kernel module to this version and carries out again Compiling.
And in this application, when kernel module is loaded on target kernel by needs, directly Connect and the kernel Release parameter in ELF file, kernel sign check parameter, kernel module are loaded The load informations such as function pointer, kernel module unloading function pointer are modified so that add information carrying Breath adaptation and target kernel, kernel module can be loaded in target kernel.I.e. kernel module exists In the case of recompilating, it is carried in the kernel of different editions.
Refer to Fig. 4, as to the realization of method shown in above-mentioned each figure, this application provides one Plant an embodiment of kernel module charger, this device embodiment and the method shown in Fig. 2 Embodiment is corresponding, and this device specifically can apply in various electronic equipment.
As shown in Figure 4, the kernel module charger 400 of the present embodiment includes: acquiring unit 401, dispensing unit 402, loading unit 403.Wherein, acquiring unit 401 is configured to ring Kernel module to be loaded is loaded into the loading operation of target kernel by Ying Yu, obtains target kernel Characteristic information, wherein, described target kernel is run after loading by kernel module to be loaded Kernel;Dispensing unit 402 is configured to feature based information, configures kernel module to be loaded Corresponding load information, wherein, load information includes: that verified by target kernel, for inciting somebody to action Kernel module is loaded into the information of target kernel;Loading unit 403 is configured to based on adding information carrying Breath, is loaded into kernel module to be loaded in target kernel.
In some optional implementations of the present embodiment, characteristic information includes: kernel version Parameter, kernel sign check and parameter, kernel module loading function pointer, kernel module unloading Function pointer.
In some optional implementations of the present embodiment, acquiring unit 401 includes: feature Acquisition of information subelement (not shown), is configured to the proc file system of target kernel Obtain the characteristic information of target kernel.
In some optional implementations of the present embodiment, dispensing unit 402 includes: kernel Release parameter configuration subelement (not shown), is configured to perform corresponding for kernel module The numerical value of the kernel Release parameter field in file is configured to kernel Release parameter;Interior nuclear symbol school Test and parameter configuration subelement (not shown), be configured to perform corresponding for kernel module The numerical value of the kernel sign check parameter field in file is configured to kernel sign check and parameter. Function pointer configuration subelement (not shown), is configured to perform corresponding for kernel module Module loading function pointer and module unloading function pointer in file are configured to module loading function Pointer and module unloading function pointer.
In some optional implementations of the present embodiment, device 400 also comprises determining that list Unit's (not shown), be configured to determine indicated by the interior nuclear symbol quoted in kernel module is interior Kernel function or the variable storage address in target kernel;Unit (not shown) is set, configuration The chained address of interior nuclear symbol it is set to for storing address.
Fig. 5 shows the meter be suitable to for the terminal unit or server realizing the embodiment of the present application The structural representation of calculation machine system.
As it is shown in figure 5, computer system 500 includes CPU (CPU) 501, its Can be according to the program being stored in read only memory (ROM) 502 or from storage part 508 It is loaded into the program in random access storage device (RAM) 503 and performs various suitable action And process.In RAM 503, also storage has system 500 to operate required various program sums According to.CPU 501, ROM502 and RAM 503 are connected with each other by bus 504.Input / output (I/O) interface 505 is also connected to bus 504.
It is connected to I/O interface 505: include the importation 506 of keyboard, mouse etc. with lower component; Including such as cathode ray tube (CRT), liquid crystal display (LCD) etc. and speaker etc. Output part 507;Storage part 508 including hard disk etc.;And include such as LAN card, The communications portion 509 of the NIC of modem etc..Communications portion 509 is via such as The network of the Internet performs communication process.Driver 510 is connected to I/O interface also according to needs 505.Detachable media 511, such as disk, CD, magneto-optic disk, semiconductor memory etc., Be arranged on as required in driver 510, in order to the computer program read from it according to Needs are mounted into storage part 508.
Especially, according to embodiment of the disclosure, the process described above with reference to flow chart is permissible It is implemented as computer software programs.Such as, embodiment of the disclosure and include a kind of computer journey Sequence product, it includes the computer program being tangibly embodied on machine readable media, described meter Calculation machine program comprises the program code for performing the method shown in flow chart.In such enforcement In example, this computer program can be downloaded and installed from network by communications portion 509, And/or be mounted from detachable media 511.
Flow chart in accompanying drawing and block diagram, it is illustrated that according to the various embodiment of the application system, Architectural framework in the cards, function and the operation of method and computer program product.This point On, each square frame in flow chart or block diagram can represent a module, program segment or code A part, a part for described module, program segment or code comprise one or more for Realize the executable instruction of the logic function of regulation.It should also be noted that at some as replacement In realization, the function marked in square frame can also be sent out to be different from the order marked in accompanying drawing Raw.Such as, two square frames succeedingly represented can essentially perform substantially in parallel, they Sometimes can also perform in the opposite order, this is depending on involved function.It is also noted that It is, the square frame in each square frame in block diagram and/or flow chart and block diagram and/or flow chart Combination, can realize by the special hardware based system of the function or operation that perform regulation, Or can realize with the combination of specialized hardware with computer instruction.
As on the other hand, present invention also provides a kind of nonvolatile computer storage media, This nonvolatile computer storage media can be described in above-described embodiment included in device Nonvolatile computer storage media;Can also be individualism, be unkitted allocate in terminal non- Volatile computer storage medium.Above-mentioned nonvolatile computer storage media storage have one or The multiple program of person, when one or more program is performed by an equipment so that described Equipment: operate in response to the loading that kernel module to be loaded is loaded into target kernel, obtain mesh The characteristic information of mark kernel, wherein, described target kernel is that kernel module to be loaded is in loading Rear run kernel;Based on described characteristic information, configure corresponding the adding of kernel module to be loaded Information carrying ceases, and wherein, described load information includes: that verified by target kernel, for by kernel Module loading is to the information of target kernel;Based on described load information, by kernel module to be loaded It is loaded in target kernel.
Above description is only the preferred embodiment of the application and saying institute's application technology principle Bright.It will be appreciated by those skilled in the art that invention scope involved in the application, do not limit In the technical scheme of the particular combination of above-mentioned technical characteristic, also should contain simultaneously without departing from In the case of described inventive concept, above-mentioned technical characteristic or its equivalent feature carry out combination in any And other technical scheme formed.Such as features described above and (but not limited to) disclosed herein The technical characteristic with similar functions is replaced mutually and the technical scheme that formed.

Claims (10)

1. a kernel module loading method, it is characterised in that described method includes:
Operate in response to the loading that kernel module to be loaded is loaded into target kernel, obtain target The characteristic information of kernel, wherein, described target kernel be kernel module to be loaded after loading The kernel run;
Based on described characteristic information, configure the load information that kernel module to be loaded is corresponding, wherein, Described load information includes: that verified by target kernel, for kernel module is loaded into target The information of kernel;
Based on described load information, kernel module to be loaded is loaded in target kernel.
Method the most according to claim 1, it is characterised in that described characteristic information includes: Kernel Release parameter, kernel sign check and parameter, kernel module loading function pointer, kernel Module unloading function pointer.
Method the most according to claim 2, it is characterised in that described acquisition target kernel Characteristic information include:
The characteristic information of target kernel is obtained by the proc file system of target kernel.
Method the most according to claim 3, it is characterised in that described based on described feature Information, the load information configuring kernel module to be loaded corresponding includes:
The numerical value of the kernel Release parameter field in executable file corresponding for kernel module is joined It is set to described kernel Release parameter;
By the kernel sign check in executable file corresponding for kernel module and the number of parameter field Value is configured to described kernel sign check and parameter;
By the kernel module loading function pointer in executable file corresponding for kernel module and kernel Module unloading function pointer is configured to described kernel module loading function pointer and kernel module unloading Function pointer.
Method the most according to claim 4, it is characterised in that described method also includes:
Determine that the kernel function indicated by interior nuclear symbol quoted in kernel module or variable are in target Storage address in kernel;
Described storage address is set to the chained address of described interior nuclear symbol.
6. a kernel module charger, it is characterised in that described device includes:
Acquiring unit, is configured to be loaded into target kernel in response to by kernel module to be loaded Loading operation, obtain the characteristic information of target kernel, wherein, described target kernel is to be loaded The kernel that kernel module is run after loading;
Dispensing unit, is configured to, based on described characteristic information, configure kernel module pair to be loaded The load information answered, wherein, described load information includes: that verified by target kernel, be used for Kernel module is loaded into the information of target kernel;
Loading unit, is configured to, based on described load information, be loaded by kernel module to be loaded In target kernel.
Device the most according to claim 6, it is characterised in that described characteristic information includes: Kernel Release parameter, kernel sign check and parameter, kernel module loading function pointer, kernel Module unloading function pointer.
Device the most according to claim 7, it is characterised in that described acquiring unit includes:
Characteristic information obtains subelement, and the proc file system being configured to target kernel obtains Take the characteristic information of target kernel.
Device the most according to claim 8, it is characterised in that dispensing unit includes:
Kernel Release parameter configuration subelement, is configured to performed literary composition corresponding for kernel module The numerical value of the kernel Release parameter field in part is configured to described kernel Release parameter;
Kernel sign check and parameter configuration subelement, being configured to can by corresponding for kernel module The numerical value performing the kernel sign check in file and parameter field is configured to described interior nuclear symbol school Test and parameter;
Function pointer configuration subelement, is configured in executable file corresponding for kernel module Module loading function pointer and module unloading function pointer be configured to described kernel module load letter Number pointer and kernel module unloading function pointer.
Device the most according to claim 9, it is characterised in that described device also includes:
Determining unit, be configured to determine indicated by the interior nuclear symbol quoted in kernel module is interior Kernel function or the variable storage address in target kernel;
Unit is set, is configured to be set to described storage address the link of described interior nuclear symbol Address.
CN201610191888.0A 2016-03-30 2016-03-30 Method and device for loading kernel module Pending CN105893085A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610191888.0A CN105893085A (en) 2016-03-30 2016-03-30 Method and device for loading kernel module
PCT/CN2016/086411 WO2017166447A1 (en) 2016-03-30 2016-06-20 Method and device for loading kernel module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610191888.0A CN105893085A (en) 2016-03-30 2016-03-30 Method and device for loading kernel module

Publications (1)

Publication Number Publication Date
CN105893085A true CN105893085A (en) 2016-08-24

Family

ID=57014655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610191888.0A Pending CN105893085A (en) 2016-03-30 2016-03-30 Method and device for loading kernel module

Country Status (2)

Country Link
CN (1) CN105893085A (en)
WO (1) WO2017166447A1 (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815031A (en) * 2017-02-22 2017-06-09 百度在线网络技术(北京)有限公司 Kernel module loading method and device
CN108073411A (en) * 2017-12-11 2018-05-25 北京奇虎科技有限公司 A kind of kernel loads method and device of patch
WO2018137258A1 (en) * 2017-01-30 2018-08-02 Qualcomm Incorporated Loadable modules with partial linking and load-time relocation
CN110414218A (en) * 2018-11-13 2019-11-05 腾讯科技(深圳)有限公司 Kernel detection method, device, electronic equipment and storage medium
CN111259392A (en) * 2020-01-13 2020-06-09 奇安信科技集团股份有限公司 Malicious software interception method and device based on kernel module
CN111752620A (en) * 2019-03-26 2020-10-09 阿里巴巴集团控股有限公司 Processing method and loading method of kernel module
CN112292678A (en) * 2019-01-04 2021-01-29 百度时代网络技术(北京)有限公司 Method and system for validating a kernel object to be executed by a data processing accelerator of a host system
CN112363726A (en) * 2020-11-10 2021-02-12 北京麟卓信息科技有限公司 Cross-kernel version compiling method and system of kernel module
CN112860267A (en) * 2021-04-23 2021-05-28 武汉深之度科技有限公司 Kernel cutting method and computing device
CN112906008A (en) * 2018-11-15 2021-06-04 百度在线网络技术(北京)有限公司 Kernel vulnerability repairing method, device, server and system
CN113220303A (en) * 2021-04-21 2021-08-06 北京麟卓信息科技有限公司 Compiling method and system of kernel module
CN114691220A (en) * 2020-12-30 2022-07-01 网神信息技术(北京)股份有限公司 Method, apparatus, electronic device, medium, and program product for protecting a process
CN117149499A (en) * 2023-10-30 2023-12-01 北京麟卓信息科技有限公司 Memory occupation optimization method for kernel module based on dynamic symbol table

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110389786B (en) * 2018-04-20 2022-10-14 伊姆西Ip控股有限责任公司 Kernel management method, electronic device and computer-readable storage medium
US10990673B1 (en) * 2019-05-24 2021-04-27 Trend Micro Inc. Protection of antivirus daemon in a computer
CN117931555B (en) * 2024-03-22 2024-06-07 新华三信息技术有限公司 Method and device for simulating SCSI equipment fault under kernel mode

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1650264A (en) * 2002-04-17 2005-08-03 计算机联合思想公司 Apparatus and method for modifying a kernel module to run on multiple kernel versions
CN104021023A (en) * 2014-06-24 2014-09-03 浪潮电子信息产业股份有限公司 Solving method of breaking version control of kernel module
CN104407887A (en) * 2014-11-06 2015-03-11 航天科工深圳(集团)有限公司 Method and device for dynamically loading programs of kernel module of embedded type system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012823A (en) * 2009-09-04 2011-04-13 中兴通讯股份有限公司 Method and device for quickly restarting computer
CN104679532B (en) * 2013-11-27 2018-12-11 腾讯科技(深圳)有限公司 kernel module loading method and device
CN104375874B (en) * 2014-12-11 2017-05-17 北京奇虎科技有限公司 Method and device for loading Linux kernel driver

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1650264A (en) * 2002-04-17 2005-08-03 计算机联合思想公司 Apparatus and method for modifying a kernel module to run on multiple kernel versions
CN104021023A (en) * 2014-06-24 2014-09-03 浪潮电子信息产业股份有限公司 Solving method of breaking version control of kernel module
CN104407887A (en) * 2014-11-06 2015-03-11 航天科工深圳(集团)有限公司 Method and device for dynamically loading programs of kernel module of embedded type system

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018137258A1 (en) * 2017-01-30 2018-08-02 Qualcomm Incorporated Loadable modules with partial linking and load-time relocation
CN106815031A (en) * 2017-02-22 2017-06-09 百度在线网络技术(北京)有限公司 Kernel module loading method and device
WO2018153052A1 (en) * 2017-02-22 2018-08-30 百度在线网络技术(北京)有限公司 Method and device for loading kernel module
CN106815031B (en) * 2017-02-22 2020-03-24 百度在线网络技术(北京)有限公司 Kernel module loading method and device
US11237844B2 (en) 2017-02-22 2022-02-01 Baidu Online Network Technology (Beijing) Co., Ltd. Method and apparatus for loading kernel module
CN108073411A (en) * 2017-12-11 2018-05-25 北京奇虎科技有限公司 A kind of kernel loads method and device of patch
CN110414218A (en) * 2018-11-13 2019-11-05 腾讯科技(深圳)有限公司 Kernel detection method, device, electronic equipment and storage medium
CN112906008A (en) * 2018-11-15 2021-06-04 百度在线网络技术(北京)有限公司 Kernel vulnerability repairing method, device, server and system
CN112292678A (en) * 2019-01-04 2021-01-29 百度时代网络技术(北京)有限公司 Method and system for validating a kernel object to be executed by a data processing accelerator of a host system
CN111752620A (en) * 2019-03-26 2020-10-09 阿里巴巴集团控股有限公司 Processing method and loading method of kernel module
CN111259392A (en) * 2020-01-13 2020-06-09 奇安信科技集团股份有限公司 Malicious software interception method and device based on kernel module
CN111259392B (en) * 2020-01-13 2023-06-13 奇安信科技集团股份有限公司 Kernel module-based malicious software interception method and device
CN112363726A (en) * 2020-11-10 2021-02-12 北京麟卓信息科技有限公司 Cross-kernel version compiling method and system of kernel module
CN114691220A (en) * 2020-12-30 2022-07-01 网神信息技术(北京)股份有限公司 Method, apparatus, electronic device, medium, and program product for protecting a process
CN113220303A (en) * 2021-04-21 2021-08-06 北京麟卓信息科技有限公司 Compiling method and system of kernel module
CN112860267A (en) * 2021-04-23 2021-05-28 武汉深之度科技有限公司 Kernel cutting method and computing device
CN112860267B (en) * 2021-04-23 2021-07-30 武汉深之度科技有限公司 Kernel cutting method and computing device
CN117149499A (en) * 2023-10-30 2023-12-01 北京麟卓信息科技有限公司 Memory occupation optimization method for kernel module based on dynamic symbol table
CN117149499B (en) * 2023-10-30 2024-01-19 北京麟卓信息科技有限公司 Memory occupation optimization method for kernel module based on dynamic symbol table

Also Published As

Publication number Publication date
WO2017166447A1 (en) 2017-10-05

Similar Documents

Publication Publication Date Title
CN105893085A (en) Method and device for loading kernel module
CN106598667B (en) Method and apparatus for repairing kernel loophole
CN110046023B (en) Data processing method and system based on intelligent contract of block chain
CN105653933A (en) Plugin loading method and device
CN104268472B (en) Reduction is by the method and apparatus of third party's dynamic base Modification growth function address
CN110704833A (en) Data permission configuration method, device, electronic device and storage medium
CN112965761B (en) Data processing method, system, electronic equipment and storage medium
CN107463406A (en) Issue the method and electronic equipment of Mobile solution
CN105868639A (en) Kernel vulnerability repair method and device
CN104050001A (en) Resource processing method, device and equipment based on Android system
CN109087089B (en) Payment method, payment device and terminal equipment
CN112650521B (en) Software development kit SDK thermal restoration method and device and electronic equipment
CN111414152B (en) Method, system, readable medium and electronic device for realizing business logic
CN110888794A (en) Interface test method and device
CN110908882A (en) Performance analysis method and device of application program, terminal equipment and medium
US9146720B1 (en) Binary file application processing
CN109145591A (en) The plug-in loading method of application program
CN111625232B (en) Method and device for generating application program installation package, readable medium and electronic equipment
CN111309551B (en) Method and device for determining event monitoring SDK integration correctness
CN107247661A (en) Support the method and system to the installation kit progress automatic Verification of application
CN113835680A (en) Application program generation method and device, electronic equipment and computer storage medium
CN111274551A (en) Compiler-based java code protection method and device and electronic equipment
CN111797009A (en) Method and device for detecting code compatibility and electronic equipment
CN111209739A (en) Electronic form, electronic device, storage medium, and electronic form verification method
CN116684494A (en) Resource processing method, device and storage medium based on distributed cloud platform

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160824

RJ01 Rejection of invention patent application after publication