Testing kernel-mode computer code by executing it in user mode

By generating dump files in the kernel mode of the M-bit operating system and performing fuzzy testing in the user mode of the N-bit operating system, the problem of low kernel mode testing in the existing technology is solved, and the kernel code and operating system are realized Fast and effective fuzz testing of drivers.

CN111868695BActive Publication Date: 2024-12-06MICROSOFT TECHNOLOGY LICENSING LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201980020369.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-03-21
Filing Date
2019-03-12
Publication Date
2024-12-06
Estimated Expiration
2039-03-12

AI Technical Summary

Technical Problem

Existing fuzz testing tools are difficult to effectively test computer code running in kernel mode, especially due to the complexity of resource sharing in kernel mode, which makes existing methods expensive and slow to calculate, and cannot capture and analyze execution trajectory, affecting testing. efficiency.

Method used

By executing computer code in kernel mode of M-bit operating system, generating dump files, and loading them into the user mode address space of N-bit operating system, using the fuzzy testing tool to contents of kernel mode address space in user mode in user mode Perform fuzz testing to achieve rapid testing of kernel code and operating system drivers.

Benefits of technology

It implements rapid fuzz testing of kernel code and operating system drivers, reduces virtualization overhead, improves testing efficiency, and provides strong success and failure indicators, which can quickly monitor execution trajectories and discover vulnerabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111868695B_ABST
    Figure CN111868695B_ABST
Patent Text Reader

Abstract

This article describes techniques related to computer code that is tested for vulnerabilities, wherein the computer code is to be run in kernel mode of an operating system. The computer code is executed in kernel mode of a first operating system, and the contents of a memory mapped to the kernel mode address space of the first operating system are converted to user mode memory mapped to the user mode address space of a second operating system. The computer code is executed in user mode and is tested while being executed in user mode.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0001] Modern operating systems running on computing devices create two separate virtual address spaces: user mode address space and kernel mode address space, to store instructions and data. When code stored in the user mode address space is executed by the processor, the processor and code are considered to be running in user mode, and when code stored in the kernel mode address space is executed by the processor, the process and code are considered to be running in kernel mode. Typically, the processor executes applications (such as web browsers, word processing applications, email applications, etc.) in user mode, while the processor executes core operating system components (including the operating system kernel and at least some drivers) in kernel mode. When a user mode application is launched, the operating system creates a process for such an application, where the process provides a private virtual address space to the application. Because the virtual address space is private, data belonging to the application cannot be changed by another application executed by the processor. In other words, each application executed in user mode runs in isolation, and when one application crashes, the crash will not affect another application running in user mode.

[0002] In contrast, all code running in kernel mode shares a single virtual address space. Therefore, drivers running in kernel mode are not isolated from other drivers running in kernel mode, and are even less isolated from the operating system kernel itself. Therefore, if a driver running in kernel mode (or other computer-executable code running in kernel mode) writes to an inappropriate virtual address in the kernel-mode address space, it could potentially corrupt data belonging to the operating system or other drivers. If a kernel-mode driver crashes, such a crash could potentially crash the entire operating system.

[0003] Dynamic analysis tools have been developed to test computer code for vulnerabilities (bugs) and / or security failures before widely releasing applications built on the computer code. For example, tools have been developed to perform fuzz testing on computer code. A fuzz testing tool is an automated software testing tool that provides invalid, unexpected, or random data as input to a computer program. After launching the computer program with the above-mentioned input, the fuzz testing tool creates an execution trace of the computer program and searches the trace for crashes, failed built-in code assertions, potential memory leaks, etc.

[0004] Traditionally, fuzz testing tools have been limited to testing computer code running in user mode. This is due, at least in part, to the isolated environment in which user mode applications run. In contrast, existing fuzz testing tools are not well suited for testing computer code running in kernel mode due to the often complex nature of resource sharing that occurs in kernel mode. More specifically, conventional fuzz testing tools currently do not have the ability to capture and analyze execution traces of computer code running in kernel mode. Existing methods for fuzz testing code running in kernel mode are computationally expensive and slow - these existing methods simulate the entire computing environment and then execute the entire operating system (kernel and drivers) as well as user mode applications inside the simulation. In addition, the virtual machine must be instrumented to collect the execution trace from the operating system, which is slow and noisy because the execution trace will contain many functions that are not relevant to the computer code being tested, such as timer interrupts, background threads, etc. Summary of the invention

[0005] The following is a brief summary of subject matter that is described in greater detail herein. This summary is not intended to limit the scope of the claims.

[0006] Described herein are various techniques related to fuzz testing of computer code to be executed in kernel mode. A debugging tool can be initiated on a computing system executing an M-bit operating system (a first operating system), where M can be, for example, 32. The computer code to be executed in the kernel mode of the first operating system is loaded into a debugger, and a developer can set a breakpoint for the computer code at a location selected by the developer. For example, when the computer code is a function or a driver, a breakpoint can be set at a location where the function or driver is called. Then, the computer code is loaded into the kernel mode address space of the first operating system, and when the processor executes instructions in the kernel mode address space, the developer declares an input that causes the breakpoint to be triggered. In response to the breakpoint being triggered, a file is generated, which indicates the content of the memory mapped to the kernel mode address space. For example, the file can be a dump file that is usually generated when the operating system crashes. Dump files are usually used for offline debugging. However, in the technology described herein, dump files are used to reconstruct the content of the memory in the kernel mode address space, and the reconstructed content is used for online debugging.

[0007] Then, a second computing system executing an N-bit operating system (a second operating system) receives a dump file, where N is greater than M. For example, the second operating system may be a 64-bit operating system. Due to the larger address space that can be allocated using N bits, the second operating system may allocate more virtual address spaces for user mode and kernel mode processes than the virtual address space allocated by the first operating system. As indicated above, the second computing system receives a dump file, which represents the contents of a memory mapped to the kernel mode address space of the first operating system when a breakpoint in the computer code is triggered. In response to the second computing system receiving the dump file, the second operating system creates a new user mode process, where a relatively large address space (e.g., 4GB) is allocated for the new user mode process. Within the user mode address space allocated to the new user mode process, the second operating system allocates an address space that is mapped to the kernel mode address space of the first operating system. In an example, the second operating system may allocate a user mode address space of 2GB to 4GB within the new user mode process.

