better SMP support for kprobes

Martin Hunt hunt@redhat.com
Thu Feb 3 09:33:00 GMT 2005


On Wed, 2005-02-02 at 18:45 -0500, Frank Ch. Eigler wrote:

> More importantly, by reading the code, it seems like kprobes user
> functions are called from within a context where interrupts are
> blocked.  Would that not make it impossible to safely invoke
> user-context might_sleep functions like copy_from_user, from any
> of the kprobes, jprobes, dprobes layers?  I hope I'm missing
> something!

This is something we should probably run by a kernel expert.

We can always just have it copy if possible, otherwise fail cleanly.
That means we need to determine if a page fault would happen and avoid
it, or simply prevent it. 

This is what my current runtime copy_from_user looks like:

unsigned long
dtr_copy_from_user (char *dst, const char __user *src, unsigned long
count)
{
  int left;
  inc_preempt_count();
  left = __copy_from_user_inatomic(dst, src, count);
  dec_preempt_count();
  return left;
}

This should return 0 on success and should not sleep.  If I understand
things correctly.  At least it works in testing so far.

Martin





More information about the Systemtap mailing list