summaryrefslogtreecommitdiff
path: root/kernel/trace/trace_uprobe.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_uprobe.c')
-rw-r--r--kernel/trace/trace_uprobe.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 912cb2093944..7154473ffaa4 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -101,7 +101,7 @@ static unsigned long get_user_stack_nth(struct pt_regs *regs, unsigned int n)
* Uprobes-specific fetch functions
*/
static nokprobe_inline int
-probe_user_read(void *dest, void *src, size_t size)
+probe_mem_read(void *dest, void *src, size_t size)
{
void __user *vaddr = (void __force __user *)src;
@@ -162,7 +162,6 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
void *base)
{
unsigned long val;
- int ret = 0;
/* 1st stage: get value from context */
switch (code->op) {
@@ -189,45 +188,7 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
}
code++;
- /* 2nd stage: dereference memory if needed */
- while (code->op == FETCH_OP_DEREF) {
- ret = probe_user_read(&val, (void *)val + code->offset,
- sizeof(val));
- if (ret)
- return ret;
- code++;
- }
-
- /* 3rd stage: store value to buffer */
- if (unlikely(!dest)) {
- if (code->op == FETCH_OP_ST_STRING)
- return fetch_store_strlen(val + code->offset);
- else
- return -EILSEQ;
- }
-
- switch (code->op) {
- case FETCH_OP_ST_RAW:
- fetch_store_raw(val, code, dest);
- break;
- case FETCH_OP_ST_MEM:
- probe_kernel_read(dest, (void *)val + code->offset, code->size);
- break;
- case FETCH_OP_ST_STRING:
- ret = fetch_store_string(val + code->offset, dest, base);
- break;
- default:
- return -EILSEQ;
- }
- code++;
-
- /* 4th stage: modify stored value if needed */
- if (code->op == FETCH_OP_MOD_BF) {
- fetch_apply_bitfield(code, dest);
- code++;
- }
-
- return code->op == FETCH_OP_END ? ret : -EILSEQ;
+ return process_fetch_insn_bottom(code, val, dest, base);
}
NOKPROBE_SYMBOL(process_fetch_insn)