Skip to content

Commit

Permalink
uprobes/tracing: Don't pass addr=ip to perf_trace_buf_submit()
Browse files Browse the repository at this point in the history
uprobe_perf_print() passes addr=ip to perf_trace_buf_submit() for
no reason. This sets perf_sample_data->addr for PERF_SAMPLE_ADDR,
we already have perf_sample_data->ip initialized if PERF_SAMPLE_IP.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
  • Loading branch information
Oleg Nesterov committed Apr 13, 2013
1 parent 4ee5a52 commit 32520b2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions kernel/trace/trace_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ static void uprobe_perf_print(struct trace_uprobe *tu,
struct ftrace_event_call *call = &tu->call;
struct uprobe_trace_entry_head *entry;
struct hlist_head *head;
unsigned long ip;
void *data;
int size, rctx, i;

Expand All @@ -825,21 +824,20 @@ static void uprobe_perf_print(struct trace_uprobe *tu,
if (!entry)
goto out;

ip = instruction_pointer(regs);
if (is_ret_probe(tu)) {
entry->vaddr[0] = func;
entry->vaddr[1] = ip;
entry->vaddr[1] = instruction_pointer(regs);
data = DATAOF_TRACE_ENTRY(entry, true);
} else {
entry->vaddr[0] = ip;
entry->vaddr[0] = instruction_pointer(regs);
data = DATAOF_TRACE_ENTRY(entry, false);
}

for (i = 0; i < tu->nr_args; i++)
call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset);

head = this_cpu_ptr(call->perf_events);
perf_trace_buf_submit(entry, size, rctx, ip, 1, regs, head, NULL);
perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL);
out:
preempt_enable();
}
Expand Down

0 comments on commit 32520b2

Please sign in to comment.