lkml.org 
[lkml]   [2005]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 19/21] i386 Kprobes semaphore fix
Andi Kleen wrote:

>On Tuesday 08 November 2005 14:36, Zachary Amsden wrote:
>
>
>
>>One can imagine clever uses for ptrace to do, say user space
>>virtualization (since I'm on the topic), or other neat things. So there
>>is nothing really wrong about having the fully correct EIP conversion
>>(and here we shouldn't need to worry about races causing some issues
>>with strict correctness, since there can be one external control thread).
>>
>>
>
>Well, the code still scaries me a bit, but ok. x86-64 left at least one case
>intentionally out.
>
>
>
>>But were kprobes even inteneded for userspace? There are races here
>>that are difficult to close without some heavy machinery, and I would
>>rather not put the machinery in place if simplifying the code is the
>>right answer.
>>
>>
>
>I believe user space kprobes are being worked on by some IBM India folks yes.
>
>

I'm convinced this is pointless. What does it buy you over a ptrace
based debugger? Why would you want extra code running in the kernel
that can be done perfectly well in userspace?

Let me stress that if you are running on modified segment state, you
have no way to safely determine the virtual address on which you took an
instruction trap (int3, general protection, etc..). If you can't
determine the virtual address safely, you can't back out your code patch
to remove the breakpoint. At this point, you can't execute the next
instruction; you must wait for a _policy_ decision to be made. Adding
policy decisions like this to the kernel surely seems like a bad idea.
If the fallback is to have a debugger running in userspace that has a
user or script attached that can make the interactive decision, then why
not solve the entire problem in userspace from the start? It's a lot
safer, it simplifies the kernel kprobes code a lot, and it leaves the
debugger implementation free to do anything it chooses, as well as not
locking the solution to a particular kernel.

Zach
-
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: 2005-11-09 17:51    [from the cache]
©2003-2011 Jasper Spaans