diff options
Diffstat (limited to 'kernel/trace/bpf_trace.c')
-rw-r--r-- | kernel/trace/bpf_trace.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index f6d2327ecb59..f274468cbc45 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
15 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
16 | #include <linux/kprobes.h> | 16 | #include <linux/kprobes.h> |
17 | #include <asm/kprobes.h> | 17 | #include <linux/error-injection.h> |
18 | 18 | ||
19 | #include "trace_probe.h" | 19 | #include "trace_probe.h" |
20 | #include "trace.h" | 20 | #include "trace.h" |
@@ -83,9 +83,8 @@ EXPORT_SYMBOL_GPL(trace_call_bpf); | |||
83 | #ifdef CONFIG_BPF_KPROBE_OVERRIDE | 83 | #ifdef CONFIG_BPF_KPROBE_OVERRIDE |
84 | BPF_CALL_2(bpf_override_return, struct pt_regs *, regs, unsigned long, rc) | 84 | BPF_CALL_2(bpf_override_return, struct pt_regs *, regs, unsigned long, rc) |
85 | { | 85 | { |
86 | __this_cpu_write(bpf_kprobe_override, 1); | ||
87 | regs_set_return_value(regs, rc); | 86 | regs_set_return_value(regs, rc); |
88 | arch_ftrace_kprobe_override_function(regs); | 87 | override_function_with_return(regs); |
89 | return 0; | 88 | return 0; |
90 | } | 89 | } |
91 | 90 | ||
@@ -800,11 +799,11 @@ int perf_event_attach_bpf_prog(struct perf_event *event, | |||
800 | int ret = -EEXIST; | 799 | int ret = -EEXIST; |
801 | 800 | ||
802 | /* | 801 | /* |
803 | * Kprobe override only works for ftrace based kprobes, and only if they | 802 | * Kprobe override only works if they are on the function entry, |
804 | * are on the opt-in list. | 803 | * and only if they are on the opt-in list. |
805 | */ | 804 | */ |
806 | if (prog->kprobe_override && | 805 | if (prog->kprobe_override && |
807 | (!trace_kprobe_ftrace(event->tp_event) || | 806 | (!trace_kprobe_on_func_entry(event->tp_event) || |
808 | !trace_kprobe_error_injectable(event->tp_event))) | 807 | !trace_kprobe_error_injectable(event->tp_event))) |
809 | return -EINVAL; | 808 | return -EINVAL; |
810 | 809 | ||