<s>
kGraft	B-Application
is	O
a	O
feature	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
that	O
implements	O
live	O
patching	O
of	O
a	O
running	O
kernel	B-Operating_System
,	O
which	O
allows	O
kernel	B-Operating_System
patches	O
to	O
be	O
applied	O
while	O
the	O
kernel	B-Operating_System
is	O
still	O
running	O
.	O
</s>
<s>
By	O
avoiding	O
the	O
need	O
for	O
rebooting	O
the	O
system	O
with	O
a	O
new	O
kernel	B-Operating_System
that	O
contains	O
the	O
desired	O
patches	O
,	O
kGraft	B-Application
aims	O
to	O
maximize	O
the	O
system	O
uptime	B-Device
and	O
availability	O
.	O
</s>
<s>
At	O
the	O
same	O
time	O
,	O
kGraft	B-Application
allows	O
kernel-related	O
security	O
updates	O
to	O
be	O
applied	O
without	O
deferring	O
them	O
to	O
scheduled	O
downtimes	O
.	O
</s>
<s>
Internally	O
,	O
kGraft	B-Application
allows	O
entire	O
functions	O
in	O
a	O
running	O
kernel	B-Operating_System
to	O
be	O
replaced	O
with	O
their	O
patched	O
versions	O
,	O
doing	O
that	O
safely	O
by	O
selectively	O
using	O
original	O
versions	O
of	O
functions	O
to	O
ensure	O
per-process	O
consistency	O
while	O
the	O
live	O
patching	O
is	O
performed	O
.	O
</s>
<s>
kGraft	B-Application
is	O
developed	O
by	O
SUSE	O
,	O
with	O
its	O
source	O
code	O
licensed	O
under	O
the	O
terms	O
of	O
versions	O
two	O
and	O
three	O
of	O
the	O
GNU	B-License
General	I-License
Public	I-License
License	I-License
(	O
GPL	B-License
)	O
.	O
</s>
<s>
In	O
April	O
2014	O
,	O
kGraft	B-Application
was	O
submitted	O
for	O
inclusion	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	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>
Internally	O
,	O
kGraft	B-Application
consists	O
of	O
two	O
parts	O
the	O
core	O
kernel	B-Application
module	I-Application
executes	O
the	O
live	O
patching	O
mechanism	O
by	O
altering	O
kernel	B-Operating_System
's	O
inner	O
workings	O
,	O
while	O
userspace	B-Operating_System
utilities	O
prepare	O
individual	O
hot	O
patch	O
kernel	B-Application
modules	I-Application
from	O
source	O
diffs	O
.	O
</s>
<s>
Live	O
kernel	B-Operating_System
patching	O
is	O
performed	O
at	O
the	O
function	O
level	O
,	O
meaning	O
that	O
kGraft	B-Application
can	O
replace	O
entire	O
functions	O
in	O
the	O
running	O
kernel	B-Operating_System
with	O
their	O
patched	O
versions	O
,	O
while	O
relying	O
on	O
the	O
mechanisms	O
and	O
infrastructure	O
established	O
by	O
ftrace	B-Application
to	O
"	O
route	O
around	O
"	O
old	O
versions	O
of	O
functions	O
.	O
</s>
<s>
No	O
changes	O
to	O
the	O
kernel	B-Operating_System
's	O
internal	O
data	B-General_Concept
structures	I-General_Concept
are	O
possible	O
;	O
however	O
,	O
security	O
patches	O
,	O
which	O
are	O
one	O
of	O
the	O
natural	O
candidates	O
to	O
be	O
used	O
with	O
kGraft	B-Application
,	O
rarely	O
contain	O
changes	O
to	O
the	O
kernel	B-Operating_System
's	O
data	B-General_Concept
structures	I-General_Concept
.	O
</s>
<s>
While	O
applying	O
hot	O
patches	O
,	O
kGraft	B-Application
does	O
not	O
require	O
a	O
running	O
kernel	B-Operating_System
to	O
be	O
stopped	O
for	O
patched	O
versions	O
of	O
functions	O
to	O
be	O
introduced	O
into	O
it	O
.	O
</s>
<s>
Instead	O
of	O
replacing	O
functions	O
atomically	B-General_Concept
,	O
kGraft	B-Application
provides	O
consistent	O
"	O
world	O
views	O
"	O
(	O
or	O
"	O
universes	O
"	O
)	O
to	O
userspace	B-Operating_System
processes	B-Operating_System
,	O
kernel	B-Operating_System
threads	O
and	O
interrupt	B-General_Concept
handlers	I-General_Concept
,	O
which	O
are	O
monitored	O
during	O
their	O
execution	O
so	O
the	O
original	O
versions	O
of	O
patched	O
kernel	B-Operating_System
functions	O
can	O
continue	O
to	O
be	O
used	O
.	O
</s>
<s>
To	O
accomplish	O
that	O
,	O
kGraft	B-Application
maintains	O
original	O
versions	O
of	O
patched	O
functions	O
in	O
a	O
read-copy-update	B-Operating_System
(	O
RCU	O
)	O
fashion	O
,	O
and	O
dynamically	O
selects	O
between	O
the	O
original	O
and	O
patched	O
versions	O
depending	O
on	O
which	O
process	B-Operating_System
,	O
kernel	B-Operating_System
thread	O
or	O
interrupt	B-General_Concept
handler	I-General_Concept
executes	O
them	O
.	O
</s>
<s>
More	O
specifically	O
,	O
original	O
versions	O
of	O
functions	O
continue	O
to	O
be	O
usedat	O
the	O
time	O
when	O
a	O
hot	O
patch	O
is	O
appliedfor	O
processes	B-Operating_System
currently	O
executing	O
within	B-Operating_System
the	I-Operating_System
kernel	I-Operating_System
space	I-Operating_System
,	O
for	O
kernel	B-Operating_System
threads	O
until	O
they	O
reach	O
their	O
completion	O
points	O
,	O
and	O
for	O
currently	O
executing	O
interrupt	B-General_Concept
handlers	I-General_Concept
.	O
</s>
<s>
Due	O
to	O
its	O
design	O
,	O
kGraft	B-Application
does	O
not	O
introduce	O
additional	O
latency	O
while	O
applying	O
hot	O
patches	O
.	O
</s>
<s>
As	O
the	O
downside	O
,	O
original	O
versions	O
of	O
patched	O
kernel	B-Operating_System
functions	O
may	O
be	O
required	O
to	O
be	O
maintained	O
for	O
extended	O
periods	O
of	O
time	O
in	O
case	O
there	O
are	O
processes	B-Operating_System
that	O
remain	O
for	O
too	O
long	O
within	B-Operating_System
the	I-Operating_System
kernel	I-Operating_System
space	I-Operating_System
;	O
for	O
example	O
,	O
a	O
process	B-Operating_System
may	O
wait	O
for	O
I/O	B-General_Concept
on	O
a	O
network	B-Protocol
socket	I-Protocol
.	O
</s>
<s>
Also	O
,	O
as	O
both	O
original	O
and	O
patched	O
versions	O
of	O
functions	O
are	O
allowed	O
to	O
be	O
executed	O
in	O
parallel	O
,	O
troubles	O
may	O
arise	O
if	O
they	O
use	O
kernel	B-Operating_System
's	O
internal	O
data	B-General_Concept
structures	I-General_Concept
in	O
different	O
ways	O
.	O
</s>
<s>
SUSE	O
announced	O
kGraft	B-Application
in	O
January	O
2014	O
and	O
released	O
it	O
publicly	O
in	O
March	O
2014	O
under	O
the	O
terms	O
of	O
the	O
GNU	B-License
General	I-License
Public	I-License
License	I-License
version2	O
(	O
GPLv2	O
)	O
for	O
the	O
kernel	B-Operating_System
part	O
,	O
and	O
under	O
the	O
terms	O
of	O
version3	O
(	O
GPLv3	O
)	O
for	O
the	O
userspace	B-Operating_System
part	O
.	O
</s>
<s>
It	O
was	O
released	O
shortly	O
after	O
Red	O
Hat	O
released	O
its	O
own	O
live	O
kernel	B-Operating_System
patching	O
implementation	O
called	O
kpatch	B-Application
.	O
</s>
<s>
kGraft	B-Application
aims	O
to	O
become	O
merged	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
,	O
and	O
it	O
was	O
submitted	O
for	O
the	O
inclusion	O
in	O
April	O
2014	O
.	O
</s>
<s>
kGraft	B-Application
was	O
made	O
available	O
for	O
SUSE	O
Linux	B-Operating_System
Enterprise	O
Server12	O
on	O
November	O
18	O
,	O
2014	O
,	O
as	O
an	O
additional	O
feature	O
called	O
SUSE	O
Linux	B-Operating_System
Enterprise	O
Live	O
Patching	O
.	O
</s>
<s>
Minimalistic	O
foundations	O
for	O
live	O
kernel	B-Operating_System
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>
Those	O
foundations	O
,	O
based	O
primarily	O
on	O
the	O
kernel	B-Operating_System
's	O
ftrace	B-Application
functionality	O
,	O
form	O
a	O
common	O
core	O
capable	O
of	O
supporting	O
hot	O
patching	O
by	O
both	O
kGraft	B-Application
and	O
kpatch	B-Application
,	O
by	O
providing	O
an	O
application	B-Application
programming	I-Application
interface	I-Application
(	O
API	B-Application
)	O
for	O
kernel	B-Application
modules	I-Application
that	O
contain	O
hot	O
patches	O
and	O
an	O
application	B-Operating_System
binary	I-Operating_System
interface	I-Operating_System
(	O
ABI	O
)	O
for	O
the	O
userspace	B-Operating_System
management	O
utilities	O
.	O
</s>
<s>
However	O
,	O
the	O
common	O
core	O
included	O
into	O
Linux	B-Operating_System
kernel4.0	O
supports	O
only	O
the	O
x86	B-Operating_System
architecture	I-Operating_System
and	O
does	O
not	O
provide	O
any	O
mechanisms	O
for	O
ensuring	O
function-level	O
consistency	O
while	O
the	O
hot	O
patches	O
are	O
applied	O
.	O
</s>
<s>
Since	O
April	O
2015	O
,	O
there	O
is	O
ongoing	O
work	O
on	O
porting	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
required	O
function-level	O
consistency	O
mechanisms	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	B-Operating_System
utility	O
has	O
also	O
been	O
developed	O
.	O
</s>
