<s>
kpatch	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
kpatch	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
kpatch	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
kpatch	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
stopping	O
all	O
running	O
processes	B-Operating_System
while	O
the	O
live	O
patching	O
is	O
performed	O
.	O
</s>
<s>
kpatch	B-Application
is	O
developed	O
by	O
Red	O
Hat	O
,	O
with	O
its	O
source	O
code	O
licensed	O
under	O
the	O
terms	O
of	O
the	O
GNU	B-License
General	I-License
Public	I-License
License	I-License
version	O
2	O
(	O
GPLv2	O
)	O
.	O
</s>
<s>
In	O
May	O
2014	O
,	O
kpatch	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
kpatch	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
a	O
set	O
of	O
userspace	B-Operating_System
utilities	O
prepares	O
individual	O
hot	O
patch	O
kernel	B-Application
modules	I-Application
from	O
source	O
diffs	O
and	O
manages	O
their	O
application	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
kpatch	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
by	O
using	O
facilities	O
provided	O
by	O
ftrace	B-Application
to	O
"	O
route	O
around	O
"	O
old	O
versions	O
of	O
functions	O
;	O
that	O
way	O
,	O
hot	O
patches	O
can	O
also	O
easily	O
be	O
undone	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
kpatch	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>
kpatch	B-Application
ensures	O
that	O
hot	O
patches	O
are	O
applied	O
atomically	B-General_Concept
and	O
safely	O
by	O
stopping	O
all	O
running	O
processes	B-Operating_System
while	O
the	O
hot	O
patch	O
is	O
applied	O
,	O
and	O
by	O
ensuring	O
that	O
none	O
of	O
the	O
stopped	O
processes	B-Operating_System
is	O
running	B-Operating_System
inside	I-Operating_System
the	I-Operating_System
functions	I-Operating_System
that	O
are	O
to	O
be	O
patched	O
.	O
</s>
<s>
Such	O
an	O
approach	O
simplifies	O
the	O
whole	O
live	O
patching	O
mechanism	O
and	O
prevents	O
certain	O
issues	O
associated	O
with	O
the	O
way	O
data	B-General_Concept
structures	I-General_Concept
are	O
used	O
by	O
original	O
and	O
patched	O
versions	O
of	O
functions	O
.	O
</s>
<s>
As	O
the	O
downside	O
,	O
this	O
approach	O
also	O
leaves	O
the	O
possibility	O
for	O
a	O
hot	O
patch	O
to	O
fail	O
,	O
and	O
introduces	O
a	O
small	O
amount	O
of	O
latency	O
required	O
for	O
stopping	O
all	O
running	O
processes	B-Operating_System
.	O
</s>
<s>
Red	O
Hat	O
announced	O
and	O
publicly	O
released	O
kpatch	B-Application
in	O
February	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
,	O
shortly	O
before	O
SUSE	O
released	O
its	O
own	O
live	O
kernel	B-Operating_System
patching	O
implementation	O
called	O
kGraft	B-Application
.	O
</s>
<s>
kpatch	B-Application
was	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
May	O
2014	O
.	O
</s>
<s>
kpatch	B-Application
has	O
been	O
included	O
in	O
Red	O
Hat	O
Enterprise	O
Linux7.0	O
,	O
released	O
on	O
June	O
10	O
,	O
2014	O
,	O
as	O
a	O
technology	O
preview	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
kpatch	B-Application
and	O
kGraft	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
work	O
on	O
porting	O
kpatch	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>
