<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
dynamic	B-Architecture
software	I-Architecture
updating	I-Architecture
(	O
DSU	O
)	O
is	O
a	O
field	O
of	O
research	O
pertaining	O
to	O
upgrading	B-General_Concept
programs	O
while	O
they	O
are	O
running	O
.	O
</s>
<s>
As	O
such	O
,	O
DSU	O
implementations	O
commonly	O
either	O
utilize	O
existing	O
tools	O
,	O
or	O
implement	O
specialty	O
compilers	B-Language
.	O
</s>
<s>
These	O
compilers	B-Language
preserve	O
the	O
semantics	O
of	O
the	O
original	O
program	O
,	O
but	O
instrument	O
either	O
the	O
source	O
code	O
or	O
object	O
code	O
to	O
produce	O
a	O
dynamically	O
updateable	O
program	O
.	O
</s>
<s>
Any	O
running	O
program	O
can	O
be	O
thought	O
of	O
a	O
tuple	B-Application
,	O
where	O
is	O
the	O
current	O
program	O
state	O
and	O
is	O
the	O
current	O
program	O
code	O
.	O
</s>
<s>
Dynamic	B-Architecture
software	I-Architecture
updating	I-Architecture
systems	O
transform	O
a	O
running	O
program	O
to	O
a	O
new	O
version	O
.	O
</s>
<s>
An	O
update	O
is	O
considered	O
valid	O
if	O
and	O
only	O
if	O
the	O
running	O
program	O
can	O
be	O
reduced	O
to	O
a	O
point	O
tuple	B-Application
that	O
is	O
reachable	O
from	O
the	O
starting	O
point	O
of	O
the	O
new	O
version	O
of	O
the	O
program	O
,	O
.	O
</s>
<s>
Ginseng	O
's	O
compiler	B-Language
will	O
attempt	O
to	O
infer	O
good	O
locations	O
for	O
update	O
points	O
,	O
but	O
can	O
also	O
use	O
programmer-specified	O
update	O
points	O
.	O
</s>
<s>
For	O
example	O
,	O
Ksplice	B-Application
only	O
supports	O
code	O
changes	O
in	O
functions	O
,	O
and	O
does	O
not	O
support	O
changes	O
to	O
state	O
representation	O
.	O
</s>
<s>
This	O
is	O
because	O
Ksplice	B-Application
primarily	O
targets	O
security	O
changes	O
,	O
rather	O
than	O
general	O
updates	O
.	O
</s>
<s>
DSU	O
systems	O
that	O
do	O
not	O
use	O
a	O
static	O
analysis	O
might	O
require	O
use	O
of	O
a	O
specialized	O
compiler	B-Language
.	O
</s>
<s>
Some	O
DSU	O
systems	O
require	O
neither	O
static	O
analysis	O
nor	O
specialty	O
compilers	B-Language
.	O
</s>
<s>
vsf	B-Language
tpd	I-Language
,	O
OpenSSH	B-Language
,	O
PostgreSQL	B-Application
,	O
Tor	B-Application
,	O
Apache	B-Application
,	O
GNU	B-Application
Zebra	I-Application
,	O
memcached	B-Application
,	O
and	O
Redis	B-Operating_System
are	O
all	O
dynamic	O
updating	O
targets	O
for	O
various	O
systems	O
.	O
</s>
<s>
Examples	O
include	O
checkpointing	B-General_Concept
,	O
dynamic	B-Application
linking	I-Application
,	O
and	O
persistence	B-Application
.	O
</s>
<s>
As	O
an	O
example	O
,	O
a	O
database	O
that	O
must	O
be	O
backward-compatible	B-General_Concept
with	O
previous	O
versions	O
of	O
its	O
on-disk	O
file	O
format	O
,	O
must	O
accomplish	O
the	O
same	O
type	O
of	O
state	O
transformation	O
expected	O
of	O
a	O
dynamic	O
updating	O
system	O
.	O
</s>
<s>
Likewise	O
,	O
a	O
program	O
that	O
has	O
a	O
plugin	O
architecture	O
,	O
must	O
be	O
able	O
to	O
load	O
and	O
execute	O
new	O
code	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
Similar	O
techniques	O
are	O
sometimes	O
also	O
employed	O
for	O
the	O
purpose	O
of	O
dynamic	O
dead-code	O
elimination	O
to	O
remove	O
conditionally	O
dead	B-Application
or	O
unreachable	O
code	O
at	O
load	O
or	O
runtime	B-Library
,	O
and	O
recombine	O
the	O
remaining	O
code	O
to	O
minimize	O
its	O
memory	O
footprint	O
or	O
improve	O
speed	O
.	O
</s>
<s>
The	O
earliest	O
precursor	O
to	O
dynamic	B-Architecture
software	I-Architecture
updating	I-Architecture
is	O
redundant	O
systems	O
.	O
</s>
<s>
The	O
hot	O
spare	O
would	O
be	O
periodically	O
seeded	O
with	O
a	O
checkpoint	B-General_Concept
of	O
the	O
primary	O
system	O
.	O
</s>
<s>
The	O
earliest	O
true	O
Dynamic	B-Architecture
Software	I-Architecture
Updating	I-Architecture
system	O
is	O
DYMOS	O
(	O
Dynamic	O
Modification	O
System	O
)	O
.	O
</s>
<s>
Presented	O
in	O
1983	O
in	O
the	O
PhD	O
dissertation	O
of	O
Insup	O
Lee	O
,	O
DYMOS	O
was	O
a	O
fully	O
integrated	O
system	O
that	O
had	O
access	O
to	O
an	O
interactive	O
user	O
interface	O
,	O
a	O
compiler	B-Language
and	O
runtime	B-Library
for	O
a	O
Modula	B-Language
variant	O
,	O
and	O
source	O
code	O
.	O
</s>
<s>
If	O
the	O
target	O
program	O
is	O
implemented	O
in	O
a	O
virtual	B-Architecture
machine	I-Architecture
language	O
,	O
the	O
VM	O
can	O
use	O
existing	O
infrastructure	O
to	O
load	O
new	O
code	O
,	O
since	O
modern	O
virtual	B-Architecture
machines	I-Architecture
support	O
runtime	B-Library
loading	O
for	O
other	O
use	O
cases	O
besides	O
DSU	O
(	O
mainly	O
debugging	O
)	O
.	O
</s>
<s>
The	O
HotSpot	B-Language
JVM	B-Language
supports	O
runtime	B-Library
code	O
loading	O
,	O
and	O
DSU	O
systems	O
targeting	O
Java	B-Language
(	O
programming	O
language	O
)	O
can	O
utilize	O
this	O
feature	O
.	O
</s>
<s>
In	O
native	O
languages	O
such	O
as	O
C	B-Language
or	O
C++	B-Language
,	O
DSU	O
systems	O
can	O
use	O
specialized	O
compilers	B-Language
that	O
insert	O
indirection	O
into	O
the	O
program	O
.	O
</s>
<s>
If	O
a	O
DSU	O
system	O
does	O
not	O
use	O
a	O
compiler	B-Language
to	O
insert	O
these	O
indirections	O
statically	O
,	O
it	O
insert	O
them	O
at	B-Library
runtime	I-Library
with	O
binary	B-Application
rewriting	I-Application
.	O
</s>
<s>
Binary	B-Application
rewriting	I-Application
is	O
the	O
process	O
of	O
writing	O
low-level	O
code	O
into	O
the	O
memory	O
image	O
of	O
a	O
running	O
native	O
program	O
to	O
re-direct	O
functions	O
.	O
</s>
<s>
Ekiden	O
and	O
Kitsune	O
load	O
new	O
program	O
code	O
via	O
starting	O
an	O
entirely	O
new	O
program	O
,	O
either	O
through	O
fork-exec	B-Operating_System
or	O
dynamic	B-Operating_System
loading	I-Operating_System
.	O
</s>
<s>
However	O
,	O
eager	O
transformation	O
allows	O
compilers	B-Language
to	O
fully	O
optimize	O
state	O
access	O
,	O
avoiding	O
the	O
steady-state	O
overhead	O
involved	O
with	O
lazy	O
transformation	O
.	O
</s>
<s>
A	O
program	O
is	O
considered	O
activeness-safe	O
if	O
no	O
updated	O
function	O
exists	O
on	O
the	O
call	B-General_Concept
stack	I-General_Concept
at	O
update	O
time	O
.	O
</s>
<s>
DYMOS	O
consists	O
of	O
a	O
fully	O
integrated	O
environment	O
for	O
programs	O
written	O
in	O
a	O
derivative	O
of	O
Modula	B-Language
,	O
giving	O
the	O
system	O
access	O
to	O
a	O
command	O
interpreter	O
,	O
source	O
code	O
,	O
compiler	B-Language
,	O
and	O
runtime	B-Library
environment	O
,	O
similar	O
to	O
a	O
REPL	B-Application
.	O
</s>
<s>
Ksplice	B-Application
is	O
a	O
DSU	O
system	O
that	O
targets	O
only	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
making	O
itself	O
one	O
of	O
the	O
specialized	O
DSU	O
systems	O
that	O
support	O
an	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
as	O
the	O
target	O
program	O
.	O
</s>
<s>
Ksplice	B-Application
uses	O
source-level	O
diffs	B-Application
to	O
determine	O
changes	O
between	O
current	O
and	O
updated	O
versions	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
and	O
then	O
uses	O
binary	B-Application
rewriting	I-Application
to	O
insert	O
the	O
changes	O
into	O
the	O
running	O
kernel	B-Operating_System
.	O
</s>
<s>
Ksplice	B-Application
was	O
maintained	O
by	O
a	O
commercial	O
venture	O
founded	O
by	O
its	O
original	O
authors	O
,	O
Ksplice	B-Application
Inc.	O
,	O
which	O
was	O
acquired	O
by	O
Oracle	B-Application
Corporation	I-Application
in	O
July	O
2011	O
.	O
</s>
<s>
Ksplice	B-Application
is	O
used	O
on	O
a	O
commercial	O
basis	O
and	O
exclusively	O
in	O
the	O
Oracle	B-Application
Linux	B-Operating_System
distribution	O
.	O
</s>
<s>
SUSE	O
developed	O
kGraft	B-Application
as	O
an	O
open-source	O
alternative	O
for	O
live	O
kernel	B-Operating_System
patching	O
,	O
and	O
Red	O
Hat	O
did	O
likewise	O
with	O
kpatch	B-Application
.	O
</s>
<s>
They	O
both	O
allow	O
function-level	O
changes	O
to	O
be	O
applied	O
to	O
a	O
running	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
while	O
relying	O
on	O
live	O
patching	O
mechanisms	O
established	O
by	O
ftrace	B-Application
.	O
</s>
<s>
The	O
primary	O
difference	O
between	O
kGraft	B-Application
and	O
kpatch	B-Application
is	O
the	O
way	O
they	O
ensure	O
runtime	B-Library
consistency	O
of	O
the	O
updated	O
code	O
sections	O
while	O
hot	O
patches	O
are	O
applied	O
.	O
</s>
<s>
kGraft	B-Application
and	O
kpatch	B-Application
were	O
submitted	O
for	O
inclusion	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
in	O
April	O
2014	O
and	O
May	O
2014	O
,	O
respectively	O
,	O
and	O
the	O
minimalistic	O
foundations	O
for	O
live	O
patching	O
were	O
merged	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
in	O
kernel	B-Operating_System
version	O
4.0	O
,	O
which	O
was	O
released	O
on	O
April	O
12	O
,	O
2015	O
.	O
</s>
<s>
Since	O
April	O
2015	O
,	O
there	O
is	O
ongoing	O
work	O
on	O
porting	O
kpatch	B-Application
and	O
kGraft	B-Application
to	O
the	O
common	O
live	O
patching	O
core	O
provided	O
by	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
.	O
</s>
<s>
However	O
,	O
implementation	O
of	O
the	O
function-level	O
consistency	O
mechanisms	O
,	O
required	O
for	O
safe	O
transitions	O
between	O
the	O
original	O
and	O
patched	O
versions	O
of	O
functions	O
,	O
has	O
been	O
delayed	O
because	O
the	O
call	B-General_Concept
stacks	I-General_Concept
provided	O
by	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
may	O
be	O
unreliable	O
in	O
situations	O
that	O
involve	O
assembly	B-Language
code	I-Language
without	O
proper	O
stack	O
frames	O
;	O
as	O
a	O
result	O
,	O
the	O
porting	O
work	O
remains	O
in	O
progress	O
.	O
</s>
<s>
In	O
an	O
attempt	O
to	O
improve	O
the	O
reliability	O
of	O
kernel	B-Operating_System
's	O
call	B-General_Concept
stacks	I-General_Concept
,	O
a	O
specialized	O
sanity-check	O
userspace	O
utility	O
has	O
also	O
been	O
developed	O
with	O
the	O
purpose	O
of	O
checking	O
kernel	B-Operating_System
's	O
compile-time	O
object	B-Application
files	I-Application
and	O
ensuring	O
that	O
the	O
call	B-General_Concept
stack	I-General_Concept
is	O
always	O
maintained	O
;	O
it	O
also	O
opens	O
up	O
a	O
possibility	O
for	O
achieving	O
more	O
reliable	O
call	B-General_Concept
stacks	I-General_Concept
as	O
part	O
of	O
the	O
kernel	B-Application
oops	I-Application
messages	O
.	O
</s>
<s>
Ginseng	O
is	O
implemented	O
as	O
a	O
source-to-source	B-Language
compiler	I-Language
written	O
using	O
the	O
C	B-Language
Intermediate	O
Language	O
framework	O
in	O
OCaml	B-Language
.	O
</s>
<s>
This	O
compiler	B-Language
inserts	O
indirection	O
to	O
all	O
function	O
calls	O
and	O
type	O
accesses	O
,	O
enabling	O
Ginseng	O
to	O
lazily	O
transform	O
state	O
at	O
the	O
cost	O
of	O
imposing	O
a	O
constant-time	O
overhead	O
for	O
the	O
entirety	O
of	O
the	O
program	O
execution	O
.	O
</s>
<s>
Ginseng	O
's	O
compiler	B-Language
proves	O
the	O
cons-freeness	O
properties	O
of	O
the	O
entire	O
initial	O
program	O
and	O
of	O
dynamic	O
patches	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
two	O
versions	O
of	O
OpenSSH	B-Language
examined	O
by	O
Ginseng	O
's	O
authors	O
,	O
important	O
user	O
verification	O
code	O
was	O
moved	O
between	O
two	O
functions	O
called	O
in	O
sequence	O
.	O
</s>
<s>
PoLUS	O
is	O
a	O
binary-rewriting	O
DSU	O
system	O
for	O
C	B-Language
.	O
It	O
is	O
able	O
to	O
update	O
unmodified	O
programs	O
at	O
any	O
point	O
in	O
their	O
execution	O
.	O
</s>
<s>
Katana	O
is	O
a	O
research	O
system	O
that	O
provides	O
limited	O
dynamic	O
updating	O
(	O
similar	O
to	O
Ksplice	B-Application
and	O
its	O
forks	O
)	O
for	O
user-mode	O
ELF	O
binaries	O
.	O
</s>
<s>
The	O
Katana	O
patching	O
model	O
operates	O
on	O
the	O
level	O
of	O
ELF	O
objects	O
,	O
and	O
thus	O
has	O
the	O
capacity	O
to	O
be	O
language-agnostic	O
as	O
long	O
as	O
the	O
compilation	B-Language
target	O
is	O
ELF	O
.	O
</s>
<s>
Ekiden	O
and	O
Kitsune	O
are	O
two	O
variants	O
of	O
a	O
single	O
DSU	O
system	O
that	O
implements	O
the	O
state-transfer	O
style	O
of	O
DSU	O
for	O
programs	O
written	O
in	O
C	B-Language
.	O
Rather	O
than	O
updating	O
functions	O
within	O
a	O
single	O
program	O
,	O
Ekiden	O
and	O
Kitsune	O
perform	O
updates	O
over	O
whole	O
programs	O
,	O
transferring	O
necessary	O
state	O
between	O
the	O
two	O
executions	O
.	O
</s>
<s>
While	O
Ekiden	O
accomplishes	O
this	O
by	O
starting	O
a	O
new	O
program	O
using	O
the	O
UNIX	B-Application
idiom	O
of	O
fork-exec	B-Operating_System
,	O
serializing	O
the	O
target	O
program	O
's	O
state	O
,	O
and	O
transferring	O
it	O
,	O
Kitsune	O
uses	O
dynamic	B-Application
linking	I-Application
to	O
perform	O
"	O
in-place	O
"	O
state	O
transfer	O
.	O
</s>
<s>
Ekiden	O
and	O
Kitsune	O
are	O
also	O
notable	O
in	O
that	O
they	O
are	O
implemented	O
primarily	O
as	O
application-level	O
libraries	O
,	O
rather	O
than	O
specialized	O
runtimes	B-Library
or	O
compilers	B-Language
.	O
</s>
<s>
To	O
ease	O
this	O
process	O
,	O
Kitsune	O
includes	O
a	O
specialized	O
compiler	B-Language
that	O
implements	O
a	O
domain-specific	B-Language
language	I-Language
for	O
writing	O
state	O
transformers	O
.	O
</s>
<s>
Erlang	B-Operating_System
supports	O
Dynamic	B-Architecture
Software	I-Architecture
Updating	I-Architecture
,	O
though	O
this	O
is	O
commonly	O
referred	O
to	O
as	O
"	O
hot	O
code	O
loading	O
"	O
.	O
</s>
<s>
Erlang	B-Operating_System
requires	O
no	O
safety	O
guarantees	O
on	O
updates	O
,	O
but	O
Erlang	B-Operating_System
culture	O
suggests	O
that	O
developers	O
write	O
in	O
a	O
defensive	O
style	O
that	O
will	O
gracefully	O
handle	O
type	O
errors	O
generated	O
by	O
updating	O
.	O
</s>
<s>
Microsoft	O
is	O
utilizing	O
internal	O
patching	O
technology	O
for	O
Microsoft	O
Visual	O
C++	B-Language
that	O
supports	O
patching	O
individual	O
C++	B-Language
functions	O
while	O
maintaining	O
functional	O
correctness	O
of	O
patches	O
.	O
</s>
