Re: [PATCH] uprobes tracer: Add stack/memory/retval access support

From: Masami Hiramatsu
Date: Tue Oct 16 2012 - 07:55:14 EST


(2012/10/16 18:02), Hyeoncheol Lee wrote:
> Event arguments except @SYM are supported. They are @ADDR,
> $stack, $stackN, $retval, and offs(arguments).
>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
> Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Hyeoncheol Lee <hyc.lee@xxxxxxxxx>
> ---

[...]
> #define DEFINE_FETCH_stack(type) \
> static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
> - void *offset, void *dest) \
> + void *offset, void *dest, \
> + bool kprobe) \
> { \
> - *(type *)dest = (type)regs_get_kernel_stack_nth(regs, \
> + if (kprobe) \
> + *(type *)dest = (type)regs_get_kernel_stack_nth(regs, \
> (unsigned int)((unsigned long)offset)); \
> + else \
> + *(type *)dest = (type)regs_get_user_stack_nth(regs, \
> + (unsigned int)((unsigned long)offset)); \
> }


Hmm, I don't think this is a good way to do that.
If fetching user space objects is different from the kernel one,
we'd better introduce new fetch handlers for it, instead of checking
a bool flag every time, because it will be done on every events.

Thank you,


--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@xxxxxxxxxxx


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/