All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prasanna S Panchamukhi <prasanna@in.ibm.com>
To: Luca Falavigna <dktrkranz@gmail.com>
Cc: Greg KH <greg@kroah.com>, Nathan Lynch <nathanl@austin.ibm.com>,
	vamsi_krishna@in.ibm.com, suparna@in.ibm.com,
	lkml <linux-kernel@vger.kernel.org>,
	maneesh@in.ibm.com
Subject: Re: [PATCH] Kprobes /proc entry
Date: Wed, 12 Jan 2005 15:19:35 +0530	[thread overview]
Message-ID: <20050112094935.GD1559@in.ibm.com> (raw)
In-Reply-To: <20050112063511.GB1559@in.ibm.com>

Hi Luca,

Below is the latest patch that provides sysrq key feature
to list the applied kernel probes.
Please let me know your comments.

Thanks
Prasanna

---
Users like to list the kprobes inserted into the kernel.
This patch provides Sysrq-key to list all the kernel probes.
Usage Alt+SysRq+W to show the applied kprobes.
or $echo w > /proc/sysrq-trigger

Signed-of-by: Prasanna S Panchamukhi <prasanna@in.ibm.com>
---



---

 linux-2.6.10-prasanna/kernel/kprobes.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

diff -puN kernel/kprobes.c~kprobes-sysrq-addn-feature kernel/kprobes.c
--- linux-2.6.10/kernel/kprobes.c~kprobes-sysrq-addn-feature	2005-01-12 12:29:49.000000000 +0530
+++ linux-2.6.10-prasanna/kernel/kprobes.c	2005-01-12 14:52:49.000000000 +0530
@@ -29,6 +29,8 @@
  *		exceptions notifier to be first on the priority list.
  */
 #include <linux/kprobes.h>
+#include <linux/sysrq.h>
+#include <linux/kallsyms.h>
 #include <linux/spinlock.h>
 #include <linux/hash.h>
 #include <linux/init.h>
@@ -131,10 +133,33 @@ void unregister_jprobe(struct jprobe *jp
 	unregister_kprobe(&jp->kp);
 }
 
+static void show_kprobes(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
+{
+	int i;
+	struct hlist_node *node;
+
+	/* unsafe: kprobe_lock ought to be taken here */
+	for(i = 0; i < KPROBE_TABLE_SIZE; i++) {
+		struct kprobe *p;
+		hlist_for_each_entry(p, node, &kprobe_table[i], hlist) {
+				printk("[<%p>] ", p->addr);
+				print_symbol("%s\t", (unsigned long)p->addr);
+				print_symbol("%s\n", (unsigned long)p->pre_handler);
+		}
+	}
+}
+
+static struct sysrq_key_op sysrq_show_kprobes = {
+	.handler        = show_kprobes,
+	.help_msg       = "shoWkprobes",
+	.action_msg     = "Show kprobes\n"
+};
+
 static int __init init_kprobes(void)
 {
 	int i, err = 0;
 
+	register_sysrq_key('w', &sysrq_show_kprobes);
 	/* FIXME allocate the probe table, currently defined statically */
 	/* initialize all list heads */
 	for (i = 0; i < KPROBE_TABLE_SIZE; i++)

_
-- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@in.ibm.com>

  reply	other threads:[~2005-01-12  9:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 16:25 [PATCH] Kprobes /proc entry Luca Falavigna
2005-01-10 18:14 ` Greg KH
2005-01-11 21:31   ` Nathan Lynch
2005-01-11 21:34     ` Greg KH
2005-01-12  0:09       ` Luca Falavigna
2005-01-12  6:35         ` Prasanna S Panchamukhi
2005-01-12  9:49           ` Prasanna S Panchamukhi [this message]
2005-01-13 23:20       ` Luca Falavigna
2005-01-13 23:34         ` Greg KH
2005-01-17 16:58           ` Luca Falavigna
2005-01-18  6:44             ` Greg KH
2005-01-20 14:13               ` Luca Falavigna
2005-01-14  0:22         ` Stephen Hemminger

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=20050112094935.GD1559@in.ibm.com \
    --to=prasanna@in.ibm.com \
    --cc=dktrkranz@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=nathanl@austin.ibm.com \
    --cc=suparna@in.ibm.com \
    --cc=vamsi_krishna@in.ibm.com \
    /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.