CN105204937A - Kernel function call method, device and operation system - Google Patents

Kernel function call method, device and operation system Download PDF

Info

Publication number
CN105204937A
CN105204937A CN201510714259.7A CN201510714259A CN105204937A CN 105204937 A CN105204937 A CN 105204937A CN 201510714259 A CN201510714259 A CN 201510714259A CN 105204937 A CN105204937 A CN 105204937A
Authority
CN
China
Prior art keywords
parameter
kernel
function
address
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.)
Granted
Application number
CN201510714259.7A
Other languages
Chinese (zh)
Other versions
CN105204937B (en
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.)
Zhongke Hongqi Beijing Information Technology Co ltd
Original Assignee
Shanghai Feixun Data Communication 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 Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201510714259.7A priority Critical patent/CN105204937B/en
Publication of CN105204937A publication Critical patent/CN105204937A/en
Application granted granted Critical
Publication of CN105204937B publication Critical patent/CN105204937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kernel function call method, comprising the steps of acquiring a name and a parameter of a kernel function, which is input by a user; analyzing the name and the parameter of the kernel function in a user space, acquiring an address and a type of the function and the parameter, and establishing a parameter list; taking the parameter list as a kernel module parameter, and adding a kernel module in a system by using a loaded module instruction; analyzing the parameter list in a kernel space so as to acquire the corresponding function address and parameter value; calling the function according to the function address and parameter value. The invention further discloses a kernel function call device and an operation system thereof.

Description