[0008] The second computing system can then deserialize the file received from the first computing system to reconstruct the contents of the memory in the kernel mode address space of the first operating system when the breakpoint is triggered. The second computing system fills the memory of the second computing system mapped to the above-mentioned user mode address space of the second operating system with the reconstructed contents. In other words, the kernel of the first operating system is in the user mode of the second operating system. In addition, the second computing system sets page protection as in the kernel mode address space of the first computing system, and also modifies the register file of the main thread of the new user mode process so that the registers of the processor of the second computing system mimic the registers of the processor of the first computing system when the breakpoint is triggered. The second computing system can also modify some parts of the contents filled in the user mode address space to ensure that the computer code runs in the user mode of the second operating system. For example, calls to memory allocation functions (these calls are only used in kernel mode) can be searched in the contents, and such calls can be replaced with calls to memory allocation functions that can be used in user mode. Finally, the second computing system can insert a call at the top of the program stack of the new user mode process, wherein the call points to a function that reports success when the computer code completes its execution (for example, the computer code does not crash).

[0009] Then, effectively, the contents of the kernel mode address space of the M-bit operating system are placed in the user mode address space of the N-bit operating system, and some patches are made to prevent the computer code from crashing due to the computer calling kernel mode-specific functions. Then, the fuzz testing tool is notified to fuzz test the new user mode process, and input data (e.g., generated by the developer) of known valid inputs (e.g., the inputs will not cause the computer code to crash) is provided to it. When the fuzz testing tool is fuzz testing the user mode process, the fuzz testing tool can function in a conventional manner; therefore, the fuzz testing tool can disrupt the known valid inputs, and the fuzz testing tool can monitor the execution trajectory of the new user mode process. Therefore, from the perspective of the fuzz testing tool, the fuzz testing tool is fuzz testing the new user mode process, and does so by disrupting the data files used by the new user mode process (where the data files are generated by the developer when the known valid input data to the disk is captured). Then, the new user mode process is actually a virtual machine running a copy of the contents of the kernel mode address space of the M-bit operating system, but running in the user mode of the N-bit operating system, where the fuzz testing tool can track and disrupt its memory. Thus, kernel code and operating system drivers can be fuzz tested using conventional fuzz testing tools. In addition, fuzz testing tools can monitor the execution of new user mode processes and obtain computer code of interest relatively quickly without tracking irrelevant code. Further, computer code can run in user mode address space at full hardware speed without virtualization overhead, resulting in relatively fast fuzz testing of computer code. Finally, fuzz testing tools are able to output strong indicators of success and failure - the computer code being tested returns, and then the fuzz testing tool did not find a vulnerability. However, when a crash occurs, a failure occurs and the user mode process crashes.

[0010] The above summary presents a simplified overview in order to provide a basic understanding of some aspects of the systems and / or methods discussed herein. This summary is not an extensive overview of the systems and / or methods discussed herein. It is not intended to identify key / critical elements of the systems and / or methods or to delineate their scope. The sole purpose is to present some concepts in a simplified form as a prelude to a more detailed description that will be presented later. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 is a functional block diagram of an exemplary computing system configured to test computer code for vulnerabilities, where the computer code is to be executed in kernel mode.

[0012] Figure 2is a schematic diagram illustrating the conversion of the contents of the kernel mode address space of an M-bit operating system to the user mode address space of an N-bit operating system, where N is greater than M.

[0013] Figure 3 is a functional block diagram of an exemplary loader component configured to patch computer code to be executed in kernel mode to allow the computer code to be executed in user mode.

[0014] Figure 4 The present invention is a flowchart illustrating an exemplary method performed by a computing system executing an M-bit operating system, wherein the method causes a dump file to be generated when a breakpoint on computer code is triggered, the dump file representing the contents of a kernel mode address space of the M-bit operating system.

[0015] Figure 5 is a flow chart illustrating an exemplary method performed by a computing system executing an N-bit operating system, wherein the method facilitates fuzz testing of computer code to be executed in kernel mode address space by placing the computer code in user mode address space.

[0016] Figure 6 is an exemplary computing system. DETAILED DESCRIPTION

[0017] Now, various techniques related to testing a computer code that will run in kernel mode are described with reference to the accompanying drawings, wherein throughout the entire text, the same reference numerals are used to refer to the same elements. In the following description, for the purpose of explanation, many specific details are set forth in order to provide a thorough understanding of one or more aspects. However, it is apparent that (one or more) these aspects can be practiced without these specific details. In other examples, well-known structures and devices are shown in block diagram form to facilitate description of one or more aspects. Further, it should be understood that the functionality described as being performed by certain system components can be performed by multiple components. Similarly, for example, a component can be configured to perform the functionality described as being performed by multiple components.

[0018] Furthermore, the term "or" is intended to mean an inclusive "or" rather than an exclusive "or." That is, unless specified otherwise or clear from the context, the phrase "X employs A or B" is intended to mean any of the natural inclusive permutations. That is, the phrase "X employs A or B" is satisfied by any of the following instances: X employs A; X employs B; or X employs both A and B. Furthermore, the articles "a" and "an" used in this application and the appended claims should generally be construed to mean "one or more" unless specified otherwise or clear from the context to be directed to the singular.

[0019] Furthermore, as used herein, the terms "component" and "system" are intended to encompass computer-readable data storage configured with computer-executable instructions that, when executed by a processor, cause certain functionality to be performed. Computer-executable instructions may include routines, functions, etc. It should also be understood that a component or system may be located on a single device or distributed across several devices. Furthermore, as used herein, the term "exemplary" is intended to mean serving as an illustration or example of something and is not intended to indicate a preference.

