Skip to content

Commit 8565a45

Browse files
committed
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/[email protected] Acked-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 007517a commit 8565a45

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,9 +1325,10 @@ probe_mem_read(void *dest, void *src, size_t size)
13251325

13261326
/* Note that we don't verify it, since the code does not come from user space */
13271327
static int
1328-
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
1328+
process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
13291329
void *base)
13301330
{
1331+
struct pt_regs *regs = rec;
13311332
unsigned long val;
13321333

13331334
retry:

kernel/trace/trace_probe_tmpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fetch_apply_bitfield(struct fetch_insn *code, void *buf)
5454
* If dest is NULL, don't store result and return required dynamic data size.
5555
*/
5656
static int
57-
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs,
57+
process_fetch_insn(struct fetch_insn *code, void *rec,
5858
void *dest, void *base);
5959
static nokprobe_inline int fetch_store_strlen(unsigned long addr);
6060
static nokprobe_inline int
@@ -188,7 +188,7 @@ __get_data_size(struct trace_probe *tp, struct pt_regs *regs)
188188

189189
/* Store the value of each argument */
190190
static nokprobe_inline void
191-
store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
191+
store_trace_args(void *data, struct trace_probe *tp, void *rec,
192192
int header_size, int maxlen)
193193
{
194194
struct probe_arg *arg;
@@ -203,7 +203,7 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
203203
/* Point the dynamic data area if needed */
204204
if (unlikely(arg->dynamic))
205205
*dl = make_data_loc(maxlen, dyndata - base);
206-
ret = process_fetch_insn(arg->code, regs, dl, base);
206+
ret = process_fetch_insn(arg->code, rec, dl, base);
207207
if (unlikely(ret < 0 && arg->dynamic)) {
208208
*dl = make_data_loc(0, dyndata - base);
209209
} else {

kernel/trace/trace_uprobe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ static unsigned long translate_user_vaddr(unsigned long file_offset)
213213

214214
/* Note that we don't verify it, since the code does not come from user space */
215215
static int
216-
process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
216+
process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
217217
void *base)
218218
{
219+
struct pt_regs *regs = rec;
219220
unsigned long val;
220221

221222
/* 1st stage: get value from context */

0 commit comments

Comments
 (0)