Kernel function call method, device and operating system
Technical field
The present invention relates to computer operating system, particularly relate to a kind of kernel function call method, device and operating system.
Background technology
Use in the embedded product of (SuSE) Linux OS, two spaces need be used when program is run: user's space and kernel spacing.Described two spaces are mutually independent.Kernel operates in kernel spacing, and application program, such as user interface etc., operate in user's space.During the service that application program needs use kernel to provide, come by system call.
In addition, usually in some way, such as file (log, message, coredump, proc file, sysfs file etc.) mode, exports to user's space Debugging message, debugs when going wrong with convenient kernel kernel.With file mode derive, need according to specific filespec encode in kernel realize after, could system cloud gray model or generation problem time export to user's space.The file of different-format needs different standard operations.Therefore, if encoded in advance realize file derivation, then corresponding kernel tailoring information cannot be checked.
Summary of the invention
In view of this, the invention provides a kind of kernel function call method, device and operating system, to solve at least one technical matters above-mentioned.
The embodiment of the present invention provides a kind of kernel function call method, comprises step: the kernel function title and the parameter that obtain user's input; Resolve described kernel function title and parameter at user's space, obtain address and the type of function and parameter, and set up parameter list; With described parameter list for kernel module parameter, the instruction that insmods is used to add kernel module in systems in which; Described parameter list is resolved, to obtain respective function address and parameter value at kernel spacing; And call described function according to described function address and parameter value.
The embodiment of the present invention also provides a kind of kernel function call device, at least comprises: name acquiring module, for obtaining kernel function title and the parameter of user's input; First parsing module, is arranged on user's space, for resolving described kernel function title and parameter, obtaining address and the type of function and parameter, and setting up parameter list; Insmod, for described parameter list for kernel module parameter, add kernel module in systems in which; Second parsing module, is arranged on kernel spacing, for resolving described parameter list, obtains respective function address and parameter value; And calling module, for calling described function according to described function address and parameter value.
The embodiment of the present invention also provides a kind of operating system, comprises user's space and kernel spacing.Described user's space at least comprises: name acquiring module, for obtaining kernel function title and the parameter of user's input; First parsing module, for resolving described kernel function title and parameter, obtaining address and the type of function and parameter, and setting up parameter list; And insmod, for described parameter list for kernel module parameter, add kernel module in systems in which.Described kernel spacing at least comprises: the second parsing module, for resolving described parameter list, obtains respective function address and parameter value; And calling module, for calling described function according to described function address and parameter value.
Kernel function call apparatus and method of the present invention, can work as Debugging message when not exporting to user's space, as long as kernel provides debugging interface function, namely this function can be called from user's space, then perform this function at kernel spacing and derive Debugging message, convenient and swift, and highly versatile.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the process flow diagram of the kernel function call method according to the embodiment of the present invention;
Fig. 2 is the parton flow chart of steps of the step S102 of kernel function call method according to the embodiment of the present invention;
Fig. 3 is the sub-step process flow diagram of the step S104 of kernel function call method according to the embodiment of the present invention;
Fig. 4 is the high-level schematic functional block diagram of kernel function call device according to the embodiment of the present invention and operating system.
Specific embodiment
Below in conjunction with the drawings and specific embodiments, more detailed description is further done to technical scheme of the present invention.Obviously, described embodiment is only a part of embodiment of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite of not making creative work, all should belong to the scope of protection of the invention.
Refer to Fig. 1, it is a kind of kernel function call method that one embodiment of the invention provides.In the present embodiment, described kernel function call method is applied to (SuSE) Linux OS.Said method comprising the steps of:
Step S101, obtains kernel function title and the parameter of user's input.In the present embodiment, user input function name or parameter at least follow following syntax format one of them:
1) function name or name variable [:] [kernel module title];
2) with 32 sexadecimal numbers [:] of 0x beginning;
3) decimal integer [:].
Wherein, character " [] " part represents selective sections, and character ": " represents gets address of variable as parameter, and the part after character " " is kernel module title corresponding to symbol source.In addition, acquiescence gets variate-value as function parameter, can Division identification further when multiple kernel module uses identical designation.Function name or variable name become with letter or " _ " beginning.In the present embodiment, support 8 parameters at most.
Step S102, resolves described kernel function title and parameter at user's space, obtains address and the type of function and parameter, and sets up parameter list.In the present embodiment, described parameter list comprises multiple two tuples, and each two tuples comprise type and the address of each function or parameter, and wherein said type and address all represent by 32 signless integers.That is, in the present embodiment, according to the syntax format of step S101, function or the parameter of user's input is resolved successively.Each function or parameter generate a < type, address > bis-tuple, and type and address all represent by 32 signless integers, and all two tuples form a parameter list successively.
Refer to Fig. 2, more specifically, described acquisition function and the address of parameter and the step of type comprise sub-step:
S102a, obtains functional symbol or address corresponding to pa-rameter symbols.
S102b, obtains the address value in two tuples and obtains 32 signless integer numerical value of sensing core position, address in two tuples, to determine type.
S102c, the parameter list generated passes to described kernel module as array parameter, and the element of described array parameter is 32 signless integers.
In addition, in certain embodiments, when function or variable input with the form of symbol (character string), pass through/proc/kallsyms file, the address that this symbol is corresponding can be inquired.And in further embodiments, when function or variable are with decimal numeral form input, need to convert to hexadecimal representation form corresponding in computing machine.The kernel function to be called of user's input is then according to the mode process of getting location (namely obtaining the address value in two tuples).
Step S103, with described parameter list for kernel module parameter, uses the instruction (such as insmod order) that insmods to add kernel module in systems in which.
Step S104, resolves described parameter list at kernel spacing, to obtain respective function address and parameter value.
Refer to Fig. 3, step S104 specifically comprises sub-step:
Step S104a, from transmitted array parameter, separates out type and respective function or argument address with the formal solution of two tuples of containing type and address; And
Step S104b, obtains function address and parameter values successively according to described type.
Step S105, calls described function according to described function address and parameter value.
Step S106, at the end of kernel function call, deletes described kernel module at user's space.
Adopt kernel function call method of the present invention, Debugging message can be worked as when not exporting to user's space, as long as kernel provides debugging interface function, namely this function can be called from user's space, then perform this function at kernel spacing and derive Debugging message, convenient and swift, and highly versatile.
Refer to Fig. 4, the present invention also provides a kind of kernel function call device 100, and it at least comprises name acquiring module 10, first parsing module 20, insmod the 30, second parsing module 40 and calling module 50.
Concrete, described name acquiring module 10 is for obtaining kernel function title and the parameter of user's input.Described first parsing module 20 is arranged on user's space, for resolving described kernel function title and parameter, obtaining address and the type of function and parameter, and setting up parameter list.Described insmod 30 for described parameter list for kernel module parameter, add kernel module in systems in which.Described second parsing module 40 is arranged on kernel spacing, for resolving described parameter list, obtains respective function address and parameter value.Described calling module 50 is for calling described function according to described function address and parameter value.
Adopt kernel function call device 100 of the present invention, Debugging message can be worked as when not exporting to user's space, as long as kernel provides debugging interface function, namely this function can be called from user's space, then perform this function at kernel spacing and derive Debugging message, convenient and swift, and highly versatile.
Please consult Fig. 4 further, the present invention also provides a kind of operating system, and it comprises described user's space and kernel spacing, and described user's space at least comprises above-mentioned name acquiring module 10, first parsing module 20 and insmods 30.Described kernel spacing at least comprises the second above-mentioned parsing module 40 and calling module 50.In addition, described user's space also can comprise a removing module 60, at the end of kernel function call, deletes described kernel module at user's space.
It should be noted that, by the description of above embodiment, those skilled in the art can be well understood to the mode that the present invention can add required hardware platform by software and realize, and can certainly all be implemented by hardware.Based on such understanding, what technical scheme of the present invention contributed to background technology can embody with the form of software product in whole or in part, described computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform the method described in some part of each embodiment of the present invention or embodiment.
The above disclosed preferred embodiment be only in the embodiment of the present invention, certainly can not limit the interest field of the present invention, therefore according to the equivalent variations that the claims in the present invention are done, still belong to the scope that the present invention is contained with this.