[0020] This article describes various techniques for facilitating testing the vulnerability of computer code, wherein the computer code will be executed by a processor in kernel mode. As will be described in more detail below, the computer code is loaded into the kernel mode address space of the first operating system, and a copy of the content of the kernel mode address space is generated, wherein (for example) the copy represents the content of the memory mapped to the kernel mode address space when the computer code is ready to be called. Then, this content is placed in the user mode address space of the second operating system, and is run as a part of a user mode process. When running as a user mode process, the computer code is tested for the vulnerability, for example, this allows conventional fuzz testing tools to provide various inputs related to the successful execution of the identification computer code and the crash of the computer code to the computer code. These techniques will be described in more detail herein.

[0021] Reference now Figure 1, an exemplary system 100 is shown that facilitates testing computer code (computer executable instructions) for vulnerabilities, wherein the computer code is to be run in the kernel mode of a computing system. The system 100 includes a client computing device 102 operated by a developer 104 of the computer code. In addition, the system 100 includes a first server computing device 106 that is in network communication with the client computing device 102, and a second server computing device 108 that is in network communication with the client computing device 102 and the first computing device 106. The first server computing device 106 includes a first processor 110 and a first memory 112. The first server computing device 106 executes a first operating system, wherein the first operating system is a 24-bit operating system. In an example, the first operating system can be a 32-bit operating system. The first memory 112 includes a 32-bit kernel mode portion (referred to herein as the first kernel mode portion 114) mapped to a 32-bit kernel mode address space. The first memory 112 also includes a 32-bit user mode portion 116 (referred to herein as the first user mode portion 116) mapped to a 32-bit user mode address space. Thus, the first kernel mode portion 114 includes a first (32-bit) operating system kernel 117, a first driver 118 (executed by the first processor 110 in kernel mode), and first kernel and driver data 120 (e.g., data generated and / or used by the first operating system kernel 117 and / or the first driver 118). The first kernel mode portion 114 of the first memory 112 also includes computer code 122 to be tested for vulnerabilities. The computer code 122 may be a driver, part of a kernel, etc.

[0022] The computer code 122 has a breakpoint 124 set therefor. Although the breakpoint 124 is shown as being included in the computer code 122, it should be understood that the breakpoint 124 will generally be set by the developer 104 just before the first processor 110 executes the computer code 122. Optionally, the first user mode portion 116 may have a user mode application 126 stored therein, or may be empty but reserved for a user mode application. The first memory 112 may also have a kernel mode debugger 128 loaded therein, wherein the kernel mode debugger 128 is configured to generate a dump file when the breakpoint 124 is triggered (e.g., when the first processor 110 reaches the breakpoint 124 while executing instructions in the first kernel mode portion 114 of the first memory 112). The first server computing device 106 also includes a data repository 130, wherein the data repository 130 stores a dump file 132 generated by the kernel mode debugger 128.

[0023] The second server computing device 108 includes a second processor 134 and a second memory 136. The second server computing device 108 runs an N-bit operating system, where N is greater than M. Figure 1 In the example shown, the second server computing device 108 may run a 64-bit operating system.

[0024] The second memory 136 includes a 64-bit kernel mode portion (referred to as the second kernel mode portion 138) mapped to the 64-bit kernel mode address space by the second operating system. The second memory 136 also includes a 64-bit user mode portion 140 (referred to as the second user mode portion 140) mapped to the 64-bit user mode address space by the second operating system. The second kernel mode portion 138 of the second memory 136 includes a second (64-bit) operating system kernel 142, a second driver 144, and second kernel and driver data 146 generated and / or used by the second operating system kernel 142 and / or the second driver 144.

[0025] The second user mode portion 140 of the second memory 136 includes a loader component 148 configured to populate the second user mode portion 140 of the second memory 136 with the contents of the first kernel mode portion 114 of the first memory 112. More specifically, the loader component 148 constructs a new user mode process to be run in user mode at the second server computing device 108, wherein the new user mode process is referred to as a kernel executor application 150. In an example where the 64-bit user mode address space ranges from 0GB-4GB and the 32-bit kernel mode address space ranges from 2GB-4GB, the loader component 148 may create the kernel executor application 150 such that the 0-4GB address space in the second user mode portion 140 of the second memory 136 is allocated to the kernel executor application 150. The loader component 148 may then deserialize the dump file 132 to reconstruct the contents of the first kernel mode portion 114 of the first memory 112, and then allocate the 2GB to 4GB address space in the 64-bit user mode address space to the kernel executor application 150. In response to deserializing the dump file 132, the loader component 148 can thus cause the first operating system kernel 117, the first driver 118, the first kernel and driver data 120, and the computer code 122 to be placed in the second user mode portion 140 of the second memory 136. Because the kernel executor application 150 has been allocated a 0GB-4GB address space, the contents of the first kernel mode portion 114 of the first memory 112 (in the 2GB-4GB address space) can be directly mapped to the 2GB-4GB address space of the user mode address space on the second server computing device 108.

[0026] As will be described in more detail below, once the kernel executor application 150 is created and the loader component 148 has loaded the first operating system kernel 117, the first driver 118, the first kernel and driver data 120, and the computer code 122 into the second user mode portion 140 of the second memory 136, the kernel executor application 150 can make some patches to the contents of the second user mode portion 140 of the second memory 136 to allow the computer code 122 to run in user mode. For example, the computer code 122 may include a call to a function that is specific to the kernel mode of the operating system (e.g., such as a call to allocate memory in kernel mode). The kernel executor application 150 can search for a call to the function in the computer code 122 (in response to the computer code 122 being placed in the second user mode portion 140 of the second memory 136), and can replace the call with a second call to a second function that is configured for use by the user mode application (e.g., where the second function is the equivalent function of the function in user mode). In addition, the kernel executor application 150 may modify the register file of the main thread of the kernel executor application 150 so that when the first processor 110 reaches the breakpoint 124, the registers of the second processor 134 emulate the registers of the first processor 110. Further, the kernel executor application 150 may modify the call stack of the kernel executor application 150 to include a pointer to a report function that reports success, wherein the report function is called each time the second processor 134 successfully executes the computer code 122.

