Commit d04659ac authored by Huang Shijie's avatar Huang Shijie Committed by Linus Torvalds

samples/kprobes: add a new module parameter

Add a new module parameter which can be used as the symbol name.

Without this patch, we can only test the "_do_fork" function with this
kernel module.  With this patch, the module becomes more flexible; we
can test any functions with this module with

	# insmod kprobe_example.ko symbol="xxx"

Link: http://lkml.kernel.org/r/1463535417-29637-1-git-send-email-shijie.huang@arm.comSigned-off-by: default avatarHuang Shijie <shijie.huang@arm.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steve Capper <steve.capper@arm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 603ac5df
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment