aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/livepatch.h
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2015-01-09 04:53:21 -0500
committerJiri Kosina <jkosina@suse.cz>2015-01-09 04:55:10 -0500
commitb9dfe0bed999d23ee8838d389637dd8aef83fafa (patch)
tree1e1761aa65759226ca26fe931b1b48de4cf65af9 /arch/x86/include/asm/livepatch.h
parent83ac237a950e130c974d0170cce30891dcd8f250 (diff)
livepatch: handle ancient compilers with more grace
We are aborting a build in case when gcc doesn't support fentry on x86_64 (regs->ip modification can't really reliably work with mcount). This however breaks allmodconfig for people with older gccs that don't support -mfentry. Turn the build-time failure into runtime failure, resulting in the whole infrastructure not being initialized if CC_USING_FENTRY is unset. Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/livepatch.h')
-rw-r--r--arch/x86/include/asm/livepatch.h6
1 files changed, 5 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