[0027] The second user mode portion 140 of the second memory 136 also includes a fuzzer component 152, which is configured to test the computer code 122 for vulnerabilities (e.g., by fuzz testing the computer code 122). For example, the fuzzer component 152 can be a conventional fuzz testing tool that perturbs input to the kernel executor application 150 and thus perturbs input to the computer code 122. In an exemplary embodiment, in response to the fuzzer component 152 providing input to the kernel executor application 150 and the kernel executor application 150 being executed (or crashing), the loader component 148, the kernel executor application 150, and the fuzzer component 152 can act as described above. More specifically, the loader component 148 can create a new user mode process (kernel executor application 150) (allocating sufficient user mode address space to the kernel executor application 150), deserialize the dump file 132, and fill the appropriate user mode address space in the second user mode portion 140 of the second memory 136. The kernel executor application 150 then executes the above process, and the fuzz testing component 152 asserts disrupted inputs to the kernel executor application 150 for testing the computer code 122 for vulnerabilities.

[0028] Although the computing system 100 is illustrated as including two server computing devices 106 and 108, other architectures can be conceived. For example, a single computing device can execute two virtual machines, wherein the first virtual machine runs a first operating system and the second virtual machine runs a second operating system. In another example, a single computing device can include multiple processor cores, wherein the first processor core is allocated a first memory and executes a first operating system, and the second processor core is allocated a second memory and executes a second operating system. It is conceivable that the system 100 can be provided to an end user as a testing service, wherein the developer uploads the computer code to be tested to one or more computing devices. It is conceivable that any suitable computing architecture that supports converting computer code from kernel mode to user mode. In addition, although the second server computing device 108 is depicted as including a fuzz testing component 152, in addition to or in place of the fuzz testing component 152, other types of testing tools can also be conceived and executed by the second server computing device 108. For example, the second server computing device 108 can execute a heap checker, a type checker, a boundary checker, an analysis tool (profiler), or other tools that can be used to test software.

[0029] An exemplary operation of the system 100 is now described. A developer 104 accesses a client computing device 102 and launches an application having, for example, a debugger-like graphical user interface thereon. For example, the application may be a debugger. The developer 104 examines the computer code 122 and identifies a point about a breakpoint 124 at which the breakpoint 124 will be placed. For example, the breakpoint 124 may be placed at a location immediately after the computer code 122 is called. The application executing on the client computing device 102 also receives one or more input values ​​from the developer 104, wherein the developer 104 knows that these values ​​will cause the breakpoint 124 of the computer code 122 to be triggered. Further, the application may receive from the developer 104 one or more input values ​​that may be provided to the computer code 122 after the breakpoint 124 has been triggered. The one or more values ​​may be known to be valid; the developer 104 already knows that providing the one or more values ​​as input to the computer code 122 will cause the computer code 122 to execute successfully. In response to the developer 104 placing a breakpoint 124 with respect to the computer code 122 and the application receiving a value that would cause the breakpoint 124 to be triggered and a known valid value of the computer code 122, the client computing device 102 causes the first operating system to be updated with the computer code 122 on the first server computing device 106 so that the computer code 122 is placed in the first kernel mode portion 114 of the first memory 112.

[0030] The first processor 110 then begins executing instructions in the first kernel mode portion 114 of the first memory 112 (e.g., instructions in the kernel mode address space of the first operating system). The kernel mode debugger 128 monitors the first processor 110 while the first processor 110 executes the instructions and identifies when the first processor 110 reaches the breakpoint 124 (e.g., the kernel mode debugger 128 identifies when the breakpoint 124 is triggered). In response to the kernel mode debugger 128 identifying that the breakpoint 124 has been triggered, the kernel mode debugger 128 serializes the contents of the first kernel mode portion 114 of the first memory 112 and creates a dump file 132. Thus, the dump file 132 represents the contents of the first kernel mode portion 114 of the first memory 112 at the time when the breakpoint 124 was triggered.

[0031] The first server computing device 106 then sends the dump file 132 to the second server computing device 108, which may then be stored in a data repository (not shown) of the second server computing device 108. In response to an indication that the second server computing device 108 has received the dump file 132, the loader component 148 creates the kernel executor application 150 as a new large address-aware user mode process. Thus, the loader component 148 causes the user mode address space 0GB-4GB to be allocated to the kernel executor application 150. The loader component 148 then deserializes the dump file 132 and writes the deserialized content to the user mode address space allocated to the kernel executor application 150. More specifically, the loader component 148 may perform a one-to-one conversion so that addresses in the deserialized content do not need to be updated. More specifically, the kernel mode address space of the first kernel mode portion 114 mapped to the first memory 112 can be 2GB-4GB, and therefore, since the loader component 148 has assigned an address of 0GB-4GB in the user mode address space (of the second server computing device 108) to the kernel executor application 150, the loader component 148 can fill the portion of the second user mode portion 140 mapped to the user mode address 2GB-4GB with the deserialized content.

[0032] Additionally, the loader component 148 can send information to the kernel executor application 150 that informs the kernel executor application 150 how to set the registers of the second processor 134, where the information can be retrieved from the dump file 132. After the registers of the second processor 134 are appropriately set, the second processor 134 can resume executing instructions from the point where the first processor 110 stopped executing instructions (e.g., at the breakpoint 124).

[0033] In response to the kernel executor application 150 having loaded the first operating system kernel 117, the first driver 118, the first kernel and driver data 120, and the computer code 122 at its appropriate user mode address space, the kernel executor application 150 performs some relatively minor patches to swap out certain kernel mode functions in the computer code 122 and replace them with their user mode equivalent functions. Based on the information provided by the loader component 148, the kernel executor application 150 updates the registers of the second processor 134. In addition, the kernel executor application 150 can patch the return address on the call stack for the kernel executor application 150 so that the return address points to the new function that reports the success indicator. Therefore, when the second processor 134 successfully executes the computer code 122, an indication that the computer code 122 ran successfully (and did not crash) is output.

