diff options
author | Li Bin <huawei.libin@huawei.com> | 2014-12-19 01:11:17 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-12-22 09:40:49 -0500 |
commit | b5bfc51707f1b56b0b733980bb4fcc0562bf02d8 (patch) | |
tree | 3b31bf562c78492f3ad304bb053426eb0f9bcbb6 /arch | |
parent | 13d1cf7e702596e0cd8ec62afa6bd49c431f2d0c (diff) |
livepatch: move x86 specific ftrace handler code to arch/x86
The execution flow redirection related implemention in the livepatch
ftrace handler is depended on the specific architecture. This patch
introduces klp_arch_set_pc(like kgdb_arch_set_pc) interface to change
the pt_regs.
Signed-off-by: Li Bin <huawei.libin@huawei.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/livepatch.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h index d529db1b1edf..b5608d7757fd 100644 --- a/arch/x86/include/asm/livepatch.h +++ b/arch/x86/include/asm/livepatch.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define _ASM_X86_LIVEPATCH_H | 22 | #define _ASM_X86_LIVEPATCH_H |
23 | 23 | ||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/ftrace.h> | ||
25 | 26 | ||
26 | #ifdef CONFIG_LIVE_PATCHING | 27 | #ifdef CONFIG_LIVE_PATCHING |
27 | #ifndef CC_USING_FENTRY | 28 | #ifndef CC_USING_FENTRY |
@@ -30,6 +31,10 @@ | |||
30 | extern int klp_write_module_reloc(struct module *mod, unsigned long type, | 31 | extern int klp_write_module_reloc(struct module *mod, unsigned long type, |
31 | unsigned long loc, unsigned long value); | 32 | unsigned long loc, unsigned long value); |
32 | 33 | ||
34 | static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip) | ||
35 | { | ||
36 | regs->ip = ip; | ||
37 | } | ||
33 | #else | 38 | #else |
34 | #error Live patching support is disabled; check CONFIG_LIVE_PATCHING | 39 | #error Live patching support is disabled; check CONFIG_LIVE_PATCHING |
35 | #endif | 40 | #endif |