This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip 4/6 V4] x86: kprobes checks safeness of insertion address.
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: Masami Hiramatsu <mhiramat at redhat dot com>
- Cc: Ingo Molnar <mingo at elte dot hu>, Jim Keniston <jkenisto at us dot ibm dot com>, LKML <linux-kernel at vger dot kernel dot org>, systemtap-ml <systemtap at sources dot redhat dot com>, kvm at vger dot kernel dot org, Andi Kleen <andi at firstfloor dot org>, Andrew Morton <akpm at linux-foundation dot org>, Arnaldo Carvalho de Melo <acme at redhat dot com>, Steven Rostedt <rostedt at goodmis dot org>, Frederic Weisbecker <fweisbec at gmail dot com>
- Date: Fri, 3 Apr 2009 10:48:54 +0530
- Subject: Re: [PATCH -tip 4/6 V4] x86: kprobes checks safeness of insertion address.
- References: <49D4F4E9.2030809@redhat.com>
- Reply-to: ananth at in dot ibm dot com
On Thu, Apr 02, 2009 at 01:24:57PM -0400, Masami Hiramatsu wrote:
> +/* Recover original instruction */
> +static int recover_probed_instruction(kprobe_opcode_t *buf, unsigned long addr)
> +{
> + struct kprobe *kp;
> + kp = get_kprobe((void *)addr);
> + if (!kp)
> + return -EINVAL;
> +
> + /* Don't use p->ainsn.insn; which will be modified by fix_riprel */
> + memcpy(buf, kp->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
> + buf[0] = kp->opcode;
> + return 0;
> +}
> +
> +/* Dummy buffers for lookup_symbol_attrs */
> +static char __dummy_buf[KSYM_NAME_LEN];
> +
> +/* Check whether the address can be probed */
> +static int __kprobes can_probe(unsigned long paddr)
A better description would've been "Check if paddr is at an instruction
boundary". Otherwise looks good.
Ananth