[0034] In response to the kernel executor application 150 updating the appropriate registers of the second processor 134, patching the computer code 122, and modifying the call stack, the fuzz testing component 152 causes the second processor 134 to execute the kernel executor application 150 using the valid instructions provided by the developer 104. The fuzz testing component 152 monitors the execution of the user mode kernel executor application 150 and operates as a conventional fuzz testing tool. That is, the fuzz testing component 152 is provided with known valid inputs, monitors the kernel executor application 150 to run and generate execution traces, and when the kernel executor application 150 successfully completes, the fuzz testing component 150 perturbs the input values. Thereafter, the loader component 148 is caused to: 1) regenerate the kernel executor application 150; 2) deserialize the dump file 132; and 3) refill the second user mode portion 140 with the contents represented in the dump file 132. Further, the kernel executor application 150 performs the relatively small patch described above and resets the registers of the second processor 134 (as described above). The fuzz testing component 150 then provides the perturbed input values ​​to the kernel executor application 150 and causes the second processor 134 to re-run the kernel executor application 150. When the kernel executor application 150 crashes (e.g., the fuzz testing component 152 provides input data that causes the computer code 122 to crash), output is generated for inspection by the developer 104. For example, when debugging the computer code 122, the developer 104 can use a time-travel debugger.

[0035] In summary, here the kernel of one operating system is allowed to enter the user mode of the second operating system. This method has many advantages. First, conventional fuzz testing tools can fuzz test the kernel code and the drivers to be run in the kernel. Conventional fuzz testing tools do not require complete virtualization of the computing system to view the execution trajectory, and in addition, there is no need to track any irrelevant code. In addition, the performance of the combination of the loader component 148, the kernel executor application 150 and the fuzz testing component 152 is very good, because the loader component 148 only takes a few seconds to recreate its instance when the kernel executor application 150 crashes, and the kernel executor application 150 (including the computer code 122) runs at full hardware speed without virtualization overhead. Finally, due to the patching performed by the kernel executor application 150, there are strong success and failure indicators. When the computer code 122 returns, the fuzz testing component 152 does not use the input provided by it to discover vulnerabilities. Conversely, when the kernel executor application 150 crashes, the fuzz testing component 152 can output an indication that a vulnerability exists in the computer code 122, and the developer 104 can use the time travel debugger to better understand and resolve the vulnerability.

[0036] Reference now Figure 2 , an exemplary schematic diagram 200 illustrates the translation of contents in the kernel mode address space of a 32-bit operating system into the user mode address space (assigned to the kernel executor application 150) in a 64-bit operating system. Schematic diagram 200 illustrates the virtual address space 202 allocated between the kernel and user mode address spaces of the 32-bit operating system. In the example, the 32-bit operating system allocates virtual addresses of 0GB-2GB to user mode processes and allocates virtual addresses of 2GB-4GB to the kernel of the operating system (including the first operating system kernel 117, the first driver 118, the first kernel and driver data 120, and the computer code 122). The location of the breakpoint 124 is illustrated in the 32-bit address space 202.

[0037] As previously described, the second operating system supports a 64-bit address space 204, wherein the second operating system assigns addresses of 0GB-4GB to user mode applications and addresses of 4GB-8TB to the kernel of the 64-bit operating system. Therefore, in order to allow a one-to-one conversion so that the address of the instruction does not need to be converted between the 32-bit address space 202 and the 64-bit address space 204, the loader component 148 can create a kernel executor application 150 as a user mode application to be assigned a virtual address of 0GB-4GB (including 2GB-4GB). The loader component 148 deserializes the dump file 132 and fills 2GB-4GB in the virtual address space 204 with the contents of 2GB-4GB in the 32-bit address space 202. After the kernel executor application 150 updates the registers of the second processor 134, the execution of the computer code 122 begins at the breakpoint 124. Therefore, the second processor 134 is effectively executing an instance of the kernel of the first operating system (without realizing that it is doing so).

[0038] Reference now Figure 3 , depicts a schematic functional block diagram depicting the operation of the kernel executor application 150. It can be determined that the content in the 2GB-4GB virtual address space includes a call to a first function. In an example, the first function can be a kernel-specific function for allocating memory to a kernel process. If a user mode process were to call this function, the user mode process would crash. Therefore, the kernel executor application 150 can search for calls to the first function and replace the calls to the first function with calls to its user mode equivalent function (e.g., calls to a function that allocates memory in user mode). This operation can be performed for multiple known kernel mode-specific functions.

[0039] Figure 4 and Figure 5 The figure shows an exemplary method related to a computer code that will be run in the kernel mode of an operating system with a test. Although the method is shown and described as a series of actions performed in a sequence, it should be understood and appreciated that the method is not subject to the order restriction of this sequence. For example, some actions may occur in an order different from that described herein. In addition, an action may occur simultaneously with another action. In addition, in some instances, it may not be necessary to need all actions to implement the method described herein.

[0040] In addition, the actions described herein may be computer-executable instructions that may be implemented by one or more processors and / or stored on one or more computer-readable media. Computer-executable instructions may include routines, subroutines, programs, execution threads, etc. Further, the results of the actions of the method may be stored in a computer-readable medium, displayed on a display device, etc.

[0041] Reference now Figure 4 , which illustrates a flow chart illustrating an exemplary method 400 that can be performed by a computing system (e.g., a first server computing device 106) running a first operating system. The method 400 starts at 402 and receives computer code to be tested at 404, wherein the computer code is to be run in the kernel mode of the operating system, and further wherein the computer code has breakpoints located therein. As previously described, the computer code can be a driver, some part of the operating system kernel, etc. At 406, an input that will cause the computer code to be called and thus trigger a breakpoint is received. At 408, the operating system runs until the breakpoint is triggered. At 410, a dump file is generated in response to triggering the breakpoint, wherein the dump file represents the contents of a portion of a memory mapped to the kernel mode address space of the operating system. Further, the dump file includes the following content, which represents the value of a register of a computer processor executing the operating system kernel. The method 400 is completed at 412.