Claims (10)

1. a kernel function call method, is characterized in that, comprises step:
Obtain kernel function title and the parameter of user's input;
Resolve described kernel function title and parameter at user's space, obtain address and the type of function and parameter, and set up parameter list;
With described parameter list for kernel module parameter, the instruction that insmods is used to add kernel module in systems in which;
Described parameter list is resolved, to obtain respective function address and parameter value at kernel spacing; And
Described function is called according to described function address and parameter value.
2. kernel function call method as claimed in claim 1, comprises step further:
At the end of kernel function call, delete described kernel module at user's space.
3. kernel function call method as claimed in claim 1, it is characterized in that, described kernel function call method is applied to (SuSE) Linux OS, the function name of described user input or parameter at least follow following syntax format one of them: function name or parameter name [:] [kernel module title], with 32 sexadecimal numbers [:] of 0x beginning, decimal integer [:], wherein, character " [] " part represents selective sections, character ": " represents gets address of variable as parameter, part after character " " is kernel module title corresponding to symbol source.
4. kernel function call method as claimed in claim 1, it is characterized in that, described parameter list comprises multiple two tuples, and each two tuples comprise type and the address of each function or parameter, and wherein said type and address all represent by 32 signless integers.
5. kernel function call method as claimed in claim 4, is characterized in that, described acquisition function and the address of parameter and the step of type comprise:
Obtain functional symbol or address corresponding to pa-rameter symbols; And
Obtain the address value in two tuples and obtain 32 signless integer numerical value of sensing core position, address in two tuples, to determine type.
6. kernel function call method as claimed in claim 1, it is characterized in that, the parameter list generated passes to described kernel module as array parameter, and the element of described array parameter is 32 signless integers.
7. kernel function call method as claimed in claim 6, it is characterized in that, the described parameter list of described parsing comprises with the step obtaining respective function address and parameter value:
From transmitted array parameter, separate out type and respective function or argument address with the formal solution of two tuples of containing type and address;
Function address and parameter values is obtained successively according to described type.
8. a kernel function call device, is characterized in that, at least comprises:
Name acquiring module, for obtaining kernel function title and the parameter of user's input;
First parsing module, is arranged on user's space, for resolving described kernel function title and parameter, obtaining address and the type of function and parameter, and setting up parameter list;
Insmod, for described parameter list for kernel module parameter, add kernel module in systems in which;
Second parsing module, is arranged on kernel spacing, for resolving described parameter list, obtains respective function address and parameter value; And
Calling module, for calling described function according to described function address and parameter value.
9. an operating system, comprises user's space and kernel spacing, it is characterized in that, described user's space at least comprises:
Name acquiring module, for obtaining kernel function title and the parameter of user's input;
First parsing module, for resolving described kernel function title and parameter, obtaining address and the type of function and parameter, and setting up parameter list; And
Insmod, for described parameter list for kernel module parameter, add kernel module in systems in which; And
Described kernel spacing at least comprises:
Second parsing module, for resolving described parameter list, obtains respective function address and parameter value; And
Calling module, for calling described function according to described function address and parameter value.
10. operating system as claimed in claim 9, it is characterized in that, described user's space comprises removing module further, at the end of kernel function call, deletes described kernel module at user's space.
CN201510714259.7A 2015-10-28 2015-10-28 Kernel function call method, apparatus and operating system Active CN105204937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510714259.7A CN105204937B (en) 2015-10-28 2015-10-28 Kernel function call method, apparatus and operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510714259.7A CN105204937B (en) 2015-10-28 2015-10-28 Kernel function call method, apparatus and operating system

Publications (2)

Publication Number Publication Date
CN105204937A true CN105204937A (en) 2015-12-30
CN105204937B CN105204937B (en) 2018-09-28

Family

ID=54952633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510714259.7A Active CN105204937B (en) 2015-10-28 2015-10-28 Kernel function call method, apparatus and operating system

Country Status (1)

