[lkml]   [2011]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] [PATCH 2.6.37-rc5-tip 10/20] 10: uprobes: task specific information.
On Thu, 2010-12-16 at 15:29 +0530, Srikar Dronamraju wrote:
> Uprobes needs to maintain some task specific information include if a
> task is currently uprobed, the currently handing uprobe, any arch
> specific information (for example to handle rip relative instructions),
> the per-task slot where the original instruction is copied to before
> single-stepping.

This can go away once you have per-task xol slots and boosted probes,
because then you can write the complete replacement sequence on trap and
never need to come back until you hit another probe, right?

> +/*
> + * uprobe_utask -- not a user-visible struct.
> + * Corresponds to a thread in a probed process.
> + * Guarded by uproc->mutex.
> + */
> +struct uprobe_task {
> + unsigned long xol_vaddr;
> + unsigned long vaddr;
> +
> + enum uprobe_task_state state;
> + struct uprobe_task_arch_info tskinfo;
> +
> + struct uprobe *active_uprobe;
> +};

So xol_vaddr is the start of the xol slot,
vaddr is the trap address, we store those so that you still have the
state during the single-step things?

I guess you could obtain the xol slot information from the IP during
single-step, but since you have storage anyway, this might be cheaper.

And the active_probe is again due to single-step, right? Why exactly do
you need that? If you trap, acquire a new slot, write the replacement
sequence, single step through it, and release the slot once you're back
to the original code stream. I'm not quite seeing where you need the
probe during stepping.

Ah, I think I found it while reading patch 13, you need the pre/post_xol
callbacks, can't you simply synthesize their effect into the replacement

push %rax
mov $vaddr, %rax
pop %rax
jmp $next_insn

like replacements would obviate the need for the pre/post callbacks and
allow you to run straight through.

It doesn't look too hard to create simple sequences for each
UPROBE_FIX_* thingy:

push %rax; mov $vaddr, %rax && UPROBE_FIX_RIP_AX
push %rcx; mov $vaddr, %rcx && UPROBE_FIX_RIP_CX


pop %rax && UPROBE_FIX_RIP_AX
pop %rcx && UPROBE_FIX_RIP_CX
add $correction, $offset(%rsp) && UPROBE_FIX_CALL
jmp $next_insn

you already have all the logic of computing the various constants there.
And your slots are 128bytes long, which should fit sequences like that
just fine I think.

It would also remove the whole single-step need since they're proper
boosted probes.

 \ /
  Last update: 2011-01-25 14:59    [W:0.304 / U:14.120 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site