[0042] Now go to Figure 5 , a flowchart 500 is shown, which illustrates an exemplary method 500 that can be performed by a computing system running a second operating system (such as the second server computing device 108). The method 500 starts at 502 and receives a dump file (e.g., the dump file generated at 410 of the method 400) at 504. At 506, in response to receiving the dump file, a new user mode process is created.

[0043] At 508, a user mode address space is allocated to a user mode process, wherein the user mode address space is based on a kernel mode address space in which the contents represented by the dump file are stored. At 510, when a breakpoint is triggered, the dump file is deserialized to reconstruct the contents of the kernel mode address space.

[0044] At 512, the allocated user mode address space is filled with the content reconstructed at 510. At 514, the register file of the newly created user mode process is modified to represent the processor registers of the processor (e.g., the first processor 110) when the breakpoint is triggered. At 516, the content in the user mode address space is patched by replacing the call to the kernel mode function in the user mode address space with a call to its equivalent user mode function. At 518, the return address of the call stack of the user mode process is patched so that it includes a pointer to a function that reports success to the fuzz testing tool, and at 520, the user mode process is fuzz tested, wherein the fuzz testing of the user mode process includes monitoring the execution trajectory of the user mode process when the input generated by the fuzz testing tool is provided to the user mode process. Method 500 can return to 506, where the user mode process is created at 506. Actions 506-520 can be repeated a threshold number of times, or until the fuzz testing tool (or other vulnerability testing tool) has been executed as designed. In another exemplary embodiment, the user mode process may iteratively replicate a copy of itself so that actions 514 and 516 may be iteratively performed, and the fuzz testing tool may fuzz test the copy of the user mode process. Method 500 completes at 522 .

[0045] Examples related to aspects described herein are now described.

[0046] Example 1: A computing system comprising: a processor; a memory storing instructions that, when executed by the processor, cause the processor to perform actions, the actions comprising: receiving a file generated by a computing device, the file representing contents of a kernel mode address space of an operating system executed on the computing device, wherein the contents represented by the file include computer code tested for a vulnerability; based on the file, filling a portion of a memory with the contents represented by the file, wherein the portion of the memory is mapped to a user mode address space of a second operating system executed by the processor; and in response to filling the portion of the memory with the contents represented by the file, testing the computer code for a vulnerability, wherein testing the computer-executable instructions for a vulnerability comprises: executing the computer code in a user mode address space based on input provided to the computer code; and generating output indicating whether the computer code crashes when executed with the input.

[0047] Example 2: The computing system of Example 1, wherein the computer code comprises a driver to be executed in a kernel space of an operating system.

[0048] Example 3: The computing system of any of Examples 1-2, wherein the file is a dump file created by the operating system in response to triggering a breakpoint when executing the computer code in kernel mode of the operating system, wherein the breakpoint is placed in the computer code by a developer.

[0049] Example 4: According to the computing system described in Example 4, the action also includes: deserializing the dump file to recreate the contents of the kernel mode address space of the operating system when the breakpoint is triggered; and in response to deserializing the dump file, filling the portion of the memory with the contents.

[0050] Example 5: A computing system according to any one of Examples 1-4, the action also includes: after filling the portion of the memory with the content and before testing the computer code for the vulnerability: searching the computer code for a call to a function that requests allocation of memory in the kernel mode address space of the operating system; replacing the call to the function with a second call to a second function, wherein the second function requests memory allocation in the user mode address space of the second operating system.

[0051] Example 6: The computing system of any of Examples 1-5, wherein the operating system and the second operating system are different operating systems.

[0052] Example 7: The computing system of Example 6, wherein the operating system is an M-bit operating system, and further wherein the second operating system is an N-bit operating system, wherein N is greater than M.

[0053] Example 8: A computing system according to Example 7, wherein filling the portion of memory with content represented by the file includes allocating the portion of memory to a computer-executable application configured to execute in user mode of an N-bit operating system, wherein in response to allocating the portion of memory to the computer-executable application, the content is placed in the portion of memory.

[0054] Example 9: The computing system of example 8, wherein testing the computer code for a vulnerability comprises detecting that the computer executable application has successfully executed.

[0055] Example 10: The computing system of any of Examples 1-9, wherein the computer code comprises a portion of kernel code to be executed in a kernel space of the operating system or a kernel space of a second operating system.

[0056] Example 11: A computing system according to any of Examples 1-10, wherein testing computer executable instructions for vulnerabilities includes: executing at least one of the following computer code-related tools: a fuzz testing tool, a heap checker, a type checker, a bounds checker, or an analysis tool.

[0057] Example 12: A method performed by a computing system including at least one processor, the method comprising: executing computer code to be tested for vulnerabilities, the computer code being executed in kernel mode of a first operating system; in response to detecting that a breakpoint is triggered in the computer code when executing the computer code, generating a file representing the contents of a kernel mode memory that is mapped to the kernel mode address space of the first operating system when the breakpoint is triggered, wherein the breakpoint has been set by a developer examining the computer code; based on the file, filling a user mode memory with the contents represented by the file, wherein the user mode memory is mapped to the user mode address space of a second operating system different from the first operating system, wherein the contents in the user mode memory include computer code; while the computer code is in the user mode memory, executing the computer code; and in response to executing the computer code in the user mode memory, identifying a vulnerability in the computer code.

[0058] Example 13: A method according to Example 12, wherein executing the computer code includes: generating input to provide to the computer code; and initiating execution of the computer code with the input, wherein identifying a vulnerability in the computer code includes identifying a situation in which the computer code crashes when initiated with the input.

[0059] Example 14: A method according to any one of Examples 12-13, wherein the first operating system is an M-bit operating system, the second operating system is an N-bit operating system, and further wherein N is greater than M.

[0060] Example 15: The method of Example 14, wherein the first operating system is a 32-bit operating system and the second operating system is a 64-bit operating system.

