mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] kprobes: add a new module parameter
@ 2016-05-18  1:36 Huang Shijie
  2016-05-18  1:36 ` [PATCH 2/2] kprobes: print out the symbol name for the hooks Huang Shijie
  2016-05-18 21:27 ` [PATCH 1/2] kprobes: add a new module parameter Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Huang Shijie @ 2016-05-18  1:36 UTC (permalink / raw)
  To: akpm; +Cc: pmladek, linux-kernel, steve.capper, nd, Huang Shijie

This patch adds a new module parameter which can be used as the
symbol name. With this parameter, the module becomes more flexable.

Signed-off-by: Huang Shijie <shijie.huang@arm.com>
---
 samples/kprobes/kprobe_example.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c
index 727eb21..2bb190d 100644
--- a/samples/kprobes/kprobe_example.c
+++ b/samples/kprobes/kprobe_example.c
@@ -14,9 +14,13 @@
 #include <linux/module.h>
 #include <linux/kprobes.h>
 
+#define MAX_SYMBOL_LEN	64
+static char symbol[MAX_SYMBOL_LEN] = "_do_fork";
+module_param_string(symbol, symbol, sizeof(symbol), 0644);
+
 /* For each probe you need to allocate a kprobe structure */
 static struct kprobe kp = {
-	.symbol_name	= "_do_fork",
+	.symbol_name	= symbol,
 };
 
 /* kprobe pre_handler: called just before the probed instruction is executed */
-- 
2.5.5

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

end of thread, other threads:[~2016-05-19  1:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  1:36 [PATCH 1/2] kprobes: add a new module parameter Huang Shijie
2016-05-18  1:36 ` [PATCH 2/2] kprobes: print out the symbol name for the hooks Huang Shijie
2016-05-18 21:27 ` [PATCH 1/2] kprobes: add a new module parameter Andrew Morton
2016-05-19  1:40   ` [PATCH v2] " Huang Shijie

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

all inboxes | Powered by JetHome®