From cff48f7deace38f8fe17962e1b3e87fb0f643328 Mon Sep 17 00:00:00 2001 From: Jamie Iles Date: Tue, 17 Jan 2017 00:35:13 +0000 Subject: [PATCH] ksplice: add sysctls for determining Ksplice features. This adds a new set of sysctls that the Ksplice user-space can use for feature tests. The first sysctl added is ksplice.init_trace_safe which means that it is safe to trace a child_subreaper processes without making them killable which was fixed in 2d39b3cd34 (signal: protect SIGNAL_UNKILLABLE from unintentional clearing.). Ksplice can now test this sysctl and use that to determine whether it is safe to trace init or not. Future sysctls can be added for other features, as well as kernel internal features for kernel Ksplice. Orabug: 25414814 Signed-off-by: Jamie Iles Reviewed-by: Dhaval Giani Conflicts: kernel/Makefile --- arch/Kconfig | 7 +++++++ include/linux/ksplice.h | 11 +++++++++++ kernel/Makefile | 1 + kernel/ksplice.c | 17 +++++++++++++++++ kernel/sysctl.c | 8 ++++++++ 5 files changed, 44 insertions(+) create mode 100644 include/linux/ksplice.h create mode 100644 kernel/ksplice.c diff --git a/arch/Kconfig b/arch/Kconfig index a65eafb24997e..bd4def1444238 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -546,3 +546,10 @@ config COMPAT_OLD_SIGACTION bool source "kernel/gcov/Kconfig" + +config KSPLICE + bool "Ksplice" + depends on MODULES + select SYSCTL + help + Enable helper features for supporting Ksplice zero-downtime updates. diff --git a/include/linux/ksplice.h b/include/linux/ksplice.h new file mode 100644 index 0000000000000..960826fe7d01a --- /dev/null +++ b/include/linux/ksplice.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2017 Oracle Corporation + */ +#ifndef __LINUX_KSPLICE_H__ +#define __LINUX_KSPLICE_H__ + +#include + +extern const struct ctl_table ksplice_sysctls[]; + +#endif /* __LINUX_KSPLICE_H__ */ diff --git a/kernel/Makefile b/kernel/Makefile index 60c302cfb4d3c..2acadd96d151f 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o obj-$(CONFIG_TORTURE_TEST) += torture.o +obj-$(CONFIG_KSPLICE) += ksplice.o $(obj)/configs.o: $(obj)/config_data.h diff --git a/kernel/ksplice.c b/kernel/ksplice.c new file mode 100644 index 0000000000000..52c7af17d7e9e --- /dev/null +++ b/kernel/ksplice.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2017 Oracle Corporation + */ +#include + +static int init_trace_safe = 1; + +const struct ctl_table ksplice_sysctls[] = { + { + .procname = "init_trace_safe", + .data = &init_trace_safe, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = proc_dointvec, + }, + { } +}; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5edf47efaedee..43c49bd30ea15 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -1141,6 +1142,13 @@ static struct ctl_table kern_table[] = { .extra1 = &zero, .extra2 = &one, }, +#ifdef CONFIG_KSPLICE + { + .procname = "ksplice", + .mode = 0555, + .child = ksplice_sysctls, + }, +#endif { } }; -- 2.50.1