From: Li Bin <huawei.libin@huawei.com>
To: Seth Jennings <sjenning@redhat.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Jiri Kosina <jkosina@suse.cz>, Vojtech Pavlik <vojtech@suse.cz>,
"Steven Rostedt" <rostedt@goodmis.org>,
Petr Mladek <pmladek@suse.cz>, Miroslav Benes <mbenes@suse.cz>
Cc: <kpatch@redhat.com>, Greg KH <gregkh@linuxfoundation.org>,
<x86@kernel.org>, <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Christoph Hellwig <hch@infradead.org>,
<live-patching@vger.kernel.org>, Li Zefan <lizefan@huawei.com>,
zhangdianfang <zhangdianfang@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>, xiexiuqi <xiexiuqi@huawei.com>
Subject: [kpatch] [PATCH] livepatch v7: move x86 specific ftrace handler code to arch/x86
Date: Fri, 19 Dec 2014 14:11:17 +0800 [thread overview]
Message-ID: <5493C185.9020001@huawei.com> (raw)
In-Reply-To: <1418752700-14649-3-git-send-email-sjenning@redhat.com>
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>
---
arch/x86/include/asm/livepatch.h | 5 +++++
kernel/livepatch/core.c | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
index c2ae592..4cdec4e 100644
--- a/arch/x86/include/asm/livepatch.h
+++ b/arch/x86/include/asm/livepatch.h
@@ -21,6 +21,7 @@
#define _ASM_X86_LIVEPATCH_H
#include <linux/module.h>
+#include <linux/ftrace.h>
#ifdef CONFIG_LIVE_PATCHING
#ifndef CC_USING_FENTRY
@@ -29,6 +30,10 @@
extern int klp_write_module_reloc(struct module *mod, unsigned long type,
unsigned long loc, unsigned long value);
+static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
+{
+ regs->ip = ip;
+}
#else
#error Live patching support is disabled; check CONFIG_LIVE_PATCHING
#endif
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 0004a71..c4c04fd 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -271,7 +271,7 @@ static void notrace klp_ftrace_handler(unsigned long ip,
{
struct klp_func *func = ops->private;
- regs->ip = (unsigned long)func->new_func;
+ klp_arch_set_pc(regs, (unsigned long)func->new_func);
}
static int klp_disable_func(struct klp_func *func)
--
1.7.1
next prev parent reply other threads:[~2014-12-19 6:11 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 17:58 [PATCHv7 0/3] Kernel Live Patching Seth Jennings
2014-12-16 17:58 ` [PATCHv7 1/3] kernel: add TAINT_LIVEPATCH Seth Jennings
2014-12-17 14:06 ` Miroslav Benes
2014-12-17 15:15 ` Petr Mladek
2014-12-18 11:44 ` Masami Hiramatsu
2014-12-18 15:52 ` Jiri Kosina
2014-12-19 3:36 ` Masami Hiramatsu
2014-12-16 17:58 ` [PATCHv7 2/3] kernel: add support for live patching Seth Jennings
2014-12-16 18:46 ` Balbir Singh
2014-12-16 19:41 ` Seth Jennings
2014-12-17 14:09 ` Miroslav Benes
2014-12-18 13:36 ` Petr Mladek
2014-12-19 5:37 ` [kpatch] [PATCH] livepatch v7: move x86 specific ftrace handler code to arch/x86 Li Bin
2014-12-19 6:12 ` Li Bin
2014-12-19 6:11 ` Li Bin [this message]
2014-12-19 7:31 ` Jiri Kosina
2014-12-19 14:23 ` Josh Poimboeuf
2014-12-19 7:39 ` [PATCHv7 2/3] kernel: add support for live patching Jiri Kosina
2014-12-16 17:58 ` [PATCHv7 3/3] samples: add sample live patching module Seth Jennings
2014-12-17 14:06 ` Miroslav Benes
2014-12-17 15:23 ` Petr Mladek
2014-12-16 18:15 ` [PATCHv7 0/3] Kernel Live Patching Balbir Singh
2014-12-16 19:05 ` Seth Jennings
2014-12-17 3:42 ` Balbir Singh
2014-12-16 20:14 ` Jiri Kosina
2014-12-17 3:43 ` Balbir Singh
2014-12-17 6:46 ` Jiri Kosina
2014-12-17 7:52 ` Balbir Singh
2014-12-17 12:40 ` Vojtech Pavlik
2014-12-17 16:21 ` Josh Poimboeuf
2014-12-18 15:56 ` Josh Poimboeuf
2014-12-18 11:55 ` Masami Hiramatsu
2014-12-18 15:49 ` [PATCH] livepatch: use FTRACE_OPS_FL_IPMODIFY Josh Poimboeuf
2014-12-19 3:34 ` Masami Hiramatsu
2014-12-19 9:43 ` Petr Mladek
2014-12-22 17:34 ` Petr Mladek
2014-12-22 17:41 ` Josh Poimboeuf
2014-12-22 19:44 ` [PATCHv7 0/3] Kernel Live Patching Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5493C185.9020001@huawei.com \
--to=huawei.libin@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=guohanjun@huawei.com \
--cc=hch@infradead.org \
--cc=jkosina@suse.cz \
--cc=jpoimboe@redhat.com \
--cc=kpatch@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=luto@amacapital.net \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.cz \
--cc=rostedt@goodmis.org \
--cc=sjenning@redhat.com \
--cc=vojtech@suse.cz \
--cc=x86@kernel.org \
--cc=xiexiuqi@huawei.com \
--cc=zhangdianfang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.