lkml.org 
[lkml]   [2007]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/8] Kprobes - do not use kprobes mutex in arch code
* Christoph Hellwig (hch@infradead.org) wrote:
> On Fri, Jul 13, 2007 at 09:21:34PM -0400, Mathieu Desnoyers wrote:
> > Remove the kprobes mutex from kprobes.h, since it does not belong there. Also
> > remove all use of this mutex in the architecture specific code, replacing it by
> > a proper mutex lock/unlock in the architecture agnostic code.
>
> This is not very nice for avr32/sparc64 which have a noop arch_remove_kprobe
> and now need to take a mutex to do nothing. Maybe you can find a nice
> way to avoid that?
>
> Except for this issue making kprobes_mutex static to kprobes.c sounds like
> a good improvement.
>

While we are here:

The whole check_safety() in kprobes.c seems awkward.. freezing processes
is probably costly, and the check:

if (p != current && p->state == TASK_RUNNING && p->pid != 0) {

Adds restrictions about where a probe can be safely put.. the idle
thread becomes a restriction.

I suggest disabling preemption in the int3 handler, just before
single-stepping, then reenabling it in the breakpoint handler executed
right after the single-step. A synchronize_sched() could then replace
the whole check_safety() and would never fail. The side-effect would be
to disable preemption in the single-step, it's no big deal.

Mathieu


--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-14 21:33    [W:0.089 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site