tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs

In preparation to allow event probes to use the process_fetch_insn()
callback in trace_probe_tmpl.h, change the data passed to it from a
pointer to pt_regs, as the event probe will not be using regs, and make it
a void pointer instead.

Update the process_fetch_insn() callers for kprobe and uprobe events to
have the regs defined in the function and just typecast the void pointer
parameter.

Link: https://lkml.kernel.org/r/20210819041842.291622924@goodmis.orgAcked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 007517a0
...@@ -1325,9 +1325,10 @@ probe_mem_read(void *dest, void *src, size_t size) ...@@ -1325,9 +1325,10 @@ probe_mem_read(void *dest, void *src, size_t size)
/* Note that we don't verify it, since the code does not come from user space */ /* Note that we don't verify it, since the code does not come from user space */
static int static int
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest, process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
void *base) void *base)
{ {
struct pt_regs *regs = rec;
unsigned long val; unsigned long val;
retry: retry:
......
...@@ -54,7 +54,7 @@ fetch_apply_bitfield(struct fetch_insn *code, void *buf) ...@@ -54,7 +54,7 @@ fetch_apply_bitfield(struct fetch_insn *code, void *buf)
* If dest is NULL, don't store result and return required dynamic data size. * If dest is NULL, don't store result and return required dynamic data size.
*/ */
static int static int
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, process_fetch_insn(struct fetch_insn *code, void *rec,
void *dest, void *base); void *dest, void *base);
static nokprobe_inline int fetch_store_strlen(unsigned long addr); static nokprobe_inline int fetch_store_strlen(unsigned long addr);
static nokprobe_inline int static nokprobe_inline int
...@@ -188,7 +188,7 @@ __get_data_size(struct trace_probe *tp, struct pt_regs *regs) ...@@ -188,7 +188,7 @@ __get_data_size(struct trace_probe *tp, struct pt_regs *regs)
/* Store the value of each argument */ /* Store the value of each argument */
static nokprobe_inline void static nokprobe_inline void
store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs, store_trace_args(void *data, struct trace_probe *tp, void *rec,
int header_size, int maxlen) int header_size, int maxlen)
{ {
struct probe_arg *arg; struct probe_arg *arg;
...@@ -203,7 +203,7 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs, ...@@ -203,7 +203,7 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
/* Point the dynamic data area if needed */ /* Point the dynamic data area if needed */
if (unlikely(arg->dynamic)) if (unlikely(arg->dynamic))
*dl = make_data_loc(maxlen, dyndata - base); *dl = make_data_loc(maxlen, dyndata - base);
ret = process_fetch_insn(arg->code, regs, dl, base); ret = process_fetch_insn(arg->code, rec, dl, base);
if (unlikely(ret < 0 && arg->dynamic)) { if (unlikely(ret < 0 && arg->dynamic)) {
*dl = make_data_loc(0, dyndata - base); *dl = make_data_loc(0, dyndata - base);
} else { } else {
......
...@@ -213,9 +213,10 @@ static unsigned long translate_user_vaddr(unsigned long file_offset) ...@@ -213,9 +213,10 @@ static unsigned long translate_user_vaddr(unsigned long file_offset)
/* Note that we don't verify it, since the code does not come from user space */ /* Note that we don't verify it, since the code does not come from user space */
static int static int
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest, process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
void *base) void *base)
{ {
struct pt_regs *regs = rec;
unsigned long val; unsigned long val;
/* 1st stage: get value from context */ /* 1st stage: get value from context */
......
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