In computer science, dynamic software updating (DSU) is a field of research pertaining to upgrading programs while they are running.
Current operating systems and programming languages are typically not designed with DSU in mind.
Systems designers can extract valuable performance or safety assurances by limiting the scope of updates.
While these analyses prove properties of programs that are valuable for DSU, they are by nature sophisticated and difficult to understand.
Academic publications of DSU systems commonly include several target programs as case studies.
vsftpd, OpenSSH, PostgreSQL, Tor, Apache, GNU Zebra, memcached, and Redis are all dynamic updating targets for various systems.
As an example, a database that must be backward-compatible with previous versions of its on-disk file format, must accomplish the same type of state transformation expected of a dynamic updating system.
[4] Presented in 1983 in the PhD dissertation of Insup Lee, DYMOS was a fully integrated system that had access to an interactive user interface, a compiler and runtime for a Modula variant, and source code.
The HotSpot JVM supports runtime code loading, and DSU systems targeting Java (programming language) can utilize this feature.
Binary rewriting is the process of writing low-level code into the memory image of a running native program to re-direct functions.
DSU systems can either attempt to synthesize transformer functions, or require that the developer manually supply them.
Lazy transformation ensures that the update will complete in constant time, but also incurs steady-state overhead on object access.
[8][9] If a function is proven cons-free, it can be updated even if it is live on the stack, since it will not cause a type error by accessing state using the old representation.
The information available to DYMOS enables it to enforce type-safety of updates with respect to the running target program.
[12] SUSE developed kGraft as an open-source alternative for live kernel patching, and Red Hat did likewise with kpatch.
They both allow function-level changes to be applied to a running Linux kernel, while relying on live patching mechanisms established by ftrace.
The primary difference between kGraft and kpatch is the way they ensure runtime consistency of the updated code sections while hot patches are applied.
[15] Since April 2015, there is ongoing work on porting kpatch and kGraft to the common live patching core provided by the Linux kernel mainline.
However, implementation of the function-level consistency mechanisms, required for safe transitions between the original and patched versions of functions, has been delayed because the call stacks provided by the Linux kernel may be unreliable in situations that involve assembly code without proper stack frames; as a result, the porting work remains in progress as of September 2015[update].
This compiler inserts indirection to all function calls and type accesses, enabling Ginseng to lazily transform state at the cost of imposing a constant-time overhead for the entirety of the program execution.
[9] Ginseng's compiler proves the cons-freeness properties of the entire initial program and of dynamic patches.
For example, in two versions of OpenSSH examined by Ginseng's authors, important user verification code was moved between two functions called in sequence.
To update a program with UpStare, a developer specifies a mapping between any possible stack frames.
UpStare is able to use this mapping to immediately update the program at any point, with any number of threads, and with any functions live on the stack.
[19] PoLUS is a binary-rewriting DSU system for C. It is able to update unmodified programs at any point in their execution.
[20] Katana is a research system that provides limited dynamic updating (similar to Ksplice and its forks) for user-mode ELF binaries.
Ekiden and Kitsune are also notable in that they are implemented primarily as application-level libraries, rather than specialized runtimes or compilers.
To ease this process, Kitsune includes a specialized compiler that implements a domain-specific language for writing state transformers.
[6][7] Erlang supports Dynamic Software Updating, though this is commonly referred to as "hot code loading".
For example, one can combine lazy update of the state as in Ginseng while changing the whole code of the application as in Kitsune or Ekiden.