Country Link
CN (1) CN105204937B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107770261A (en) * 2017-10-13 2018-03-06 郑州云海信息技术有限公司 A kind of computational methods and relevant apparatus based on distributed memory system
WO2019057155A1 (en) * 2017-09-21 2019-03-28 华为技术有限公司 Method and device for dynamically managing kernel node

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895576B2 (en) * 2001-10-18 2005-05-17 Hewlett-Packard Development Company, L.P. Method and system for device driver and operating system debugging of portable computers
CN1722100A (en) * 2004-07-13 2006-01-18 鸿富锦精密工业(深圳)有限公司 memory test system and method
CN102467447A (en) * 2010-11-16 2012-05-23 鸿富锦精密工业(深圳)有限公司 Driver debugging system and method
CN104050080A (en) * 2014-06-09 2014-09-17 汉柏科技有限公司 Method and system for debugging linux kernel in user mode

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895576B2 (en) * 2001-10-18 2005-05-17 Hewlett-Packard Development Company, L.P. Method and system for device driver and operating system debugging of portable computers
CN1722100A (en) * 2004-07-13 2006-01-18 鸿富锦精密工业(深圳)有限公司 memory test system and method
CN102467447A (en) * 2010-11-16 2012-05-23 鸿富锦精密工业(深圳)有限公司 Driver debugging system and method
CN104050080A (en) * 2014-06-09 2014-09-17 汉柏科技有限公司 Method and system for debugging linux kernel in user mode

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019057155A1 (en) * 2017-09-21 2019-03-28 华为技术有限公司 Method and device for dynamically managing kernel node
CN109543400A (en) * 2017-09-21 2019-03-29 华为技术有限公司 A kind of method and apparatus of dynamic management core nodes
CN109543400B (en) * 2017-09-21 2022-08-09 华为技术有限公司 Method and equipment for dynamically managing kernel nodes
US11579899B2 (en) 2017-09-21 2023-02-14 Huawei Technologies Co., Ltd. Method and device for dynamically managing kernel node
CN107770261A (en) * 2017-10-13 2018-03-06 郑州云海信息技术有限公司 A kind of computational methods and relevant apparatus based on distributed memory system

Also Published As

Publication number Publication date
CN105204937B (en) 2018-09-28

Similar Documents

Publication Publication Date Title
CN108845930B (en) Interface operation test method and device, storage medium and electronic device
US20160179495A1 (en) Device and method for packaging application
CN110188135B (en) File generation method and equipment
JP6955676B2 (en) Log analysis method, system and recording medium
KR101881271B1 (en) Apparatus for collecting vulnerability information and method thereof
CN111596920B (en) File compiling method, device, compiling equipment and storage medium
CN106055375B (en) Application program installation method and device
CN113434464A (en) Distributed log processing system and method
CN110708307B (en) Transcoder generation method and apparatus, electronic device, and storage medium
CN104636157A (en) Software upgrading method based on data compatibility, client side, server and system
CN106330520A (en) Method and device of extracting feature information of terminal equipment
CN108595178B (en) Hook-based data acquisition method, device and equipment
CN112149035A (en) Website static resource processing method and device
CN110019012B (en) Data preprocessing method, data preprocessing device and computer-readable storage medium
CN113312083A (en) Application generation method, device and equipment
CN105204937A (en) Kernel function call method, device and operation system
CN107368557B (en) Page editing method and device
CN106599637B (en) Method and device for inputting verification code on verification interface
CN115437641A (en) Code generation method, device, equipment and storage medium based on interface data
CN110865818A (en) Application associated domain name detection method and device and electronic equipment
CN110196793B (en) Log analysis method and device for plug-in database
CN110389754B (en) Service processing method, system, server, terminal, electronic equipment and storage medium
CN108897677B (en) Log construction method and system
CN115543227B (en) Cross-system data migration method, system, electronic device and storage medium
CN113194039B (en) Method and device for segmenting system data flow, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201209

Address after: 313028 Industrial Park, balidian Town, Huzhou City, Zhejiang Province

Patentee after: HUZHOU FENGYUAN AGRICULTURAL EQUIPMENT MANUFACTURE Co.,Ltd.

Address before: 201616 No. 3666 Sixian Road, Songjiang District, Shanghai

Patentee before: Phicomm (Shanghai) Co.,Ltd.

PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Kernel function calling method, device and operating system

Effective date of registration: 20211203

Granted publication date: 20180928

Pledgee: Zhejiang Tailong Commercial Bank Co.,Ltd. Huzhou Branch

Pledgor: HUZHOU FENGYUAN AGRICULTURAL EQUIPMENT MANUFACTURE Co.,Ltd.

Registration number: Y2021330002446

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20230811

Granted publication date: 20180928

Pledgee: Zhejiang Tailong Commercial Bank Co.,Ltd. Huzhou Branch

Pledgor: HUZHOU FENGYUAN AGRICULTURAL EQUIPMENT MANUFACTURE Co.,Ltd.

Registration number: Y2021330002446

PC01 Cancellation of the registration of the contract for pledge of patent right
TR01 Transfer of patent right

Effective date of registration: 20240122

Address after: Room 03, 3rd Floor, Building 3, Yard A2, West Third Ring North Road, Haidian District, Beijing, 100080

Patentee after: Zhongke Hongqi (Beijing) Information Technology Co.,Ltd.

Country or region after: China

Address before: 313028 Industrial Park, balidian Town, Huzhou City, Zhejiang Province

Patentee before: HUZHOU FENGYUAN AGRICULTURAL EQUIPMENT MANUFACTURE Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right