Commit b6b76dd6 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Daniel Borkmann

error-injection: Fix to prohibit jump optimization

Since the kprobe which was optimized by jump can not change
the execution path, the kprobe for error-injection must not
be optimized. To prohibit it, set a dummy post-handler as
officially stated in Documentation/kprobes.txt.

Fixes: 4b1a29a7 ("error-injection: Support fault injection framework")
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 9e5fb720
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs); static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs);
static void fei_post_handler(struct kprobe *kp, struct pt_regs *regs,
unsigned long flags)
{
/*
* A dummy post handler is required to prohibit optimizing, because
* jump optimization does not support execution path overriding.
*/
}
struct fei_attr { struct fei_attr {
struct list_head list; struct list_head list;
struct kprobe kp; struct kprobe kp;
...@@ -56,6 +65,7 @@ static struct fei_attr *fei_attr_new(const char *sym, unsigned long addr) ...@@ -56,6 +65,7 @@ static struct fei_attr *fei_attr_new(const char *sym, unsigned long addr)
return NULL; return NULL;
} }
attr->kp.pre_handler = fei_kprobe_handler; attr->kp.pre_handler = fei_kprobe_handler;
attr->kp.post_handler = fei_post_handler;
attr->retval = adjust_error_retval(addr, 0); attr->retval = adjust_error_retval(addr, 0);
INIT_LIST_HEAD(&attr->list); INIT_LIST_HEAD(&attr->list);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment