Playing around with kprobe I noticed, that "kprobing"
the function "do_gettimeofday" completly freezes the
system (2.6.12-rc3). Other functions like "do_fork" or
"do_settimeofday" are doing well.
Does anybody know the reason for it?
Juergen.
=================================
// BEWARE: THIS CODE MAY FREEZE YOUR SYSTEM
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
static int call_count = 0;
static int pre_probe(struct kprobe *p, struct pt_regs *regs)
{
++call_count;
return 0;
}
static struct kprobe kp = {
.pre_handler = pre_probe,
.post_handler = NULL,
.fault_handler = NULL,
.addr = (kprobe_opcode_t *) NULL,
};
static int __init probe_init(void)
{
kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_gettimeofday");
if (kp.addr == NULL) {
printk("kallsyms_lookup_name could not find address"
"for the specified symbol name\n");
return 1;
}
register_kprobe(&kp);
printk("kprobe registered address %p\n", kp.addr);
return 0;
}
static void __exit probe_exit(void)
{
unregister_kprobe(&kp);
printk("do_gettimeofday() called %d times.\n", call_count);
}
module_init( probe_init );
module_exit( probe_exit );
MODULE_LICENSE("GPL");
On Sat, Apr 23, 2005 at 12:12:51PM +0200, Juergen Quade wrote:
> Playing around with kprobe I noticed, that "kprobing"
> the function "do_gettimeofday" completly freezes the
> system (2.6.12-rc3). Other functions like "do_fork" or
Kprobe on "do_gettimeofday" seems to work fine on 4-way SMP i386 box.
What is configuration of your machine?
Thanks
Prasanna
--
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<[email protected]>
On Mon, Apr 25, 2005 at 09:26:49PM +0530, Prasanna S Panchamukhi wrote:
> On Sat, Apr 23, 2005 at 12:12:51PM +0200, Juergen Quade wrote:
> > Playing around with kprobe I noticed, that "kprobing"
> > the function "do_gettimeofday" completly freezes the
> > system (2.6.12-rc3). Other functions like "do_fork" or
>
> Kprobe on "do_gettimeofday" seems to work fine on 4-way SMP i386 box.
> What is configuration of your machine?
Thank you for your answer!
Find my kernel-config attached.
The processor of the system is an Pentium M
(1400MHz, 512MByte Memory - nothing specific).
Juergen.
On Mon, Apr 25, 2005 at 06:08:59PM +0200, Juergen Quade wrote:
> On Mon, Apr 25, 2005 at 09:26:49PM +0530, Prasanna S Panchamukhi wrote:
> > On Sat, Apr 23, 2005 at 12:12:51PM +0200, Juergen Quade wrote:
> > > Playing around with kprobe I noticed, that "kprobing"
> > > the function "do_gettimeofday" completly freezes the
> > > system (2.6.12-rc3). Other functions like "do_fork" or
> >
> > Kprobe on "do_gettimeofday" seems to work fine on 4-way SMP i386 box.
> > What is configuration of your machine?
>
> Thank you for your answer!
> Find my kernel-config attached.
> The processor of the system is an Pentium M
> (1400MHz, 512MByte Memory - nothing specific).
>
I tested with your configuration file and it still
works fine. Can you get some more info about current tasks
using Alt+SysRq+t and Alt+SysRq+d keys.
Thanks
Prasanna
--
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<[email protected]>
On Tue, Apr 26, 2005 at 08:22:10PM +0530, Prasanna S Panchamukhi wrote:
>
> On Mon, Apr 25, 2005 at 06:08:59PM +0200, Juergen Quade wrote:
> > On Mon, Apr 25, 2005 at 09:26:49PM +0530, Prasanna S Panchamukhi wrote:
> > > On Sat, Apr 23, 2005 at 12:12:51PM +0200, Juergen Quade wrote:
> > > > Playing around with kprobe I noticed, that "kprobing"
> > > > the function "do_gettimeofday" completly freezes the
> > > > system (2.6.12-rc3). Other functions like "do_fork" or
> > >
> > > Kprobe on "do_gettimeofday" seems to work fine on 4-way SMP i386 box.
> > > What is configuration of your machine?
> >
> > Thank you for your answer!
> > Find my kernel-config attached.
> > The processor of the system is an Pentium M
> > (1400MHz, 512MByte Memory - nothing specific).
> >
>
> I tested with your configuration file and it still
> works fine. Can you get some more info about current tasks
> using Alt+SysRq+t and Alt+SysRq+d keys.
I did now a lot of additional tests. When running
"insmod kgettime.ko" from the console (not from x-windows)
I get:
kprobe registered address c0107bd0 // output from the module
double fault, gdt at c049bd00 [255 bytes]
double fault, tss at c03d4060
eip = c0103c86, esp = db932000
eax = ffffffff, ebx = db932134, ecx = 0000000d, edx = 00000000
esi = db932080, edi = 0000000d
Alt+SysRq did not work...
Then I removed all my modules (except 2) I was able to load the module
without problems. I added module by module and checked every time with
"insmod kgettime.ko". When loading the "ohci1394" module it crashed
again. But next time I loaded the "ohci"-module first - no crash. (So I
don't think it is the ohci-module). I was able to load all modules and
it still worked.
Hmmm. What else to check?
Juergen.
Juergen,
>
> I did now a lot of additional tests. When running
> "insmod kgettime.ko" from the console (not from x-windows)
> I get:
>
> kprobe registered address c0107bd0 // output from the module
> double fault, gdt at c049bd00 [255 bytes]
> double fault, tss at c03d4060
> eip = c0103c86, esp = db932000
> eax = ffffffff, ebx = db932134, ecx = 0000000d, edx = 00000000
> esi = db932080, edi = 0000000d
>
> Alt+SysRq did not work...
>
> Then I removed all my modules (except 2) I was able to load the module
> without problems. I added module by module and checked every time with
> "insmod kgettime.ko". When loading the "ohci1394" module it crashed
> again. But next time I loaded the "ohci"-module first - no crash. (So I
> don't think it is the ohci-module). I was able to load all modules and
> it still worked.
>
> Hmmm. What else to check?
>
Thanks for providing the information, we are not able to reproduce this
problem here. Can you pls write a similar fault handler for kprobes as shown
below and get us the log messages.
int fault_probe(struct kprobe *p, struct pt_regs *regs, int trapnr) {
printk("fault_handler:p->addr=0x%p, eflags=0x%lx\n", p->addr, regs->eflags);
return 0;
}
Thanks
Prasanna
--
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<[email protected]>
> > ...
> Thanks for providing the information, we are not able to reproduce this
> problem here. Can you pls write a similar fault handler for kprobes as shown
> below and get us the log messages.
>
> int fault_probe(struct kprobe *p, struct pt_regs *regs, int trapnr) {
> printk("fault_handler:p->addr=0x%p, eflags=0x%lx\n", p->addr, regs->eflags);
> return 0;
I tried it a few time, system freezes but the fault handler
has not been called. First time the system rebooted completly,
second time I got no output at all.
I added the proposed line into the pre-handler. Here is the
output:
kprobe registered address c0107bd0
pre_handler:p->addr=0xc0107bd0, eflags=0x282
root@esz-mobil:/tmp/kprobes# double fault, gdt
at c049bd00 ...
The first line is the output of "init_module". The second
line is the output of the pre_handler. As you can see,
before the "double fault" message I get one prompt. Could
there be a problem with the timer interrupt?
Juergen.