tracing/kprobe: bpf: Check error injectable event is on function entry
Check whether error injectable event is on function entry or not. Currently it checks the event is ftrace-based kprobes or not, but that is wrong. It should check if the event is on the entry of target function. Since error injection will override a function to just return with modified return value, that operation must be done before the target function starts making stackframe. As a side effect, bpf error injection is no need to depend on function-tracer. It can work with sw-breakpoint based kprobe events too. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
daaf24c634
commit
b4da3340ea
@@ -252,8 +252,8 @@ struct symbol_cache;
|
||||
unsigned long update_symbol_cache(struct symbol_cache *sc);
|
||||
void free_symbol_cache(struct symbol_cache *sc);
|
||||
struct symbol_cache *alloc_symbol_cache(const char *sym, long offset);
|
||||
int trace_kprobe_ftrace(struct trace_event_call *call);
|
||||
int trace_kprobe_error_injectable(struct trace_event_call *call);
|
||||
bool trace_kprobe_on_func_entry(struct trace_event_call *call);
|
||||
bool trace_kprobe_error_injectable(struct trace_event_call *call);
|
||||
#else
|
||||
/* uprobes do not support symbol fetch methods */
|
||||
#define fetch_symbol_u8 NULL
|
||||
@@ -280,14 +280,14 @@ alloc_symbol_cache(const char *sym, long offset)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int trace_kprobe_ftrace(struct trace_event_call *call)
|
||||
static inline bool trace_kprobe_on_func_entry(struct trace_event_call *call)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int trace_kprobe_error_injectable(struct trace_event_call *call)
|
||||
static inline bool trace_kprobe_error_injectable(struct trace_event_call *call)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_KPROBE_EVENTS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user