mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Huang Shijie <shijie.huang@arm.com>
To: <akpm@linux-foundation.org>
Cc: <pmladek@suse.com>, <linux-kernel@vger.kernel.org>,
	<steve.capper@arm.com>, <nd@arm.com>,
	Huang Shijie <shijie.huang@arm.com>
Subject: [PATCH 1/2] kprobes: add a new module parameter
Date: Wed, 18 May 2016 09:36:56 +0800	[thread overview]
Message-ID: <1463535417-29637-1-git-send-email-shijie.huang@arm.com> (raw)

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

             reply	other threads:[~2016-05-18  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18  1:36 Huang Shijie [this message]
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

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=1463535417-29637-1-git-send-email-shijie.huang@arm.com \
    --to=shijie.huang@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nd@arm.com \
    --cc=pmladek@suse.com \
    --cc=steve.capper@arm.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 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®