All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Quade <quade@hsnr.de>
To: linux-kernel@vger.kernel.org
Cc: quade@hsnr.de
Subject: system-freeze: kprobe and do_gettimeofday
Date: Sat, 23 Apr 2005 12:12:51 +0200	[thread overview]
Message-ID: <20050423101251.GA327@hsnr.de> (raw)

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

             reply	other threads:[~2005-04-23 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-23 10:12 Juergen Quade [this message]
2005-04-25 15:56 ` system-freeze: kprobe and do_gettimeofday 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050423101251.GA327@hsnr.de \
    --to=quade@hsnr.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.