# US 2015/0178071 A1 · Runtime patching of an operating system (os) without stopping execution

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2015/0178071 A1
- Document ID: US20150178071A1
- Status: Published application
- Kind: A1
- Application number: 14/134,026
- Filed: 2013-12-19
- Published: 2015-06-25
- Earliest claimed: 2013-12-19
- Assignees: Novell, Inc.
- Applicants: Novell, Inc.
- Inventors: Vojtech Pavlík; Jirí Kosina
- Web page: https://patentgrep.com/patent/US20150178071A1

## CPC

- G06F 12/128: adapted to multidimensional cache systems, e.g. set-associative, multicache, multiset or multilevel
- G06F 8/656: while running
- G06F 9/30043: {LOAD or STORE instructions; Clear instruction}
- G06F 9/3009: {Thread control instructions}
- G06F 9/441: {Multiboot arrangements, i.e. selecting an operating system to be loaded}
- G06F 9/45554: {Instruction set architectures of guest OS and hypervisor or native processor differ, e.g. Bochs or VirtualPC on PowerPC MacOS}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 9/5088: {involving task migration}
- G06F 9/545: {where tasks reside in different layers, e.g. user- and kernel-space}
- G06F 12/0833: {in combination with broadcast means (e.g. for invalidation or updating)}
- G06F 2009/45562: {Creating, deleting, cloning virtual machine instances}
- G06F 2009/45591: {Monitoring or debugging support}
- G06F 2212/62: Details of cache specific to multiprocessor cache arrangements
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for runtime patching of an OS without stopping execution of the OS are presented. When a patch function is needed, it is loaded into the OS code. Threads of the OS that are in kernel mode have a flag set and a jump is inserted at a location of an old function. When the old function is accessed, the jump uses a trampoline to check the flag, if the flag is set, processing returns to the old function; otherwise processing jumps to a given location of the patch. Flags are unset when exiting or entering the kernel mode.

## Claims

### Claim 1

A method, comprising:
loading, via the device, a patch function for an existing function within a kernel of an Operating System (OS);
setting, via the device, a flag for each kernel thread active within the Operating System (OS);
unsetting, via the device, each flag when any OS thread enters the kernel or when any OS thread exits the kernel; and
inspecting, via the device, each flag for each kernel thread that attempts to execute the existing function and when that flag is set pass that kernel thread to the existing function for execution but when that flag is unset pass that kernel thread to the patch function without halting the OS.

### Claim 2 (depends on 1)

The method of claim 1, wherein loading further includes installing the patch function as a loadable module within memory without stopping the OS.

### Claim 3 (depends on 1)

The method of claim 1, wherein setting further includes injecting a jump instruction at a location for the existing function within the kernel to initially execute to the existing function.

### Claim 4 (depends on 3)

The method of claim 3, wherein injecting further includes issuing a flush of cache on processors using the OS.

### Claim 5 (depends on 4)

The method of claim 4, wherein issuing further includes inserting a trampoline function at every remaining reference to the existing function within the kernel, the trampoline function permits each flag to be checked every time the existing function is called for execution by each kernel thread.

### Claim 6 (depends on 5)

The method of claim 5, wherein inserting further includes issuing a second flush of the cache.

### Claim 7 (depends on 6)

The method of claim 6, wherein issuing further includes using each trampoline function to send each kernel thread to the jump instruction at the first reference when that kernel thread's flag is set.

### Claim 8 (depends on 6)

The method of claim 6, wherein issuing further includes using each trampoline function to send each kernel thread to the patch function when that kernel thread's flag is unset.

### Claim 9 (depends on 6)

The method of claim 6, wherein issuing further includes modifying the jump instruction to jump to the patch function when every kernel thread has its flag unset.

### Claim 10 (depends on 9)

The method of claim 9, wherein modifying further includes replacing each trampoline function with a new jump instruction that jumps to the patch function when every kernel thread has its flag unset.

### Claim 11 (depends on 10)

The method of claim 10, wherein replacing further includes terminating the unsetting of each flag and the inspecting of each flag when every kernel thread has its flag unset.

### Claim 12 (depends on 1)

The method of claim 1, wherein unsetting further includes setting and unsetting an additional flag for each processing unit in a multi-processing unit environment while updating the OS with the patch function on a per processing unit basis.

### Claim 13

A method, comprising:
inserting, via a device, labels before locations of functions within a kernel of an Operating System (OS) when the OS is compiled;
replacing, via the device, the labels with no operations (NOPs) when the OS is booted; and
loading, via the device, a patch function for a particular one of the functions; and
gradually migrating, via the device, all references to the particular one of the functions within the kernel to call the patch function using particular NOPs for the particular one of the functions without halting the OS during migration.

### Claim 14 (depends on 13)

The method of claim 13, wherein inserting further includes processing a counter instruction of a compiler that compiles the OS for inserting the labels.

### Claim 15 (depends on 14)

The method of claim 14, wherein replacing further includes using a list for the locations provided by the compiler to replace the labels with the NOPs.

### Claim 16 (depends on 15)

The method of claim 15, wherein using further includes maintaining the list for use when updating any of the functions within the OS.

### Claim 17 (depends on 13)

The method of claim 13, wherein loading further includes loading the patch function as a loadable module within memory of the device.

### Claim 18

A system, comprising:
a server memory configured to update kernel functions of an Operating System (OS) without halting the OS by gradually updating the kernel functions to ensure consistency of operation for threads of the OS that are passing between kernel mode and user mode.

### Claim 19 (depends on 18)

The system of claim 18, wherein the server further includes a compiler software module to label locations of the kernel functions during compiles of the OS.

### Claim 20 (depends on 19)

The system of claim 19, wherein the server further includes a patch software module to use the label locations when gradually updating particular ones of the kernel functions.