[0061] Example 16: The method of any one of Examples 12-15, further comprising executing at least one of the following tools related to the computer code: a fuzz testing tool; a heap checker; a type checker; a bounds checker; or an analysis tool, wherein vulnerabilities are identified in the computer code based on the output of the at least one tool.

[0062] Example 17: A method according to any one of Examples 12-16, wherein the file is a dump file, and further wherein filling the user mode memory with the contents represented by the file includes: deserializing the file to reconstruct the contents of the kernel mode memory when the breakpoint is triggered.

[0063] Example 18: The method of any one of Examples 12-17 further includes: when the computer code is in user mode memory, after filling the user mode memory with content represented by a file and before executing the computer code: determining that the content includes a call to a function; and in response to determining that the content includes a call to a function, replacing the call to the function in the content with a second call to a second function.

[0064] Example 19: A method according to any of Examples 12-18, wherein filling the user mode memory with content represented by the file includes: allocating the user mode memory to a computer executable application, the computer executable application being configured to execute in user mode of the second operating system, wherein in response to allocating the user mode memory to the computer executable application, the content is placed in the user mode memory.

[0065] Example 20: A computer-readable storage medium comprising instructions that, when executed by a processor, cause the processor to perform the following actions: receiving a file generated by a computing device, the file representing contents in kernel mode memory mapped to a kernel mode address space of an operating system executing on the computing device, wherein the contents represented by the file include computer code to be tested for vulnerabilities; based on the file, filling user mode memory with the contents represented by the file, wherein the user mode memory is mapped to a user mode address space of a second operating system executed by the processor; and in response to filling the user mode memory with the contents represented by the file, testing computer executable instructions for vulnerabilities, wherein testing computer executable instructions for vulnerabilities comprises: executing the computer executable instructions in a user mode address space based on input provided to the computer executable instructions; and generating output indicating whether the computer executable instructions crash when executed with the input.

[0066] Reference now Figure 6 , which shows a high-level diagram of an exemplary computing device 600 that can be used in accordance with the systems and methods disclosed herein. For example, the computing device 600 can be used in a system that supports generating dump files. As another example, the computing device 600 can be used in a system that supports fuzz testing of computer code to be executed in kernel mode. The computing device 600 includes at least one processor 602, which executes instructions stored in a memory 604. For example, the instructions can be instructions for implementing functionality described as being performed by one or more of the above components, or instructions for implementing one or more of the above methods. The processor 602 can access the memory 604 via a system bus 606. In addition to storing executable instructions, the memory 604 can also store kernel data, driver data, registry information, etc.

[0067] The computing device 600 also includes a data repository 608, which can be accessed by the processor 602 via the system bus 606. The data repository 608 may include executable instructions, dump files, etc. The computing device 600 also includes an input interface 610, which allows external devices to communicate with the computing device 600. For example, the input interface 610 can be used to receive instructions from an external computer device, a user, etc. The computing device 600 also includes an output interface 612, which interfaces the computing device 600 with one or more external devices. For example, the computing device 600 can display text, images, etc. through the output interface 612.

[0068] It is contemplated that external devices that communicate with the computing device 600 via the input interface 610 and the output interface 612 may be included in an environment that provides substantially any type of user interface with which a user may interact. Examples of user interface types include graphical user interfaces, natural user interfaces, and the like. For example, a graphical user interface may accept input from a user using (one or more) input devices such as a keyboard, a mouse, a remote control, and the like, and provide output on an output device such as a display. Further, a natural user interface may enable a user to interact with the computing device 600 in a manner that is not constrained by input devices such as a keyboard, a mouse, a remote control, and the like. In contrast, a natural user interface may rely on speech recognition, touch and stylus recognition, gesture recognition on and adjacent to the screen, air gestures, head and eye tracking, sound and speech, vision, touch, gestures, machine intelligence, and the like.

[0069] In addition, although illustrated as a single system, it should be understood that the computing device 600 may be a distributed system. Thus, for example, several devices may communicate via a network connection and may jointly perform the tasks described as being performed by the computing device 600.

[0070] The various functions described herein can be implemented in hardware, software or any combination thereof. If implemented in software, the function can be stored on a computer-readable medium or transmitted on a computer-readable medium as one or more instructions or codes. Computer-readable media include computer-readable storage media. Computer-readable storage media can be any available storage medium that a computer can access. As an example and not limitation, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure that can be accessed by a computer. Disks and optical disks used herein include compact disks (CDs), laser optical disks, optical disks, digital versatile disks (DVDs), floppy disks and blue-ray disks (BDs), wherein disks usually copy data magnetically, and optical disks usually copy data optically with lasers. Further, propagated signals are not included in the scope of computer-readable storage media. Computer-readable media also include communication media, which include any media that facilitates transferring a computer program from one place to another. For example, a connection can be a communication medium. For example, if the software is transmitted from a website, server or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technologies such as infrared, radio and microwave, then the definition of communication media includes coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave. Combinations of the above should also be included within the scope of computer-readable media.

[0071] Alternatively or additionally, the functionality described herein may be at least partially performed by one or more hardware logic components. For example, but not limited to, illustrative types of hardware logic components that may be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), etc.

[0072] What has been described above includes examples of one or more embodiments. Of course, in order to describe the aforementioned aspects, it is impossible to describe every conceivable modification and variation of the above-mentioned apparatus or method, but a person of ordinary skill in the art will recognize that many further modifications and permutations of various aspects are possible. Therefore, the various aspects described are intended to cover all such changes, modifications and variations that fall within the spirit and scope of the appended claims. In addition, to the extent that the term "comprising" is used in a specific specification or claim, the term is intended to cover a similar manner to that in which the term "comprising" is interpreted when used as a transitional word in a claim.

Claims

