git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tracing/kprobes: Fix probe offset to be unsigned
[pandora-kernel.git]
/
kernel
/
trace
/
trace_kprobe.c
diff --git
a/kernel/trace/trace_kprobe.c
b/kernel/trace/trace_kprobe.c
index
1a9ca79
..
c24b7e9
100644
(file)
--- a/
kernel/trace/trace_kprobe.c
+++ b/
kernel/trace/trace_kprobe.c
@@
-210,7
+210,7
@@
static __kprobes const char *probe_symbol(struct trace_probe *tp)
return tp->symbol ? tp->symbol : "unknown";
}
return tp->symbol ? tp->symbol : "unknown";
}
-static __kprobes
long
probe_offset(struct trace_probe *tp)
+static __kprobes
unsigned int
probe_offset(struct trace_probe *tp)
{
return (probe_is_return(tp)) ? tp->rp.kp.offset : tp->kp.offset;
}
{
return (probe_is_return(tp)) ? tp->rp.kp.offset : tp->kp.offset;
}
@@
-220,7
+220,7
@@
static __kprobes void *probe_address(struct trace_probe *tp)
return (probe_is_return(tp)) ? tp->rp.kp.addr : tp->kp.addr;
}
return (probe_is_return(tp)) ? tp->rp.kp.addr : tp->kp.addr;
}
-static int
trac
e_arg_string(char *buf, size_t n, struct fetch_func *ff)
+static int
prob
e_arg_string(char *buf, size_t n, struct fetch_func *ff)
{
int ret = -EINVAL;
{
int ret = -EINVAL;
@@
-250,7
+250,7
@@
static int trace_arg_string(char *buf, size_t n, struct fetch_func *ff)
if (ret >= n)
goto end;
l += ret;
if (ret >= n)
goto end;
l += ret;
- ret =
trac
e_arg_string(buf + l, n - l, &id->orig);
+ ret =
prob
e_arg_string(buf + l, n - l, &id->orig);
if (ret < 0)
goto end;
l += ret;
if (ret < 0)
goto end;
l += ret;
@@
-380,7
+380,7
@@
end:
}
/* Split symbol and offset. */
}
/* Split symbol and offset. */
-static int split_symbol_offset(char *symbol, long *offset)
+static int split_symbol_offset(char *symbol,
unsigned
long *offset)
{
char *tmp;
int ret;
{
char *tmp;
int ret;
@@
-389,16
+389,11
@@
static int split_symbol_offset(char *symbol, long *offset)
return -EINVAL;
tmp = strchr(symbol, '+');
return -EINVAL;
tmp = strchr(symbol, '+');
- if (!tmp)
- tmp = strchr(symbol, '-');
-
if (tmp) {
/* skip sign because strict_strtol doesn't accept '+' */
if (tmp) {
/* skip sign because strict_strtol doesn't accept '+' */
- ret = strict_strtol(tmp + 1, 0, offset);
+ ret = strict_strto
u
l(tmp + 1, 0, offset);
if (ret)
return ret;
if (ret)
return ret;
- if (*tmp == '-')
- *offset = -(*offset);
*tmp = '\0';
} else
*offset = 0;
*tmp = '\0';
} else
*offset = 0;
@@
-408,7
+403,7
@@
static int split_symbol_offset(char *symbol, long *offset)
#define PARAM_MAX_ARGS 16
#define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
#define PARAM_MAX_ARGS 16
#define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
-static int parse_
trac
e_arg(char *arg, struct fetch_func *ff, int is_return)
+static int parse_
prob
e_arg(char *arg, struct fetch_func *ff, int is_return)
{
int ret = 0;
unsigned long param;
{
int ret = 0;
unsigned long param;
@@
-499,7
+494,7
@@
static int parse_trace_arg(char *arg, struct fetch_func *ff, int is_return)
if (!id)
return -ENOMEM;
id->offset = offset;
if (!id)
return -ENOMEM;
id->offset = offset;
- ret = parse_
trac
e_arg(arg, &id->orig, is_return);
+ ret = parse_
prob
e_arg(arg, &id->orig, is_return);
if (ret)
kfree(id);
else {
if (ret)
kfree(id);
else {
@@
-520,7
+515,7
@@
static int create_trace_probe(int argc, char **argv)
{
/*
* Argument syntax:
{
/*
* Argument syntax:
- * - Add kprobe: p[:EVENT] SYMBOL[+OFFS
|-OFFS
]|ADDRESS [FETCHARGS]
+ * - Add kprobe: p[:EVENT] SYMBOL[+OFFS]|ADDRESS [FETCHARGS]
* - Add kretprobe: r[:EVENT] SYMBOL[+0] [FETCHARGS]
* Fetch args:
* aN : fetch Nth of function argument. (N:0-)
* - Add kretprobe: r[:EVENT] SYMBOL[+0] [FETCHARGS]
* Fetch args:
* aN : fetch Nth of function argument. (N:0-)
@@
-539,7
+534,7
@@
static int create_trace_probe(int argc, char **argv)
int i, ret = 0;
int is_return = 0;
char *symbol = NULL, *event = NULL;
int i, ret = 0;
int is_return = 0;
char *symbol = NULL, *event = NULL;
- long offset = 0;
+
unsigned
long offset = 0;
void *addr = NULL;
if (argc < 2)
void *addr = NULL;
if (argc < 2)
@@
-605,7
+600,7
@@
static int create_trace_probe(int argc, char **argv)
if (tp->symbol) {
kp->symbol_name = tp->symbol;
if (tp->symbol) {
kp->symbol_name = tp->symbol;
- kp->offset = offset;
+ kp->offset =
(unsigned int)
offset;
} else
kp->addr = addr;
} else
kp->addr = addr;
@@
-617,7
+612,7
@@
static int create_trace_probe(int argc, char **argv)
ret = -ENOSPC;
goto error;
}
ret = -ENOSPC;
goto error;
}
- ret = parse_
trac
e_arg(argv[i], &tp->args[i], is_return);
+ ret = parse_
prob
e_arg(argv[i], &tp->args[i], is_return);
if (ret)
goto error;
}
if (ret)
goto error;
}
@@
-675,12
+670,12
@@
static int probes_seq_show(struct seq_file *m, void *v)
seq_printf(m, ":%s", tp->call.name);
if (tp->symbol)
seq_printf(m, ":%s", tp->call.name);
if (tp->symbol)
- seq_printf(m, " %s
%+ld
", probe_symbol(tp), probe_offset(tp));
+ seq_printf(m, " %s
+%u
", probe_symbol(tp), probe_offset(tp));
else
seq_printf(m, " 0x%p", probe_address(tp));
for (i = 0; i < tp->nr_args; i++) {
else
seq_printf(m, " 0x%p", probe_address(tp));
for (i = 0; i < tp->nr_args; i++) {
- ret =
trac
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret =
prob
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0) {
pr_warning("Argument%d decoding error(%d).\n", i, ret);
return ret;
if (ret < 0) {
pr_warning("Argument%d decoding error(%d).\n", i, ret);
return ret;
@@
-819,6
+814,7
@@
static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
struct trace_probe *tp = container_of(kp, struct trace_probe, kp);
struct kprobe_trace_entry *entry;
struct ring_buffer_event *event;
struct trace_probe *tp = container_of(kp, struct trace_probe, kp);
struct kprobe_trace_entry *entry;
struct ring_buffer_event *event;
+ struct ring_buffer *buffer;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
@@
-830,7
+826,7
@@
static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args);
size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args);
- event = trace_current_buffer_lock_reserve(call->id, size,
+ event = trace_current_buffer_lock_reserve(
&buffer,
call->id, size,
irq_flags, pc);
if (!event)
return 0;
irq_flags, pc);
if (!event)
return 0;
@@
-841,8
+837,8
@@
static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
- if (!filter_current_check_discard(call, entry, event))
- trace_nowake_buffer_unlock_commit(event, irq_flags, pc);
+ if (!filter_current_check_discard(
buffer,
call, entry, event))
+ trace_nowake_buffer_unlock_commit(
buffer,
event, irq_flags, pc);
return 0;
}
return 0;
}
@@
-853,6
+849,7
@@
static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
struct kretprobe_trace_entry *entry;
struct ring_buffer_event *event;
struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
struct kretprobe_trace_entry *entry;
struct ring_buffer_event *event;
+ struct ring_buffer *buffer;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
int size, i, pc;
unsigned long irq_flags;
struct ftrace_event_call *call = &tp->call;
@@
-862,7
+859,7
@@
static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args);
size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args);
- event = trace_current_buffer_lock_reserve(call->id, size,
+ event = trace_current_buffer_lock_reserve(
&buffer,
call->id, size,
irq_flags, pc);
if (!event)
return 0;
irq_flags, pc);
if (!event)
return 0;
@@
-874,8
+871,8
@@
static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri,
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
for (i = 0; i < tp->nr_args; i++)
entry->args[i] = call_fetch(&tp->args[i], regs);
- if (!filter_current_check_discard(call, entry, event))
- trace_nowake_buffer_unlock_commit(event, irq_flags, pc);
+ if (!filter_current_check_discard(
buffer,
call, entry, event))
+ trace_nowake_buffer_unlock_commit(
buffer,
event, irq_flags, pc);
return 0;
}
return 0;
}
@@
-964,7
+961,7
@@
static void probe_event_disable(struct ftrace_event_call *call)
static int probe_event_raw_init(struct ftrace_event_call *event_call)
{
INIT_LIST_HEAD(&event_call->fields);
static int probe_event_raw_init(struct ftrace_event_call *event_call)
{
INIT_LIST_HEAD(&event_call->fields);
- init_preds(event_call);
+
return 0;
}
return 0;
}
@@
-997,7
+994,7
@@
static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
- ret =
trac
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret =
prob
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
@@
-1024,7
+1021,7
@@
static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
sprintf(buf, "arg%d", i);
DEFINE_FIELD(unsigned long, args[i], buf, 0);
/* Set argument string as an alias field */
- ret =
trac
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret =
prob
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
if (ret < 0)
return ret;
DEFINE_FIELD(unsigned long, args[i], buf, 0);
@@
-1041,7
+1038,7
@@
static int __probe_event_show_format(struct trace_seq *s,
/* Show aliases */
for (i = 0; i < tp->nr_args; i++) {
/* Show aliases */
for (i = 0; i < tp->nr_args; i++) {
- ret =
trac
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
+ ret =
prob
e_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i]);
if (ret < 0)
return ret;
if (!trace_seq_printf(s, "\talias: %s;\toriginal: arg%d;\n",
if (ret < 0)
return ret;
if (!trace_seq_printf(s, "\talias: %s;\toriginal: arg%d;\n",