aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/livepatch.h6
-rw-r--r--kernel/livepatch/core.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
index b5608d7757fd..26e58134c8cb 100644
--- a/arch/x86/include/asm/livepatch.h
+++ b/arch/x86/include/asm/livepatch.h
@@ -25,9 +25,13 @@
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26 26
27#ifdef CONFIG_LIVE_PATCHING 27#ifdef CONFIG_LIVE_PATCHING
28static inline int klp_check_compiler_support(void)
29{
28#ifndef CC_USING_FENTRY 30#ifndef CC_USING_FENTRY
29#error Your compiler must support -mfentry for live patching to work 31 return 1;
30#endif 32#endif
33 return 0;
34}
31extern int klp_write_module_reloc(struct module *mod, unsigned long type, 35extern int klp_write_module_reloc(struct module *mod, unsigned long type,
32 unsigned long loc, unsigned long value); 36 unsigned long loc, unsigned long value);
33 37
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 6f6387912da7..ce42d3b930dc 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -911,6 +911,12 @@ static int klp_init(void)
911{ 911{
912 int ret; 912 int ret;
913 913
914 ret = klp_check_compiler_support();
915 if (ret) {
916 pr_info("Your compiler is too old; turning off.\n");
917 return -EINVAL;
918 }
919
914 ret = register_module_notifier(&klp_module_nb); 920 ret = register_module_notifier(&klp_module_nb);
915 if (ret) 921 if (ret)
916 return ret; 922 return ret;