This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: [PATCH] kprobes: fix single-step out of line
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: Paul Mackerras <paulus at samba dot org>
- Cc: linuxppc64-dev at ozlabs dot org, anton at samba dot org, systemtap at sources dot redhat dot com
- Date: Fri, 10 Jun 2005 08:05:55 -0400
- Subject: Re: [PATCH] kprobes: fix single-step out of line
- References: <20050525170159.GA9364@in.ibm.com> <17064.61386.359039.438550@cargo.ozlabs.ibm.com>
- Reply-to: ananth at in dot ibm dot com
On Fri, Jun 10, 2005 at 11:41:30AM +1000, Paul Mackerras wrote:
> Ananth N Mavinakayanahalli writes:
Hi Paul,
> > On Power4 and above, single-step out of line when the instruction copy
> > is on a kmalloc'ed memory area, fails with an Instruction Access
> > exception. Here is a patch that fixes it.
>
> > +static kprobe_opcode_t stepped_insn;
>
> Hmmm... you are putting the instruction in a location in the data
> segment, which may not be mapped executable. You would get away with
> it if the kernel is mapped with large pages (which is the default) and
> the kernel text + data fits into 16MB (which I hope would be the
> case). But still, it's not a really clean solution. However, I'm not
> sure what would be better; you need some storage that is both writable
> and executable, which we try to avoid having.
One option could be to __vmalloc() a page with pgprot = PAGE_KERNEL_EXEC
and use that as a scratch area for stepping probed instructions - similar
to what x86_64 kprobes does currently (though it uses module_alloc() to
handle some special (RIP-relative) instructions).
Suggestions?
Ananth