livepatch: kernel: add support for live patching
authorSeth Jennings <sjenning@redhat.com>
Tue, 16 Dec 2014 17:58:19 +0000 (11:58 -0600)
committerJiri Kosina <jkosina@suse.cz>
Mon, 22 Dec 2014 14:40:49 +0000 (15:40 +0100)
This commit introduces code for the live patching core.  It implements
an ftrace-based mechanism and kernel interface for doing live patching
of kernel and kernel module functions.

It represents the greatest common functionality set between kpatch and
kgraft and can accept patches built using either method.

This first version does not implement any consistency mechanism that
ensures that old and new code do not run together.  In practice, ~90% of
CVEs are safe to apply in this way, since they simply add a conditional
check.  However, any function change that can not execute safely with
the old version of the function can _not_ be safely applied in this
version.

[ jkosina@suse.cz: due to the number of contributions that got folded into
  this original patch from Seth Jennings, add SUSE's copyright as well, as
  discussed via e-mail ]

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Documentation/ABI/testing/sysfs-kernel-livepatch [new file with mode: 0644]
MAINTAINERS
arch/x86/Kconfig
arch/x86/include/asm/livepatch.h [new file with mode: 0644]
arch/x86/kernel/Makefile
arch/x86/kernel/livepatch.c [new file with mode: 0644]
include/linux/livepatch.h [new file with mode: 0644]
kernel/Makefile
kernel/livepatch/Kconfig [new file with mode: 0644]
kernel/livepatch/Makefile [new file with mode: 0644]
kernel/livepatch/core.c [new file with mode: 0644]

diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
new file mode 100644 (file)
index 0000000..5bf42a8
--- /dev/null
@@ -0,0 +1,44 @@
+What:          /sys/kernel/livepatch
+Date:          Nov 2014
+KernelVersion: 3.19.0
+Contact:       live-patching@vger.kernel.org
+Description:
+               Interface for kernel live patching
+
+               The /sys/kernel/livepatch directory contains subdirectories for
+               each loaded live patch module.
+
+What:          /sys/kernel/livepatch/<patch>
+Date:          Nov 2014
+KernelVersion: 3.19.0
+Contact:       live-patching@vger.kernel.org
+Description:
+               The patch directory contains subdirectories for each kernel
+               object (vmlinux or a module) in which it patched functions.
+
+What:          /sys/kernel/livepatch/<patch>/enabled
+Date:          Nov 2014
+KernelVersion: 3.19.0
+Contact:       live-patching@vger.kernel.org
+Description:
+               A writable attribute that indicates whether the patched
+               code is currently applied.  Writing 0 will disable the patch
+               while writing 1 will re-enable the patch.
+
+What:          /sys/kernel/livepatch/<patch>/<object>
+Date:          Nov 2014
+KernelVersion: 3.19.0
+Contact:       live-patching@vger.kernel.org
+Description:
+               The object directory contains subdirectories for each function
+               that is patched within the object.
+
+What:          /sys/kernel/livepatch/<patch>/<object>/<function>
+Date:          Nov 2014
+KernelVersion: 3.19.0
+Contact:       live-patching@vger.kernel.org
+Description:
+               The function directory contains attributes regarding the
+               properties and state of the patched function.
+
+               There are currently no such attributes.
index ddb9ac8..df6a078 100644 (file)
@@ -5784,6 +5784,19 @@ F:       Documentation/misc-devices/lis3lv02d
 F:     drivers/misc/lis3lv02d/
 F:     drivers/platform/x86/hp_accel.c
 
+LIVE PATCHING
+M:     Josh Poimboeuf <jpoimboe@redhat.com>
+M:     Seth Jennings <sjenning@redhat.com>
+M:     Jiri Kosina <jkosina@suse.cz>
+M:     Vojtech Pavlik <vojtech@suse.cz>
+S:     Maintained
+F:     kernel/livepatch/
+F:     include/linux/livepatch.h
+F:     arch/x86/include/asm/livepatch.h
+F:     arch/x86/kernel/livepatch.c
+F:     Documentation/ABI/testing/sysfs-kernel-livepatch
+L:     live-patching@vger.kernel.org
+
 LLC (802.2)
 M:     Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 S:     Maintained
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc kernel/Makefile
Simple merge
Simple merge
Simple merge
Simple merge