summaryrefslogtreecommitdiffstats
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 @@
#include <linux/ftrace.h>
#ifdef CONFIG_LIVE_PATCHING
+static inline int klp_check_compiler_support(void)
+{
#ifndef CC_USING_FENTRY
-#error Your compiler must support -mfentry for live patching to work
+ return 1;
#endif
+ return 0;
+}
extern int klp_write_module_reloc(struct module *mod, unsigned long type,
unsigned long loc, unsigned long value);
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)
{
int ret;
+ ret = klp_check_compiler_support();
+ if (ret) {
+ pr_info("Your compiler is too old; turning off.\n");
+ return -EINVAL;
+ }
+
ret = register_module_notifier(&klp_module_nb);
if (ret)
return ret;