1. A computing system, include: processor; as well as a memory storing instructions that, when executed by the processor, cause the processor to perform actions comprising: receiving a dump file generated by a computing device, the dump file comprising content stored in a kernel mode address space of an operating system executing on the computing device, wherein the content comprises computer code stored in the kernel mode address space of the operating system, wherein the computer code is to be tested for a vulnerability, and further wherein the dump file is created by the computing device in response to triggering a breakpoint while executing the computer code in kernel mode of the operating system; deserializing the dump file to recreate the contents of the kernel mode address space of the operating system when the breakpoint was triggered; filling a portion of the memory with the contents including the computer code, the computer code being based on the deserialized dump file, wherein the portion of the memory is mapped into a user mode address space of a second operating system executed by the processor; and In response to filling the portion of the memory with the content, testing the computer code for the vulnerability, wherein testing the computer code for the vulnerability comprises: executing the computer code in the user mode address space based on input provided to the computer code; and An output is generated indicating whether the computer code crashes when executed with the input.

2. The computing system of claim 1, wherein the computer code comprises a driver to be executed in a kernel space of the operating system.

3. The computing system according to claim 1, wherein the action further include: After filling the portion of the memory with the content and before testing the computer code for the vulnerability: searching the computer code for a call to a function requesting a memory allocation in the kernel mode address space of the operating system; as well as The call to the function is replaced with a second call to a second function, wherein the second function requests a memory allocation in the user mode address space of the second operating system. 4 . The computing system of claim 1 , wherein the operating system and the second operating system are different operating systems. 5 . The computing system of claim 4 , wherein the operating system is an M-bit operating system, and further wherein the second operating system is an N-bit operating system, wherein N is greater than M.

6. The computing system of claim 5 , wherein filling the portion of the memory with the content comprises allocating the portion of the memory to a computer-executable application configured to execute in a user mode of the N-bit operating system, wherein the content is placed in the portion of the memory in response to allocating the portion of the memory to the computer-executable application. 7 . The computing system of claim 6 , wherein testing the computer code for vulnerabilities comprises detecting successful execution of the computer executable application.

8. The computing system of claim 1, wherein the computer code comprises a portion of kernel code to be executed in a kernel space of the operating system or a kernel space of the second operating system.

9. The computing system of claim 1, wherein testing the computer-executable instructions for the vulnerability comprises executing at least one of the following tools associated with the computer code: a fuzz testing tool, a heap checker, a type checker, a bounds checker, or an analysis tool.

10. A method performed by a computing system comprising at least one processor, the method include: executing computer code to be tested for vulnerabilities, the computer code being executed in kernel mode of a first operating system; generating a dump file in response to detecting that a breakpoint has been triggered in the computer code while executing the computer code, the dump file comprising contents of a kernel mode memory, wherein the contents were mapped to a kernel mode address space of the first operating system when the breakpoint was triggered, wherein the contents comprise computer code, and further wherein the breakpoint has been set by a developer examining the computer code; populating a user mode memory with the contents based on the file, wherein the user mode memory is mapped to a user mode address space of a second operating system different from the first operating system, wherein the contents in the user mode memory include the computer code, and further wherein populating the user mode memory with the contents includes deserializing the dump file to reconstruct the contents of the kernel mode memory when the breakpoint was triggered; executing said computer code while said computer code is in said user mode memory; as well as In response to executing the computer code in the user mode memory, a vulnerability in the computer code is identified.

11. The method of claim 10, wherein executing the computer code include: generating input to provide to said computer code; as well as Execution of the computer code is initiated with the input, wherein identifying the vulnerability in the computer code comprises identifying that the computer code crashes when initiated with the input.

12. The method according to claim 10, wherein the first operating system is an M-bit operating system, the second operating system is an N-bit operating system, and further wherein N is greater than M.

13. The method of claim 12, wherein the first operating system is a 32-bit operating system and the second operating system is a 64-bit operating system.

14. The method of claim 10, further comprising executing at least one of the following tools associated with the computer code: Fuzz testing tools; Heap checker; Type checker; a bounds checker; or Analysis tools, wherein the vulnerability is identified in the computer code based on an output of the at least one tool.

15. The method according to claim 10, further comprising: include: After filling the user mode memory with the content and before testing the computer code for the vulnerability while the computer code is in the user mode memory: determining that the content includes a call to a function; and In response to determining that the content includes the call to the function, the call to the function in the content is replaced with a second call to a second function.

16. The method of claim 10, wherein populating the user mode memory with the content comprises allocating the user mode memory to a computer executable application configured to execute in a user mode of the second operating system, wherein the content is placed in the user mode memory in response to allocating the user mode memory to the computer executable application.

17. A computer-readable storage medium comprising instructions, which, when executed by a processor, cause the processor to perform actions, the actions include: receiving a dump file generated by a computing device, the dump file representing contents of a kernel-mode memory mapped to a kernel-mode address space of an operating system executing on the computing device, wherein the contents represented by the dump file include computer-executable instructions to be tested for a vulnerability; Based on the dump file, populating a user mode memory with the contents represented by the dump file, wherein the user mode memory is mapped to a user mode address space of a second operating system executed by the processor, and further wherein populating the user mode memory with the contents comprises deserializing the dump file to reconstruct the contents of the kernel mode memory when a breakpoint was triggered; and In response to populating the user mode memory with the contents represented by the dump file, testing the computer executable instructions for the vulnerability, wherein testing the computer executable instructions for the vulnerability comprises: executing the computer-executable instructions in the user mode memory based on input provided to the computer-executable instructions; and An output is generated indicating whether the computer executable instructions crash when executed with the input.

18. The computer-readable storage medium of claim 17, wherein the operating system is an M-bit operating system, the second operating system is an N-bit operating system, and further wherein N is greater than M.

19. The computer-readable storage medium of claim 18, wherein the operating system is a 32-bit operating system and the second operating system is a 64-bit operating system.

20. The computer-readable storage medium of claim 17, wherein the action further comprises: include: After filling the user mode memory with the contents and before testing the computer executable instructions for the vulnerability while the computer executable instructions are in the user mode memory: determining that the content includes a call to a function; and In response to determining that the content includes the call to the function, the call to the function in the content is replaced with a second call to a second function.