Citando Jason Wessel <jason.wes...@windriver.com>: > On 10/09/2014 11:17 AM, joaoandrefe...@sapo.pt wrote: >> Hello all, >> >> I'm trying to use KGDB for some days now, and since I'm still getting >> some errors that need to be fixed (working on it), I think that for >> now it's better to ask here if what I'm trying to achieve is >> theoretically possible with KGDB. I'm trying to do some kind of fault >> injection, and so what I'm planning to do is: >> >> 1. Interrupt whatever is running in the OS (this, of course, includes >> the OS itself); > > > This is something you don't necessarily need kgdb/kdb for. You > might consider using a kprobe with a hardware break point, assuming > you are on an architecture that has support, else you can > strategically select your point of entry. >
Thanks for yout reply, Jason. I've heard about Kprobes previously, but never gave it a try, and I guess I'll probably do it now. > >> >> 2. Be able to call some kind of service routine to handle the >> interruption (an interrupt handler, I guess). This interrupt handler >> would inject a fault (e. g. bit-flip a breakpoint register, or the >> stack of the process that was interrupted, etc, i.e. something >> "critical" for the OS); >> >> 3. Resume OS execution and be able to access the context of the >> process interrupted (i. e., >> https://www.princeton.edu/~achaney/tmve/wiki100k/docs/Context_switch.html); >> >> I know that it seems that some of these requirements are present in >> KGDB, at least after reading the manual and some tutorials. But can >> someone confirm or deny that the above is indeed possible with KGDB? >> If the answer is positive, in a conceptual, general way, how would I >> achieve that? >> > > > KGDB assumes there is an external agent talking to your running > system. It would seem you want to scramble some kernel memory on > demand, and there is certainly more than one way to achieve that. > Certainly you can write a loadable kernel module or use a kprobe. > > It almost seems like you are looking for the ability to inject a few > commands to the kernel debugger and continue. The kgdb test suite > actually does do that because it pretends to be an I/O module (not > unlike your serial port or keyboard). This also requires you to > create a kernel module however. I've tried to write a loadable kernel module before (an interrupt handler), but because I was using it "alone" (without any tool making the breakpoint, only through the "insmod" command), I guess it wasn't that easy to have access to the context information of the interrupted process (I do not know, but probably the kernel sets up some kind of "special" context when an interrupt is set up by calling the request_irq method(..) ). I looked at the context switch part of the kernel code, but it is too complex for me to and I wasn't able to reach any solid conclusion. > If you are looking for some kind of generic support to inject a > command I had contemplated doing a few times, but have never really > found a case that required it. This sound interesting. Thanks, João > > Cheers, > Jason. ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport