Content deleted Content added
→Related fields: Meh, missed that |
Ungrabled the Wiki code of references |
||
Line 5:
== Introduction ==
Any running program can be thought of a [[tuple]] <math>(\delta, P)</math>, where <math>\delta</math> is the current program state and <math>P</math> is the current program code. Dynamic software updating systems transform a running program <math>(\delta, P)</math> to a new version <math>(\delta', P')</math>. In order to do this, the state must be transformed into the representation <math>P'</math> expects. This requires a ''state transformer'' function. Thus, DSU transforms a program <math>(\delta, P)</math> to <math>(S (\delta), P')</math>. An update is considered '''valid''' if and only if the running program <math>(S (\delta), P')</math> can be reduced to a point tuple <math>(\delta, P')</math> that is reachable from the starting point of the new version of the program, <math>(\delta_{init}, P')</math>.<ref name="gupta">{{cite journal
| author-last1 = Gupta | author-first1 = Deepak
| author-last2 = Jalote | author-first2 = Pankaj
| author-last3 = Barua | author-first3 = Gautam
| title = A Formal Framework for On-line Software Version Change
| journal = IEEE Transactions on Software Engineering
| volume = 22 | number = 2 | pages = 120–131
| url = http://www.win.tue.nl/~hmei/SoftwareUpdate/A%20formal%20framework%20for%20on-line%20software%20version%20change.pdf
| year = 1996 | doi = 10.1109/32.485222
}}</ref>
The ___location in a program where a dynamic update occurs is referred to as an '''update point'''. Existing DSU implementations vary widely in their treatment of update points. In some systems, such as [[#UpStare|UpStare]] and [[#PoLUS|PoLUS]], an update can occur at any time during execution. [[#Ginseng|Ginseng]]'s compiler will attempt to infer good locations for update points, but can also use programmer-specified update points. [[#Kitsune and Ekiden|Kitsune and Ekiden]] require developers to manually specify and name all update points.
Line 18 ⟶ 26:
The problem space addressed by dynamic updating can be thought of as an intersection of several others. Examples include [[checkpointing]], [[dynamic linking]], and [[Persistence (computer science)|persistence]]. 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. Likewise, a program that has a plugin architecture, must be able to load and execute new code at runtime.
Similar techniques are sometimes also employed for the purpose of [[dynamic dead-code elimination]] to remove conditionally [[dead code|dead]] or [[unreachable code]] at load or runtime, and recombine the remaining code to minimize its memory footprint or improve speed.<ref name="Paul_1997_FreeKEYB">{{cite
| title = FreeKEYB - Enhanced DOS keyboard and console driver | edition = v6.5 | author-first1 = Matthias | author-last1 = | author-first2 = Axel C. | author-last2 = | type = User Manual | }} (NB. The K3PLUS successor FreeKEYB is a fully reconfigurable driver with many dynamically loadable special features. It implements a unique form of byte-level granular [[dynamic dead code elimination]] and [[relocation (computing)|relocation]] techniques at [[load-time]] as well as [[self-modifying code]] and reconfigurability at [[runtime (computing)|run-time]] to minimize its memory footprint close to the [[canonical form]] depending on the hardware, operating system, other environment and driver configuration as well as the selected feature set and locale (about sixty configuration switches with hundreds of options for an almost unlimited number of possible combinations). The build process utilizes a [[macro assembler]] as well as a framework of automatic pre- and post-processing tools analyzing the temporary binaries to generate dependency and [[code morphing]] [[meta data]] to be embedded into the resulting [[executable file]] alongside the [[binary code]] and a self-discarding, [[instruction relaxation|relaxing]] and [[relocating loader]] to dynamically (re)combine, (over)load, modify, update or unload the runtime image (code and data) of the driver as requested. The complexity is hidden in a single self-contained file so that for a user the handling is the same as for a normal (semi-)monolithic driver/[[Terminate and stay resident program|TSR]].</ref><ref name="Paul_2006_FreeKEYB">{{cite | title = FreeKEYB - Advanced international DOS keyboard and console driver | | author-first1 = Matthias | author-last1 = Paul
| author-first2 = Axel C. | author-last2 = Frinke
| type = User Manual
| date = 2006-01-16
}}</ref>
== History ==
The earliest precursor to dynamic software updating is [[Redundancy (engineering)|redundant systems]]. In a redundant environment, spare systems exist ready to take control of active computations in the event of a failure of the main system. These systems contain a main machine and a ''hot spare''. The hot spare would be periodically seeded with a [[Application checkpointing|checkpoint]] of the primary system. In the event of a failure, the hot spare would take over, and the main machine would become the new hot spare. This pattern can be generalized to updating. In the event of an update, the hot spare would activate, the main system would update, and then the updated system would resume control.
The earliest true Dynamic Software Updating system is [[#DYMOS|DYMOS]] (''Dy''namic ''Mo''dification ''S''ystem).<ref name="dymos">{{cite thesis
| author-first = Insup | author-last = | title = Dymos: a dynamic modification system | degree = Doctor of Philosophy (Computer Science) | year = 1983 | publisher = University of Wisconsin - Madison | url = http://www.cis.upenn.edu/~lee/mydissertation.doc | dead-url = | | }}</ref> 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. This enabled DYMOS to type-check updates against the existing program. ==Implementation==
DSU systems must load new code into a running program, and transform existing state into a format that is understood by the new code. Since many motivational use-cases of DSU are time-critical (for example, deploying a security fix on a live and vulnerable system), DSU systems must provide adequate '''update availability'''. Some DSU systems also attempt to ensure that updates are safe before applying them.
There is no one canonical solution to any of these problems. Typically, a DSU system that performs well in one problem area does so at a trade-off to others. For example, empirical testing of dynamic updates indicates that increasing the number of update points results in an increased number of unsafe updates.<ref name="testing">{{cite journal
| title = Evaluating dynamic software update safety using systematic testing | author-first1 = Chris | author-last1 = | author-first2 = Edward K. | author-last2 = | author-first3 = Eric | author-last3 = | author-first4 = Michael | author-last4 = | author-first5 = Jeffery | author-last5 = | year = | journal = Software Engineering, IEEE Transactions on | issue = 99 | publisher = IEEE | url = http://www.cs.umd.edu/~hayden/papers/empiricalsafety-draft.pdf
}}</ref>
== Code transformation ==
Most DSU systems use [[subroutine]]s as the unit of code for updates; however, newer DSU systems implement whole-program updates.<ref name="ekiden">{{cite journal
| author-first1 = Chris | author-last1 = Hayden
| author-first2 = Edward K. | author-last2 = Smith
| author-first3 = Michael | author-last3 = Hicks
| author-first4 = Jeffery | author-last4 = Foster
| journal = Data Engineering Workshops (ICDEW), 2011 IEEE 27th International Conference on
| pages = 179–184 | publisher = IEEE
| url = http://www.cs.umd.edu/~jfoster/papers/hotswup11.pdf
| year = 2011
| title = State transfer for clear and efficient runtime updates
}}</ref><ref name="kitsune">{{cite journal
| author-last1 = Hayden | author-first1 = Chris
| author-last2 = Smith | author-first2 = Edward K.
| author-first3 = Michail | author-last3 = Denchev
| author-first4 = Michael | author-last4 = Hicks
| author-first5 = Jeffery | author-last5 = Foster
| year = 2011
| title = Kitsune: Efficient, General-purpose Dynamic Software Updating for C
| url = http://www.cs.umd.edu/~mwh/papers/kitsune.pdf
}}</ref>
If the target program is implemented in a [[virtual machine]] language, the VM can use existing infrastructure to load new code, since modern virtual machines support runtime loading for other use cases besides DSU (mainly [[debugging]]). The [[HotSpot]] [[JVM]] supports runtime code loading, and DSU systems targeting [[Java (programming language)]] can utilize this feature.
Line 51 ⟶ 112:
Type safety is typically checked by showing one of two properties, '''activeness safety''' or '''cons-freeness safety'''. A program is considered activeness-safe if no updated function exists on the [[call stack]] at update time. This proves safety because control can never return to old code that would access new representations of data.
''Cons-Freeness'' is another way to prove type safety, where a section of code is considered safe if it does not access state of a given type in a way that requires knowledge of the type representation. This code can be said to not access the state ''concretely'', while it may access the state ''abstractly''. It is possible to prove or disprove ''cons-freeness'' for all types in any section of code, and the DSU system Ginseng uses this to prove type safety.<ref name="cons-freeness">{{cite journal
| title = Mutatis mutandis: Safe and predictable dynamic software updating
| author-first1 = Gareth | author-last1 = Stoyle
| author-first2 = Michael | author-last2 = Hicks
| author-first3 = Gavin | author-last3 = Bierman
| author-first4 = Peter | author-last4 = Sewall
| author-first5 = Iulian | author-last5 = Neamtiu
| year = 2005
| journal = Proceedings of the ACM Conference on Principles of Programming Languages
| url = http://www.cs.umd.edu/~mwh/papers/proteus-popl.pdf
}}</ref><ref name="ginseng">{{cite journal
| title = Practical dynamic software updating for C
| author-first1 = Iulian | author-last1 = Neamtiu
| author-first2 = Michael | author-last2 = Hicks
| author-first3 = Gareth | author-last3 = Stoyle
| author-first4 = Manuel | author-last4 = Oriol
| journal = ACM SIGPLAN Notices
| volume = 41 | issue = 6 | pages = 72–83
| publisher = ACM
| url = http://www.cs.umd.edu/~mwh/papers/ginseng.pdf
| doi = 10.1145/1133255.1133991
}}</ref> 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.
Empirical analysis of ''cons-freeness'' and activeness safety by Hayden et all show that both techniques permit most correct updates and deny most erroneous updates. However, manually selecting update points results in zero update errors, and still allows frequent update availability.<ref name="testing" />
Line 61 ⟶ 143:
=== {{Anchor|STACKTOOL}}Ksplice, kpatch and kGraft ===
[[Ksplice]] is a DSU system that targets only the [[Linux kernel]], making itself one of the specialized DSU systems that support an [[operating system kernel]] as the target program. Ksplice uses source-level [[diff]]s to determine changes between current and updated versions of the Linux kernel, and then uses binary rewriting to insert the changes into the running kernel.<ref name="ksplice">{{cite journal
| title = Ksplice: automatic rebootless kernel updates | author-first1 = Jeff | author-last1 = | author-first2 = M. Frans | author-last2 = Kaashoek | author-link2 = Frans Kaashoek | year = | journal = Proceedings of the 4th ACM European conference on Computer systems | doi = 10.1145/1519065.1519085 | }}</ref> Ksplice was maintained by a commercial venture founded by its original authors, Ksplice Inc., which was acquired by [[Oracle Corporation]] in July 2011.<ref>{{cite news | url = http://www.oracle.com/us/corporate/Acquisitions/ksplice/index.html | title = Oracle and Ksplice
| accessdate = 2011-07-21
}}</ref> Ksplice is used on a commercial basis and exclusively in Oracle's [[Unbreakable Linux]] distribution.<ref>{{cite web
| url = https://oss.oracle.com/ksplice/docs/GettingStarted.html
| title = Getting Started with Oracle Ksplice
| website = oracle.com
| accessdate = 2014-08-02
}}</ref>
[[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. kGraft and kpatch were submitted for inclusion into the [[Linux kernel mainline]] in April 2014 and May 2014, respectively,<ref name="lwn-597123">{{cite web
| url = https://lwn.net/Articles/597123/ | | date = 2014-05-01 | | author-first = Josh | author-last = | publisher = [[LWN.net]] }}</ref><ref>{{cite web | url = https://lwn.net/Articles/596854/ | title = The initial kGraft submission | date = 2014-04-30 | | author-first = Jonathan | author-last = Corbet
| publisher = [[LWN.net]]
}}</ref> and the minimalistic foundations for live patching were merged into the Linux kernel mainline in kernel version 4.0, which was released on April 12, 2015.<ref>{{cite web
| url = http://kernelnewbies.org/Linux_4.0#head-9aa7c8499b42911a48c02b24f367bf2bc6db8606
| title = Linux kernel 4.0, Section 1.2. Live patching
| date = 2015-04-26 | accessdate = 2015-05-14
| website = kernelnewbies.org
}}</ref>
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 stack]]s provided by the Linux kernel may be unreliable in situations that involve [[assembly code]] without proper [[stack frame]]s; as a result, the porting work remains in progress {{As of|2015|9|lc=yes}}. In an attempt to improve the reliability of kernel's call stacks, a specialized sanity-check {{Mono|stacktool}} userspace utility has also been developed with the purpose of checking kernel's compile-time [[object file]]s and ensuring that the call stack is always maintained; it also opens up a possibility for achieving more reliable call stacks as part of the [[kernel oops]] messages.<ref>{{cite web
| url = https://lwn.net/Articles/658333/ | title = Compile-time stack validation | date = 2015-09-30 | | author-first = Jonathan | author-last = | publisher = [[LWN.net]] }}</ref><ref>{{cite web | url = https://lwn.net/Articles/658347/ | title = Linux kernel documentation: Documentation/stack-validation.txt (from the v13 patch) | | author-first = Josh | author-last = Poimboeuf
| publisher = [[LWN.net]]
}}</ref>
=== Ginseng ===
Line 72 ⟶ 200:
Ginseng is implemented as a [[source-to-source compiler]] written using the [[C Intermediate Language]] framework in [[OCaml]]. 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.<ref name="ginseng" /> Ginseng's compiler proves the ''cons-freeness'' properties of the entire initial program and of dynamic patches.
Later versions of Ginseng also support a notion of transactional safety. This allows developers to annotate a sequence of function calls as a logical unit, preventing updates from violating program semantics in ways that are not detectable by either activeness safety or ''cons-freeness'' safety. For example, in two versions of [[OpenSSH]] examined by Ginseng's authors, important user verification code was moved between two functions called in sequence. If the first version of the first function executed, an update occurred, and the new version of the second function was executed, then the verification would never be performed. Marking this section as a transaction ensures that an update will not prevent the verification from occurring.<ref name="vc">{{cite journal
| author-first1 = Iulian | author-last1 = | author-first2 = Michael | author-last2 = | author-first3 = Jeffrey | author-last3 = | author-first4 = Polyvios | author-last4 = | title = Contextual Effects for Version-Consistent Dynamic Software Updating and Safe Concurrent Programming | journal = Proceedings of the {ACM} Conference on Principles of Programming Languages (POPL) | year = 2008 | pages = 37–58 }}</ref> === UpStare ===
UpStare is a DSU system that uses a unique updating mechanism, '''stack reconstruction'''. 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.<ref name="upstare">{{cite journal
| title = Immediate Multi-Threaded Dynamic Software Updates Using Stack Reconstruction | author-first1 = Kristis | author-last1 = | author-first2 = Rida A. | author-last2 = | journal = Proceedings of the 2009 conference on USENIX Annual technical conference | url = http://files.mkgnu.net/files/upstare/doc/misc/upstare_usenix_09.pdf | year = 2009 }}</ref> === PoLUS ===
PoLUS is a binary-rewriting DSU system for [[C (programming language)|C]]. It is able to update unmodified programs at any point in their execution. To update functions, it rewrites the prelude to a target function to redirect to a new function, chaining these redirections over multiple versions. This avoids steady-state overhead in functions that have not been updated.<ref name="polus">{{cite journal
| title = POLUS: A POwerful Live Updating System | author-first1 = Haibo | author-last1 = | author-first2 = Jie | author-last2 = | author-first3 = Rong | author-last3 = | author-first4 = Binyu | author-last4 = | author-first5 = Pen-Chung | author-last5 = | journal = 29th International Conference on Software Engineering | year = 2007 | pages = | url = http://ppi.fudan.edu.cn/system/publications/paper/chen-polus.pdf }}</ref>
=== Katana ===
{{Empty section|date=May 2016}}
<ref name="Katana_2010">{{cite journal
| title = Katana: Towards Patching as a Runtime Part of the Compiler-Linker-Loader Toolchain
| author-first1 = Sergey | author-last1 = Bratus
| author-first2 = James | author-last2 = Oakley
| author-first3 = Ashwin | author-last3 = Ramaswamy
| author-first4 = Sean W. | author-last4 = Smith
| author-first5 = Michael E. | author-last5 = Locasto
| journal = International Journal of Secure Software Engineering (IJSSE)
| volume = 1 | number = 3 | date = 2010
| doi = 10.4018/jsse.2010070101
| url = http://www.igi-global.com/article/katana-towards-patching-runtime-part/46149
| accessdate = 2016-05-22
| dead-url = no
| archiveurl = https://web.archive.org/web/20160522191914/http://www.igi-global.com/article/katana-towards-patching-runtime-part/46149
| archivedate = 2016-05-22
}} [http://cs.dartmouth.edu/~sws/pubs/borsl10.pdf] [https://web.archive.org/web/20160522191918/http://cs.dartmouth.edu/~sws/pubs/borsl10.pdf]</ref>
http://www.nongnu.org/katana/doc/katana.html
Line 94 ⟶ 262:
=== Pymoult ===
Pymoult is a prototyping platform for dynamic update written in Python. It gathers many techniques from other systems, allowing their combination and configuration. The objective of this platform is to let developers chose the update techniques they find more appropriate for their needs. 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.<ref>{{cite journal
| title = Prototyping DSU Techniques using Python | author1 = Sébastien Martinez | author2 = Fabien Dagnat | author3 = Jérémy Buisson | journal = Proceedings of the 5th Workshop on Hot Topics in Software Upgrades (HotSWUp'13) | year = | url = https://www.usenix.org/conference/hotswup13/workshop-program/presentation/martinez }}</ref><ref>{{cite web | url = https://bitbucket.org/smartinezgd/pymoult | title = | date = 2013-03-06 | | author-first = Sébastien | author-last = Martinez
| publisher = [[Bitbucket.org]]
}}</ref>
== See also ==
|