public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* system-freeze: kprobe and do_gettimeofday
@ 2005-04-23 10:12 Juergen Quade
  2005-04-25 15:56 ` Prasanna S Panchamukhi
  0 siblings, 1 reply; 7+ messages in thread
From: Juergen Quade @ 2005-04-23 10:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: quade

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");

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-04-29 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-23 10:12 system-freeze: kprobe and do_gettimeofday Juergen Quade
2005-04-25 15:56 ` Prasanna S Panchamukhi
2005-04-25 16:08   ` Juergen Quade
2005-04-26 14:52     ` Prasanna S Panchamukhi
2005-04-26 19:34       ` Juergen Quade
2005-04-29 11:18         ` Prasanna S Panchamukhi
2005-04-29 17:27           ` Juergen Quade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox